From 929c34d8509b284127c6bdee46c4ceea572b7231 Mon Sep 17 00:00:00 2001 From: Driftay Date: Mon, 1 Jun 2020 22:52:03 -0400 Subject: [PATCH] Final Touches on PermissableAction Rollback --- .../factions/listeners/FactionsBlockListener.java | 4 ++-- .../factions/listeners/FactionsEntityListener.java | 9 ++++----- .../factions/listeners/FactionsPlayerListener.java | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index 8778cf62..57ad0657 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -430,7 +430,7 @@ public class FactionsBlockListener implements Listener { if (!justCheck) fPlayer.setLastFrostwalkerMessage(); // Check if they have build permissions here. If not, block this from happening. - if (!playerCanBuildDestroyBlock(player, location, PermissableAction.FROST_WALK.toString(), justCheck)) + if (!playerCanBuildDestroyBlock(player, location, "frostwalk", justCheck)) event.setCancelled(true); } @@ -521,7 +521,7 @@ public class FactionsBlockListener implements Listener { public void onFarmLandDamage(EntityChangeBlockEvent event) { if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); - if (!playerCanBuildDestroyBlock(player, event.getBlock().getLocation(), PermissableAction.DESTROY.name(), true)) { + if (!playerCanBuildDestroyBlock(player, event.getBlock().getLocation(), "destroy", true)) { FPlayer me = FPlayers.getInstance().getByPlayer(player); Faction otherFaction = Board.getInstance().getFactionAt(new FLocation(event.getBlock().getLocation())); me.msg(TL.ACTION_DENIED_OTHER, otherFaction.getTag(), "trample crops"); diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java index 4a876a3f..cce2e784 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -4,7 +4,6 @@ import com.massivecraft.factions.*; import com.massivecraft.factions.event.PowerLossEvent; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.util.MiscUtil; -import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.util.TL; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -138,7 +137,7 @@ public class FactionsEntityListener implements Listener { // Run the check for a player if (damager instanceof Player) { - if (!FactionsBlockListener.playerCanBuildDestroyBlock((Player) damager, damagee.getLocation(), PermissableAction.DESTROY, false)) + if (!FactionsBlockListener.playerCanBuildDestroyBlock((Player) damager, damagee.getLocation(), "destroy", false)) event.setCancelled(true); } else { @@ -508,7 +507,7 @@ public class FactionsEntityListener implements Listener { Player p = (Player) e.getRemover(); if (e.getEntity().getType() == EntityType.PAINTING || e.getEntity().getType() == EntityType.ITEM_FRAME) { - if (!FactionsBlockListener.playerCanBuildDestroyBlock(p, e.getEntity().getLocation(), PermissableAction.DESTROY, false)) { + if (!FactionsBlockListener.playerCanBuildDestroyBlock(p, e.getEntity().getLocation(), "destroy", false)) { e.setCancelled(true); } } @@ -519,7 +518,7 @@ public class FactionsEntityListener implements Listener { if (e.getPlayer() == null) return; if (e.getEntity().getType() == EntityType.PAINTING || e.getEntity().getType() == EntityType.ITEM_FRAME) { - if (!FactionsBlockListener.playerCanBuildDestroyBlock(e.getPlayer(), e.getBlock().getLocation(), PermissableAction.BUILD, false)) { + if (!FactionsBlockListener.playerCanBuildDestroyBlock(e.getPlayer(), e.getBlock().getLocation(), "build", false)) { e.setCancelled(true); e.getPlayer().updateInventory(); } @@ -626,7 +625,7 @@ public class FactionsEntityListener implements Listener { if (event.getRightClicked() == null) return; if (!event.getRightClicked().getType().equals(EntityType.ITEM_FRAME)) return; - if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getRightClicked().getLocation(), PermissableAction.BUILD, false)) { + if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), event.getRightClicked().getLocation(), "build", false)) { event.setCancelled(true); } } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 9ee68295..a981d7eb 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -861,7 +861,7 @@ public class FactionsPlayerListener implements Listener { Block block = event.getClickedBlock(); if (event.getAction() == Action.RIGHT_CLICK_BLOCK && block.getType() == XMaterial.GRASS_BLOCK.parseMaterial() && event.hasItem() && event.getItem().getType() == XMaterial.BONE_MEAL.parseMaterial()) { - if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), block.getLocation(), PermissableAction.BUILD, true)) { + if (!FactionsBlockListener.playerCanBuildDestroyBlock(event.getPlayer(), block.getLocation(), "build", true)) { FPlayer me = FPlayers.getInstance().getById(event.getPlayer().getUniqueId().toString()); Faction myFaction = me.getFaction();