mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-30 00:56:47 +01:00
Moved last few hashmaps to mcMMO.java & killed off Misc.java
This commit is contained in:
parent
9e604aed5e
commit
0fa39c4ace
@ -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<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
|
||||
public HashMap<Integer, Player> tntTracker = new HashMap<Integer, Player>();
|
||||
mcMMO plugin;
|
||||
|
||||
public Misc(mcMMO mcMMO) {
|
||||
this.plugin = mcMMO;
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<String, String> aliasMap = new HashMap<String, String>();
|
||||
public HashMap<Entity, Integer> arrowTracker = new HashMap<Entity, Integer>();
|
||||
public HashMap<Integer, Player> tntTracker = new HashMap<Integer, Player>();
|
||||
|
||||
public static Database database = null;
|
||||
public Misc misc = new Misc(this);
|
||||
|
||||
//Config file stuff
|
||||
LoadProperties config;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user