-
-
Save CeramicTitan/8540153 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lastHit.put(victim.getName(), attacker.getName()); | |
final Player vic = victim.getPlayer(); | |
final BukkitScheduler scheduler = Bukkit.getScheduler(); | |
if (lastHitId.containsKey(vic.getName())) { | |
int taskId = lastHitId.get(vic.getName()); | |
if (scheduler.isCurrentlyRunning(taskId)) { | |
scheduler.cancelTask(taskId); | |
} | |
} | |
BukkitTask task = scheduler.runTaskLater(plugin, new BukkitRunnable() { | |
@Override | |
public void run() { | |
lastHit.remove(vic.getName()); | |
} | |
}, 300); | |
lastHitId.put(vic.getName(), task.getTaskId()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment