Final Touches on PermissableAction Rollback

This commit is contained in:
Driftay 2020-06-01 22:52:03 -04:00
parent 903129e462
commit 929c34d850
3 changed files with 7 additions and 8 deletions

View File

@ -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");

View File

@ -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);
}
}

View File

@ -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();