Skip to content

Commit

Permalink
Add admin permission override to edit signs (#4287)
Browse files Browse the repository at this point in the history
* add admin permission override to edit signs

* include sign dying
  • Loading branch information
SirYwell authored Jan 6, 2024
1 parent ead7acd commit 449af2f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,17 @@ public void onPlayerDyeSign(PlayerInteractEvent event) {
}
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;
}
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

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;
Expand All @@ -46,15 +47,17 @@ public void onPlayerSignOpenEvent(PlayerSignOpenEvent event) {
}
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;
}
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);
}
Expand Down

0 comments on commit 449af2f

Please sign in to comment.