Add a few more checks for sanity on the new ability buffs.

This commit is contained in:
GJ 2013-02-24 23:57:30 -05:00
parent afe28d54c6
commit ec8221610a
3 changed files with 9 additions and 4 deletions

View File

@ -14,7 +14,6 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.AnvilInventory;
import org.bukkit.inventory.FurnaceInventory; import org.bukkit.inventory.FurnaceInventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -134,8 +133,6 @@ public class InventoryListener implements Listener{
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onInventoryClickEvent(InventoryClickEvent event) { public void onInventoryClickEvent(InventoryClickEvent event) {
if (event.getInventory() instanceof AnvilInventory) {
SkillTools.removeAbilityBuff(event.getCurrentItem()); SkillTools.removeAbilityBuff(event.getCurrentItem());
} }
} }
}

View File

@ -146,7 +146,10 @@ public class PlayerListener implements Listener {
if (playerProfile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || playerProfile.getAbilityMode(AbilityType.SUPER_BREAKER)) { if (playerProfile.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || playerProfile.getAbilityMode(AbilityType.SUPER_BREAKER)) {
event.setCancelled(true); event.setCancelled(true);
return;
} }
SkillTools.removeAbilityBuff(event.getItemDrop().getItemStack());
} }
/** /**

View File

@ -30,6 +30,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mods.ModChecks; import com.gmail.nossr50.mods.ModChecks;
import com.gmail.nossr50.spout.SpoutConfig; import com.gmail.nossr50.spout.SpoutConfig;
import com.gmail.nossr50.spout.SpoutTools; import com.gmail.nossr50.spout.SpoutTools;
import com.gmail.nossr50.util.ItemChecks;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.ParticleEffectUtils; import com.gmail.nossr50.util.ParticleEffectUtils;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
@ -544,6 +545,10 @@ public class SkillTools {
return item; return item;
} }
if (!ItemChecks.isPickaxe(item) && !ItemChecks.isShovel(item)) {
return item;
}
if (item.containsEnchantment(Enchantment.DIG_SPEED)) { if (item.containsEnchantment(Enchantment.DIG_SPEED)) {
ItemMeta itemMeta = item.getItemMeta(); ItemMeta itemMeta = item.getItemMeta();