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