stop iron door from being opened by players not in clan (outpost)

This commit is contained in:
Ben 2016-04-05 23:49:16 +01:00
parent 738825ea9d
commit d25f1abfbf
2 changed files with 25 additions and 0 deletions

View File

@ -53,6 +53,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.event.ClansWaterPlaceEvent;
import mineplex.game.clans.clans.event.IronDoorOpenEvent;
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
import mineplex.game.clans.clans.siege.events.SiegeWeaponExplodeEvent;
import mineplex.game.clans.clans.siege.outpost.build.OutpostBlock;
@ -561,6 +562,22 @@ public class Outpost implements Listener
_ownerClan.inform("Your Clan's Outpost has been destroyed.", null);
}
@EventHandler
public void doorOpen(IronDoorOpenEvent event)
{
if (!UtilAlg.inBoundingBox(event.getBlock().getLocation(), _startCorner.clone().subtract(.5, 0, .5), _endCorner))
{
return;
}
if (_ownerClan.isMember(event.getPlayer()))
{
return;
}
event.setCancelled(true);
}
@EventHandler
public void onSiegeWeaponExplode(SiegeWeaponExplodeEvent event)
{

View File

@ -68,6 +68,7 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClansWaterPlaceEvent;
import mineplex.game.clans.clans.event.IronDoorOpenEvent;
import mineplex.game.clans.core.repository.ClanTerritory;
import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
@ -449,6 +450,13 @@ public class Gameplay extends MiniPlugin
// Open
else
{
IronDoorOpenEvent customEvent = UtilServer.CallEvent(new IronDoorOpenEvent(event.getPlayer(), block));
if (customEvent.isCancelled())
{
return;
}
if (block.getData() >= 8) block = block.getRelative(BlockFace.DOWN);
if (block.getData() < 4)