SteamWar/BungeeCore
Archiviert
13
2

Speed BrandListener up
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-04-26 19:58:11 +02:00
Ursprung 34757566d3
Commit d6c82e923f

Datei anzeigen

@ -19,7 +19,6 @@
package de.steamwar.bungeecore.listeners; package de.steamwar.bungeecore.listeners;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.messages.ChatSender; import de.steamwar.messages.ChatSender;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufAllocator;
@ -37,16 +36,11 @@ public class BrandListener extends BasicListener {
return; return;
} }
if(event.getReceiver().getAddress().getHostName().contains("localhost")) {
return;
}
if (!(event.getReceiver() instanceof ProxiedPlayer)) { if (!(event.getReceiver() instanceof ProxiedPlayer)) {
return; return;
} }
event.setCancelled(true); event.setCancelled(true);
ProxyServer.getInstance().getScheduler().runAsync(BungeeCore.get(), () -> {
ProxiedPlayer player = (ProxiedPlayer) event.getReceiver(); ProxiedPlayer player = (ProxiedPlayer) event.getReceiver();
String brandString = ChatSender.of(player).parseToLegacy("STEAMWAR_BRAND", ProxyServer.getInstance().getName(), player.getServer().getInfo().getName(), new String(event.getData(), 1, event.getData().length - 1)); String brandString = ChatSender.of(player).parseToLegacy("STEAMWAR_BRAND", ProxyServer.getInstance().getName(), player.getServer().getInfo().getName(), new String(event.getData(), 1, event.getData().length - 1));
@ -54,6 +48,5 @@ public class BrandListener extends BasicListener {
DefinedPacket.writeString(brandString, brand); DefinedPacket.writeString(brandString, brand);
player.sendData(event.getTag(), DefinedPacket.toArray(brand)); player.sendData(event.getTag(), DefinedPacket.toArray(brand));
brand.release(); brand.release();
});
} }
} }