From c750231b144a1bc7bef675766105cae7b1251e41 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 26 Jun 2021 11:13:01 +0200 Subject: [PATCH] Add + to Local Chat --- .../bungeecore/listeners/ChatListener.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/ChatListener.java b/src/de/steamwar/bungeecore/listeners/ChatListener.java index b41ea78f..9fd80619 100644 --- a/src/de/steamwar/bungeecore/listeners/ChatListener.java +++ b/src/de/steamwar/bungeecore/listeners/ChatListener.java @@ -19,10 +19,7 @@ package de.steamwar.bungeecore.listeners; -import de.steamwar.bungeecore.BungeeCore; -import de.steamwar.bungeecore.Message; -import de.steamwar.bungeecore.Servertype; -import de.steamwar.bungeecore.Subserver; +import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.commands.BauCommand; import de.steamwar.bungeecore.commands.TpCommand; import de.steamwar.bungeecore.comms.packets.PingPacket; @@ -51,6 +48,8 @@ public class ChatListener extends BasicListener { sanitize7(e); if(e.getMessage().startsWith("/")) onCommand(e); + else if(e.getMessage().startsWith("+")) + onPlusMessage(e); else onChat(e); } @@ -116,6 +115,21 @@ public class ChatListener extends BasicListener { scheduler.schedule(BungeeCore.get(), () -> Message.sendPrefixless("MSG_FORMAT", sender, "YoyoNow", sender.getDisplayName(), Message.parse("CHAT_YOYONOW_4", sender)), 12, TimeUnit.SECONDS); } + private void onPlusMessage(ChatEvent e) { + ProxiedPlayer p = (ProxiedPlayer) e.getSender(); + Subserver subserver = Subserver.getSubserver(p); + if(/*subserver instanceof Bauserver*/true) { + String[] smolArgs = e.getMessage().split(" "); + String[] args = new String[smolArgs.length + 1]; + smolArgs[0] = smolArgs[0].substring(1); + args[0] = ""; + System.arraycopy(smolArgs, 0, args, 1, smolArgs.length); + localChat(e, args); + } else { + onChat(e); + } + } + private void onChat(ChatEvent e){ if(e.getSender() instanceof ProxiedPlayer){ ProxiedPlayer sender = (ProxiedPlayer) e.getSender();