1.18.2 Guys i need help with making a plugin

Discussion in 'Spigot Plugin Development' started by GamingRohan, Jan 14, 2022.

Thread Status:
Not open for further replies.
  1. so , I want to make a plugin that doesn't allow any player to join the server for 15 mins (real life time) after server restart . i've tried but im not able to get it and im no where near it .
  2. pls try to make the plugin for me if you would feel comfortable
  3. Code (Java):
    private long time;

    public void onEnable() {
        time = System.currentTimeMillis();

    public void login(PlayerLoginEvent event) {
            event.disallow(PlayerLoginEvent.Result.KICK_FULL, ChatColor.RED + "Connection Lost");
    Thats one way to do it
    #3 Eisi05, Jan 14, 2022
    Last edited: Jan 14, 2022
  4. On my phone so can’t really type code, but just store start time as System.currentTimeMillis, and then on login check whether the currentTimeMillis when the event is handled is greater than start time + 15*60*1000. Then there’s no need for all that parsing.
    • Agree Agree x 1
  5. I changed it
    • Like Like x 1
  6. I have a dumb question. Why use long instead of double? I have never stored time for any of my plugins so that might be why. Does it overload?
  7. Because System.getCurrentTimeMillis returns a long, not a double. Decimals aren’t needed and would introduce imprecision so it wouldn’t make sense for that method to return a double.
    • Like Like x 2
  8. Makes sense. Thank you thank you!
  9. Strahan


    I had nothing better to do during a meeting today, lol, so I make this.
    • Like Like x 1
    • Funny Funny x 1
  10. thanks a lot
  11. damn so good tysm
Thread Status:
Not open for further replies.