From 6b3bde585dcfef816e6476af407947ac050461f2 Mon Sep 17 00:00:00 2001 From: Grant Date: Mon, 24 Dec 2012 16:17:19 -0500 Subject: [PATCH] Fixed some issues with static access --- Changelog.txt | 1 + .../nossr50/listeners/BlockListener.java | 24 +++++++++---------- .../nossr50/listeners/WorldListener.java | 6 ++--- .../nossr50/runnables/ChunkletUnloader.java | 4 ++-- .../runnables/StickyPistonTracker.java | 6 ++--- .../BlockStoreConversionZDirectory.java | 2 +- .../nossr50/skills/gathering/BlastMining.java | 4 ++-- .../nossr50/skills/gathering/Excavation.java | 2 +- .../nossr50/skills/gathering/Herbalism.java | 18 +++++++------- .../nossr50/skills/gathering/Mining.java | 6 ++--- .../nossr50/skills/gathering/WoodCutting.java | 12 +++++----- 11 files changed, 43 insertions(+), 42 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 8b8160742..b04b1fed2 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -11,6 +11,7 @@ Version 1.3.13 + Added Craftbukkit 1.4.6 compatibility = Fixed issue with missing default cases from several switch/case statements = Fixed issue with Mining using actual skill level rather than max skill level + = Fixed some issues with static access ! GJ stopped being a lazy slacker and got stuff done - Removed dead code relating to null profiles - Removed unused imports diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 414181627..d6f6dd32d 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -62,17 +62,17 @@ public class BlockListener implements Listener { Block futureEmptyBlock = event.getBlock().getRelative(direction); for (Block b : blocks) { - if (mcMMO.p.placeStore.isTrue(b)) { + if (mcMMO.placeStore.isTrue(b)) { b.getRelative(direction).setMetadata("pistonTrack", new FixedMetadataValue(plugin, true)); if (b.equals(futureEmptyBlock)) { - mcMMO.p.placeStore.setFalse(b); + mcMMO.placeStore.setFalse(b); } } } for (Block b : blocks) { if (b.getRelative(direction).hasMetadata("pistonTrack")) { - mcMMO.p.placeStore.setTrue(b.getRelative(direction)); + mcMMO.placeStore.setTrue(b.getRelative(direction)); b.getRelative(direction).removeMetadata("pistonTrack", plugin); } } @@ -95,7 +95,7 @@ public class BlockListener implements Listener { Block fallenBlock = event.getBlock().getRelative(BlockFace.UP); if (fallenBlock.getType() == type) { - mcMMO.p.placeStore.setTrue(fallenBlock); + mcMMO.placeStore.setTrue(fallenBlock); } } } @@ -138,7 +138,7 @@ public class BlockListener implements Listener { } else { Block newLocation = block.getRelative(0, y + 1, 0); - mcMMO.p.placeStore.setTrue(newLocation); + mcMMO.placeStore.setTrue(newLocation); break; } } @@ -147,7 +147,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 (BlockChecks.shouldBeWatched(block)) { if (!((type == Material.SAND || type == Material.GRAVEL) && block.getRelative(BlockFace.DOWN).getType() == Material.AIR)) { //Don't wanna track sand that's gonna fall. - mcMMO.p.placeStore.setTrue(block); + mcMMO.placeStore.setTrue(block); } } @@ -232,7 +232,7 @@ public class BlockListener implements Listener { } /* EXCAVATION */ - else if (BlockChecks.canBeGigaDrillBroken(block) && permInstance.excavation(player) && !mcMMO.p.placeStore.isTrue(block)) { + else if (BlockChecks.canBeGigaDrillBroken(block) && permInstance.excavation(player) && !mcMMO.placeStore.isTrue(block)) { if (configInstance.getExcavationRequiresTool()) { if (ItemChecks.isShovel(inHand)) { Excavation.excavationProcCheck(block, player); @@ -245,7 +245,7 @@ public class BlockListener implements Listener { //Remove metadata when broken if (BlockChecks.shouldBeWatched(block)) { - mcMMO.p.placeStore.setFalse(block); + mcMMO.placeStore.setFalse(block); } //Remove metadata from fallen sand/gravel @@ -256,11 +256,11 @@ public class BlockListener implements Listener { Block relative = block.getRelative(0, y, 0); Material relativeType = relative.getType(); - if ((relativeType == Material.SAND || relativeType == Material.GRAVEL) && mcMMO.p.placeStore.isTrue(relative)) { - mcMMO.p.placeStore.setFalse(relative); + if ((relativeType == Material.SAND || relativeType == Material.GRAVEL) && mcMMO.placeStore.isTrue(relative)) { + mcMMO.placeStore.setFalse(relative); } - else if (!BlockChecks.shouldBeWatched(relative) && mcMMO.p.placeStore.isTrue(relative)){ - mcMMO.p.placeStore.setFalse(relative); + else if (!BlockChecks.shouldBeWatched(relative) && mcMMO.placeStore.isTrue(relative)){ + mcMMO.placeStore.setFalse(relative); } else { break; diff --git a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java index 6a1ab7261..92d599a07 100644 --- a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java @@ -34,16 +34,16 @@ public class WorldListener implements Listener { @EventHandler public void onWorldUnload(WorldUnloadEvent event) { - mcMMO.p.placeStore.unloadWorld(event.getWorld()); + mcMMO.placeStore.unloadWorld(event.getWorld()); } @EventHandler public void onWorldSave(WorldSaveEvent event) { - mcMMO.p.placeStore.saveWorld(event.getWorld()); + mcMMO.placeStore.saveWorld(event.getWorld()); } @EventHandler public void onChunkUnload(ChunkUnloadEvent event) { - mcMMO.p.placeStore.chunkUnloaded(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld()); + mcMMO.placeStore.chunkUnloaded(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld()); } } diff --git a/src/main/java/com/gmail/nossr50/runnables/ChunkletUnloader.java b/src/main/java/com/gmail/nossr50/runnables/ChunkletUnloader.java index 8460d9ce1..d3aa49eba 100644 --- a/src/main/java/com/gmail/nossr50/runnables/ChunkletUnloader.java +++ b/src/main/java/com/gmail/nossr50/runnables/ChunkletUnloader.java @@ -42,10 +42,10 @@ public class ChunkletUnloader implements Runnable { //Chunklets are unloaded only if their chunk has been unloaded for minimumInactiveTime if (inactiveTime >= minimumInactiveTime) { - if(mcMMO.p.placeStore == null) + if(mcMMO.placeStore == null) continue; - mcMMO.p.placeStore.unloadChunk(chunk.getX(), chunk.getZ(), chunk.getWorld()); + mcMMO.placeStore.unloadChunk(chunk.getX(), chunk.getZ(), chunk.getWorld()); it.remove(); continue; } diff --git a/src/main/java/com/gmail/nossr50/runnables/StickyPistonTracker.java b/src/main/java/com/gmail/nossr50/runnables/StickyPistonTracker.java index 18a30ceb4..bcf27ce2c 100644 --- a/src/main/java/com/gmail/nossr50/runnables/StickyPistonTracker.java +++ b/src/main/java/com/gmail/nossr50/runnables/StickyPistonTracker.java @@ -17,11 +17,11 @@ public class StickyPistonTracker implements Runnable { public void run() { Block originalBlock = event.getRetractLocation().getBlock(); - if (originalBlock.getType() == Material.AIR && mcMMO.p.placeStore.isTrue(originalBlock)) { + if (originalBlock.getType() == Material.AIR && mcMMO.placeStore.isTrue(originalBlock)) { Block newBlock = originalBlock.getRelative(event.getDirection().getOppositeFace()); - mcMMO.p.placeStore.setFalse(originalBlock); - mcMMO.p.placeStore.setTrue(newBlock); + mcMMO.placeStore.setFalse(originalBlock); + mcMMO.placeStore.setTrue(newBlock); } } } diff --git a/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionZDirectory.java b/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionZDirectory.java index 7b737ccee..72cb6eae9 100755 --- a/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionZDirectory.java +++ b/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionZDirectory.java @@ -36,7 +36,7 @@ public class BlockStoreConversionZDirectory implements Runnable { this.world = world; this.scheduler = mcMMO.p.getServer().getScheduler(); this.manager = new HashChunkletManager(); - this.newManager = (HashChunkManager) mcMMO.p.placeStore; + this.newManager = (HashChunkManager) mcMMO.placeStore; this.dataDir = dataDir; this.xDir = xDir; diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java b/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java index 525dafbf2..e9446f5d8 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/BlastMining.java @@ -62,7 +62,7 @@ public class BlastMining { blocksDropped.add(temp); Mining.miningDrops(temp); - if (!mcMMO.p.placeStore.isTrue(temp)) { + if (!mcMMO.placeStore.isTrue(temp)) { for (int i = 1 ; i < extraDrops ; i++) { blocksDropped.add(temp); Mining.miningDrops(temp); @@ -172,7 +172,7 @@ public class BlastMining { } for (Block block : xp) { - if (!mcMMO.p.placeStore.isTrue(block)) { + if (!mcMMO.placeStore.isTrue(block)) { Mining.miningXP(player, block); } } diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java b/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java index 7967dbfd1..8f5c5823d 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java @@ -130,7 +130,7 @@ public class Excavation { Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage()); - if (!mcMMO.p.placeStore.isTrue(block) && !Misc.blockBreakSimulate(block, player, true)) { + if (!mcMMO.placeStore.isTrue(block) && !Misc.blockBreakSimulate(block, player, true)) { FakePlayerAnimationEvent armswing = new FakePlayerAnimationEvent(player); mcMMO.p.getServer().getPluginManager().callEvent(armswing); diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java index ce88c120e..4e66e04bf 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java @@ -63,7 +63,7 @@ public class Herbalism { else if (Config.getInstance().getHerbalismGreenThumbCobbleToMossy() && type == Material.COBBLESTONE) { block.setType(Material.MOSSY_COBBLESTONE); // Don't award double drops to mossified cobblestone - mcMMO.p.placeStore.setTrue(block); + mcMMO.placeStore.setTrue(block); } else if (Config.getInstance().getHerbalismGreenThumbCobbleWallToMossyWall() && type == Material.COBBLE_WALL) { block.setData((byte) 1); @@ -109,7 +109,7 @@ public class Herbalism { switch (type) { case BROWN_MUSHROOM: case RED_MUSHROOM: - if (!mcMMO.p.placeStore.isTrue(block)) { + if (!mcMMO.placeStore.isTrue(block)) { mat = Material.getMaterial(id); xp = Config.getInstance().getHerbalismXPMushrooms(); } @@ -120,7 +120,7 @@ public class Herbalism { Block b = block.getRelative(0, y, 0); if (b.getType().equals(Material.CACTUS)) { mat = Material.CACTUS; - if (!mcMMO.p.placeStore.isTrue(b)) { + if (!mcMMO.placeStore.isTrue(b)) { if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel) { catciDrops++; } @@ -142,7 +142,7 @@ public class Herbalism { break; case MELON_BLOCK: - if (!mcMMO.p.placeStore.isTrue(block)) { + if (!mcMMO.placeStore.isTrue(block)) { mat = Material.MELON; xp = Config.getInstance().getHerbalismXPMelon(); } @@ -161,7 +161,7 @@ public class Herbalism { case PUMPKIN: case JACK_O_LANTERN: - if (!mcMMO.p.placeStore.isTrue(block)) { + if (!mcMMO.placeStore.isTrue(block)) { mat = Material.getMaterial(id); xp = Config.getInstance().getHerbalismXPPumpkin(); } @@ -169,7 +169,7 @@ public class Herbalism { case RED_ROSE: case YELLOW_FLOWER: - if (!mcMMO.p.placeStore.isTrue(block)) { + if (!mcMMO.placeStore.isTrue(block)) { mat = Material.getMaterial(id); xp = Config.getInstance().getHerbalismXPFlowers(); } @@ -180,7 +180,7 @@ public class Herbalism { Block b = block.getRelative(0, y, 0); if (b.getType().equals(Material.SUGAR_CANE_BLOCK)) { mat = Material.SUGAR_CANE; - if (!mcMMO.p.placeStore.isTrue(b)) { + if (!mcMMO.placeStore.isTrue(b)) { if (herbLevel > MAX_BONUS_LEVEL || random.nextInt(randomChance) <= herbLevel) { caneDrops++; } @@ -191,14 +191,14 @@ public class Herbalism { break; case VINE: - if (!mcMMO.p.placeStore.isTrue(block)) { + if (!mcMMO.placeStore.isTrue(block)) { mat = type; xp = Config.getInstance().getHerbalismXPVines(); } break; case WATER_LILY: - if (!mcMMO.p.placeStore.isTrue(block)) { + if (!mcMMO.placeStore.isTrue(block)) { mat = type; xp = Config.getInstance().getHerbalismXPLilyPads(); } diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java b/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java index 27a9e7a16..f9cbd2fd2 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Mining.java @@ -316,7 +316,7 @@ public class Mining { * @param block The block being broken */ public static void miningBlockCheck(Player player, Block block) { - if (mcMMO.p.placeStore.isTrue(block)) { + if (mcMMO.placeStore.isTrue(block)) { return; } @@ -362,7 +362,7 @@ public class Mining { return; } - if (mcMMO.p.placeStore.isTrue(block) || Misc.blockBreakSimulate(block, player, true)) { + if (mcMMO.placeStore.isTrue(block) || Misc.blockBreakSimulate(block, player, true)) { return; } @@ -408,7 +408,7 @@ public class Mining { case NETHERRACK: case SANDSTONE: case STONE: - if (mcMMO.p.placeStore.isTrue(block) || Misc.blockBreakSimulate(block, player, true)) { + if (mcMMO.placeStore.isTrue(block) || Misc.blockBreakSimulate(block, player, true)) { return; } diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java index e57125a78..06e02ed03 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java @@ -109,7 +109,7 @@ public class WoodCutting { CustomBlock block = ModChecks.getCustomBlock(x); item = block.getItemDrop(); - if (!mcMMO.p.placeStore.isTrue(x)) { + if (!mcMMO.placeStore.isTrue(x)) { WoodCutting.woodCuttingProcCheck(player, x); xp = block.getXpGain(); } @@ -169,7 +169,7 @@ public class WoodCutting { break; } - if (!mcMMO.p.placeStore.isTrue(x)) { + if (!mcMMO.placeStore.isTrue(x)) { WoodCutting.woodCuttingProcCheck(player, x); switch (species) { @@ -245,7 +245,7 @@ public class WoodCutting { Block zNegative = currentBlock.getRelative(0, 0, -1); Block yPositive = currentBlock.getRelative(0, 1, 0); - if (!mcMMO.p.placeStore.isTrue(currentBlock)) { + if (!mcMMO.placeStore.isTrue(currentBlock)) { if (!isTooAggressive(currentBlock, xPositive) && BlockChecks.treeFellerCompatible(xPositive) && !toBeFelled.contains(xPositive)) { processTreeFelling(xPositive, toBeFelled); } @@ -277,7 +277,7 @@ public class WoodCutting { Block corner3 = currentBlock.getRelative(-1, 0, 1); Block corner4 = currentBlock.getRelative(-1, 0, -1); - if (!mcMMO.p.placeStore.isTrue(currentBlock)) { + if (!mcMMO.placeStore.isTrue(currentBlock)) { if (!isTooAggressive(currentBlock, corner1) && BlockChecks.treeFellerCompatible(corner1) && !toBeFelled.contains(corner1)) { processTreeFelling(corner1, toBeFelled); } @@ -297,7 +297,7 @@ public class WoodCutting { } if (BlockChecks.treeFellerCompatible(yPositive)) { - if(!mcMMO.p.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) { + if(!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) { processTreeFelling(yPositive, toBeFelled); } } @@ -421,7 +421,7 @@ public class WoodCutting { PlayerProfile profile = Users.getProfile(player); int xp = 0; - if (mcMMO.p.placeStore.isTrue(block)) { + if (mcMMO.placeStore.isTrue(block)) { return; }