Archiviert
1
0

Merge pull request 'Plus Local Chat' (#225) from plus_local_chat into master

Reviewed-on: SteamWar/BungeeCore#225
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
YoyoNow 2021-07-12 09:20:46 +02:00
Commit 6b8c4ab561

Datei anzeigen

@ -19,10 +19,7 @@
package de.steamwar.bungeecore.listeners; package de.steamwar.bungeecore.listeners;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.Servertype;
import de.steamwar.bungeecore.Subserver;
import de.steamwar.bungeecore.commands.BauCommand; import de.steamwar.bungeecore.commands.BauCommand;
import de.steamwar.bungeecore.commands.TpCommand; import de.steamwar.bungeecore.commands.TpCommand;
import de.steamwar.bungeecore.comms.packets.PingPacket; import de.steamwar.bungeecore.comms.packets.PingPacket;
@ -51,6 +48,8 @@ public class ChatListener extends BasicListener {
sanitize7(e); sanitize7(e);
if(e.getMessage().startsWith("/")) if(e.getMessage().startsWith("/"))
onCommand(e); onCommand(e);
else if(e.getMessage().startsWith("+"))
onPlusMessage(e);
else else
onChat(e); onChat(e);
} }
@ -116,6 +115,20 @@ 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); 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) {
String[] smolArgs = e.getMessage().substring(1).split(" ");
String[] args = new String[smolArgs.length + 1];
args[0] = "";
System.arraycopy(smolArgs, 0, args, 1, smolArgs.length);
localChat(e, args);
} else {
onChat(e);
}
}
private void onChat(ChatEvent e){ private void onChat(ChatEvent e){
if(e.getSender() instanceof ProxiedPlayer){ if(e.getSender() instanceof ProxiedPlayer){
ProxiedPlayer sender = (ProxiedPlayer) e.getSender(); ProxiedPlayer sender = (ProxiedPlayer) e.getSender();