Archiviert
1
0

Add + to Local Chat

Dieser Commit ist enthalten in:
Chaoscaot 2021-06-26 11:13:01 +02:00
Ursprung deabc7d68d
Commit c750231b14

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,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); 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){ 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();