Set cooldown

Discussion in 'Plugin Development' started by Darris, Mar 17, 2018.

Thread Status:
Not open for further replies.
  1. Offline

    Darris

    Hi! Help set this code to cooldown!
    I need to see if the player pressed, the event was carried out, and if I repeat something let the triggered cooldown!
    Code:
        @SuppressWarnings("deprecation")
        @EventHandler
        public void click(PlayerInteractEvent e) {
            Player p = e.getPlayer();
            if ((e.getAction() == Action.RIGHT_CLICK_BLOCK) || e.getAction == Action.RIGHT_CLICK_AIR))) {
                    if(p.getInventory().contains(item)) {
                        if(p.isOnGround()) {
                            p.sendMessage("Hello!");
                        }
                    }
                }
            }
        }
    }[code]
     
  2. Last edited: Mar 17, 2018
  3. Offline

    Darris

  4. Offline

    Darris

  5. Online

    timtower Administrator Administrator Moderator

    Should work in everything, as long as your instances are setup correct.
     
  6. Yes. Just add them to the restriction with
    PHP:
    cooldownUsers.put(playerSystem.currentTimeMillis() / 1000L);
     
Thread Status:
Not open for further replies.

Share This Page