From 97cf02eb37896fbc7c37330a764fbc4a56d0d828 Mon Sep 17 00:00:00 2001 From: Chiss Date: Sat, 9 Aug 2014 12:35:36 +1000 Subject: [PATCH] Hub changes --- .../src/mineplex/hub/HubManager.java | 2 +- .../mineplex/hub/modules/ParkourManager.java | 19 +++++++++++++++++-- .../hub/modules/VisibilityManager.java | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 055fcce44..a94de5750 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -554,7 +554,7 @@ public class HubManager extends MiniClientPlugin return; //Dont Let Chat Near Spawn! - if (UtilMath.offset(GetSpawn(), event.getPlayer().getLocation()) < 4) + if (UtilMath.offset2d(GetSpawn(), event.getPlayer().getLocation()) == 0) { UtilPlayer.message(event.getPlayer(), F.main("Chat", "You must leave spawn before you can chat!")); event.setCancelled(true); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java index 7f4d8a5f2..870dc03e1 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/ParkourManager.java @@ -14,12 +14,14 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerVelocityEvent; @@ -29,10 +31,14 @@ import mineplex.core.common.util.Callback; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.event.GadgetActivateEvent; import mineplex.core.gadget.event.GadgetBlockEvent; @@ -181,9 +187,18 @@ public class ParkourManager extends MiniPlugin } } - @EventHandler - public void disallowBlockPlace(BlockPlaceEvent event) + @EventHandler(priority = EventPriority.LOWEST) + public void disallowBlockPlace(PlayerInteractEvent event) { + if (event.getPlayer().getItemInHand() == null) + return; + + if (!event.getPlayer().getItemInHand().getType().isBlock()) + return; + + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + if (isParkourMode(event.getPlayer())) { event.getPlayer().teleport(Manager.GetSpawn()); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/VisibilityManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/VisibilityManager.java index 2515865c1..fe53e4134 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/VisibilityManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/VisibilityManager.java @@ -47,7 +47,7 @@ public class VisibilityManager extends MiniPlugin if (player.equals(other)) continue; - if (hideMe || !Manager.getPreferences().Get(other).ShowPlayers || UtilMath.offset(player.getLocation(), Manager.GetSpawn()) < 4 || + if (hideMe || !Manager.getPreferences().Get(other).ShowPlayers || UtilMath.offset2d(player.getLocation(), Manager.GetSpawn()) == 0 || Manager.GetTutorial().InTutorial(other) || Manager.GetTutorial().InTutorial(player) || (player.getOpenInventory().getType() != InventoryType.CRAFTING && player.getOpenInventory().getType() != InventoryType.CREATIVE)) {