diff --git a/src/main/java/com/gmail/nossr50/commands/database/McpurgeCommand.java b/src/main/java/com/gmail/nossr50/commands/database/McpurgeCommand.java index 06237fab9..13f49169f 100644 --- a/src/main/java/com/gmail/nossr50/commands/database/McpurgeCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/database/McpurgeCommand.java @@ -23,10 +23,10 @@ public class McpurgeCommand implements TabExecutor { switch (args.length) { case 0: - mcMMO.databaseManager.purgePowerlessUsers(); + mcMMO.getDatabaseManager().purgePowerlessUsers(); if (Config.getInstance().getOldUsersCutoff() != -1) { - mcMMO.databaseManager.purgeOldUsers(); + mcMMO.getDatabaseManager().purgeOldUsers(); } sender.sendMessage(LocaleLoader.getString("Commands.mcpurge.Success")); diff --git a/src/main/java/com/gmail/nossr50/commands/database/McremoveCommand.java b/src/main/java/com/gmail/nossr50/commands/database/McremoveCommand.java index c996e81bb..dbf648270 100644 --- a/src/main/java/com/gmail/nossr50/commands/database/McremoveCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/database/McremoveCommand.java @@ -32,7 +32,7 @@ public class McremoveCommand implements TabExecutor { return true; } - if (mcMMO.databaseManager.removeUser(args[0])) { + if (mcMMO.getDatabaseManager().removeUser(args[0])) { sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", args[0])); } else { diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index f6856fd71..64967a2e3 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -41,10 +41,10 @@ public class RepairCommand extends SkillCommand { @Override protected void dataCalculations() { // We're using pickaxes here, not the best but it works - Repairable diamondRepairable = mcMMO.repairableManager.getRepairable(Material.DIAMOND_PICKAXE.getId()); - Repairable goldRepairable = mcMMO.repairableManager.getRepairable(Material.GOLD_PICKAXE.getId()); - Repairable ironRepairable = mcMMO.repairableManager.getRepairable(Material.IRON_PICKAXE.getId()); - Repairable stoneRepairable = mcMMO.repairableManager.getRepairable(Material.STONE_PICKAXE.getId()); + Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE.getId()); + Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLD_PICKAXE.getId()); + Repairable ironRepairable = mcMMO.getRepairableManager().getRepairable(Material.IRON_PICKAXE.getId()); + Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE.getId()); // TODO: This isn't really accurate - if they don't have pickaxes loaded it doesn't always mean the repair level is 0 diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel(); diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index c1646ce49..4f0818e67 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -63,17 +63,17 @@ public class BlockListener implements Listener { Block futureEmptyBlock = event.getBlock().getRelative(direction); // Block that would be air after piston is finished for (Block b : blocks) { - if (BlockUtils.shouldBeWatched(b.getState()) && mcMMO.placeStore.isTrue(b)) { + if (BlockUtils.shouldBeWatched(b.getState()) && mcMMO.getPlaceStore().isTrue(b)) { b.getRelative(direction).setMetadata(mcMMO.blockMetadataKey, mcMMO.metadataValue); if (b.equals(futureEmptyBlock)) { - mcMMO.placeStore.setFalse(b); + mcMMO.getPlaceStore().setFalse(b); } } } for (Block b : blocks) { if (b.getRelative(direction).hasMetadata(mcMMO.blockMetadataKey)) { - mcMMO.placeStore.setTrue(b.getRelative(direction)); + mcMMO.getPlaceStore().setTrue(b.getRelative(direction)); b.getRelative(direction).removeMetadata(mcMMO.blockMetadataKey, plugin); } } @@ -110,7 +110,7 @@ public class BlockListener implements Listener { /* Check if the blocks placed should be monitored so they do not give out XP in the future */ if (BlockUtils.shouldBeWatched(blockState)) { - mcMMO.placeStore.setTrue(blockState); + mcMMO.getPlaceStore().setTrue(blockState); } if (Repair.anvilMessagesEnabled && (blockId == Repair.repairAnvilId || blockId == Repair.salvageAnvilId)) { @@ -163,13 +163,13 @@ public class BlockListener implements Listener { } /* MINING */ - else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && Permissions.skillEnabled(player, SkillType.MINING) && !mcMMO.placeStore.isTrue(blockState)) { + else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && Permissions.skillEnabled(player, SkillType.MINING) && !mcMMO.getPlaceStore().isTrue(blockState)) { MiningManager miningManager = mcMMOPlayer.getMiningManager(); miningManager.miningBlockCheck(blockState); } /* WOOD CUTTING */ - else if (BlockUtils.isLog(blockState) && Permissions.skillEnabled(player, SkillType.WOODCUTTING) && !mcMMO.placeStore.isTrue(blockState)) { + else if (BlockUtils.isLog(blockState) && Permissions.skillEnabled(player, SkillType.WOODCUTTING) && !mcMMO.getPlaceStore().isTrue(blockState)) { WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager(); if (woodcuttingManager.canUseTreeFeller(heldItem)) { @@ -181,7 +181,7 @@ public class BlockListener implements Listener { } /* EXCAVATION */ - else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && Permissions.skillEnabled(player, SkillType.EXCAVATION) && !mcMMO.placeStore.isTrue(blockState)) { + else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && Permissions.skillEnabled(player, SkillType.EXCAVATION) && !mcMMO.getPlaceStore().isTrue(blockState)) { ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager(); excavationManager.excavationBlockCheck(blockState); @@ -191,7 +191,7 @@ public class BlockListener implements Listener { } /* Remove metadata from placed watched blocks */ - mcMMO.placeStore.setFalse(blockState); + mcMMO.getPlaceStore().setFalse(blockState); } /** diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 7e53c04b0..b17589df0 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -68,12 +68,12 @@ public class EntityListener implements Listener { Block block = event.getBlock(); boolean isTracked = entity.hasMetadata(mcMMO.entityMetadataKey); - if (mcMMO.placeStore.isTrue(block) && !isTracked) { - mcMMO.placeStore.setFalse(block); + if (mcMMO.getPlaceStore().isTrue(block) && !isTracked) { + mcMMO.getPlaceStore().setFalse(block); entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue); } else if (isTracked) { - mcMMO.placeStore.setTrue(block); + mcMMO.getPlaceStore().setTrue(block); } } diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index c362a45e6..614adaf14 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -193,7 +193,8 @@ public class PlayerListener implements Listener { case CAUGHT_ENTITY: Entity entity = event.getCaught(); - + System.out.println(event.getState()); + System.out.println(entity); if (fishingManager.canShake(entity)) { fishingManager.shakeCheck((LivingEntity) entity); } @@ -319,7 +320,7 @@ public class PlayerListener implements Listener { ItemStack heldItem = player.getItemInHand(); /* REPAIR CHECKS */ - if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.repairableManager.isRepairable(heldItem)) { + if (blockID == Repair.repairAnvilId && Permissions.skillEnabled(player, SkillType.REPAIR) && mcMMO.getRepairableManager().isRepairable(heldItem)) { UserManager.getPlayer(player).getRepairManager().handleRepair(heldItem); event.setCancelled(true); player.updateInventory(); diff --git a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java index 8780c9e93..9115174b4 100644 --- a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java @@ -30,9 +30,9 @@ public class WorldListener implements Listener { public void onStructureGrow(StructureGrowEvent event) { Location location = event.getLocation(); - if (mcMMO.placeStore.isTrue(location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getWorld())) { + if (mcMMO.getPlaceStore().isTrue(location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getWorld())) { for (BlockState blockState : event.getBlocks()) { - mcMMO.placeStore.setFalse(blockState); + mcMMO.getPlaceStore().setFalse(blockState); } } } @@ -65,7 +65,7 @@ public class WorldListener implements Listener { */ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onWorldUnload(WorldUnloadEvent event) { - mcMMO.placeStore.unloadWorld(event.getWorld()); + mcMMO.getPlaceStore().unloadWorld(event.getWorld()); } /** @@ -77,6 +77,6 @@ public class WorldListener implements Listener { public void onChunkUnload(ChunkUnloadEvent event) { Chunk chunk = event.getChunk(); - mcMMO.placeStore.chunkUnloaded(chunk.getX(), chunk.getZ(), event.getWorld()); + mcMMO.getPlaceStore().chunkUnloaded(chunk.getX(), chunk.getZ(), event.getWorld()); } } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 69cc774b6..8bfc20f89 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -64,9 +64,9 @@ public class mcMMO extends JavaPlugin { public static mcMMO p; - public static ChunkManager placeStore; - public static RepairableManager repairableManager; - public static DatabaseManager databaseManager; + private static ChunkManager placeStore; + private static RepairableManager repairableManager; + private static DatabaseManager databaseManager; // Jar Stuff public static File mcmmo; @@ -222,6 +222,18 @@ public class mcMMO extends JavaPlugin { getLogger().info("[Debug] " + message); } + public static ChunkManager getPlaceStore() { + return placeStore; + } + + public static DatabaseManager getDatabaseManager() { + return databaseManager; + } + + public static RepairableManager getRepairableManager() { + return repairableManager; + } + /** * Setup the various storage file paths */ diff --git a/src/main/java/com/gmail/nossr50/runnables/StickyPistonTrackerTask.java b/src/main/java/com/gmail/nossr50/runnables/StickyPistonTrackerTask.java index 14530b054..37a054ada 100644 --- a/src/main/java/com/gmail/nossr50/runnables/StickyPistonTrackerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/StickyPistonTrackerTask.java @@ -21,11 +21,11 @@ public class StickyPistonTrackerTask extends BukkitRunnable { Block newBlock = block.getRelative(direction); Block originalBlock = newBlock.getRelative(direction); - if (originalBlock.getType() != Material.AIR || !mcMMO.placeStore.isTrue(originalBlock)) { + if (originalBlock.getType() != Material.AIR || !mcMMO.getPlaceStore().isTrue(originalBlock)) { return; } - mcMMO.placeStore.setFalse(originalBlock); - mcMMO.placeStore.setTrue(newBlock); + mcMMO.getPlaceStore().setFalse(originalBlock); + mcMMO.getPlaceStore().setTrue(newBlock); } } diff --git a/src/main/java/com/gmail/nossr50/runnables/database/UserPurgeTask.java b/src/main/java/com/gmail/nossr50/runnables/database/UserPurgeTask.java index 6c2c88196..93fac4b74 100644 --- a/src/main/java/com/gmail/nossr50/runnables/database/UserPurgeTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/database/UserPurgeTask.java @@ -8,10 +8,10 @@ import com.gmail.nossr50.config.Config; public class UserPurgeTask extends BukkitRunnable { @Override public void run() { - mcMMO.databaseManager.purgePowerlessUsers(); + mcMMO.getDatabaseManager().purgePowerlessUsers(); if (Config.getInstance().getOldUsersCutoff() != -1) { - mcMMO.databaseManager.purgeOldUsers(); + mcMMO.getDatabaseManager().purgeOldUsers(); } } } diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java index 317feb539..ffb433518 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/Herbalism.java @@ -63,7 +63,7 @@ public class Herbalism { protected static int calculateCatciAndSugarDrops(BlockState blockState) { Block block = blockState.getBlock(); Material blockType = blockState.getType(); - int dropAmount = mcMMO.placeStore.isTrue(block) ? 0 : 1; + int dropAmount = mcMMO.getPlaceStore().isTrue(block) ? 0 : 1; // Handle the two blocks above it - cacti & sugar cane can only grow 3 high naturally for (int y = 1; y < 3; y++) { @@ -73,8 +73,8 @@ public class Herbalism { break; } - if (mcMMO.placeStore.isTrue(relativeBlock)) { - mcMMO.placeStore.setFalse(relativeBlock); + if (mcMMO.getPlaceStore().isTrue(relativeBlock)) { + mcMMO.getPlaceStore().setFalse(relativeBlock); } else { dropAmount++; diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index d8538c683..708b4ecaf 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -118,7 +118,7 @@ public class HerbalismManager extends SkillManager { Material material = blockState.getType(); boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.SUGAR_CANE_BLOCK); - if (oneBlockPlant && mcMMO.placeStore.isTrue(blockState)) { + if (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState)) { return; } @@ -206,8 +206,8 @@ public class HerbalismManager extends SkillManager { case RED_ROSE: case YELLOW_FLOWER: - if (mcMMO.placeStore.isTrue(blockState)) { - mcMMO.placeStore.setFalse(blockState); + if (mcMMO.getPlaceStore().isTrue(blockState)) { + mcMMO.getPlaceStore().setFalse(blockState); return false; } diff --git a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java index cd985ce97..a1c2f3e94 100644 --- a/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java +++ b/src/main/java/com/gmail/nossr50/skills/mining/MiningManager.java @@ -139,13 +139,13 @@ public class MiningManager extends SkillManager{ for (BlockState blockState : ores) { if (Misc.getRandom().nextFloat() < (yield + oreBonus)) { - if (!mcMMO.placeStore.isTrue(blockState)) { + if (!mcMMO.getPlaceStore().isTrue(blockState)) { xp += Mining.getBlockXp(blockState); } Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1)); // Initial block that would have been dropped - if (!mcMMO.placeStore.isTrue(blockState)) { + if (!mcMMO.getPlaceStore().isTrue(blockState)) { for (int i = 1; i < dropMultiplier; i++) { Mining.handleSilkTouchDrops(blockState); // Bonus drops - should drop the block & not the items } diff --git a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java index b20b57393..a5dd10fd4 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/RepairManager.java @@ -65,7 +65,7 @@ public class RepairManager extends SkillManager { Player player = getPlayer(); int itemId = item.getTypeId(); - Repairable repairable = mcMMO.repairableManager.getRepairable(itemId); + Repairable repairable = mcMMO.getRepairableManager().getRepairable(itemId); // Permissions checks on material and item types if (!repairable.getRepairItemType().getPermissions(player)) { diff --git a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java index 4269ab0fa..d3b91dad6 100644 --- a/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/smelting/SmeltingManager.java @@ -25,7 +25,7 @@ public class SmeltingManager extends SkillManager { } public boolean canUseFluxMining(BlockState blockState) { - return getSkillLevel() >= Smelting.fluxMiningUnlockLevel && BlockUtils.affectedByFluxMining(blockState) && Permissions.fluxMining(getPlayer()) && !mcMMO.placeStore.isTrue(blockState); + return getSkillLevel() >= Smelting.fluxMiningUnlockLevel && BlockUtils.affectedByFluxMining(blockState) && Permissions.fluxMining(getPlayer()) && !mcMMO.getPlaceStore().isTrue(blockState); } public boolean canUseVanillaXpBoost() { diff --git a/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java b/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java index 5709e5055..76a6c7200 100644 --- a/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java +++ b/src/main/java/com/gmail/nossr50/skills/woodcutting/Woodcutting.java @@ -248,7 +248,7 @@ public final class Woodcutting { * @param treeFellerBlocks List of blocks to be removed */ private static void handleBlock(BlockState blockState, List futureCenterBlocks, List treeFellerBlocks) { - if (!BlockUtils.affectedByTreeFeller(blockState) || mcMMO.placeStore.isTrue(blockState) || treeFellerBlocks.contains(blockState)) { + if (!BlockUtils.affectedByTreeFeller(blockState) || mcMMO.getPlaceStore().isTrue(blockState) || treeFellerBlocks.contains(blockState)) { return; } diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionZDirectory.java b/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionZDirectory.java index 34a9245f8..fb72bf3cb 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionZDirectory.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/conversion/BlockStoreConversionZDirectory.java @@ -34,7 +34,7 @@ public class BlockStoreConversionZDirectory implements Runnable { this.world = world; this.scheduler = mcMMO.p.getServer().getScheduler(); this.manager = new HashChunkletManager(); - this.newManager = (HashChunkManager) mcMMO.placeStore; + this.newManager = (HashChunkManager) mcMMO.getPlaceStore(); this.dataDir = dataDir; this.xDir = xDir;