diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 4c0518876..f173c9cc2 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -144,12 +144,10 @@ public class EntityListener implements Listener { @EventHandler (priority = EventPriority.MONITOR) public void onEntityDeath(EntityDeathEvent event) { LivingEntity entity = event.getEntity(); + entity.setFireTicks(0); - - /* Remove bleed track */ BleedTimer.remove(entity); - - Archery.arrowRetrievalCheck(entity, plugin); + Archery.arrowRetrievalCheck(entity); } /** diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 75039f57f..115b1a6b3 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -32,7 +32,6 @@ import org.bukkit.plugin.PluginManager; import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Entity; import org.bukkit.entity.Player; public class mcMMO extends JavaPlugin { @@ -43,7 +42,6 @@ public class mcMMO extends JavaPlugin { private final HardcoreListener hardcoreListener = new HardcoreListener(); public HashMap aliasMap = new HashMap(); //Alias - Command - public HashMap arrowTracker = new HashMap(); public HashMap tntTracker = new HashMap(); public static File versionFile; diff --git a/src/main/java/com/gmail/nossr50/skills/combat/Archery.java b/src/main/java/com/gmail/nossr50/skills/combat/Archery.java index aa9af16c2..b8a5bbdf1 100644 --- a/src/main/java/com/gmail/nossr50/skills/combat/Archery.java +++ b/src/main/java/com/gmail/nossr50/skills/combat/Archery.java @@ -1,5 +1,9 @@ package com.gmail.nossr50.skills.combat; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; import java.util.Random; import org.bukkit.Location; @@ -18,6 +22,7 @@ import com.gmail.nossr50.util.Users; public class Archery { + public static Map arrowTracker = new HashMap(); private static Random random = new Random(); /** @@ -31,12 +36,15 @@ public class Archery { final int MAX_BONUS_LEVEL = 1000; int skillLevel = PPa.getSkillLevel(SkillType.ARCHERY); - if (!plugin.arrowTracker.containsKey(entity)) { - plugin.arrowTracker.put(entity, 0); - } - if (skillLevel > MAX_BONUS_LEVEL || (random.nextInt(1000) <= skillLevel)) { - plugin.arrowTracker.put(entity, 1); + for (Entry entry : arrowTracker.entrySet()) { + if (entry.getKey() == entity) { + entry.setValue(entry.getValue() + 1); + return; + } + } + + arrowTracker.put(entity, 1); } } @@ -72,13 +80,16 @@ public class Archery { * Check for arrow retrieval. * * @param entity The entity hit by the arrows - * @param plugin mcMMO plugin instance */ - public static void arrowRetrievalCheck(Entity entity, mcMMO plugin) { - if (plugin.arrowTracker.containsKey(entity)) { - Misc.mcDropItems(entity.getLocation(), new ItemStack(Material.ARROW), plugin.arrowTracker.get(entity)); - } + public static void arrowRetrievalCheck(Entity entity) { + for (Iterator> it = arrowTracker.entrySet().iterator() ; it.hasNext() ; ) { + Entry entry = it.next(); - plugin.arrowTracker.remove(entity); + if (entry.getKey() == entity) { + Misc.mcDropItem(entity.getLocation(), new ItemStack(Material.ARROW, entry.getValue())); + it.remove(); + return; + } + } } }