Comment on the leader check bypass.

This commit is contained in:
ProSavage 2019-04-05 10:25:55 -05:00
parent f3f31b483a
commit d0c03640a6
1 changed files with 966 additions and 960 deletions

View File

@ -731,7 +731,8 @@ public class FactionsPlayerListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) {
// only need to check right-clicks and physical as of MC 1.4+; good performance boost
if (event.getAction().equals(Action.LEFT_CLICK_BLOCK) || event.getAction().equals(Action.LEFT_CLICK_AIR)) return;
if (event.getAction().equals(Action.LEFT_CLICK_BLOCK) || event.getAction().equals(Action.LEFT_CLICK_AIR))
return;
Block block = event.getClickedBlock();
Player player = event.getPlayer();
// Check if the material is bypassing protection
@ -877,6 +878,7 @@ public class FactionsPlayerListener implements Listener {
return attempts;
}
}
/// <summary>
/// This checks if the current player can execute an action based on it's factions access and surroundings
/// It will grant access in the following priorities:
@ -909,16 +911,19 @@ public class FactionsPlayerListener implements Listener {
return false;
}
}
// Approves any permission check if the player in question is a leader AND owns the faction.
if (me.getRole().equals(Role.LEADER) && me.getFaction().equals(factionToCheck)) return true;
me.msg("You cannot " + action + " in the territory of " + factionToCheck.getTag(me.getFaction()));
return false;
}
/// <summary>
/// This will try to resolve a permission action based on the item material, if it's not usable, will return null
/// </summary>
private static PermissableAction GetPermissionFromUsableBlock(Block block) {
return GetPermissionFromUsableBlock(block.getType());
}
/// <summary>
/// This will try to resolve a permission action based on the item material, if it's not usable, will return null
/// <summary>
@ -926,7 +931,8 @@ public class FactionsPlayerListener implements Listener {
// Check for doors that might have diff material name in old version.
if (material.name().contains("DOOR"))
return PermissableAction.DOOR;
if (material.name().toUpperCase().contains("BUTTON") || material.name().toUpperCase().contains("PRESSURE")) return PermissableAction.BUTTON;
if (material.name().toUpperCase().contains("BUTTON") || material.name().toUpperCase().contains("PRESSURE"))
return PermissableAction.BUTTON;
if (SavageFactions.plugin.mc113) {
switch (material) {
case LEVER: