Parcourir la source

cancel PlayerInteractEvent to prevent editing signs on mc 1.20

mastercake10 il y a 1 an
Parent
commit
ffad1d58c1
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      Plugin/src/main/java/de/Linus122/TimeIsMoney/ATM.java

+ 2 - 1
Plugin/src/main/java/de/Linus122/TimeIsMoney/ATM.java

@@ -321,12 +321,13 @@ public class ATM implements Listener, CommandExecutor {
 		return prefix + "_TimBANK";
 	}
 	
-	@EventHandler(priority = EventPriority.HIGHEST)
+	@EventHandler(priority = EventPriority.NORMAL)
 	public void onInteract(PlayerInteractEvent e) {
 		if (e.getClickedBlock() != null) {
 			if (e.getClickedBlock().getState() instanceof Sign) {
 				Sign sign = (Sign) e.getClickedBlock().getState();
 				if (sign.getLine(0).equalsIgnoreCase(CC(Main.finalconfig.getString("atm_sign_label")))) {
+					e.setCancelled(true);
 					if (!e.getPlayer().hasPermission("tim.atm.use")) {
 						e.getPlayer().sendMessage(CC(Main.finalconfig.getString("message_atm_noperms")));
 					} else {