From ed89d2b37b5280b0120490337301c7bb061ad569 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 5 Aug 2022 12:10:19 +0200 Subject: [PATCH] Fix local chat signing --- SpigotCore_Main/src/SpigotCore.properties | 1 + SpigotCore_Main/src/SpigotCore_de.properties | 1 + .../src/de/steamwar/core/events/ChattingEvent.java | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/SpigotCore_Main/src/SpigotCore.properties b/SpigotCore_Main/src/SpigotCore.properties index a676f86..7264c3e 100644 --- a/SpigotCore_Main/src/SpigotCore.properties +++ b/SpigotCore_Main/src/SpigotCore.properties @@ -16,6 +16,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # +LOCAL_CHAT=§eLocal §r{0}§8»§7 {1} COMMAND_SYSTEM_ERROR = §cError executing the command! diff --git a/SpigotCore_Main/src/SpigotCore_de.properties b/SpigotCore_Main/src/SpigotCore_de.properties index c21650e..b5e089a 100644 --- a/SpigotCore_Main/src/SpigotCore_de.properties +++ b/SpigotCore_Main/src/SpigotCore_de.properties @@ -16,6 +16,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # +LOCAL_CHAT=§eLokal §r{0}§8»§7 {1} COMMAND_SYSTEM_ERROR = §cFehler beim Ausführen des Befehls! diff --git a/SpigotCore_Main/src/de/steamwar/core/events/ChattingEvent.java b/SpigotCore_Main/src/de/steamwar/core/events/ChattingEvent.java index a807d67..1de582f 100644 --- a/SpigotCore_Main/src/de/steamwar/core/events/ChattingEvent.java +++ b/SpigotCore_Main/src/de/steamwar/core/events/ChattingEvent.java @@ -19,14 +19,17 @@ package de.steamwar.core.events; +import de.steamwar.core.Core; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.AsyncPlayerChatEvent; public class ChattingEvent implements Listener { - @EventHandler + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) private void onChat(AsyncPlayerChatEvent event) { - event.setFormat("§eLokal §r"+ event.getPlayer().getDisplayName() + "§8»§7 %2$s"); + event.setCancelled(true); + Core.MESSAGE.broadcastPrefixless("LOCAL_CHAT", event.getPlayer().getDisplayName(), event.getMessage()); } }