Right Click Block no longer activates Bending

This commit is contained in:
MistPhizzle 2014-08-03 00:55:52 -04:00
parent d117adb44d
commit 673bb841e7
2 changed files with 12 additions and 0 deletions

View file

@ -118,6 +118,7 @@ public class Methods {
public static ConcurrentHashMap<Block, Information> movedearth = new ConcurrentHashMap<Block, Information>();
public static ConcurrentHashMap<Integer, Information> tempair = new ConcurrentHashMap<Integer, Information>();
public static ConcurrentHashMap<String, Long> cooldowns = new ConcurrentHashMap<String, Long>();
public static ArrayList<Block> tempnophysics = new ArrayList<Block>();
private static Integer[] plantIds = { 6, 18, 31, 32, 37, 38, 39, 40, 59, 81, 83, 86, 99, 100, 103, 104, 105, 106, 111, 161, 175};
@ -252,6 +253,12 @@ public class Methods {
if (Commands.isToggledForAll) return false;
if (!bPlayer.isToggled) return false;
if (p == null) return false;
if (cooldowns.containsKey(p.getName())) {
if (cooldowns.get(p.getName()) + ProjectKorra.plugin.getConfig().getLong("Properties.GlobalCooldown") >= System.currentTimeMillis()) {
return false;
}
cooldowns.remove(p.getName());
}
if (!p.hasPermission("bending.ability." + ability)) return false;
if (isAirAbility(ability) && !isBender(player, Element.Air)) return false;
if (isWaterAbility(ability) && !isBender(player, Element.Water)) return false;

View file

@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockFormEvent;
@ -208,6 +209,10 @@ public class PKListener implements Listener {
public void onPlayerInteraction(PlayerInteractEvent event) {
if (event.isCancelled()) return;
Player player = event.getPlayer();
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
Methods.cooldowns.put(player.getName(), System.currentTimeMillis());
}
if (Paralyze.isParalyzed(player) || Bloodbending.isBloodbended(player)) {
event.setCancelled(true);
}