Solved (1.17) How to make a grace period?

Discussion in 'Spigot Plugin Help' started by electcheese, Jul 17, 2021.

  1. I am trying to make a 5 minute grace period for a UHC plugin but I can't.
    Code (Java):
    public class Main extends JavaPlugin implements CommandExecutor{
        public void onEnable() {


        public void onDisable() {

        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            return true;
  2. For starters I would implement your so called command class into another class instead of it being in your main class where it extend Java Plugin. Also if you're thinking of making an actual UHC plugin look into Arena Management, World Management, Command Management, etc.

    For grace period look into scheduler programming

    Best of luck!
  3. No problem! Just mark this as solve if this solved your problem :)
  4. Strahan


    One thing that would help would be to move your setting of the executor from the onDisable to onEnable, otherwise the command won't be usable until the server is shutting down lol
    • Funny Funny x 5
  5. I have been trying to make this work, but I can't get the bukkit runnable to work.
  6. Via Bukkit Runnable
    Code (Text):
     new BukkitRunnable(){

                public void run() {

            }.runTaskTimer(plugin, delay, period);
    via Scheduler:

    Code (Text):
     Bukkit.getScheduler().runTaskTimer(plugin, () -> {
            }, delay, period);
  7. Instead of using a runnable, you can save the time the plugin loaded, and then listen for pvp events. If enough time has passed when a player tries to hurt the other, you can allow it. Disallow otherwise!