geforkt von Mirrors/Paper
#1067: Add preview chat option in ServerListPingEvent
By: Doc <nachito94@msn.com>
Dieser Commit ist enthalten in:
Ursprung
63d419d302
Commit
40a58283ca
@ -4,7 +4,7 @@
|
||||
MinecraftServer minecraftserver = this.serverConnectionListener.getServer();
|
||||
int i = bytebuf.readableBytes();
|
||||
String s;
|
||||
+ org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(minecraftserver.server, inetsocketaddress.getAddress(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); // CraftBukkit
|
||||
+ org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(minecraftserver.server, inetsocketaddress.getAddress(), minecraftserver.getMotd(), minecraftserver.previewsChat(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); // CraftBukkit
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
|
@ -19,7 +19,7 @@
|
||||
public class PacketStatusListener implements PacketStatusInListener {
|
||||
|
||||
private static final IChatBaseComponent DISCONNECT_REASON = IChatBaseComponent.translatable("multiplayer.status.request_handled");
|
||||
@@ -35,7 +47,102 @@
|
||||
@@ -35,7 +47,103 @@
|
||||
this.connection.disconnect(PacketStatusListener.DISCONNECT_REASON);
|
||||
} else {
|
||||
this.hasRequestedStatus = true;
|
||||
@ -32,7 +32,7 @@
|
||||
+ CraftIconCache icon = server.server.getServerIcon();
|
||||
+
|
||||
+ ServerListPingEvent() {
|
||||
+ super(((InetSocketAddress) connection.getRemoteAddress()).getAddress(), server.getMotd(), server.getPlayerList().getMaxPlayers());
|
||||
+ super(((InetSocketAddress) connection.getRemoteAddress()).getAddress(), server.getMotd(), server.previewsChat(), server.getPlayerList().getMaxPlayers());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -112,6 +112,7 @@
|
||||
+ }
|
||||
+
|
||||
+ ServerPing ping = new ServerPing();
|
||||
+ ping.setPreviewsChat(event.shouldSendChatPreviews());
|
||||
+ ping.setFavicon(event.icon.value);
|
||||
+ ping.setDescription(CraftChatMessage.fromString(event.getMotd(), true)[0]);
|
||||
+ ping.setPlayers(playerSample);
|
||||
|
@ -834,8 +834,8 @@ public class CraftEventFactory {
|
||||
/**
|
||||
* Server methods
|
||||
*/
|
||||
public static ServerListPingEvent callServerListPingEvent(Server craftServer, InetAddress address, String motd, int numPlayers, int maxPlayers) {
|
||||
ServerListPingEvent event = new ServerListPingEvent(address, motd, numPlayers, maxPlayers);
|
||||
public static ServerListPingEvent callServerListPingEvent(Server craftServer, InetAddress address, String motd, boolean shouldSendChatPreviews, int numPlayers, int maxPlayers) {
|
||||
ServerListPingEvent event = new ServerListPingEvent(address, motd, shouldSendChatPreviews, numPlayers, maxPlayers);
|
||||
craftServer.getPluginManager().callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren