2018-08-16 13:20:58 +02:00
|
|
|
From 73668957aa1621c7fb91a27bd4cd05ece98b4cd8 Mon Sep 17 00:00:00 2001
|
2018-03-23 04:19:59 +01:00
|
|
|
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
|
2018-08-16 13:20:58 +02:00
|
|
|
index dd1deafdb..db992df24 100644
|
2018-03-23 04:19:59 +01:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/server/PaperServerListPingEvent.java
|
2018-03-26 23:45:18 +02:00
|
|
|
@@ -4,6 +4,7 @@ import static java.util.Objects.requireNonNull;
|
2018-03-23 04:19:59 +01:00
|
|
|
|
|
|
|
import com.destroystokyo.paper.network.StatusClient;
|
|
|
|
import com.destroystokyo.paper.profile.PlayerProfile;
|
|
|
|
+import com.google.common.base.Strings;
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.Cancellable;
|
2018-03-26 23:45:18 +02:00
|
|
|
@@ -316,4 +317,25 @@ public class PaperServerListPingEvent extends ServerListPingEvent implements Can
|
2018-03-23 04:19:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // TODO: Remove in 1.13
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Deprecated
|
|
|
|
+ public List<String> getSampleText() {
|
2018-03-26 23:45:18 +02:00
|
|
|
+ List<String> sampleText = new ArrayList<>();
|
2018-03-23 04:19:59 +01:00
|
|
|
+ for (PlayerProfile profile : getPlayerSample()) {
|
|
|
|
+ sampleText.add(Strings.nullToEmpty(profile.getName()));
|
|
|
|
+ }
|
2018-03-26 23:45:18 +02:00
|
|
|
+ return sampleText;
|
2018-03-23 04:19:59 +01:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @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
|
2018-08-16 13:20:58 +02:00
|
|
|
index a293bc212..f552eab18 100644
|
2018-03-23 04:19:59 +01:00
|
|
|
--- 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()}
|
2018-08-16 13:20:58 +02:00
|
|
|
* @param sample the new player list sample
|
2018-03-23 04:19:59 +01:00
|
|
|
*/
|
|
|
|
@Deprecated
|
2018-08-16 13:20:58 +02:00
|
|
|
@@ -160,7 +161,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
|
2018-03-23 04:19:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
- * @deprecated Will be replaced in 1.13
|
|
|
|
+ * @deprecated Will be removed in 1.13, use {@link PaperServerListPingEvent#getPlayerSample()}
|
2018-08-16 13:20:58 +02:00
|
|
|
* @return the player list sample
|
2018-03-23 04:19:59 +01:00
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
--
|
2018-08-16 13:20:58 +02:00
|
|
|
2.18.0
|
2018-03-23 04:19:59 +01:00
|
|
|
|