mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-25 11:46:49 +01:00
Add FakeBlockPlaceEvent handling and adminMode override in PvP.
This commit is contained in:
parent
f77750fc91
commit
2b7a505a7c
@ -904,6 +904,10 @@ public class EngineMain extends EngineAbstract
|
|||||||
// ... gather defender PS and faction information ...
|
// ... gather defender PS and faction information ...
|
||||||
PS defenderPs = PS.valueOf(defender.getLocation());
|
PS defenderPs = PS.valueOf(defender.getLocation());
|
||||||
Faction defenderPsFaction = BoardColl.get().getFactionAt(defenderPs);
|
Faction defenderPsFaction = BoardColl.get().getFactionAt(defenderPs);
|
||||||
|
|
||||||
|
// ... fast evaluate if the attacker is overriding ...
|
||||||
|
MPlayer mplayer = MPlayer.get(eattacker);
|
||||||
|
if (mplayer != null && mplayer.isUsingAdminMode()) return true;
|
||||||
|
|
||||||
// ... PVP flag may cause a damage block ...
|
// ... PVP flag may cause a damage block ...
|
||||||
if (defenderPsFaction.getFlag(MFlag.getFlagPvp()) == false)
|
if (defenderPsFaction.getFlag(MFlag.getFlagPvp()) == false)
|
||||||
@ -1421,7 +1425,9 @@ public class EngineMain extends EngineAbstract
|
|||||||
{
|
{
|
||||||
if (!event.canBuild()) return;
|
if (!event.canBuild()) return;
|
||||||
|
|
||||||
if (canPlayerBuildAt(event.getPlayer(), PS.valueOf(event.getBlock()), true)) return;
|
boolean verboose = ! MUtil.isFakeEvent(event);
|
||||||
|
|
||||||
|
if (canPlayerBuildAt(event.getPlayer(), PS.valueOf(event.getBlock()), verboose)) return;
|
||||||
|
|
||||||
event.setBuild(false);
|
event.setBuild(false);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -1430,7 +1436,9 @@ public class EngineMain extends EngineAbstract
|
|||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void blockBuild(BlockBreakEvent event)
|
public void blockBuild(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
if (canPlayerBuildAt(event.getPlayer(), PS.valueOf(event.getBlock()), true)) return;
|
boolean verboose = ! MUtil.isFakeEvent(event);
|
||||||
|
|
||||||
|
if (canPlayerBuildAt(event.getPlayer(), PS.valueOf(event.getBlock()), verboose)) return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -1440,7 +1448,9 @@ public class EngineMain extends EngineAbstract
|
|||||||
{
|
{
|
||||||
if (!event.getInstaBreak()) return;
|
if (!event.getInstaBreak()) return;
|
||||||
|
|
||||||
if (canPlayerBuildAt(event.getPlayer(), PS.valueOf(event.getBlock()), true)) return;
|
boolean verboose = ! MUtil.isFakeEvent(event);
|
||||||
|
|
||||||
|
if (canPlayerBuildAt(event.getPlayer(), PS.valueOf(event.getBlock()), verboose)) return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -1507,7 +1517,9 @@ public class EngineMain extends EngineAbstract
|
|||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void blockBuild(HangingPlaceEvent event)
|
public void blockBuild(HangingPlaceEvent event)
|
||||||
{
|
{
|
||||||
if (canPlayerBuildAt(event.getPlayer(), PS.valueOf(event.getEntity().getLocation()), true)) return;
|
boolean verboose = ! MUtil.isFakeEvent(event);
|
||||||
|
|
||||||
|
if (canPlayerBuildAt(event.getPlayer(), PS.valueOf(event.getEntity().getLocation()), verboose)) return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -1521,7 +1533,9 @@ public class EngineMain extends EngineAbstract
|
|||||||
Entity breaker = entityEvent.getRemover();
|
Entity breaker = entityEvent.getRemover();
|
||||||
if (MUtil.isntPlayer(breaker)) return;
|
if (MUtil.isntPlayer(breaker)) return;
|
||||||
|
|
||||||
if ( ! canPlayerBuildAt(breaker, PS.valueOf(event.getEntity().getLocation()), true))
|
boolean verboose = ! MUtil.isFakeEvent(event);
|
||||||
|
|
||||||
|
if ( ! canPlayerBuildAt(breaker, PS.valueOf(event.getEntity().getLocation()), verboose))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user