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> <groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId> <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> <packaging>jar</packaging>
<name>SavageFactions</name> <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()) if (SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded())
return true; return true;
if (otherFaction.getId().equals(myFaction.getId()) && me.getRole() == Role.LEADER) return true;
PermissableAction action = GetPermissionFromUsableBlock(block); PermissableAction action = GetPermissionFromUsableBlock(block);
if (action == null) return false; if (action == null) return false;
// We only care about some material types. // We only care about some material types.
/// Who was the idiot? /// Who was the idiot?
if (otherFaction.hasPlayersOnline()) { if (otherFaction.hasPlayersOnline()) {
@ -734,34 +733,28 @@ public class FactionsPlayerListener implements Listener {
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;
if (event.getPlayer().getItemInHand() != null) {
Material handItem = event.getPlayer().getItemInHand().getType();
if (handItem.isEdible()
|| handItem.equals(Material.POTION)
|| handItem.equals(Material.LINGERING_POTION)
|| handItem.equals(Material.SPLASH_POTION)) {
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
if (Conf.territoryBypasssProtectedMaterials.contains(block.getType())) return; if (Conf.territoryBypasssProtectedMaterials.contains(block.getType())) return;
if (block == null) return; // clicked in air, apparently if (block == null) return; // clicked in air, apparently
SavageFactions.plugin.log("Checking for material permission");
if (GetPermissionFromUsableBlock(event.getClickedBlock().getType()) != null) { if (GetPermissionFromUsableBlock(event.getClickedBlock().getType()) != null) {
SavageFactions.plugin.log("Checking for use block permission");
if (!canPlayerUseBlock(player, block, false)) { if (!canPlayerUseBlock(player, block, false)) {
event.setCancelled(true); event.setCancelled(true);
event.setUseInteractedBlock(Event.Result.DENY); event.setUseInteractedBlock(Event.Result.DENY);
return; return;
} }
} }
if (event.getPlayer().getItemInHand() != null) {
Material handItem = event.getPlayer().getItemInHand().getType();
if (handItem.isEdible()
|| handItem.equals(Material.POTION)
|| handItem.equals(Material.LINGERING_POTION)
|| handItem.equals(Material.SPLASH_POTION)) {
return;
}
}
if (event.getMaterial().isSolid()) return; if (event.getMaterial().isSolid()) return;
SavageFactions.plugin.log("Checking if you can use that item");
if (!playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false)) { if (!playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false)) {
event.setCancelled(true); event.setCancelled(true);
event.setUseInteractedBlock(Event.Result.DENY); event.setUseInteractedBlock(Event.Result.DENY);
@ -995,7 +988,6 @@ public class FactionsPlayerListener implements Listener {
case HOPPER: case HOPPER:
case BEACON: case BEACON:
case JUKEBOX: case JUKEBOX:
case ANVIL: case ANVIL:
case CHIPPED_ANVIL: case CHIPPED_ANVIL:
case DAMAGED_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. // 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;
return null; return null;
} }
} else { } else {
@ -1039,7 +1032,7 @@ 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.toString().toUpperCase().contains("BUTTON")) if (material.toString().toUpperCase().contains("BUTTON") || material.toString().toUpperCase().contains("PRESSURE"))
return PermissableAction.BUTTON; return PermissableAction.BUTTON;
return null; return null;
} }