73 Zeilen
3.6 KiB
Diff
73 Zeilen
3.6 KiB
Diff
|
Index: src/main/java/net/minecraft/server/PacketStatusListener.java
|
||
|
IDEA additional info:
|
||
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||
|
<+>UTF-8
|
||
|
===================================================================
|
||
|
diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java
|
||
|
--- a/src/main/java/net/minecraft/server/PacketStatusListener.java (revision 5cf5c067682a57920cd0b0115fd232f5f55d756c)
|
||
|
+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java (date 1620029771989)
|
||
|
@@ -4,8 +4,10 @@
|
||
|
import com.mojang.authlib.GameProfile;
|
||
|
import io.netty.channel.ChannelFutureListener;
|
||
|
import java.net.InetSocketAddress;
|
||
|
+import java.util.Arrays;
|
||
|
import java.util.Iterator;
|
||
|
|
||
|
+import java.util.Objects;
|
||
|
import org.bukkit.craftbukkit.util.CraftIconCache;
|
||
|
import org.bukkit.entity.Player;
|
||
|
|
||
|
@@ -68,9 +70,8 @@
|
||
|
if (player != null) {
|
||
|
return true;
|
||
|
}
|
||
|
- final Object[] currentPlayers = players;
|
||
|
- for (int length = currentPlayers.length, i = this.i; i < length; i++) {
|
||
|
- final EntityPlayer player = (EntityPlayer) currentPlayers[i];
|
||
|
+ for (int length = players.length, i = this.i; i < length; i++) {
|
||
|
+ final EntityPlayer player = (EntityPlayer) players[i];
|
||
|
if (player != null) {
|
||
|
this.i = i + 1;
|
||
|
this.player = player;
|
||
|
@@ -93,12 +94,11 @@
|
||
|
|
||
|
@Override
|
||
|
public void remove() {
|
||
|
- final Object[] currentPlayers = players;
|
||
|
final int i = this.ret;
|
||
|
- if (i < 0 || currentPlayers[i] == null) {
|
||
|
+ if (i < 0 || players[i] == null) {
|
||
|
throw new IllegalStateException();
|
||
|
}
|
||
|
- currentPlayers[i] = null;
|
||
|
+ players[i] = null;
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
@@ -107,6 +107,7 @@
|
||
|
ServerListPingEvent event = new ServerListPingEvent();
|
||
|
this.minecraftServer.server.getPluginManager().callEvent(event);
|
||
|
|
||
|
+ /*
|
||
|
java.util.List<GameProfile> profiles = new java.util.ArrayList<GameProfile>(players.length);
|
||
|
for (Object player : players) {
|
||
|
if (player != null) {
|
||
|
@@ -123,13 +124,15 @@
|
||
|
}
|
||
|
// Spigot End
|
||
|
playerSample.a(profiles.toArray(new GameProfile[profiles.size()]));
|
||
|
+ */
|
||
|
+
|
||
|
+ ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), (int) Arrays.stream(players).filter(Objects::nonNull).count());
|
||
|
|
||
|
ServerPing ping = new ServerPing();
|
||
|
ping.setFavicon(event.icon.value);
|
||
|
ping.setMOTD(new ChatComponentText(event.getMotd()));
|
||
|
ping.setPlayerSample(playerSample);
|
||
|
- int version = SharedConstants.getGameVersion().getProtocolVersion();
|
||
|
- ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version));
|
||
|
+ ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), SharedConstants.getGameVersion().getProtocolVersion()));
|
||
|
|
||
|
this.networkManager.sendPacket(new PacketStatusOutServerInfo(ping));
|
||
|
}
|