From 449af2f3a4ae3f88b6ce9830aeb90c2ab3e6c740 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Sat, 6 Jan 2024 11:28:33 +0100 Subject: [PATCH] Add admin permission override to edit signs (#4287) * add admin permission override to edit signs * include sign dying --- .../plotsquared/bukkit/listener/PlayerEventListener.java | 6 ++++-- .../bukkit/listener/PlayerEventListener1201.java | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java index f35804948..9fba3dff9 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener.java @@ -252,7 +252,8 @@ public class PlayerEventListener implements Listener { } Plot plot = location.getOwnedPlot(); if (plot == null) { - if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, EditSignFlag.class, false)) { + if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, EditSignFlag.class, false) + && !event.getPlayer().hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString())) { event.setCancelled(true); } return; @@ -260,7 +261,8 @@ public class PlayerEventListener implements Listener { if (plot.isAdded(event.getPlayer().getUniqueId())) { return; // allow for added players } - if (!plot.getFlag(EditSignFlag.class)) { + if (!plot.getFlag(EditSignFlag.class) + && !event.getPlayer().hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString())) { plot.debug(event.getPlayer().getName() + " could not color the sign because of edit-sign = false"); event.setCancelled(true); } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener1201.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener1201.java index 694e8e65f..0af9a5977 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener1201.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/PlayerEventListener1201.java @@ -20,6 +20,7 @@ package com.plotsquared.bukkit.listener; import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.core.location.Location; +import com.plotsquared.core.permissions.Permission; import com.plotsquared.core.plot.Plot; import com.plotsquared.core.plot.PlotArea; import com.plotsquared.core.plot.flag.implementations.EditSignFlag; @@ -46,7 +47,8 @@ public class PlayerEventListener1201 implements Listener { } Plot plot = location.getOwnedPlot(); if (plot == null) { - if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, EditSignFlag.class, false)) { + if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, EditSignFlag.class, false) + && !event.getPlayer().hasPermission(Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString())) { event.setCancelled(true); } return; @@ -54,7 +56,8 @@ public class PlayerEventListener1201 implements Listener { if (plot.isAdded(event.getPlayer().getUniqueId())) { return; // allow for added players } - if (!plot.getFlag(EditSignFlag.class)) { + if (!plot.getFlag(EditSignFlag.class) + && !event.getPlayer().hasPermission(Permission.PERMISSION_ADMIN_INTERACT_OTHER.toString())) { plot.debug(event.getPlayer().getName() + " could not edit the sign because of edit-sign = false"); event.setCancelled(true); }