Hub changes

This commit is contained in:
Chiss 2014-08-09 12:35:36 +10:00
parent db90bcc958
commit 97cf02eb37
3 changed files with 19 additions and 4 deletions

View File

@ -554,7 +554,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
return; return;
//Dont Let Chat Near Spawn! //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!")); UtilPlayer.message(event.getPlayer(), F.main("Chat", "You must leave spawn before you can chat!"));
event.setCancelled(true); event.setCancelled(true);

View File

@ -14,12 +14,14 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent; 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.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; 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.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetActivateEvent; import mineplex.core.gadget.event.GadgetActivateEvent;
import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.event.GadgetBlockEvent;
@ -181,9 +187,18 @@ public class ParkourManager extends MiniPlugin
} }
} }
@EventHandler @EventHandler(priority = EventPriority.LOWEST)
public void disallowBlockPlace(BlockPlaceEvent event) 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())) if (isParkourMode(event.getPlayer()))
{ {
event.getPlayer().teleport(Manager.GetSpawn()); event.getPlayer().teleport(Manager.GetSpawn());

View File

@ -47,7 +47,7 @@ public class VisibilityManager extends MiniPlugin
if (player.equals(other)) if (player.equals(other))
continue; 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) || Manager.GetTutorial().InTutorial(other) || Manager.GetTutorial().InTutorial(player) ||
(player.getOpenInventory().getType() != InventoryType.CRAFTING && player.getOpenInventory().getType() != InventoryType.CREATIVE)) (player.getOpenInventory().getType() != InventoryType.CRAFTING && player.getOpenInventory().getType() != InventoryType.CREATIVE))
{ {