From 0fa39c4aceb7db3300d49535cf3eae1d1055915e Mon Sep 17 00:00:00 2001 From: GJ Date: Tue, 20 Mar 2012 18:36:47 -0400 Subject: [PATCH] Moved last few hashmaps to mcMMO.java & killed off Misc.java --- .../java/com/gmail/nossr50/config/Misc.java | 17 ----------------- .../nossr50/listeners/mcEntityListener.java | 10 +++++----- src/main/java/com/gmail/nossr50/mcMMO.java | 4 +++- .../java/com/gmail/nossr50/skills/Archery.java | 12 ++++++------ .../com/gmail/nossr50/skills/BlastMining.java | 2 +- 5 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 src/main/java/com/gmail/nossr50/config/Misc.java diff --git a/src/main/java/com/gmail/nossr50/config/Misc.java b/src/main/java/com/gmail/nossr50/config/Misc.java deleted file mode 100644 index 86cccd155..000000000 --- a/src/main/java/com/gmail/nossr50/config/Misc.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.gmail.nossr50.config; - -import java.util.HashMap; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; - -import com.gmail.nossr50.mcMMO; - -public class Misc { - public HashMap arrowTracker = new HashMap(); - public HashMap tntTracker = new HashMap(); - mcMMO plugin; - - public Misc(mcMMO mcMMO) { - this.plugin = mcMMO; - } -} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java index efa4f63b0..e08f0e2cf 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcEntityListener.java @@ -180,8 +180,8 @@ public class mcEntityListener implements Listener { if (entity instanceof TNTPrimed) { int id = entity.getEntityId(); - if (plugin.misc.tntTracker.containsKey(id)) { - Player player = plugin.misc.tntTracker.get(id); + if (plugin.tntTracker.containsKey(id)) { + Player player = plugin.tntTracker.get(id); if (mcPermissions.getInstance().biggerBombs(player)) { BlastMining.biggerBombs(player, event); @@ -202,10 +202,10 @@ public class mcEntityListener implements Listener { if (event.getEntity() instanceof TNTPrimed) { int id = entity.getEntityId(); - if (plugin.misc.tntTracker.containsKey(id)) { - Player player = plugin.misc.tntTracker.get(id); + if (plugin.tntTracker.containsKey(id)) { + Player player = plugin.tntTracker.get(id); BlastMining.dropProcessing(player, event); - plugin.misc.tntTracker.remove(id); + plugin.tntTracker.remove(id); } } } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index c6c6804c8..44c77fed3 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -38,6 +38,7 @@ 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; import org.getspout.spoutapi.SpoutManager; import org.getspout.spoutapi.player.FileManager; @@ -54,9 +55,10 @@ public class mcMMO extends JavaPlugin { //Alias - Command public HashMap aliasMap = new HashMap(); + public HashMap arrowTracker = new HashMap(); + public HashMap tntTracker = new HashMap(); public static Database database = null; - public Misc misc = new Misc(this); //Config file stuff LoadProperties config; diff --git a/src/main/java/com/gmail/nossr50/skills/Archery.java b/src/main/java/com/gmail/nossr50/skills/Archery.java index 4fb6a6998..b89c188c6 100644 --- a/src/main/java/com/gmail/nossr50/skills/Archery.java +++ b/src/main/java/com/gmail/nossr50/skills/Archery.java @@ -28,12 +28,12 @@ public class Archery { final int MAX_BONUS_LEVEL = 1000; int skillLevel = PPa.getSkillLevel(SkillType.ARCHERY); - if (!plugin.misc.arrowTracker.containsKey(entity)) { - plugin.misc.arrowTracker.put(entity, 0); + if (!plugin.arrowTracker.containsKey(entity)) { + plugin.arrowTracker.put(entity, 0); } if (skillLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= skillLevel)) { - plugin.misc.arrowTracker.put(entity, 1); + plugin.arrowTracker.put(entity, 1); } } @@ -115,10 +115,10 @@ public class Archery { * @param plugin mcMMO plugin instance */ public static void arrowRetrievalCheck(Entity entity, mcMMO plugin) { - if (plugin.misc.arrowTracker.containsKey(entity)) { - m.mcDropItems(entity.getLocation(), new ItemStack(Material.ARROW), plugin.misc.arrowTracker.get(entity)); + if (plugin.arrowTracker.containsKey(entity)) { + m.mcDropItems(entity.getLocation(), new ItemStack(Material.ARROW), plugin.arrowTracker.get(entity)); } - plugin.misc.arrowTracker.remove(entity); + plugin.arrowTracker.remove(entity); } } diff --git a/src/main/java/com/gmail/nossr50/skills/BlastMining.java b/src/main/java/com/gmail/nossr50/skills/BlastMining.java index 98e11bb4a..9f06775ac 100644 --- a/src/main/java/com/gmail/nossr50/skills/BlastMining.java +++ b/src/main/java/com/gmail/nossr50/skills/BlastMining.java @@ -274,7 +274,7 @@ public class BlastMining { /* Create the TNT entity */ TNTPrimed tnt = player.getWorld().spawn(block.getLocation(), TNTPrimed.class); - plugin.misc.tntTracker.put(tnt.getEntityId(), player); + plugin.tntTracker.put(tnt.getEntityId(), player); block.setType(Material.AIR); tnt.setFuseTicks(0);