Prevents sign editing from triggering when changing a sign line
All checks were successful
KnarCraft/PlaceholderSigns/pipeline/head This commit looks good

This commit is contained in:
Kristian Knarvik 2024-04-04 02:21:52 +02:00
parent 82032dbbbc
commit 788be0cdcd
2 changed files with 4 additions and 1 deletions

View File

@ -39,6 +39,9 @@ public class SignClickListener implements Listener {
return; return;
} }
// Cancel the event to prevent vanilla behavior
event.setCancelled(true);
String[] lines = sign.getSide(Side.FRONT).getLines(); String[] lines = sign.getSide(Side.FRONT).getLines();
lines[request.line()] = request.text(); lines[request.line()] = request.text();

View File

@ -19,7 +19,7 @@ import java.util.Map;
public class SignTextListener implements Listener { public class SignTextListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSignCreate(SignChangeEvent event) { public void onSignCreateOrEdit(SignChangeEvent event) {
// Only check for placeholders if the player is allowed to // Only check for placeholders if the player is allowed to
if (!event.getPlayer().hasPermission("placeholdersigns.placeholder")) { if (!event.getPlayer().hasPermission("placeholdersigns.placeholder")) {
return; return;