mirror of
https://github.com/LordBoos/boosCooldowns.git
synced 2024-11-26 12:35:47 +01:00
PlayerMoveEvent is now more lightweight
This commit is contained in:
parent
ca293fdd29
commit
76d70593d0
Binary file not shown.
@ -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: >
|
||||
|
@ -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();
|
||||
|
@ -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: >
|
||||
|
Loading…
Reference in New Issue
Block a user