geforkt von SteamWar/BungeeCore
Untested tablist name handling
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
790d37300e
Commit
055aaa2aca
@ -23,6 +23,8 @@ public class PacketIdManager {
|
|||||||
|
|
||||||
//0x0(X) Standalone Packets
|
//0x0(X) Standalone Packets
|
||||||
public final static byte PING_PACKET = 0x01;
|
public final static byte PING_PACKET = 0x01;
|
||||||
|
public final static byte TABLIST_NAME = 0x02;
|
||||||
|
|
||||||
//0x1(X) Bungee Inventory
|
//0x1(X) Bungee Inventory
|
||||||
public final static byte INVENTORY_PACKET = 0x10;
|
public final static byte INVENTORY_PACKET = 0x10;
|
||||||
public final static byte INVENTORY_CALLBACK_PACKET = 0x11;
|
public final static byte INVENTORY_CALLBACK_PACKET = 0x11;
|
||||||
|
@ -22,6 +22,7 @@ package de.steamwar.bungeecore.comms;
|
|||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
import de.steamwar.bungeecore.comms.handlers.InventoryCallbackHandler;
|
import de.steamwar.bungeecore.comms.handlers.InventoryCallbackHandler;
|
||||||
|
import de.steamwar.bungeecore.comms.handlers.TablistNameHandler;
|
||||||
import de.steamwar.bungeecore.listeners.BasicListener;
|
import de.steamwar.bungeecore.listeners.BasicListener;
|
||||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
@ -53,5 +54,6 @@ public class SpigotReceiver extends BasicListener {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
registerHandler(PacketIdManager.INVENTORY_CALLBACK_PACKET, new InventoryCallbackHandler());
|
registerHandler(PacketIdManager.INVENTORY_CALLBACK_PACKET, new InventoryCallbackHandler());
|
||||||
|
registerHandler(PacketIdManager.TABLIST_NAME, new TablistNameHandler());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
src/de/steamwar/bungeecore/comms/handlers/TablistNameHandler.java
Normale Datei
21
src/de/steamwar/bungeecore/comms/handlers/TablistNameHandler.java
Normale Datei
@ -0,0 +1,21 @@
|
|||||||
|
package de.steamwar.bungeecore.comms.handlers;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
import de.steamwar.bungeecore.Subserver;
|
||||||
|
import de.steamwar.bungeecore.comms.SpigotHandler;
|
||||||
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
|
||||||
|
public class TablistNameHandler implements SpigotHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(ByteArrayDataInput byteArrayDataInput) {
|
||||||
|
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(
|
||||||
|
SteamwarUser.get(
|
||||||
|
byteArrayDataInput.readInt()
|
||||||
|
).getUuid()
|
||||||
|
);
|
||||||
|
Subserver.getSubserver(player).getTablistNames().set(player, byteArrayDataInput.readUTF());
|
||||||
|
}
|
||||||
|
}
|
@ -196,6 +196,10 @@ public class TablistManager extends BasicListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getTablistName(ProxiedPlayer p, boolean sameServer) {
|
private String getTablistName(ProxiedPlayer p, boolean sameServer) {
|
||||||
|
String tablistName = Subserver.getSubserver(p).getTablistNames().get(p);
|
||||||
|
if(tablistName != null)
|
||||||
|
return tablistName;
|
||||||
|
|
||||||
StringBuilder st = new StringBuilder();
|
StringBuilder st = new StringBuilder();
|
||||||
if (p.hasPermission("bungeecore.group.admin")) st.append("§4");
|
if (p.hasPermission("bungeecore.group.admin")) st.append("§4");
|
||||||
else if (p.hasPermission("bungeecore.group.developer")) st.append("§3");
|
else if (p.hasPermission("bungeecore.group.developer")) st.append("§3");
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren