From 7dee6db36287b7c11c4d0e3b274dc10aa03c12a5 Mon Sep 17 00:00:00 2001 From: GJ Date: Thu, 9 Feb 2012 14:04:48 -0500 Subject: [PATCH] Changed CraftItem to Item in Fishing, one step closer to being free of CB dependency. --- .../gmail/nossr50/listeners/mcBlockListener.java | 12 +++++++++--- .../gmail/nossr50/listeners/mcEntityListener.java | 2 +- .../gmail/nossr50/listeners/mcPlayerListener.java | 3 +-- .../java/com/gmail/nossr50/skills/Fishing.java | 14 ++++++-------- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java index c33095fef..ba26b40f9 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java @@ -29,6 +29,7 @@ import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Statistic; import org.bukkit.block.Block; +import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -39,6 +40,7 @@ import org.bukkit.event.block.BlockFromToEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.PlayerAnimationEvent; import org.bukkit.inventory.ItemStack; + import org.getspout.spoutapi.SpoutManager; import org.getspout.spoutapi.player.SpoutPlayer; import org.getspout.spoutapi.sound.SoundEffect; @@ -47,8 +49,6 @@ import com.gmail.nossr50.locale.mcLocale; import com.gmail.nossr50.skills.*; import com.gmail.nossr50.datatypes.FakeBlockBreakEvent; -import net.minecraft.server.Enchantment; - public class mcBlockListener implements Listener { private final mcMMO plugin; @@ -153,6 +153,12 @@ public class mcBlockListener implements Listener * HERBALISM */ + //TNT removal checks - needed for Blast Mining + if(block.getTypeId() == 46) + { + plugin.misc.tntTracker.remove(block); + } + //Green Terra if(PP.getHoePreparationMode() && mcPermissions.getInstance().herbalismAbility(player) && block.getTypeId() == 59 && block.getData() == (byte) 0x07) { @@ -250,7 +256,7 @@ public class mcBlockListener implements Listener } if(LoadProperties.toolsLoseDurabilityFromAbilities) { - if(!inhand.getEnchantments().containsKey(Enchantment.DURABILITY)) + if(!player.getItemInHand().containsEnchantment(Enchantment.DURABILITY)) m.damageTool(player, (short) LoadProperties.abilityDurabilityLoss); } plugin.misc.treeFeller.clear(); diff --git a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java index 9648e2ca6..49df3a741 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java @@ -154,7 +154,7 @@ public class mcEntityListener implements Listener /* * PARTY CHECKS */ - if(event.getEntity() instanceof Player && f instanceof Player) + if(e instanceof Player && f instanceof Player) { Player defender = (Player)e; Player attacker = (Player)f; diff --git a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java index db3a5b9dd..0964dfcbd 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcPlayerListener.java @@ -26,7 +26,6 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.craftbukkit.command.ColouredConsoleSender; -import org.bukkit.craftbukkit.entity.CraftItem; import org.bukkit.entity.CreatureType; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; @@ -84,7 +83,7 @@ public class mcPlayerListener implements Listener { if(event.getState() == State.CAUGHT_FISH) { - if(event.getCaught() instanceof CraftItem) + if(event.getCaught() instanceof Item) { Fishing.processResults(event); } diff --git a/src/main/java/com/gmail/nossr50/skills/Fishing.java b/src/main/java/com/gmail/nossr50/skills/Fishing.java index 73734bde7..2763ea44d 100644 --- a/src/main/java/com/gmail/nossr50/skills/Fishing.java +++ b/src/main/java/com/gmail/nossr50/skills/Fishing.java @@ -18,7 +18,6 @@ package com.gmail.nossr50.skills; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.entity.CraftItem; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.*; import org.bukkit.event.player.PlayerFishEvent; @@ -86,8 +85,7 @@ public class Fishing { private static void getFishingResultsTier1(Player player, PlayerFishEvent event) { int randomNum = (int)(Math.random() * 15); - CraftItem theCatch = (CraftItem)event.getCaught(); - + Item theCatch = (Item)event.getCaught(); if(Math.random() * 100 < LoadProperties.fishingDropChanceTier1) { switch(randomNum) @@ -189,7 +187,7 @@ public class Fishing { private static void getFishingResultsTier2(Player player, PlayerFishEvent event) { int randomNum = (int)(Math.random() * 20); - CraftItem theCatch = (CraftItem)event.getCaught(); + Item theCatch = (Item)event.getCaught(); if(Math.random() * 100 < LoadProperties.fishingDropChanceTier2) { @@ -322,7 +320,7 @@ public class Fishing { private static void getFishingResultsTier3(Player player, PlayerFishEvent event) { int randomNum = (int)(Math.random() * 24); - CraftItem theCatch = (CraftItem)event.getCaught(); + Item theCatch = (Item)event.getCaught(); if(Math.random() * 100 < LoadProperties.fishingDropChanceTier3) { @@ -479,7 +477,7 @@ public class Fishing { private static void getFishingResultsTier4(Player player, PlayerFishEvent event) { int randomNum = (int)(Math.random() * 41); - CraftItem theCatch = (CraftItem)event.getCaught(); + Item theCatch = (Item)event.getCaught(); if(Math.random() * 100 < LoadProperties.fishingDropChanceTier4) { @@ -737,7 +735,7 @@ public class Fishing { private static void getFishingResultsTier5(Player player, PlayerFishEvent event) { int randomNum = (int)(Math.random() * 50); - CraftItem theCatch = (CraftItem)event.getCaught(); + Item theCatch = (Item)event.getCaught(); if(Math.random() * 100 < LoadProperties.fishingDropChanceTier5) { @@ -1049,7 +1047,7 @@ public class Fishing { PlayerProfile PP = Users.getProfile(player); Fishing.getFishingResults(player, event); - CraftItem theCatch = (CraftItem)event.getCaught(); + Item theCatch = (Item)event.getCaught(); if(theCatch.getItemStack().getType() != Material.RAW_FISH) {