Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class onPlayerDeathEvent implements Listener{
- HashMap<Player, Long> shardsCooldown = new HashMap<Player, Long>();
- public void onPlayerDeath(PlayerDeathEvent e) {
- Player p = e.getEntity().getKiller();
- int cooldownShard = 3000; //5 minut w sekundach
- if(shardsCooldown.containsKey(p)) {
- long secondsLeft = ((shardsCooldown.get(p)/1000) + cooldownShard) - (System.currentTimeMillis()/1000);
- if(secondsLeft>0) {
- p.sendMessage("Tutaj nie wypada shard");
- }else {
- p.sendMessage("Tutaj wypada");
- shardsCooldown.put(p, System.currentTimeMillis());
- }
- }else {
- p.sendMessage("Tutaj wypada");
- shardsCooldown.put(p, System.currentTimeMillis());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement