PlayerMoveEvent is now more lightweight

This commit is contained in:
Boosik 2013-03-15 15:31:14 +01:00
parent ca293fdd29
commit 76d70593d0
4 changed files with 11 additions and 6 deletions

View File

@ -1,6 +1,6 @@
name: boosCooldowns
main: cz.boosik.boosCooldown.boosCoolDown
version: 3.4.0
version: 3.4.1
authors: [LordBoos (ingame name boosik)]
softdepend: [Vault]
description: >

View File

@ -6,18 +6,22 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import util.boosChat;
import cz.boosik.boosCooldown.boosConfigManager;
import cz.boosik.boosCooldown.boosCoolDownListener;
import cz.boosik.boosCooldown.boosWarmUpManager;
public class boosPlayerMoveListener implements Listener {
int tempTimer = 0;
@EventHandler(priority = EventPriority.NORMAL)
private void onPlayerMove(PlayerMoveEvent event) {
if (event.isCancelled())
if (event.isCancelled()) {
return;
}
if (tempTimer < 20){
tempTimer = tempTimer + 1;
return;
} else {
Player player = event.getPlayer();
if (player != null
&& !player.hasPermission("booscooldowns.nocancel.move")) {
@ -27,9 +31,10 @@ public class boosPlayerMoveListener implements Listener {
boosConfigManager.getWarmUpCancelledByMoveMessage());
boosWarmUpManager.cancelWarmUps(player);
}
}
tempTimer = 0;
}
}
private static boolean hasMoved(Player player) {
String curworld = player.getWorld().getName();

View File

@ -1,6 +1,6 @@
name: boosCooldowns
main: cz.boosik.boosCooldown.boosCoolDown
version: 3.4.0
version: 3.4.1
authors: [LordBoos (ingame name boosik)]
softdepend: [Vault]
description: >