Add extended PaperServerListPingEvent (#980)

* Drop original implementation for old player sample API

* Add extended PaperServerListPingEvent

Add a new event that extends the original ServerListPingEvent
and allows full control of the response sent to the client.

* Implement deprecated player sample API
This commit is contained in:
Minecrell 2018-03-23 04:19:59 +01:00 committed by Daniel Ennis
parent 3f4fa0e839
commit e15167251b
59 changed files with 927 additions and 185 deletions

View File

@ -0,0 +1,370 @@
From 8614ecd3ac7244618cab3302a3c2f28105276966 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Wed, 11 Oct 2017 15:55:38 +0200
Subject: [PATCH] Add extended PaperServerListPingEvent
Add a new event that extends the original ServerListPingEvent
and allows full control of the response sent to the client.
diff --git a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
new file mode 100644
index 00000000..dd1deafd
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
@@ -0,0 +1,319 @@
+package com.destroystokyo.paper.event.server;
+
+import static java.util.Objects.requireNonNull;
+
+import com.destroystokyo.paper.network.StatusClient;
+import com.destroystokyo.paper.profile.PlayerProfile;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.server.ServerListPingEvent;
+import org.bukkit.util.CachedServerIcon;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.UUID;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+/**
+ * Extended version of {@link ServerListPingEvent} that allows full control
+ * of the response sent to the client.
+ */
+public class PaperServerListPingEvent extends ServerListPingEvent implements Cancellable {
+
+ @Nonnull private final StatusClient client;
+
+ private int numPlayers;
+ private boolean hidePlayers;
+ @Nonnull private final List<PlayerProfile> playerSample = new ArrayList<>();
+
+ @Nonnull private String version;
+ private int protocolVersion;
+
+ @Nullable private CachedServerIcon favicon;
+
+ private boolean cancelled;
+
+ private boolean originalPlayerCount = true;
+ private Object[] players;
+
+ public PaperServerListPingEvent(@Nonnull StatusClient client, String motd, int numPlayers, int maxPlayers,
+ @Nonnull String version, int protocolVersion, @Nullable CachedServerIcon favicon) {
+ super(client.getAddress().getAddress(), motd, numPlayers, maxPlayers);
+ this.client = client;
+ this.numPlayers = numPlayers;
+ this.version = version;
+ this.protocolVersion = protocolVersion;
+ setServerIcon(favicon);
+ }
+
+ /**
+ * Returns the {@link StatusClient} pinging the server.
+ *
+ * @return The client
+ */
+ @Nonnull
+ public StatusClient getClient() {
+ return this.client;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>Returns {@code -1} if players are hidden using
+ * {@link #shouldHidePlayers()}.</p>
+ */
+ @Override
+ public int getNumPlayers() {
+ if (this.hidePlayers) {
+ return -1;
+ }
+
+ return this.numPlayers;
+ }
+
+ /**
+ * Sets the number of players displayed in the server list.
+ *
+ * <p>Note that this won't have any effect if {@link #shouldHidePlayers()}
+ * is enabled.</p>
+ *
+ * @param numPlayers The number of online players
+ */
+ public void setNumPlayers(int numPlayers) {
+ if (this.numPlayers != numPlayers) {
+ this.numPlayers = numPlayers;
+ this.originalPlayerCount = false;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>Returns {@code -1} if players are hidden using
+ * {@link #shouldHidePlayers()}.</p>
+ */
+ @Override
+ public int getMaxPlayers() {
+ if (this.hidePlayers) {
+ return -1;
+ }
+
+ return super.getMaxPlayers();
+ }
+
+ /**
+ * Returns whether all player related information is hidden in the server
+ * list. This will cause {@link #getNumPlayers()}, {@link #getMaxPlayers()}
+ * and {@link #getPlayerSample()} to be skipped in the response.
+ *
+ * <p>The Vanilla Minecraft client will display the player count as {@code ???}
+ * when this option is enabled.</p>
+ *
+ * @return {@code true} if the player count is hidden
+ */
+ public boolean shouldHidePlayers() {
+ return hidePlayers;
+ }
+
+ /**
+ * Sets whether all player related information is hidden in the server
+ * list. This will cause {@link #getNumPlayers()}, {@link #getMaxPlayers()}
+ * and {@link #getPlayerSample()} to be skipped in the response.
+ *
+ * <p>The Vanilla Minecraft client will display the player count as {@code ???}
+ * when this option is enabled.</p>
+ *
+ * @param hidePlayers {@code true} if the player count should be hidden
+ */
+ public void setHidePlayers(boolean hidePlayers) {
+ this.hidePlayers = hidePlayers;
+ }
+
+ /**
+ * Returns a mutable list of {@link PlayerProfile} that will be displayed
+ * as online players on the client.
+ *
+ * <p>The Vanilla Minecraft client will display them when hovering the
+ * player count with the mouse.</p>
+ *
+ * @return The mutable player sample list
+ */
+ @Nonnull
+ public List<PlayerProfile> getPlayerSample() {
+ return this.playerSample;
+ }
+
+ /**
+ * Returns the version that will be sent as server version on the client.
+ *
+ * @return The server version
+ */
+ @Nonnull
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Sets the version that will be sent as server version to the client.
+ *
+ * @param version The server version
+ */
+ public void setVersion(@Nonnull String version) {
+ this.version = requireNonNull(version, "version");
+ }
+
+ /**
+ * Returns the protocol version that will be sent as the protocol version
+ * of the server to the client.
+ *
+ * @return The protocol version of the server
+ */
+ public int getProtocolVersion() {
+ return protocolVersion;
+ }
+
+ /**
+ * Sets the protocol version that will be sent as the protocol version
+ * of the server to the client.
+ *
+ * @param protocolVersion The protocol version of the server
+ */
+ public void setProtocolVersion(int protocolVersion) {
+ this.protocolVersion = protocolVersion;
+ }
+
+ /**
+ * Gets the server icon sent to the client.
+ *
+ * @return The icon to send to the client, or {@code null} for none
+ */
+ @Nullable
+ public CachedServerIcon getServerIcon() {
+ return this.favicon;
+ }
+
+ /**
+ * Sets the server icon sent to the client.
+ *
+ * @param icon The icon to send to the client, or {@code null} for none
+ */
+ @Override
+ public void setServerIcon(@Nullable CachedServerIcon icon) {
+ if (icon != null && icon.isEmpty()) {
+ // Represent empty icons as null
+ icon = null;
+ }
+
+ this.favicon = icon;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>Cancelling this event will cause the connection to be closed immediately,
+ * without sending a response to the client.</p>
+ */
+ @Override
+ public boolean isCancelled() {
+ return this.cancelled;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>Cancelling this event will cause the connection to be closed immediately,
+ * without sending a response to the client.</p>
+ */
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p><b>Note:</b> For compatibility reasons, this method will return all
+ * online players, not just the ones referenced in {@link #getPlayerSample()}.
+ * Removing a player will:</p>
+ *
+ * <ul>
+ * <li>Decrement the online player count (if and only if) the player
+ * count wasn't changed by another plugin before.</li>
+ * <li>Remove all entries from {@link #getPlayerSample()} that refer to
+ * the removed player (based on their {@link UUID}).</li>
+ * </ul>
+ */
+ @Nonnull
+ @Override
+ public Iterator<Player> iterator() {
+ if (this.players == null) {
+ this.players = getOnlinePlayers();
+ }
+
+ return new PlayerIterator();
+ }
+
+ protected Object[] getOnlinePlayers() {
+ return Bukkit.getOnlinePlayers().toArray();
+ }
+
+ protected Player getBukkitPlayer(Object player) {
+ return (Player) player;
+ }
+
+ private final class PlayerIterator implements Iterator<Player> {
+
+ private int next;
+ private int current;
+ @Nullable private Player player;
+
+ @Override
+ public boolean hasNext() {
+ for (; this.next < players.length; this.next++) {
+ if (players[this.next] != null) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public Player next() {
+ if (!hasNext()) {
+ this.player = null;
+ throw new NoSuchElementException();
+ }
+
+ this.current = this.next++;
+ return this.player = getBukkitPlayer(players[this.current]);
+ }
+
+ @Override
+ public void remove() {
+ if (this.player == null) {
+ throw new IllegalStateException();
+ }
+
+ UUID uniqueId = this.player.getUniqueId();
+ this.player = null;
+
+ // Remove player from iterator
+ players[this.current] = null;
+
+ // Remove player from sample
+ getPlayerSample().removeIf(p -> uniqueId.equals(p.getId()));
+
+ // Decrement player count
+ if (originalPlayerCount) {
+ numPlayers--;
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/com/destroystokyo/paper/network/StatusClient.java b/src/main/java/com/destroystokyo/paper/network/StatusClient.java
new file mode 100644
index 00000000..517d1523
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/StatusClient.java
@@ -0,0 +1,13 @@
+package com.destroystokyo.paper.network;
+
+import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
+
+/**
+ * Represents a client requesting the current status from the server (e.g. from
+ * the server list).
+ *
+ * @see PaperServerListPingEvent
+ */
+public interface StatusClient extends NetworkClient {
+
+}
diff --git a/src/main/java/org/bukkit/util/CachedServerIcon.java b/src/main/java/org/bukkit/util/CachedServerIcon.java
index 04804706..44563482 100644
--- a/src/main/java/org/bukkit/util/CachedServerIcon.java
+++ b/src/main/java/org/bukkit/util/CachedServerIcon.java
@@ -14,4 +14,10 @@ import org.bukkit.event.server.ServerListPingEvent;
*/
public interface CachedServerIcon {
public String getData(); // Spigot
+
+ // Paper start
+ default boolean isEmpty() {
+ return getData() == null;
+ }
+ // Paper end
}
--
2.16.1

View File

@ -0,0 +1,78 @@
From 9ed51547f8f2474fdda8cfd6178dcaa7b301dc0a Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Mon, 27 Nov 2017 16:21:19 +0100
Subject: [PATCH] Implement deprecated player sample API
diff --git a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
index a6576f99..41899698 100644
--- a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
+++ b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
@@ -4,6 +4,8 @@ import static java.util.Objects.requireNonNull;
import com.destroystokyo.paper.network.StatusClient;
import com.destroystokyo.paper.profile.PlayerProfile;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableList;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
@@ -316,4 +318,25 @@ public class PaperServerListPingEvent extends ServerListPingEvent implements Can
}
}
+ // TODO: Remove in 1.13
+
+ @Override
+ @Deprecated
+ public List<String> getSampleText() {
+ ImmutableList.Builder<String> sampleText = ImmutableList.builder();
+ for (PlayerProfile profile : getPlayerSample()) {
+ sampleText.add(Strings.nullToEmpty(profile.getName()));
+ }
+ return sampleText.build();
+ }
+
+ @Override
+ @Deprecated
+ public void setSampleText(List<String> sample) {
+ getPlayerSample().clear();
+ for (String name : sample) {
+ getPlayerSample().add(Bukkit.createProfile(name));
+ }
+ }
+
}
diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
index cb8d0fcd..116d7c7a 100644
--- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
@@ -4,6 +4,7 @@ import java.net.InetAddress;
import java.util.Iterator;
import java.util.List;
+import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
import org.apache.commons.lang.Validate;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
@@ -151,7 +152,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
private java.util.List<String> sample;
/**
- * @deprecated Will be replaced in 1.13
+ * @deprecated Will be removed in 1.13, use {@link PaperServerListPingEvent#getPlayerSample()}
*/
@Deprecated
public void setSampleText(java.util.List<String> sample) {
@@ -159,7 +160,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
}
/**
- * @deprecated Will be replaced in 1.13
+ * @deprecated Will be removed in 1.13, use {@link PaperServerListPingEvent#getPlayerSample()}
*/
@Deprecated
public java.util.List<String> getSampleText() {
--
2.16.1

View File

@ -1,11 +1,11 @@
From de28e5dbfe736bdec1a553e02b88ee1e682de92a Mon Sep 17 00:00:00 2001 From f8cbb3244bba6213d2646df4e2fcae3cee918afb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 30 Mar 2016 19:36:20 -0400 Date: Wed, 30 Mar 2016 19:36:20 -0400
Subject: [PATCH] MC Dev fixes Subject: [PATCH] MC Dev fixes
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
index d4f41274..d55e180d 100644 index d4f412742..d55e180d7 100644
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
@@ -89,7 +89,7 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> { @@ -89,7 +89,7 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
@ -18,7 +18,7 @@ index d4f41274..d55e180d 100644
} }
} }
diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java
index 62a9c92f..1b759976 100644 index 62a9c92f8..1b7599769 100644
--- a/src/main/java/net/minecraft/server/BiomeBase.java --- a/src/main/java/net/minecraft/server/BiomeBase.java
+++ b/src/main/java/net/minecraft/server/BiomeBase.java +++ b/src/main/java/net/minecraft/server/BiomeBase.java
@@ -46,7 +46,7 @@ public abstract class BiomeBase { @@ -46,7 +46,7 @@ public abstract class BiomeBase {
@ -31,7 +31,7 @@ index 62a9c92f..1b759976 100644
@Nullable @Nullable
diff --git a/src/main/java/net/minecraft/server/CommandAbstract.java b/src/main/java/net/minecraft/server/CommandAbstract.java diff --git a/src/main/java/net/minecraft/server/CommandAbstract.java b/src/main/java/net/minecraft/server/CommandAbstract.java
index 76bf04f5..a99d0f87 100644 index 76bf04f56..a99d0f870 100644
--- a/src/main/java/net/minecraft/server/CommandAbstract.java --- a/src/main/java/net/minecraft/server/CommandAbstract.java
+++ b/src/main/java/net/minecraft/server/CommandAbstract.java +++ b/src/main/java/net/minecraft/server/CommandAbstract.java
@@ -231,7 +231,7 @@ public abstract class CommandAbstract implements ICommand { @@ -231,7 +231,7 @@ public abstract class CommandAbstract implements ICommand {
@ -71,7 +71,7 @@ index 76bf04f5..a99d0f87 100644
} }
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index 77b81a57..ba461ad4 100644 index 77b81a575..ba461ad48 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java --- a/src/main/java/net/minecraft/server/EntityTypes.java
+++ b/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java
@@ -34,7 +34,7 @@ public class EntityTypes { @@ -34,7 +34,7 @@ public class EntityTypes {
@ -93,7 +93,7 @@ index 77b81a57..ba461ad4 100644
EntityTypes.g.set(i, s1); EntityTypes.g.set(i, s1);
diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java
index 58f47d0d..8860a012 100644 index 58f47d0de..8860a0129 100644
--- a/src/main/java/net/minecraft/server/RegistryBlockID.java --- a/src/main/java/net/minecraft/server/RegistryBlockID.java
+++ b/src/main/java/net/minecraft/server/RegistryBlockID.java +++ b/src/main/java/net/minecraft/server/RegistryBlockID.java
@@ -8,7 +8,7 @@ import java.util.Iterator; @@ -8,7 +8,7 @@ import java.util.Iterator;
@ -114,8 +114,114 @@ index 58f47d0d..8860a012 100644
} }
this.b.set(i, t0); this.b.set(i, t0);
diff --git a/src/main/java/net/minecraft/server/ServerPing.java b/src/main/java/net/minecraft/server/ServerPing.java
index 2179664a0..981582212 100644
--- a/src/main/java/net/minecraft/server/ServerPing.java
+++ b/src/main/java/net/minecraft/server/ServerPing.java
@@ -57,7 +57,8 @@ public class ServerPing {
public Serializer() {}
- public ServerPing a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ // Paper - decompile fix
+ public ServerPing deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
JsonObject jsonobject = ChatDeserializer.m(jsonelement, "status");
ServerPing serverping = new ServerPing();
@@ -80,7 +81,8 @@ public class ServerPing {
return serverping;
}
- public JsonElement a(ServerPing serverping, Type type, JsonSerializationContext jsonserializationcontext) {
+ // Paper - decompile fix
+ public JsonElement serialize(ServerPing serverping, Type type, JsonSerializationContext jsonserializationcontext) {
JsonObject jsonobject = new JsonObject();
if (serverping.a() != null) {
@@ -101,14 +103,6 @@ public class ServerPing {
return jsonobject;
}
-
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
- return this.a((ServerPing) object, type, jsonserializationcontext);
- }
-
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
- return this.a(jsonelement, type, jsondeserializationcontext);
- }
}
public static class ServerData {
@@ -133,27 +127,21 @@ public class ServerPing {
public Serializer() {}
- public ServerPing.ServerData a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ // Paper - decompile fix
+ public ServerPing.ServerData deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
JsonObject jsonobject = ChatDeserializer.m(jsonelement, "version");
return new ServerPing.ServerData(ChatDeserializer.h(jsonobject, "name"), ChatDeserializer.n(jsonobject, "protocol"));
}
- public JsonElement a(ServerPing.ServerData serverping_serverdata, Type type, JsonSerializationContext jsonserializationcontext) {
+ // Paper - decompile fix
+ public JsonElement serialize(ServerPing.ServerData serverping_serverdata, Type type, JsonSerializationContext jsonserializationcontext) {
JsonObject jsonobject = new JsonObject();
jsonobject.addProperty("name", serverping_serverdata.a());
jsonobject.addProperty("protocol", Integer.valueOf(serverping_serverdata.getProtocolVersion()));
return jsonobject;
}
-
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
- return this.a((ServerPing.ServerData) object, type, jsonserializationcontext);
- }
-
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
- return this.a(jsonelement, type, jsondeserializationcontext);
- }
}
}
@@ -188,7 +176,8 @@ public class ServerPing {
public Serializer() {}
- public ServerPing.ServerPingPlayerSample a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ // Paper - decompile fix
+ public ServerPing.ServerPingPlayerSample deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
JsonObject jsonobject = ChatDeserializer.m(jsonelement, "players");
ServerPing.ServerPingPlayerSample serverping_serverpingplayersample = new ServerPing.ServerPingPlayerSample(ChatDeserializer.n(jsonobject, "max"), ChatDeserializer.n(jsonobject, "online"));
@@ -212,7 +201,8 @@ public class ServerPing {
return serverping_serverpingplayersample;
}
- public JsonElement a(ServerPing.ServerPingPlayerSample serverping_serverpingplayersample, Type type, JsonSerializationContext jsonserializationcontext) {
+ // Paper - decompile fix
+ public JsonElement serialize(ServerPing.ServerPingPlayerSample serverping_serverpingplayersample, Type type, JsonSerializationContext jsonserializationcontext) {
JsonObject jsonobject = new JsonObject();
jsonobject.addProperty("max", Integer.valueOf(serverping_serverpingplayersample.a()));
@@ -234,14 +224,6 @@ public class ServerPing {
return jsonobject;
}
-
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
- return this.a((ServerPing.ServerPingPlayerSample) object, type, jsonserializationcontext);
- }
-
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
- return this.a(jsonelement, type, jsondeserializationcontext);
- }
}
}
}
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java
index f5bcbdbe..3190cadf 100644 index f5bcbdbe1..3190cadfc 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemFactoryTest.java
@@ -20,7 +20,7 @@ public class ItemFactoryTest extends AbstractTestingBase { @@ -20,7 +20,7 @@ public class ItemFactoryTest extends AbstractTestingBase {
@ -128,5 +234,5 @@ index f5bcbdbe..3190cadf 100644
for (ZipEntry clazzEntry; (clazzEntry = nmsZipStream.getNextEntry()) != null; ) { for (ZipEntry clazzEntry; (clazzEntry = nmsZipStream.getNextEntry()) != null; ) {
final String entryName = clazzEntry.getName(); final String entryName = clazzEntry.getName();
-- --
2.14.3 2.16.2

View File

@ -1,68 +0,0 @@
From 6fd4e6faec7bd63098f83384d6edec0341a85050 Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Fri, 5 May 2017 18:59:22 -0400
Subject: [PATCH] Allow Changing of Player Sample in ServerListPingEvent
diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java
index 313bb0007..45d6984f7 100644
--- a/src/main/java/net/minecraft/server/PacketStatusListener.java
+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java
@@ -5,6 +5,7 @@ import com.mojang.authlib.GameProfile;
import io.netty.channel.ChannelFutureListener;
import java.net.InetSocketAddress;
import java.util.Iterator;
+import java.util.UUID;
import org.bukkit.craftbukkit.util.CraftIconCache;
import org.bukkit.entity.Player;
@@ -97,23 +98,44 @@ public class PacketStatusListener implements PacketStatusInListener {
}
}
+ // Paper start
+ java.util.List<String> sample = new java.util.ArrayList<>(players.length);
+ for (Object player : players) {
+ if (player != null) sample.add(((EntityPlayer) player).getName());
+ }
+ if (!sample.isEmpty()) {
+ java.util.Collections.shuffle(sample);
+ sample = sample.subList(0, Math.min(sample.size(), org.spigotmc.SpigotConfig.playerSample));
+ }
+ // Paper end
+
ServerListPingEvent event = new ServerListPingEvent();
+ event.setSampleText(sample); // Paper
this.minecraftServer.server.getPluginManager().callEvent(event);
-
java.util.List<GameProfile> profiles = new java.util.ArrayList<GameProfile>(players.length);
+ // Paper start
+ if (event.getSampleText() != sample) sample = event.getSampleText();
+ sample.forEach(line -> profiles.add(new GameProfile(UUID.randomUUID(), line)));
+ /*
for (Object player : players) {
if (player != null) {
profiles.add(((EntityPlayer) player).getProfile());
}
}
+ */
+ // Paper end
- ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size());
+ ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), minecraftServer.getPlayerList().getPlayerCount()); // Paper
// Spigot Start
+ // Paper start - Move up
+ /*
if ( !profiles.isEmpty() )
{
java.util.Collections.shuffle( profiles ); // This sucks, its inefficient but we have no simple way of doing it differently
profiles = profiles.subList( 0, Math.min( profiles.size(), org.spigotmc.SpigotConfig.playerSample ) ); // Cap the sample to n (or less) displayed players, ie: Vanilla behaviour
}
+ */
+ // Paper end
// Spigot End
playerSample.a(profiles.toArray(new GameProfile[profiles.size()]));
--
2.16.1

View File

@ -1,4 +1,4 @@
From 28c130aba2b5bb09b6f5fb05bd3fd8f433f97e4f Mon Sep 17 00:00:00 2001 From efd42e114eb71c2be0d86ead30021912f824eeb6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sat, 10 Dec 2016 16:24:06 -0500 Date: Sat, 10 Dec 2016 16:24:06 -0500
Subject: [PATCH] Improve the Saddle API for Horses Subject: [PATCH] Improve the Saddle API for Horses
@ -61,5 +61,5 @@ index 000000000..99cfbaf90
+ +
+} +}
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 1c57bc166a4c5abdc981ac6b43a6763494ce0524 Mon Sep 17 00:00:00 2001 From fe7ce33993d440e9c76081fc200f7ec485585577 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 4 May 2016 22:43:12 -0400 Date: Wed, 4 May 2016 22:43:12 -0400
Subject: [PATCH] Implement ensureServerConversions API Subject: [PATCH] Implement ensureServerConversions API
@ -23,5 +23,5 @@ index 49ebad22e..eb6987338 100644
+ // Paper end + // Paper end
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 1148ed97aacf2627d0595c0b42b34c28dc80123f Mon Sep 17 00:00:00 2001 From 353af92aee149a9fa8da7be14063da43f482bbad Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 4 May 2016 23:59:38 -0400 Date: Wed, 4 May 2016 23:59:38 -0400
Subject: [PATCH] Implement getI18NDisplayName Subject: [PATCH] Implement getI18NDisplayName
@ -31,5 +31,5 @@ index eb6987338..c2f26577c 100644
// Paper end // Paper end
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 1e77f009173654cde9c436afbb9481b4c2e558a3 Mon Sep 17 00:00:00 2001 From 1704f540314c0ebee0050656bc2bfd1bfa5ca4f0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Thu, 27 Jul 2017 00:06:43 -0400 Date: Thu, 27 Jul 2017 00:06:43 -0400
Subject: [PATCH] GH-806: Respect saving disabled before unloading all chunks Subject: [PATCH] GH-806: Respect saving disabled before unloading all chunks
@ -22,5 +22,5 @@ index 0b10f1684..4af557321 100644
} }
} // Paper timing } // Paper timing
-- --
2.16.1 2.16.2

View File

@ -1,11 +1,11 @@
From 520cba43a16a37b21121f33a7dab1d515f249036 Mon Sep 17 00:00:00 2001 From 25e3e3866a671366fe108346b2276de967bd7974 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 3 Jul 2017 18:11:10 -0500 Date: Mon, 3 Jul 2017 18:11:10 -0500
Subject: [PATCH] ProfileWhitelistVerifyEvent Subject: [PATCH] ProfileWhitelistVerifyEvent
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 311c0b86f..06a5b6d02 100644 index 563b0fb12..d28838627 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java --- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -542,9 +542,9 @@ public abstract class PlayerList { @@ -542,9 +542,9 @@ public abstract class PlayerList {
@ -48,5 +48,5 @@ index 311c0b86f..06a5b6d02 100644
public boolean isOp(GameProfile gameprofile) { public boolean isOp(GameProfile gameprofile) {
return this.operators.d(gameprofile) || this.server.R() && this.server.worlds.get(0).getWorldData().u() && this.server.Q().equalsIgnoreCase(gameprofile.getName()) || this.u; // CraftBukkit return this.operators.d(gameprofile) || this.server.R() && this.server.worlds.get(0).getWorldData().u() && this.server.Q().equalsIgnoreCase(gameprofile.getName()) || this.u; // CraftBukkit
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 4f378a2e90a687b23096f2e62d281e77176b4298 Mon Sep 17 00:00:00 2001 From dd3e82914551cdfbe5cc5c1ade02d05278d7e31b Mon Sep 17 00:00:00 2001
From: DemonWav <demonwav@gmail.com> From: DemonWav <demonwav@gmail.com>
Date: Sun, 6 Aug 2017 17:17:53 -0500 Date: Sun, 6 Aug 2017 17:17:53 -0500
Subject: [PATCH] Fix this stupid bullshit Subject: [PATCH] Fix this stupid bullshit
@ -29,5 +29,5 @@ index d3d848f8c..21628e196 100644
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 86801091a4d5d93d6598509fe1f11f9cb198d62e Mon Sep 17 00:00:00 2001 From 403eb99cf2c74d9fee9fad03715624fa76997ea6 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com> From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 01:54:40 -0500 Date: Mon, 31 Jul 2017 01:54:40 -0500
Subject: [PATCH] Ocelot despawns should honor nametags and leash Subject: [PATCH] Ocelot despawns should honor nametags and leash
@ -18,5 +18,5 @@ index 5a76821ea..858bbef5b 100644
protected void initAttributes() { protected void initAttributes() {
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From f78d0fd199f662df9bf4295a04a473f0ac152b3e Mon Sep 17 00:00:00 2001 From 2d6f54549cc44458e18bb0c430ffa3528c0cee54 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com> From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 01:45:19 -0500 Date: Mon, 31 Jul 2017 01:45:19 -0500
Subject: [PATCH] Reset spawner timer when spawner event is cancelled Subject: [PATCH] Reset spawner timer when spawner event is cancelled
@ -28,5 +28,5 @@ index 1ed0def1e..87fe4775f 100644
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 5868a14449bc00fb1d1c5709425f34d6e06dc9ce Mon Sep 17 00:00:00 2001 From 6f6d06130c0008bff90b2008873ca6809fb803fc Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de> From: Brokkonaut <hannos17@gmx.de>
Date: Fri, 11 Aug 2017 03:29:26 +0200 Date: Fri, 11 Aug 2017 03:29:26 +0200
Subject: [PATCH] MC-94186 Fix dragon egg falling in lazy chunks Subject: [PATCH] MC-94186 Fix dragon egg falling in lazy chunks
@ -21,5 +21,5 @@ index ce186f825..291342c90 100644
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 0c11302422d14d2cc64b9ed3a16ada9be0ba95a5 Mon Sep 17 00:00:00 2001 From 44ca262d4f689d942d058797c586ffd4c99d4028 Mon Sep 17 00:00:00 2001
From: mezz <tehgeek@gmail.com> From: mezz <tehgeek@gmail.com>
Date: Wed, 9 Aug 2017 17:51:22 -0500 Date: Wed, 9 Aug 2017 17:51:22 -0500
Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike
@ -22,5 +22,5 @@ index b0139fff6..00513d02c 100644
this.tileEntityListUnload.clear(); this.tileEntityListUnload.clear();
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From e0ee9656360c7d8bd856a2eb60321b04d83241e7 Mon Sep 17 00:00:00 2001 From b4539bef0e0f7e9d88337f7e738f41906d939ab1 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc> From: kashike <kashike@vq.lc>
Date: Thu, 17 Aug 2017 16:08:20 -0700 Date: Thu, 17 Aug 2017 16:08:20 -0700
Subject: [PATCH] Allow specifying a custom "authentication servers down" kick Subject: [PATCH] Allow specifying a custom "authentication servers down" kick

View File

@ -1,4 +1,4 @@
From d05d7cc2a275ac2b40c6906f80350ceaf0e306f4 Mon Sep 17 00:00:00 2001 From a3a43308ff532e716ed9c416bc8c437b271e90cf Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com> From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 01:49:48 -0500 Date: Mon, 31 Jul 2017 01:49:48 -0500
Subject: [PATCH] LivingEntity#setKiller Subject: [PATCH] LivingEntity#setKiller
@ -26,5 +26,5 @@ index d4d51688c..a7b076377 100644
return addPotionEffect(effect, false); return addPotionEffect(effect, false);
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 8d120f57374eefc72809cd7bdfaa6d1909e7723b Mon Sep 17 00:00:00 2001 From 52613fd6e28b47b552e1a2118326de8c45160d46 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc> From: kashike <kashike@vq.lc>
Date: Mon, 18 Sep 2017 13:38:40 -0700 Date: Mon, 18 Sep 2017 13:38:40 -0700
Subject: [PATCH] Avoid NPE during CraftBlockEntityState load Subject: [PATCH] Avoid NPE during CraftBlockEntityState load
@ -38,5 +38,5 @@ index 266f87d7f..22dcaea72 100644
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 553c8b95deacada0571d9e4c8a00c696bbdfc782 Mon Sep 17 00:00:00 2001 From 3edbb5d38723f7afa16a794c46cc6d84bb83dcf4 Mon Sep 17 00:00:00 2001
From: stonar96 <minecraft.stonar96@gmail.com> From: stonar96 <minecraft.stonar96@gmail.com>
Date: Thu, 21 Sep 2017 00:38:47 +0200 Date: Thu, 21 Sep 2017 00:38:47 +0200
Subject: [PATCH] Anti-Xray Subject: [PATCH] Anti-Xray
@ -1579,5 +1579,5 @@ index 9942f0c75..2da6edc63 100644
} }
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 66c9cdfd056ed6789980d4cca7245efa0a8ad9ce Mon Sep 17 00:00:00 2001 From d3721c2c211d6a732466fe31e0aa31fcd9f6eb73 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net> From: Minecrell <minecrell@minecrell.net>
Date: Mon, 18 Sep 2017 12:00:03 +0200 Date: Mon, 18 Sep 2017 12:00:03 +0200
Subject: [PATCH] Use Log4j IOStreams to redirect System.out/err to logger Subject: [PATCH] Use Log4j IOStreams to redirect System.out/err to logger
@ -47,5 +47,5 @@ index b3f1aa999..854455711 100644
thread.setDaemon(true); thread.setDaemon(true);
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From e5dc209cabc90dbdc9824472d8888176fb1f9234 Mon Sep 17 00:00:00 2001 From 3b9137e60577cf746bd17a92387f490e5309bc49 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net> From: Minecrell <minecrell@minecrell.net>
Date: Thu, 21 Sep 2017 16:14:55 +0200 Date: Thu, 21 Sep 2017 16:14:55 +0200
Subject: [PATCH] Handle plugin prefixes using Log4J configuration Subject: [PATCH] Handle plugin prefixes using Log4J configuration
@ -70,5 +70,5 @@ index 08b6bb7f9..9f8334376 100644
<TimeBasedTriggeringPolicy /> <TimeBasedTriggeringPolicy />
<OnStartupTriggeringPolicy /> <OnStartupTriggeringPolicy />
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 378ceeb7f03f20c26db6e8a6b0249ad0b6a7e713 Mon Sep 17 00:00:00 2001 From 0de29dbddb249cb3b210935e18e4ed61e4caf1f0 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net> From: Minecrell <minecrell@minecrell.net>
Date: Thu, 21 Sep 2017 16:33:35 +0200 Date: Thu, 21 Sep 2017 16:33:35 +0200
Subject: [PATCH] Include Log4J2 SLF4J implementation Subject: [PATCH] Include Log4J2 SLF4J implementation

View File

@ -1,4 +1,4 @@
From 0685c29429ea9669da418dc14d7d0ff9817f29ad Mon Sep 17 00:00:00 2001 From 145ff25d57dec3f3a86e7afc1344c7532607bddc Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net> From: Minecrell <minecrell@minecrell.net>
Date: Sat, 23 Sep 2017 21:07:20 +0200 Date: Sat, 23 Sep 2017 21:07:20 +0200
Subject: [PATCH] Disable logger prefix for various plugins bypassing the Subject: [PATCH] Disable logger prefix for various plugins bypassing the
@ -35,5 +35,5 @@ index 9f8334376..6711e6dff 100644
</LoggerNamePatternSelector> </LoggerNamePatternSelector>
</PatternLayout> </PatternLayout>
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From ec9b9999f5abe31e1c8661e419d1e9fd6b747311 Mon Sep 17 00:00:00 2001 From c272a375273ed825e19202ba075bb8dd7dfd25c2 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 28 Sep 2017 17:21:44 -0400 Date: Thu, 28 Sep 2017 17:21:44 -0400
Subject: [PATCH] Add PlayerJumpEvent Subject: [PATCH] Add PlayerJumpEvent
@ -17,7 +17,7 @@ index deb0f4a9c..579996d1e 100644
super.cu(); super.cu();
this.b(StatisticList.w); this.b(StatisticList.w);
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 9c8828ebd..cc58a4a93 100644 index 3104fc0ea..aa57ff8ed 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -57,6 +57,7 @@ import org.bukkit.inventory.EquipmentSlot; @@ -57,6 +57,7 @@ import org.bukkit.inventory.EquipmentSlot;
@ -65,5 +65,5 @@ index 9c8828ebd..cc58a4a93 100644
this.player.move(EnumMoveType.PLAYER, d7, d8, d9); this.player.move(EnumMoveType.PLAYER, d7, d8, d9);
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 8739276298bf59af5c9a36049733aec513ce659e Mon Sep 17 00:00:00 2001 From 336d31b126a2d9cdc3cb53fbe1ef71af40c9da81 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com> From: Shane Freeder <theboyetronic@gmail.com>
Date: Thu, 5 Oct 2017 01:54:07 +0100 Date: Thu, 5 Oct 2017 01:54:07 +0100
Subject: [PATCH] handle PacketPlayInKeepAlive async Subject: [PATCH] handle PacketPlayInKeepAlive async
@ -15,7 +15,7 @@ also adding some additional logging in order to help work out what is causing
random disconnections for clients. random disconnections for clients.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index cc58a4a93..a92bf8967 100644 index aa57ff8ed..869a2b402 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2230,14 +2230,20 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -2230,14 +2230,20 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@ -42,5 +42,5 @@ index cc58a4a93..a92bf8967 100644
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From f8c2ab7e5d8fe885f51cf9f6311fcff36a125884 Mon Sep 17 00:00:00 2001 From 3d483cab8e7200988d72276aef4f6f56ec86a615 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net> From: Minecrell <minecrell@minecrell.net>
Date: Tue, 10 Oct 2017 18:45:20 +0200 Date: Tue, 10 Oct 2017 18:45:20 +0200
Subject: [PATCH] Expose client protocol version and virtual host Subject: [PATCH] Expose client protocol version and virtual host
@ -136,5 +136,5 @@ index 1269a02aa..428b208ae 100644
public double getEyeHeight(boolean ignorePose) { public double getEyeHeight(boolean ignorePose) {
if (ignorePose) { if (ignorePose) {
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 17fb64da01acd903a06fc671490a5f378e9b2d99 Mon Sep 17 00:00:00 2001 From c0932b4bd2689009449872c10b1ef7e8689b5f3f Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com> From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 15 Oct 2017 00:29:07 +0100 Date: Sun, 15 Oct 2017 00:29:07 +0100
Subject: [PATCH] revert serverside behavior of keepalives Subject: [PATCH] revert serverside behavior of keepalives
@ -17,7 +17,7 @@ from networking or during connections flood of chunk packets on slower clients,
at the cost of dead connections being kept open for longer. at the cost of dead connections being kept open for longer.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index a92bf8967..d0ab87d0f 100644 index 869a2b402..167e386c8 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -100,6 +100,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -100,6 +100,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@ -65,5 +65,5 @@ index a92bf8967..d0ab87d0f 100644
this.minecraftServer.methodProfiler.b(); this.minecraftServer.methodProfiler.b();
// CraftBukkit start // CraftBukkit start
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From bddc88554209cb2f0a14e9539f07da19fa11ad18 Mon Sep 17 00:00:00 2001 From de0e79d31274e5264ec0982b542429b843462c06 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de> From: Brokkonaut <hannos17@gmx.de>
Date: Fri, 20 Oct 2017 04:33:45 +0200 Date: Fri, 20 Oct 2017 04:33:45 +0200
Subject: [PATCH] Replace HashSet with fastutil's ObjectOpenHashSet in Subject: [PATCH] Replace HashSet with fastutil's ObjectOpenHashSet in
@ -26,5 +26,5 @@ index 80a5c29f3..cd864c404 100644
public HashTreeSet() { public HashTreeSet() {
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From d1969c3af9e747f85d2feb4a9b1ba58175c4980e Mon Sep 17 00:00:00 2001 From dc5e0bc19d3620712cf9b32b740cac0165e20960 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de> From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 31 Oct 2017 03:26:18 +0100 Date: Tue, 31 Oct 2017 03:26:18 +0100
Subject: [PATCH] Send attack SoundEffects only to players who can see the Subject: [PATCH] Send attack SoundEffects only to players who can see the
@ -89,5 +89,5 @@ index 592e5b3ba..d45cbf2f6 100644
for (int i = 0; i < this.u.size(); ++i) { for (int i = 0; i < this.u.size(); ++i) {
((IWorldAccess) this.u.get(i)).a(entityhuman, soundeffect, soundcategory, d0, d1, d2, f, f1); ((IWorldAccess) this.u.get(i)).a(entityhuman, soundeffect, soundcategory, d0, d1, d2, f, f1);
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From f92d7abd16d122577360574d18179ae2442a556c Mon Sep 17 00:00:00 2001 From a828e7d4f74282b4672b1d694de81afe9b12904a Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com> From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 10 Nov 2017 23:03:12 -0500 Date: Fri, 10 Nov 2017 23:03:12 -0500
Subject: [PATCH] Option for maximum exp value when merging orbs Subject: [PATCH] Option for maximum exp value when merging orbs
@ -56,5 +56,5 @@ index d45cbf2f6..0193364d2 100644
} // Spigot end } // Spigot end
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 2ae8791e2ee4b302d1878c24e8cc369d1d0e6c74 Mon Sep 17 00:00:00 2001 From d550c213879bcea6cf496830f8218b276fb64dba Mon Sep 17 00:00:00 2001
From: pkt77 <parkerkt77@gmail.com> From: pkt77 <parkerkt77@gmail.com>
Date: Fri, 10 Nov 2017 23:46:34 -0500 Date: Fri, 10 Nov 2017 23:46:34 -0500
Subject: [PATCH] Add PlayerArmorChangeEvent Subject: [PATCH] Add PlayerArmorChangeEvent
@ -42,5 +42,5 @@ index cdf3a3ba4..be5d0bf89 100644
return this.g; return this.g;
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From b9120a4c1f05660508e9dd62ea9eb01f01be3c79 Mon Sep 17 00:00:00 2001 From e7c2c2926920c0809361f62f0e454d6cc67569d0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sat, 11 Nov 2017 17:57:39 -0500 Date: Sat, 11 Nov 2017 17:57:39 -0500
Subject: [PATCH] Improve Structures Checking Subject: [PATCH] Improve Structures Checking
@ -195,5 +195,5 @@ index b6abc74e0..f9bb953d0 100644
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From ad2a0a4d78e9fda00fe73c30f7a662ec98770c80 Mon Sep 17 00:00:00 2001 From 05147fb3c8fbcf1a5044784c7d9ac9321ab8a143 Mon Sep 17 00:00:00 2001
From: killme <killme-git@ibts.me> From: killme <killme-git@ibts.me>
Date: Sun, 12 Nov 2017 19:40:01 +0100 Date: Sun, 12 Nov 2017 19:40:01 +0100
Subject: [PATCH] Prevent logins from being processed when the player has Subject: [PATCH] Prevent logins from being processed when the player has
@ -23,5 +23,5 @@ index 75df92836..eaac25dc3 100644
EntityPlayer entityplayer = this.server.getPlayerList().a(this.i.getId()); EntityPlayer entityplayer = this.server.getPlayerList().a(this.i.getId());
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 9ad5c79dafdeeaaa2a297f2f85e90d31c5fd4fd5 Mon Sep 17 00:00:00 2001 From 34a37e9c46c3c50ffbd9454c207761a17db79dc0 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com> From: Shane Freeder <theboyetronic@gmail.com>
Date: Thu, 16 Nov 2017 12:12:41 +0000 Date: Thu, 16 Nov 2017 12:12:41 +0000
Subject: [PATCH] use CB BlockState implementations for captured blocks Subject: [PATCH] use CB BlockState implementations for captured blocks
@ -32,5 +32,5 @@ index 0193364d2..e4502551b 100644
} }
// CraftBukkit end // CraftBukkit end
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 2cb703b80db3bf8c508bb4d02fc29575d1bfc3e2 Mon Sep 17 00:00:00 2001 From f95656f371344b14c743f297f282253e5ec114fa Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 6 Nov 2017 21:08:22 -0500 Date: Mon, 6 Nov 2017 21:08:22 -0500
Subject: [PATCH] API to get a BlockState without a snapshot Subject: [PATCH] API to get a BlockState without a snapshot
@ -101,5 +101,5 @@ index 22dcaea72..3b5a90c39 100644
// copy tile entity data: // copy tile entity data:
this.snapshot = this.createSnapshot(tileEntity); this.snapshot = this.createSnapshot(tileEntity);
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 68df71e092d912014c7cde5c7504e016474fdb65 Mon Sep 17 00:00:00 2001 From 64855ea7893dfa03167b3a6019050b312109cc7b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 26 Nov 2017 13:19:58 -0500 Date: Sun, 26 Nov 2017 13:19:58 -0500
Subject: [PATCH] AsyncTabCompleteEvent Subject: [PATCH] AsyncTabCompleteEvent
@ -14,7 +14,7 @@ completion, such as offline players.
Also adds isCommand and getLocation to the sync TabCompleteEvent Also adds isCommand and getLocation to the sync TabCompleteEvent
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index d0ab87d0f..ca054afcf 100644 index 167e386c8..3fbf51e52 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2276,24 +2276,51 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { @@ -2276,24 +2276,51 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
@ -80,7 +80,7 @@ index d0ab87d0f..ca054afcf 100644
public void a(PacketPlayInSettings packetplayinsettings) { public void a(PacketPlayInSettings packetplayinsettings) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index f0ae65f08..f01408d55 100644 index aca5ea7c0..090a4d2f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1643,8 +1643,8 @@ public final class CraftServer implements Server { @@ -1643,8 +1643,8 @@ public final class CraftServer implements Server {
@ -139,5 +139,5 @@ index 1e3aae3b8..95d13c146 100644
Waitable<List<String>> waitable = new Waitable<List<String>>() { Waitable<List<String>> waitable = new Waitable<List<String>>() {
@Override @Override
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 080f3de513fd1534aa3a9e5eb63741a854d9d2db Mon Sep 17 00:00:00 2001 From 501d5c54604d790979c421b8e848d7768a6756e9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 29 Nov 2017 22:18:54 -0500 Date: Wed, 29 Nov 2017 22:18:54 -0500
Subject: [PATCH] Avoid NPE in PathfinderGoalTempt Subject: [PATCH] Avoid NPE in PathfinderGoalTempt
@ -18,5 +18,5 @@ index 188825d19..8004f3a3f 100644
} }
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From b3b7b8219d2c9dfc059263f8f4980be57dabe687 Mon Sep 17 00:00:00 2001 From 7a024bd2fa7106faeee289d90f6b790a73f5aee6 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com> From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 18 Dec 2017 07:26:56 +0000 Date: Mon, 18 Dec 2017 07:26:56 +0000
Subject: [PATCH] Don't blindly send unlit chunks when lighting updates are Subject: [PATCH] Don't blindly send unlit chunks when lighting updates are
@ -44,5 +44,5 @@ index d1066d82e..001fca42a 100644
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From e262ae75abac4df6a511aa83fdd67c13f4e27357 Mon Sep 17 00:00:00 2001 From 0bd1877fce888d94bb2781c405f16329f51a57b7 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 22:02:53 -0500 Date: Tue, 19 Dec 2017 22:02:53 -0500
Subject: [PATCH] PlayerPickupExperienceEvent Subject: [PATCH] PlayerPickupExperienceEvent
@ -19,5 +19,5 @@ index d567ad4a5..ff5cc74ba 100644
entityhuman.receive(this, 1); entityhuman.receive(this, 1);
ItemStack itemstack = EnchantmentManager.b(Enchantments.C, (EntityLiving) entityhuman); ItemStack itemstack = EnchantmentManager.b(Enchantments.C, (EntityLiving) entityhuman);
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 74b2b4a7e674cff79b0521721ef07183b708aa4f Mon Sep 17 00:00:00 2001 From 300676cf7bbd8e89cb7ca9cf0b20ed259d144c6e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 22:57:26 -0500 Date: Tue, 19 Dec 2017 22:57:26 -0500
Subject: [PATCH] ExperienceOrbMergeEvent Subject: [PATCH] ExperienceOrbMergeEvent
@ -21,5 +21,5 @@ index e4502551b..9f5388ed9 100644
// Paper start // Paper start
if (!mergeUnconditionally && xp.value > maxValue) { if (!mergeUnconditionally && xp.value > maxValue) {
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 1d583f46df6cfbc3888496aeb092515d183a3ffe Mon Sep 17 00:00:00 2001 From 75ba076d78fd31338f40ec6843714bb9978a3cdf Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 20 Dec 2017 17:36:49 -0500 Date: Wed, 20 Dec 2017 17:36:49 -0500
Subject: [PATCH] Ability to apply mending to XP API Subject: [PATCH] Ability to apply mending to XP API

View File

@ -1,4 +1,4 @@
From 91700cb7ce8e0dd61fd844b85c1bd6984fbe2db4 Mon Sep 17 00:00:00 2001 From a0551028ff94e0db88c39c6f3c76137541fb0d58 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 1 Jan 2018 15:41:59 -0500 Date: Mon, 1 Jan 2018 15:41:59 -0500
Subject: [PATCH] Configurable Chunks Sends per Tick setting Subject: [PATCH] Configurable Chunks Sends per Tick setting
@ -39,5 +39,5 @@ index 4af557321..6ee9f6cfb 100644
Iterator iterator2 = this.g.iterator(); Iterator iterator2 = this.g.iterator();
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From f0e0f9c55243d1dd2478ed6cdc651a4fe2c2442d Mon Sep 17 00:00:00 2001 From ad4b9433cd1e5053f6fb2519c6099fa60b44f76d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 1 Jan 2018 16:10:24 -0500 Date: Mon, 1 Jan 2018 16:10:24 -0500
Subject: [PATCH] Configurable Max Chunk Gens per Tick Subject: [PATCH] Configurable Max Chunk Gens per Tick
@ -108,5 +108,5 @@ index 193c3621c..cf1258c55 100644
+ // Paper end + // Paper end
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From f7c13210387f0829c7f82425f45299fb13a37238 Mon Sep 17 00:00:00 2001 From 360c4600147704b64657ce9e37ca2dee7b1454b0 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 11 Jan 2018 16:47:28 -0600 Date: Thu, 11 Jan 2018 16:47:28 -0600
Subject: [PATCH] Make max squid spawn height configurable Subject: [PATCH] Make max squid spawn height configurable
@ -36,5 +36,5 @@ index 0ce16be65..58a902831 100644
public void b(float f, float f1, float f2) { public void b(float f, float f1, float f2) {
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 7d00eaca27f88fe73d52cb565085953013d89410 Mon Sep 17 00:00:00 2001 From 5b1782d302698f34d71ea00d4f112025a78bca1d Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:01:31 -0500 Date: Sun, 14 Jan 2018 17:01:31 -0500
Subject: [PATCH] PreCreatureSpawnEvent Subject: [PATCH] PreCreatureSpawnEvent
@ -87,5 +87,5 @@ index 2cd063829..e217d3340 100644
try { try {
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From ff7671025707830fb683200c9b85e26de979e6a7 Mon Sep 17 00:00:00 2001 From 477d4982ea2e5826f9c389b3b4e7dea231721745 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:36:02 -0500 Date: Sun, 14 Jan 2018 17:36:02 -0500
Subject: [PATCH] PlayerNaturallySpawnCreaturesEvent Subject: [PATCH] PlayerNaturallySpawnCreaturesEvent
@ -29,5 +29,5 @@ index e217d3340..46faa062d 100644
for (int i1 = -b0; i1 <= b0; ++i1) { for (int i1 = -b0; i1 <= b0; ++i1) {
for (k = -b0; k <= b0; ++k) { for (k = -b0; k <= b0; ++k) {
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 948ec83dcbd7090a8573021948ec2bc96feeb8ed Mon Sep 17 00:00:00 2001 From dc84dd3d43671fc1197e4e976eaca94cbc1e112f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Fri, 19 Jan 2018 00:36:25 -0500 Date: Fri, 19 Jan 2018 00:36:25 -0500
Subject: [PATCH] Add SkullMeta.setPlayerProfile API Subject: [PATCH] Add SkullMeta.setPlayerProfile API
@ -49,5 +49,5 @@ index e2ea49cd9..4855307b9 100644
public OfflinePlayer getOwningPlayer() { public OfflinePlayer getOwningPlayer() {
if (hasOwner()) { if (hasOwner()) {
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 4f8def8cb7fbe369bb6a0dc77d9bc923484e7435 Mon Sep 17 00:00:00 2001 From b903d537f8b4858692643e6d1c90379e9fb1d554 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Tue, 2 Jan 2018 00:31:26 -0500 Date: Tue, 2 Jan 2018 00:31:26 -0500
Subject: [PATCH] Fill Profile Property Events Subject: [PATCH] Fill Profile Property Events
@ -101,5 +101,5 @@ index 6159cf4c0..95d1ac442 100644
gameprofilerepository = new com.destroystokyo.paper.profile.WrappedGameProfileRepository(gameprofilerepository); // Paper gameprofilerepository = new com.destroystokyo.paper.profile.WrappedGameProfileRepository(gameprofilerepository); // Paper
UserCache usercache = new UserCache(gameprofilerepository, new File(s1, MinecraftServer.a.getName())); UserCache usercache = new UserCache(gameprofilerepository, new File(s1, MinecraftServer.a.getName()));
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 37ac0c5c2fa91f8f922cb07489ce1cf11cfde4be Mon Sep 17 00:00:00 2001 From e6ed90358568cc2422eab0f489fd2e1be0b2ea7c Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com> From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 19 Jan 2018 08:15:29 -0600 Date: Fri, 19 Jan 2018 08:15:29 -0600
Subject: [PATCH] PlayerAdvancementCriterionGrantEvent Subject: [PATCH] PlayerAdvancementCriterionGrantEvent
@ -22,5 +22,5 @@ index 6896b7095..8913e2744 100644
this.i.add(advancement); this.i.add(advancement);
flag = true; flag = true;
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From d4e195955eeef8c475479e8c5bb6e265395ea706 Mon Sep 17 00:00:00 2001 From 8138a69b7faebbfd9ad210ce8b76c8282424c426 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 24 Jan 2018 20:06:39 -0500 Date: Wed, 24 Jan 2018 20:06:39 -0500
Subject: [PATCH] MC-99321 - Dont check for blocked double chest for hoppers Subject: [PATCH] MC-99321 - Dont check for blocked double chest for hoppers
@ -24,5 +24,5 @@ index 90267a1fb..91d3308c1 100644
} }
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 817f05030086ead4203fa67f74e027d4d5d90fd0 Mon Sep 17 00:00:00 2001 From fc7571ae73456691d437cf3a6403b9d62c020b11 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com> From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 27 Jan 2018 17:04:14 -0500 Date: Sat, 27 Jan 2018 17:04:14 -0500
Subject: [PATCH] Add ArmorStand Item Meta Subject: [PATCH] Add ArmorStand Item Meta
@ -407,5 +407,5 @@ index 1f537d584..a29731f1d 100644
); );
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From eb3a4602b0b462211c8c9793d37081a6287881bd Mon Sep 17 00:00:00 2001 From 2b7de80466e6bf6fd5ad582be810a43d5ff65546 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com> From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 11 Feb 2018 10:43:46 +0000 Date: Sun, 11 Feb 2018 10:43:46 +0000
Subject: [PATCH] Extend Player Interact cancellation to GUIs Subject: [PATCH] Extend Player Interact cancellation to GUIs
@ -24,5 +24,5 @@ index 5ec7f5819..b1cdb2154 100644
((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-2867 ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-2867
enuminteractionresult = (event.useItemInHand() != Event.Result.ALLOW) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS; enuminteractionresult = (event.useItemInHand() != Event.Result.ALLOW) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS;
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 6844a109b190cc39435a670157ab245ad8960fc9 Mon Sep 17 00:00:00 2001 From a0d6eed8bdd12a63bb237367bc4bc2c9dab9e4f1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 27 Apr 2016 22:09:52 -0400 Date: Wed, 27 Apr 2016 22:09:52 -0400
Subject: [PATCH] Optimize Hoppers Subject: [PATCH] Optimize Hoppers
@ -280,5 +280,5 @@ index e9315f2d5..5198a590a 100644
flag = true; flag = true;
} else if (a(itemstack1, itemstack)) { } else if (a(itemstack1, itemstack)) {
-- --
2.16.1 2.16.2

View File

@ -1,4 +1,4 @@
From 8c67163e5c0e98e219b1bbe28eb7dfbc9685c1d2 Mon Sep 17 00:00:00 2001 From 80184feb9923f988543045716346b8638e11ac0f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sat, 24 Feb 2018 01:14:55 -0500 Date: Sat, 24 Feb 2018 01:14:55 -0500
Subject: [PATCH] Tameable#getOwnerUniqueId API Subject: [PATCH] Tameable#getOwnerUniqueId API
@ -35,5 +35,5 @@ index eaaebeab8..2e959321b 100644
try { try {
return getHandle().getOwnerUUID(); return getHandle().getOwnerUUID();
-- --
2.16.1 2.16.2

View File

@ -1,11 +1,11 @@
From fa93fba35b7fa5ee49268eac594a77e0f873ea56 Mon Sep 17 00:00:00 2001 From 688442287074e5f6311a3ee512c92c6d8193a0e5 Mon Sep 17 00:00:00 2001
From: MiniDigger <admin@minidigger.me> From: MiniDigger <admin@minidigger.me>
Date: Sat, 10 Mar 2018 00:50:24 +0100 Date: Sat, 10 Mar 2018 00:50:24 +0100
Subject: [PATCH] Toggleable player crits, helps mitigate hacked clients. Subject: [PATCH] Toggleable player crits, helps mitigate hacked clients.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 61cc1d4..038f874 100644 index 61cc1d4e6..038f874b3 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -232,6 +232,11 @@ public class PaperWorldConfig { @@ -232,6 +232,11 @@ public class PaperWorldConfig {
@ -21,7 +21,7 @@ index 61cc1d4..038f874 100644
private void allChunksAreSlimeChunks() { private void allChunksAreSlimeChunks() {
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 3472370..4b82e43 100644 index 347237055..4b82e43a8 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java --- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -978,7 +978,7 @@ public abstract class EntityHuman extends EntityLiving { @@ -978,7 +978,7 @@ public abstract class EntityHuman extends EntityLiving {
@ -34,5 +34,5 @@ index 3472370..4b82e43 100644
if (flag2) { if (flag2) {
f *= 1.5F; f *= 1.5F;
-- --
2.7.4 2.16.2

View File

@ -1,4 +1,4 @@
From 4caec43af620f7c53787870fd105694be881b5d2 Mon Sep 17 00:00:00 2001 From 02780e7f31207c021b84cb2757eb77c8bf29ca65 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com> From: Shane Freeder <theboyetronic@gmail.com>
Date: Sat, 10 Mar 2018 13:03:49 +0000 Date: Sat, 10 Mar 2018 13:03:49 +0000
Subject: [PATCH] Fix NPE when getting location from InventoryEnderChest opened Subject: [PATCH] Fix NPE when getting location from InventoryEnderChest opened

View File

@ -1,4 +1,4 @@
From cbb76ce2d26dab508d9e5b26c2eccc11a37d6275 Mon Sep 17 00:00:00 2001 From 6dc061c0c7c25b187f45d8247ca8ce18ca4d2ab3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sat, 10 Mar 2018 16:33:15 -0500 Date: Sat, 10 Mar 2018 16:33:15 -0500
Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks

View File

@ -1,4 +1,4 @@
From b7806469aa14552fea0aece2446419b9a96c27cc Mon Sep 17 00:00:00 2001 From 9e1c5a7852f21efbc2bc259be9eb5b3a567f3b9e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Sun, 11 Mar 2018 14:13:33 -0400 Date: Sun, 11 Mar 2018 14:13:33 -0400
Subject: [PATCH] Disable Explicit Network Manager Flushing Subject: [PATCH] Disable Explicit Network Manager Flushing
@ -12,7 +12,7 @@ flushing on the netty event loop, so it won't do the flush on the main thread.
Renable flushing by passing -Dpaper.explicit-flush=true Renable flushing by passing -Dpaper.explicit-flush=true
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index b93a26e8f..da7c45697 100644 index b93a26e8f..3d32e0056 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java --- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -78,6 +78,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { @@ -78,6 +78,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {

View File

@ -0,0 +1,255 @@
From be13b11e1cb79084ab4d0b400ab6c013a0357fa7 Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Wed, 11 Oct 2017 15:56:26 +0200
Subject: [PATCH] Implement extended PaperServerListPingEvent
diff --git a/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java
new file mode 100644
index 000000000..c1a8e295b
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/PaperServerListPingEventImpl.java
@@ -0,0 +1,31 @@
+package com.destroystokyo.paper.network;
+
+import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
+import net.minecraft.server.EntityPlayer;
+import net.minecraft.server.MinecraftServer;
+import org.bukkit.entity.Player;
+import org.bukkit.util.CachedServerIcon;
+
+import javax.annotation.Nullable;
+
+class PaperServerListPingEventImpl extends PaperServerListPingEvent {
+
+ private final MinecraftServer server;
+
+ PaperServerListPingEventImpl(MinecraftServer server, StatusClient client, int protocolVersion, @Nullable CachedServerIcon icon) {
+ super(client, server.getMotd(), server.getPlayerCount(), server.getMaxPlayers(),
+ server.getServerModName() + ' ' + server.getVersion(), protocolVersion, icon);
+ this.server = server;
+ }
+
+ @Override
+ protected final Object[] getOnlinePlayers() {
+ return this.server.getPlayerList().players.toArray();
+ }
+
+ @Override
+ protected final Player getBukkitPlayer(Object player) {
+ return ((EntityPlayer) player).getBukkitEntity();
+ }
+
+}
diff --git a/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java b/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java
new file mode 100644
index 000000000..a2a409e63
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/PaperStatusClient.java
@@ -0,0 +1,11 @@
+package com.destroystokyo.paper.network;
+
+import net.minecraft.server.NetworkManager;
+
+class PaperStatusClient extends PaperNetworkClient implements StatusClient {
+
+ PaperStatusClient(NetworkManager networkManager) {
+ super(networkManager);
+ }
+
+}
diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
new file mode 100644
index 000000000..33dd196fb
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java
@@ -0,0 +1,112 @@
+package com.destroystokyo.paper.network;
+
+import com.destroystokyo.paper.profile.CraftPlayerProfile;
+import com.destroystokyo.paper.profile.PlayerProfile;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Strings;
+import com.mojang.authlib.GameProfile;
+import net.minecraft.server.ChatComponentText;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.NetworkManager;
+import net.minecraft.server.PacketStatusOutServerInfo;
+import net.minecraft.server.ServerPing;
+
+import java.util.List;
+import java.util.UUID;
+
+import javax.annotation.Nonnull;
+
+public final class StandardPaperServerListPingEventImpl extends PaperServerListPingEventImpl {
+
+ private static final GameProfile[] EMPTY_PROFILES = new GameProfile[0];
+ private static final UUID FAKE_UUID = new UUID(0, 0);
+
+ private GameProfile[] originalSample;
+
+ private StandardPaperServerListPingEventImpl(MinecraftServer server, NetworkManager networkManager, ServerPing ping) {
+ super(server, new PaperStatusClient(networkManager), ping.getServerData().getProtocolVersion(), server.server.getServerIcon());
+ this.originalSample = ping.getPlayers().getSample();
+ }
+
+ @Nonnull
+ @Override
+ public List<PlayerProfile> getPlayerSample() {
+ List<PlayerProfile> sample = super.getPlayerSample();
+
+ if (this.originalSample != null) {
+ for (GameProfile profile : this.originalSample) {
+ sample.add(CraftPlayerProfile.asBukkitMirror(profile));
+ }
+ this.originalSample = null;
+ }
+
+ return sample;
+ }
+
+ private GameProfile[] getPlayerSampleHandle() {
+ if (this.originalSample != null) {
+ return this.originalSample;
+ }
+
+ List<PlayerProfile> entries = super.getPlayerSample();
+ if (entries.isEmpty()) {
+ return EMPTY_PROFILES;
+ }
+
+ GameProfile[] profiles = new GameProfile[entries.size()];
+ for (int i = 0; i < profiles.length; i++) {
+ /*
+ * Avoid null UUIDs/names since that will make the response invalid
+ * on the client.
+ * Instead, fall back to a fake/empty UUID and an empty string as name.
+ * This can be used to create custom lines in the player list that do not
+ * refer to a specific player.
+ */
+
+ PlayerProfile profile = entries.get(i);
+ if (profile.getId() != null && profile.getName() != null) {
+ profiles[i] = CraftPlayerProfile.asAuthlib(profile);
+ } else {
+ profiles[i] = new GameProfile(MoreObjects.firstNonNull(profile.getId(), FAKE_UUID), Strings.nullToEmpty(profile.getName()));
+ }
+ }
+
+ return profiles;
+ }
+
+ @SuppressWarnings("deprecation")
+ public static void processRequest(MinecraftServer server, NetworkManager networkManager) {
+ StandardPaperServerListPingEventImpl event = new StandardPaperServerListPingEventImpl(server, networkManager, server.getServerPing());
+ server.server.getPluginManager().callEvent(event);
+
+ // Close connection immediately if event is cancelled
+ if (event.isCancelled()) {
+ networkManager.close(null);
+ return;
+ }
+
+ // Setup response
+ ServerPing ping = new ServerPing();
+
+ // Description
+ ping.setMOTD(new ChatComponentText(event.getMotd()));
+
+ // Players
+ if (!event.shouldHidePlayers()) {
+ ping.setPlayerSample(new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), event.getNumPlayers()));
+ ping.getPlayers().setSample(event.getPlayerSampleHandle());
+ }
+
+ // Version
+ ping.setServerInfo(new ServerPing.ServerData(event.getVersion(), event.getProtocolVersion()));
+
+ // Favicon
+ if (event.getServerIcon() != null) {
+ ping.setFavicon(event.getServerIcon().getData());
+ }
+
+ // Send response
+ networkManager.sendPacket(new PacketStatusOutServerInfo(ping));
+ }
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e8c72db96..9da09d53b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -768,7 +768,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
if (i - this.Z >= 5000000000L) {
this.Z = i;
this.q.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.I(), this.H()));
- GameProfile[] agameprofile = new GameProfile[Math.min(this.H(), 12)];
+ GameProfile[] agameprofile = new GameProfile[Math.min(this.H(), org.spigotmc.SpigotConfig.playerSample)]; // Paper
int j = MathHelper.nextInt(this.r, 0, this.H() - agameprofile.length);
for (int k = 0; k < agameprofile.length; ++k) {
@@ -1116,10 +1116,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IAs
return "1.12.2";
}
+ public int getPlayerCount() { return H(); } // Paper - OBFHELPER
public int H() {
return this.v.getPlayerCount();
}
+ public int getMaxPlayers() { return I(); } // Paper - OBFHELPER
public int I() {
return this.v.getMaxPlayers();
}
diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java
index 313bb0007..f3c25367d 100644
--- a/src/main/java/net/minecraft/server/PacketStatusListener.java
+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java
@@ -30,6 +30,8 @@ public class PacketStatusListener implements PacketStatusInListener {
this.networkManager.close(PacketStatusListener.a);
} else {
this.d = true;
+ // Paper start - Replace everything
+ /*
// CraftBukkit start
// this.networkManager.sendPacket(new PacketStatusOutServerInfo(this.minecraftServer.getServerPing()));
final Object[] players = minecraftServer.getPlayerList().players.toArray();
@@ -125,6 +127,9 @@ public class PacketStatusListener implements PacketStatusInListener {
ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version));
this.networkManager.sendPacket(new PacketStatusOutServerInfo(ping));
+ */
+ com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(this.minecraftServer, this.networkManager);
+ // Paper end
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/ServerPing.java b/src/main/java/net/minecraft/server/ServerPing.java
index 981582212..ac161f505 100644
--- a/src/main/java/net/minecraft/server/ServerPing.java
+++ b/src/main/java/net/minecraft/server/ServerPing.java
@@ -29,6 +29,7 @@ public class ServerPing {
this.a = ichatbasecomponent;
}
+ public ServerPingPlayerSample getPlayers() { return b(); } // Paper - OBFHELPER
public ServerPing.ServerPingPlayerSample b() {
return this.b;
}
@@ -164,10 +165,12 @@ public class ServerPing {
return this.b;
}
+ public GameProfile[] getSample() { return c(); } // Paper - OBFHELPER
public GameProfile[] c() {
return this.c;
}
+ public void setSample(GameProfile[] sample) { a(sample); } // Paper - OBFHELPER
public void a(GameProfile[] agameprofile) {
this.c = agameprofile;
}
--
2.16.2

View File

@ -97,6 +97,7 @@ import PlayerConnectionUtils
import RegionFile import RegionFile
import RegistryBlockID import RegistryBlockID
import RemoteControlListener import RemoteControlListener
import ServerPing
import StructureBoundingBox import StructureBoundingBox
import StructurePiece import StructurePiece
import StructureStart import StructureStart