mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +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) {
|
if (entity instanceof TNTPrimed) {
|
||||||
int id = entity.getEntityId();
|
int id = entity.getEntityId();
|
||||||
|
|
||||||
if (plugin.misc.tntTracker.containsKey(id)) {
|
if (plugin.tntTracker.containsKey(id)) {
|
||||||
Player player = plugin.misc.tntTracker.get(id);
|
Player player = plugin.tntTracker.get(id);
|
||||||
|
|
||||||
if (mcPermissions.getInstance().biggerBombs(player)) {
|
if (mcPermissions.getInstance().biggerBombs(player)) {
|
||||||
BlastMining.biggerBombs(player, event);
|
BlastMining.biggerBombs(player, event);
|
||||||
@ -202,10 +202,10 @@ public class mcEntityListener implements Listener {
|
|||||||
if (event.getEntity() instanceof TNTPrimed) {
|
if (event.getEntity() instanceof TNTPrimed) {
|
||||||
int id = entity.getEntityId();
|
int id = entity.getEntityId();
|
||||||
|
|
||||||
if (plugin.misc.tntTracker.containsKey(id)) {
|
if (plugin.tntTracker.containsKey(id)) {
|
||||||
Player player = plugin.misc.tntTracker.get(id);
|
Player player = plugin.tntTracker.get(id);
|
||||||
BlastMining.dropProcessing(player, event);
|
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.scheduler.BukkitScheduler;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.getspout.spoutapi.SpoutManager;
|
import org.getspout.spoutapi.SpoutManager;
|
||||||
import org.getspout.spoutapi.player.FileManager;
|
import org.getspout.spoutapi.player.FileManager;
|
||||||
@ -54,9 +55,10 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
//Alias - Command
|
//Alias - Command
|
||||||
public HashMap<String, String> aliasMap = new HashMap<String, String>();
|
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 static Database database = null;
|
||||||
public Misc misc = new Misc(this);
|
|
||||||
|
|
||||||
//Config file stuff
|
//Config file stuff
|
||||||
LoadProperties config;
|
LoadProperties config;
|
||||||
|
@ -28,12 +28,12 @@ public class Archery {
|
|||||||
final int MAX_BONUS_LEVEL = 1000;
|
final int MAX_BONUS_LEVEL = 1000;
|
||||||
int skillLevel = PPa.getSkillLevel(SkillType.ARCHERY);
|
int skillLevel = PPa.getSkillLevel(SkillType.ARCHERY);
|
||||||
|
|
||||||
if (!plugin.misc.arrowTracker.containsKey(entity)) {
|
if (!plugin.arrowTracker.containsKey(entity)) {
|
||||||
plugin.misc.arrowTracker.put(entity, 0);
|
plugin.arrowTracker.put(entity, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skillLevel > MAX_BONUS_LEVEL || (Math.random() * 1000 <= skillLevel)) {
|
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
|
* @param plugin mcMMO plugin instance
|
||||||
*/
|
*/
|
||||||
public static void arrowRetrievalCheck(Entity entity, mcMMO plugin) {
|
public static void arrowRetrievalCheck(Entity entity, mcMMO plugin) {
|
||||||
if (plugin.misc.arrowTracker.containsKey(entity)) {
|
if (plugin.arrowTracker.containsKey(entity)) {
|
||||||
m.mcDropItems(entity.getLocation(), new ItemStack(Material.ARROW), plugin.misc.arrowTracker.get(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 */
|
/* Create the TNT entity */
|
||||||
TNTPrimed tnt = player.getWorld().spawn(block.getLocation(), TNTPrimed.class);
|
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);
|
block.setType(Material.AIR);
|
||||||
tnt.setFuseTicks(0);
|
tnt.setFuseTicks(0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user