Added pressure plates to permission items, moved version forward

This commit is contained in:
SvenjaReißaus 2019-03-19 00:45:42 -05:00
parent 6a24b34a70
commit 29640925eb
No known key found for this signature in database
GPG Key ID: E5494A03FA36D54B
3 changed files with 13 additions and 20 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<version>1.6.9.5-U0.2.1-RC-1.6-RC</version>
<version>1.6.9.5-U0.2.1-RC-1.6.1-RC</version>
<packaging>jar</packaging>
<name>SavageFactions</name>

View File

@ -178,10 +178,9 @@ public class FactionsPlayerListener implements Listener {
if (SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded())
return true;
if (otherFaction.getId().equals(myFaction.getId()) && me.getRole() == Role.LEADER) return true;
PermissableAction action = GetPermissionFromUsableBlock(block);
if (action == null) return false;
// We only care about some material types.
/// Who was the idiot?
if (otherFaction.hasPlayersOnline()) {
@ -734,6 +733,18 @@ public class FactionsPlayerListener implements Listener {
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;
Block block = event.getClickedBlock();
Player player = event.getPlayer();
// Check if the material is bypassing protection
if (Conf.territoryBypasssProtectedMaterials.contains(block.getType())) return;
if (block == null) return; // clicked in air, apparently
if (GetPermissionFromUsableBlock(event.getClickedBlock().getType()) != null) {
if (!canPlayerUseBlock(player, block, false)) {
event.setCancelled(true);
event.setUseInteractedBlock(Event.Result.DENY);
return;
}
}
if (event.getPlayer().getItemInHand() != null) {
Material handItem = event.getPlayer().getItemInHand().getType();
if (handItem.isEdible()
@ -743,25 +754,7 @@ public class FactionsPlayerListener implements Listener {
return;
}
}
Block block = event.getClickedBlock();
Player player = event.getPlayer();
// Check if the material is bypassing protection
if (Conf.territoryBypasssProtectedMaterials.contains(block.getType())) return;
if (block == null) return; // clicked in air, apparently
SavageFactions.plugin.log("Checking for material permission");
if (GetPermissionFromUsableBlock(event.getClickedBlock().getType()) != null) {
SavageFactions.plugin.log("Checking for use block permission");
if (!canPlayerUseBlock(player, block, false)) {
event.setCancelled(true);
event.setUseInteractedBlock(Event.Result.DENY);
return;
}
}
if (event.getMaterial().isSolid()) return;
SavageFactions.plugin.log("Checking if you can use that item");
if (!playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false)) {
event.setCancelled(true);
event.setUseInteractedBlock(Event.Result.DENY);
@ -995,7 +988,6 @@ public class FactionsPlayerListener implements Listener {
case HOPPER:
case BEACON:
case JUKEBOX:
case ANVIL:
case CHIPPED_ANVIL:
case DAMAGED_ANVIL:
@ -1004,6 +996,7 @@ 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;
return null;
}
} else {
@ -1039,7 +1032,7 @@ 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.toString().toUpperCase().contains("BUTTON"))
if (material.toString().toUpperCase().contains("BUTTON") || material.toString().toUpperCase().contains("PRESSURE"))
return PermissableAction.BUTTON;
return null;
}