From 58eaaaa2eebaab1bd0714beb60ea17ef471980e0 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Tue, 10 Feb 2015 21:15:44 -0500 Subject: [PATCH] Treasure fixes --- Plugins/.idea/libraries/NoCheatPlus.xml | 9 ++++ Plugins/Mineplex.Core/Mineplex.Core.iml | 1 + .../src/mineplex/core/treasure/Treasure.java | 2 + .../core/treasure/TreasureLocation.java | 51 +++++++++++-------- .../src/mineplex/game/clans/Clans.java | 9 ++-- .../Mineplex.MapParser/Mineplex.MapParser.iml | 4 +- 6 files changed, 50 insertions(+), 26 deletions(-) create mode 100644 Plugins/.idea/libraries/NoCheatPlus.xml diff --git a/Plugins/.idea/libraries/NoCheatPlus.xml b/Plugins/.idea/libraries/NoCheatPlus.xml new file mode 100644 index 000000000..92bd59440 --- /dev/null +++ b/Plugins/.idea/libraries/NoCheatPlus.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Plugins/Mineplex.Core/Mineplex.Core.iml b/Plugins/Mineplex.Core/Mineplex.Core.iml index d331f2503..1a3abf88d 100644 --- a/Plugins/Mineplex.Core/Mineplex.Core.iml +++ b/Plugins/Mineplex.Core/Mineplex.Core.iml @@ -19,5 +19,6 @@ + \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java index 463224286..e93f556da 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/Treasure.java @@ -277,6 +277,8 @@ public class Treasure _rewards[_currentReward].giveReward("Treasure", _player); } + _currentReward = _rewards.length; + // Remove any extra blocks resetBlockInfo(_chestBlockInfo); resetBlockInfo(_openedChestBlockInfo); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java index 60571e757..8911e6d3a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/treasure/TreasureLocation.java @@ -169,7 +169,7 @@ public class TreasureLocation implements Listener treasure.update(); - if (treasure.isFinished() && treasure.getFinishedTickCount() >= 80) + if (!treasure.getPlayer().isOnline() || (treasure.isFinished() && treasure.getFinishedTickCount() >= 80)) { treasure.cleanup(); @@ -191,24 +191,6 @@ public class TreasureLocation implements Listener } } - @EventHandler - public void preventGadgetBlockEvent(GadgetBlockEvent event) - { - if (isTreasureInProgress()) - { - List blocks = event.getBlocks(); - - for (Block block : blocks) - { - if (_currentTreasure.containsBlock(block)) - { - event.setCancelled(true); - return; - } - } - } - } - @EventHandler(priority = EventPriority.HIGH) public void interact(PlayerInteractEvent event) { @@ -237,6 +219,10 @@ public class TreasureLocation implements Listener @EventHandler public void inventoryOpen(InventoryOpenEvent event) { + // Ignore punish gui + if (event.getInventory().getTitle() != null && event.getInventory().getTitle().contains("Punish")) + return; + if (isTreasureInProgress() && event.getPlayer().equals(_currentTreasure.getPlayer())) { event.setCancelled(true); @@ -268,7 +254,7 @@ public class TreasureLocation implements Listener Location centerLocation = _currentTreasure.getCenterBlock().getLocation().add(0.5, 1.5, 0.5); double toDistanceFromCenter = centerLocation.distanceSquared(toLocation); - if (toDistanceFromCenter <= 16 && player.getVelocity().lengthSquared() < 10) + if (toDistanceFromCenter <= 16) { // Only cancel movement if they are moving towards the center double fromDistanceFromCenter = centerLocation.distanceSquared(fromLocation); @@ -276,7 +262,7 @@ public class TreasureLocation implements Listener { Location spawnLocation = new Location(player.getWorld(), 0, 64, 0); UtilAction.velocity(player, UtilAlg.getTrajectory(player.getLocation(), spawnLocation).multiply(-1), 1.5, true, 0.8, 0, 1.0, true); - event.setTo(event.getFrom()); +// event.setTo(event.getFrom()); } } } @@ -293,6 +279,29 @@ public class TreasureLocation implements Listener } } + @EventHandler + public void preventGadgetBlockEvent(GadgetBlockEvent event) + { + List blocks = event.getBlocks(); + + int x = _chestBlock.getX(); + int y = _chestBlock.getY(); + int z = _chestBlock.getZ(); + + for (Block block : blocks) + { + int dx = Math.abs(x - block.getX()); + int dy = Math.abs(y - block.getY()); + int dz = Math.abs(z - block.getZ()); + + if (dx <= 4 && dz <= 4 && dy <= 4) + { + event.setCancelled(true); + return; + } + } + } + @EventHandler public void quit(PlayerQuitEvent event) { diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java index 01f0ff5fa..cf3f18f75 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/Clans.java @@ -10,6 +10,7 @@ import mineplex.core.command.CommandCenter; import mineplex.core.donation.DonationManager; import mineplex.core.explosion.Explosion; import mineplex.core.friend.FriendManager; +import mineplex.core.ignore.IgnoreManager; import mineplex.core.inventory.InventoryManager; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.memory.MemoryFix; @@ -62,7 +63,6 @@ public class Clans extends JavaPlugin new ServerConfiguration(this); PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager); - new MessageManager(this, _clientManager, preferenceManager); ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); new Spawn(this, serverStatusManager.getCurrentServerName()); @@ -74,9 +74,12 @@ public class Clans extends JavaPlugin Punish punish = new Punish(this, webServerAddress, _clientManager); AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager); AntiHack.Instance.setKick(false); - + BlockRestore blockRestore = new BlockRestore(this); - + + IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal); + new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish); + new MemoryFix(this); new Explosion(this, blockRestore); new FriendManager(this, _clientManager, preferenceManager, portal); diff --git a/Plugins/Mineplex.MapParser/Mineplex.MapParser.iml b/Plugins/Mineplex.MapParser/Mineplex.MapParser.iml index d4443f18f..86ec89ce9 100644 --- a/Plugins/Mineplex.MapParser/Mineplex.MapParser.iml +++ b/Plugins/Mineplex.MapParser/Mineplex.MapParser.iml @@ -9,6 +9,6 @@ + - - + \ No newline at end of file