API patches

This commit is contained in:
Nassim Jahnke 2022-12-07 17:46:46 +01:00
parent 476ef25d05
commit fd58a696cb
No known key found for this signature in database
GPG key ID: 6BE3B555EBC5982B
994 changed files with 584 additions and 581 deletions

View file

@ -7,7 +7,7 @@ Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts
index f4b289d92892003bcc254a65cefe4d73c368aa55..3320666626cdadefc045331d33c3e9e9741344fc 100644
index c2928c6f2d54de0ffde164fd9407085cf9fa18a6..ab62ed5c6767d0a858583af795018a82c94d2fc3 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,17 +8,37 @@ java {
@ -29,8 +29,8 @@ index f4b289d92892003bcc254a65cefe4d73c368aa55..3320666626cdadefc045331d33c3e9e9
+
dependencies {
// api dependencies are listed transitively to API consumers
api("com.google.guava:guava:31.0.1-jre")
api("com.google.code.gson:gson:2.8.9")
api("com.google.guava:guava:31.1-jre")
api("com.google.code.gson:gson:2.10")
- api("net.md-5:bungeecord-chat:1.16-R0.4")
+ api("net.md-5:bungeecord-chat:1.16-R0.4-deprecated+build.6") // Paper
api("org.yaml:snakeyaml:1.33")
@ -735,7 +735,7 @@ index 0000000000000000000000000000000000000000..6e94562d79206d88b74b53814f9423f1
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 72143df182e55b70726b066b6b276021c1f4f4d7..c800da7aba43de995682eb724ccf8b7066d6cad3 100644
index 446e4d21c5b9b624e633875df62160a7351517d9..0084898567e8bb74fa271b65b56523a5c26d387c 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -358,7 +358,9 @@ public final class Bukkit {
@ -748,7 +748,7 @@ index 72143df182e55b70726b066b6b276021c1f4f4d7..c800da7aba43de995682eb724ccf8b70
public static int broadcastMessage(@NotNull String message) {
return server.broadcastMessage(message);
}
@@ -1072,6 +1074,19 @@ public final class Bukkit {
@@ -1074,6 +1076,19 @@ public final class Bukkit {
server.shutdown();
}
@ -768,7 +768,7 @@ index 72143df182e55b70726b066b6b276021c1f4f4d7..c800da7aba43de995682eb724ccf8b70
/**
* Broadcasts the specified message to every user with the given
* permission name.
@@ -1081,6 +1096,21 @@ public final class Bukkit {
@@ -1083,6 +1098,21 @@ public final class Bukkit {
* permissibles} must have to receive the broadcast
* @return number of message recipients
*/
@ -790,7 +790,7 @@ index 72143df182e55b70726b066b6b276021c1f4f4d7..c800da7aba43de995682eb724ccf8b70
public static int broadcast(@NotNull String message, @NotNull String permission) {
return server.broadcast(message, permission);
}
@@ -1319,6 +1349,7 @@ public final class Bukkit {
@@ -1321,6 +1351,7 @@ public final class Bukkit {
return server.createInventory(owner, type);
}
@ -798,7 +798,7 @@ index 72143df182e55b70726b066b6b276021c1f4f4d7..c800da7aba43de995682eb724ccf8b70
/**
* Creates an empty inventory with the specified type and title. If the type
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
@@ -1344,6 +1375,38 @@ public final class Bukkit {
@@ -1346,6 +1377,38 @@ public final class Bukkit {
* @see InventoryType#isCreatable()
*/
@NotNull
@ -837,7 +837,7 @@ index 72143df182e55b70726b066b6b276021c1f4f4d7..c800da7aba43de995682eb724ccf8b70
public static Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull String title) {
return server.createInventory(owner, type, title);
}
@@ -1362,6 +1425,7 @@ public final class Bukkit {
@@ -1364,6 +1427,7 @@ public final class Bukkit {
return server.createInventory(owner, size);
}
@ -845,7 +845,7 @@ index 72143df182e55b70726b066b6b276021c1f4f4d7..c800da7aba43de995682eb724ccf8b70
/**
* Creates an empty inventory of type {@link InventoryType#CHEST} with the
* specified size and title.
@@ -1374,10 +1438,30 @@ public final class Bukkit {
@@ -1376,10 +1440,30 @@ public final class Bukkit {
* @throws IllegalArgumentException if the size is not a multiple of 9
*/
@NotNull
@ -876,7 +876,7 @@ index 72143df182e55b70726b066b6b276021c1f4f4d7..c800da7aba43de995682eb724ccf8b70
/**
* Creates an empty merchant.
*
@@ -1385,7 +1469,20 @@ public final class Bukkit {
@@ -1387,7 +1471,20 @@ public final class Bukkit {
* when the merchant inventory is viewed
* @return a new merchant
*/
@ -897,7 +897,7 @@ index 72143df182e55b70726b066b6b276021c1f4f4d7..c800da7aba43de995682eb724ccf8b70
public static Merchant createMerchant(@Nullable String title) {
return server.createMerchant(title);
}
@@ -1502,22 +1599,47 @@ public final class Bukkit {
@@ -1504,22 +1601,47 @@ public final class Bukkit {
return server.isPrimaryThread();
}
@ -1070,7 +1070,7 @@ index 803fa0019869127ee8c7e4fb1777a59c43e66f8a..c65f0d6569c130b4920a9e71ad24af64
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index c0a3b44c728ec98ecce4d1e71746747d87582aa9..4d5c3af2e1f0030aa7415fbe9d11fe3580854fd5 100644
index 52dd3148ae2a3480982593dc627ef7eede52bc5a..892e03189957b0072827be4fd485dd98352334e8 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -59,13 +59,13 @@ import org.jetbrains.annotations.Nullable;
@ -1108,7 +1108,7 @@ index c0a3b44c728ec98ecce4d1e71746747d87582aa9..4d5c3af2e1f0030aa7415fbe9d11fe35
public int broadcastMessage(@NotNull String message);
/**
@@ -911,8 +913,33 @@ public interface Server extends PluginMessageRecipient {
@@ -913,8 +915,33 @@ public interface Server extends PluginMessageRecipient {
* @param permission the required permission {@link Permissible
* permissibles} must have to receive the broadcast
* @return number of message recipients
@ -1142,7 +1142,7 @@ index c0a3b44c728ec98ecce4d1e71746747d87582aa9..4d5c3af2e1f0030aa7415fbe9d11fe35
/**
* Gets the player by the given name, regardless if they are offline or
@@ -1110,6 +1137,7 @@ public interface Server extends PluginMessageRecipient {
@@ -1112,6 +1139,7 @@ public interface Server extends PluginMessageRecipient {
@NotNull
Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type);
@ -1150,7 +1150,7 @@ index c0a3b44c728ec98ecce4d1e71746747d87582aa9..4d5c3af2e1f0030aa7415fbe9d11fe35
/**
* Creates an empty inventory with the specified type and title. If the type
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
@@ -1135,6 +1163,36 @@ public interface Server extends PluginMessageRecipient {
@@ -1137,6 +1165,36 @@ public interface Server extends PluginMessageRecipient {
* @see InventoryType#isCreatable()
*/
@NotNull
@ -1187,7 +1187,7 @@ index c0a3b44c728ec98ecce4d1e71746747d87582aa9..4d5c3af2e1f0030aa7415fbe9d11fe35
Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull String title);
/**
@@ -1149,6 +1207,22 @@ public interface Server extends PluginMessageRecipient {
@@ -1151,6 +1209,22 @@ public interface Server extends PluginMessageRecipient {
@NotNull
Inventory createInventory(@Nullable InventoryHolder owner, int size) throws IllegalArgumentException;
@ -1210,7 +1210,7 @@ index c0a3b44c728ec98ecce4d1e71746747d87582aa9..4d5c3af2e1f0030aa7415fbe9d11fe35
/**
* Creates an empty inventory of type {@link InventoryType#CHEST} with the
* specified size and title.
@@ -1159,10 +1233,13 @@ public interface Server extends PluginMessageRecipient {
@@ -1161,10 +1235,13 @@ public interface Server extends PluginMessageRecipient {
* viewed
* @return a new inventory
* @throws IllegalArgumentException if the size is not a multiple of 9
@ -1224,7 +1224,7 @@ index c0a3b44c728ec98ecce4d1e71746747d87582aa9..4d5c3af2e1f0030aa7415fbe9d11fe35
/**
* Creates an empty merchant.
*
@@ -1170,7 +1247,18 @@ public interface Server extends PluginMessageRecipient {
@@ -1172,7 +1249,18 @@ public interface Server extends PluginMessageRecipient {
* when the merchant inventory is viewed
* @return a new merchant
*/
@ -1243,7 +1243,7 @@ index c0a3b44c728ec98ecce4d1e71746747d87582aa9..4d5c3af2e1f0030aa7415fbe9d11fe35
Merchant createMerchant(@Nullable String title);
/**
@@ -1266,20 +1354,41 @@ public interface Server extends PluginMessageRecipient {
@@ -1268,20 +1356,41 @@ public interface Server extends PluginMessageRecipient {
*/
boolean isPrimaryThread();
@ -1285,7 +1285,7 @@ index c0a3b44c728ec98ecce4d1e71746747d87582aa9..4d5c3af2e1f0030aa7415fbe9d11fe35
String getShutdownMessage();
/**
@@ -1661,7 +1770,9 @@ public interface Server extends PluginMessageRecipient {
@@ -1663,7 +1772,9 @@ public interface Server extends PluginMessageRecipient {
* Sends the component to the player
*
* @param component the components to send
@ -1295,7 +1295,7 @@ index c0a3b44c728ec98ecce4d1e71746747d87582aa9..4d5c3af2e1f0030aa7415fbe9d11fe35
public void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1670,7 +1781,9 @@ public interface Server extends PluginMessageRecipient {
@@ -1672,7 +1783,9 @@ public interface Server extends PluginMessageRecipient {
* Sends an array of components as a single message to the player
*
* @param components the components to send
@ -1306,7 +1306,7 @@ index c0a3b44c728ec98ecce4d1e71746747d87582aa9..4d5c3af2e1f0030aa7415fbe9d11fe35
throw new UnsupportedOperationException("Not supported yet.");
}
diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java
index 21b95d404fbdf7f972f8a13ecd07dc28481f2286..da844079a9d3efd1a92c892de79fc7b3aeecaf4b 100644
index 6b360758cd4cb02145f18ce743b51f91a471a650..bf8eea5464f4b09198e7b621419a3adade9f4601 100644
--- a/src/main/java/org/bukkit/Sound.java
+++ b/src/main/java/org/bukkit/Sound.java
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull;
@ -1318,7 +1318,7 @@ index 21b95d404fbdf7f972f8a13ecd07dc28481f2286..da844079a9d3efd1a92c892de79fc7b3
AMBIENT_BASALT_DELTAS_ADDITIONS("ambient.basalt_deltas.additions"),
AMBIENT_BASALT_DELTAS_LOOP("ambient.basalt_deltas.loop"),
@@ -1345,4 +1345,12 @@ public enum Sound implements Keyed {
@@ -1416,4 +1416,12 @@ public enum Sound implements Keyed {
public NamespacedKey getKey() {
return key;
}
@ -2689,10 +2689,10 @@ index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..7941c60b0e1840785ba2b250071591bd
* Gets how much EXP the Player should have at respawn.
* <p>
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java
index 441362d2fbdc9413ed64a1f00b50fb6d06327e79..e1e7f45fd0f65d0874dd0698da436c7ac2e7951b 100644
index 21ef4150d41a57fdc4f405fea1f578448f0c860b..b917c13a30254a83cc2ea87279d427276bc75074 100644
--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java
+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java
@@ -140,6 +140,18 @@ public enum InventoryType {
@@ -144,6 +144,18 @@ public enum InventoryType {
private final String title;
private final boolean isCreatable;
@ -2711,7 +2711,7 @@ index 441362d2fbdc9413ed64a1f00b50fb6d06327e79..e1e7f45fd0f65d0874dd0698da436c7a
private InventoryType(int defaultSize, /*@NotNull*/ String defaultTitle) {
this(defaultSize, defaultTitle, true);
}
@@ -148,6 +160,7 @@ public enum InventoryType {
@@ -152,6 +164,7 @@ public enum InventoryType {
size = defaultSize;
title = defaultTitle;
this.isCreatable = isCreatable;
@ -2719,7 +2719,7 @@ index 441362d2fbdc9413ed64a1f00b50fb6d06327e79..e1e7f45fd0f65d0874dd0698da436c7a
}
public int getDefaultSize() {
@@ -155,6 +168,7 @@ public enum InventoryType {
@@ -159,6 +172,7 @@ public enum InventoryType {
}
@NotNull
@ -3501,55 +3501,53 @@ index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..943d324435350d3f16fad3e21cb472a0
/**
diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
index cf13380b23b70edb73b5879397b64b24a1088729..77173e1ca3ce972632608c620aa1a2fffed27e04 100644
index 5adbe0514129abf3cfbc4b29a213f522359fe2e1..732d8d0436dc76cff33394b43452ff8f7a9b7fab 100644
--- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
+++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java
@@ -23,7 +23,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
@@ -22,7 +22,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
private static final HandlerList handlers = new HandlerList();
private final String hostname;
private final InetAddress address;
private final boolean shouldSendChatPreviews;
- private String motd;
+ private net.kyori.adventure.text.Component motd; // Paper
private final int numPlayers;
private int maxPlayers;
@@ -37,7 +37,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
@@ -31,7 +31,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
Preconditions.checkArgument(numPlayers >= 0, "Cannot have negative number of players online", numPlayers);
this.hostname = hostname;
this.address = address;
- this.motd = motd;
+ this.motd = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(motd); // Paper
this.shouldSendChatPreviews = shouldSendChatPreviews;
this.numPlayers = numPlayers;
this.maxPlayers = maxPlayers;
@@ -58,16 +58,83 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
}
@@ -45,15 +45,80 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* @param address the address of the pinger
* @param motd the message of the day
* @param shouldSendChatPreviews if the server should send chat previews
* @param maxPlayers the max number of players
+ * @deprecated in favour of {@link #ServerListPingEvent(String, java.net.InetAddress, net.kyori.adventure.text.Component, boolean, int)}
+ * @deprecated in favour of {@link #ServerListPingEvent(String, java.net.InetAddress, net.kyori.adventure.text.Component, int)}
*/
+ @Deprecated // Paper
protected ServerListPingEvent(@NotNull final String hostname, @NotNull final InetAddress address, @NotNull final String motd, boolean shouldSendChatPreviews, final int maxPlayers) {
protected ServerListPingEvent(@NotNull final String hostname, @NotNull final InetAddress address, @NotNull final String motd, final int maxPlayers) {
super(true);
this.numPlayers = MAGIC_PLAYER_COUNT;
this.hostname = hostname;
this.address = address;
+ this.motd = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(motd); // Paper
+ this.shouldSendChatPreviews = shouldSendChatPreviews;
+ this.maxPlayers = maxPlayers;
+ }
+ // Paper start
+ @Deprecated
+ public ServerListPingEvent(@NotNull final InetAddress address, @NotNull final net.kyori.adventure.text.Component motd, boolean shouldSendChatPreviews, final int numPlayers, final int maxPlayers) {
+ this("", address, motd, shouldSendChatPreviews, numPlayers, maxPlayers);
+ public ServerListPingEvent(@NotNull final InetAddress address, @NotNull final net.kyori.adventure.text.Component motd, final int numPlayers, final int maxPlayers) {
+ this("", address, motd, numPlayers, maxPlayers);
+ }
+ public ServerListPingEvent(@NotNull final String hostname, @NotNull final InetAddress address, @NotNull final net.kyori.adventure.text.Component motd, boolean shouldSendChatPreviews, final int numPlayers, final int maxPlayers) {
+ public ServerListPingEvent(@NotNull final String hostname, @NotNull final InetAddress address, @NotNull final net.kyori.adventure.text.Component motd, final int numPlayers, final int maxPlayers) {
+ super(true);
+ Preconditions.checkArgument(numPlayers >= 0, "Cannot have negative number of players online (%s)", numPlayers);
+ this.hostname = hostname;
+ this.address = address;
this.motd = motd;
this.shouldSendChatPreviews = shouldSendChatPreviews;
+ this.numPlayers = numPlayers;
this.maxPlayers = maxPlayers;
}
@ -3561,11 +3559,11 @@ index cf13380b23b70edb73b5879397b64b24a1088729..77173e1ca3ce972632608c620aa1a2ff
+ * @param address the address of the pinger
+ * @param motd the message of the day
+ * @param maxPlayers the max number of players
+ * @deprecated in favour of {@link #ServerListPingEvent(String, java.net.InetAddress, net.kyori.adventure.text.Component, boolean, int)}
+ * @deprecated in favour of {@link #ServerListPingEvent(String, java.net.InetAddress, net.kyori.adventure.text.Component, int)}
+ */
+ @Deprecated
+ protected ServerListPingEvent(@NotNull final InetAddress address, @NotNull final net.kyori.adventure.text.Component motd, boolean shouldSendChatPreviews, final int maxPlayers) {
+ this("", address, motd, shouldSendChatPreviews, maxPlayers);
+ protected ServerListPingEvent(@NotNull final InetAddress address, @NotNull final net.kyori.adventure.text.Component motd, final int maxPlayers) {
+ this("", address, motd, maxPlayers);
+ }
+
+ /**
@ -3578,12 +3576,11 @@ index cf13380b23b70edb73b5879397b64b24a1088729..77173e1ca3ce972632608c620aa1a2ff
+ * @param motd the message of the day
+ * @param maxPlayers the max number of players
+ */
+ protected ServerListPingEvent(final @NotNull String hostname, final @NotNull InetAddress address, final @NotNull net.kyori.adventure.text.Component motd, final boolean shouldSendChatPreviews, final int maxPlayers) {
+ protected ServerListPingEvent(final @NotNull String hostname, final @NotNull InetAddress address, final @NotNull net.kyori.adventure.text.Component motd, final int maxPlayers) {
+ this.numPlayers = MAGIC_PLAYER_COUNT;
+ this.hostname = hostname;
+ this.address = address;
+ this.motd = motd;
+ this.shouldSendChatPreviews = shouldSendChatPreviews;
+ this.maxPlayers = maxPlayers;
+ }
+ /**
@ -3606,7 +3603,7 @@ index cf13380b23b70edb73b5879397b64b24a1088729..77173e1ca3ce972632608c620aa1a2ff
/**
* Gets the hostname that the player used to connect to the server, or
@@ -94,19 +161,23 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
@@ -80,19 +145,23 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* Get the message of the day message.
*
* @return the message of the day