Adventure changes for Java 17 and Component support for resourcepack prompt
This commit is contained in:
parent
8a21c1742b
commit
26fbb02aae
|
@ -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 3777d12874ede329410a6bf1c0533deb44924d73..0e8e827b5a05ac9423386eaea4188d132cc7f954 100644
|
||||
index 55ee0c6330e4dbba22b4044346d1e1dd39c745ce..80fdd05dd593455ca89b66636ed30f1d9facf4ed 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -8,6 +8,19 @@ java {
|
||||
|
@ -379,7 +379,7 @@ index 0000000000000000000000000000000000000000..eb179aae1e1d2ce842442e49fe275827
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/text/PaperComponents.java b/src/main/java/io/papermc/paper/text/PaperComponents.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9bbd30a4e
|
||||
index 0000000000000000000000000000000000000000..be72827aafc9a689883f936b4db97bdf01d3bb35
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/text/PaperComponents.java
|
||||
@@ -0,0 +1,88 @@
|
||||
|
@ -390,9 +390,9 @@ index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9
|
|||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
+import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer;
|
||||
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Paper API-specific methods for working with {@link Component}s and related.
|
||||
|
@ -407,7 +407,7 @@ index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9
|
|||
+ *
|
||||
+ * @return a component flattener
|
||||
+ */
|
||||
+ public static @NonNull ComponentFlattener flattener() {
|
||||
+ public static @NotNull ComponentFlattener flattener() {
|
||||
+ return Bukkit.getUnsafe().componentFlattener();
|
||||
+ }
|
||||
+
|
||||
|
@ -420,7 +420,7 @@ index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9
|
|||
+ *
|
||||
+ * @return a serializer to plain text
|
||||
+ */
|
||||
+ public static @NonNull PlainComponentSerializer plainSerializer() {
|
||||
+ public static @NotNull PlainTextComponentSerializer plainSerializer() {
|
||||
+ return Bukkit.getUnsafe().plainComponentSerializer();
|
||||
+ }
|
||||
+
|
||||
|
@ -434,7 +434,7 @@ index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9
|
|||
+ *
|
||||
+ * @return a json component serializer
|
||||
+ */
|
||||
+ public static @NonNull GsonComponentSerializer gsonSerializer() {
|
||||
+ public static @NotNull GsonComponentSerializer gsonSerializer() {
|
||||
+ return Bukkit.getUnsafe().gsonComponentSerializer();
|
||||
+ }
|
||||
+
|
||||
|
@ -449,7 +449,7 @@ index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9
|
|||
+ *
|
||||
+ * @return a json component serializer
|
||||
+ */
|
||||
+ public static @NonNull GsonComponentSerializer colorDownsamplingGsonSerializer() {
|
||||
+ public static @NotNull GsonComponentSerializer colorDownsamplingGsonSerializer() {
|
||||
+ return Bukkit.getUnsafe().colorDownsamplingGsonComponentSerializer();
|
||||
+ }
|
||||
+
|
||||
|
@ -467,7 +467,7 @@ index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9
|
|||
+ *
|
||||
+ * @return a section serializer
|
||||
+ */
|
||||
+ public static @NonNull LegacyComponentSerializer legacySectionSerializer() {
|
||||
+ public static @NotNull LegacyComponentSerializer legacySectionSerializer() {
|
||||
+ return Bukkit.getUnsafe().legacyComponentSerializer();
|
||||
+ }
|
||||
+}
|
||||
|
@ -1086,7 +1086,7 @@ index ac5e263d737973af077e3406a84a84baca4370db..2d91924b7f5ef16a91d40cdc1bfc3d68
|
|||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..207c656c0a11a3a630bc70491efcf433b2681e18 100644
|
||||
index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..3b10d6387606a6efbed059ce54d565bdc756e13e 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -17,6 +17,13 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
||||
|
@ -1095,7 +1095,7 @@ index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..207c656c0a11a3a630bc70491efcf433
|
|||
public interface UnsafeValues {
|
||||
+ // Paper start
|
||||
+ net.kyori.adventure.text.flattener.ComponentFlattener componentFlattener();
|
||||
+ net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer();
|
||||
+ net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainComponentSerializer();
|
||||
+ net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gsonComponentSerializer();
|
||||
+ net.kyori.adventure.text.serializer.gson.GsonComponentSerializer colorDownsamplingGsonComponentSerializer();
|
||||
+ net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer();
|
||||
|
@ -1579,7 +1579,7 @@ index 25a6f9313a1953def7470e411b53016f2ca14bef..10cb6088c4618f228c757f4e592b44ed
|
|||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856bc561d70 100644
|
||||
index c36e4ceb1094aa9469f976e0952e2725358ff761..e3cc40a54b48e8a90ccc93c272c1a2dca1da9595 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -35,7 +35,28 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
@ -1752,7 +1752,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
/**
|
||||
* Says a message (or runs a command).
|
||||
*
|
||||
@@ -473,6 +554,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -473,6 +554,90 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public void sendEquipmentChange(@NotNull LivingEntity entity, @NotNull EquipmentSlot slot, @NotNull ItemStack item);
|
||||
|
||||
|
@ -1776,18 +1776,23 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
+ this.sendSignChange(loc, lines, DyeColor.BLACK);
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Send a sign change. This fakes a sign change packet for a user at
|
||||
* a certain location. This will not actually change the world in any way.
|
||||
@@ -485,9 +586,75 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*
|
||||
* @param loc the location of the sign
|
||||
* @param lines the new text on the sign or null to clear it
|
||||
+ /**
|
||||
+ * Send a sign change. This fakes a sign change packet for a user at
|
||||
+ * a certain location. This will not actually change the world in any way.
|
||||
+ * This method will use a sign at the location's block or a faked sign
|
||||
+ * sent via
|
||||
+ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}.
|
||||
+ * <p>
|
||||
+ * If the client does not have a sign at the given location it will
|
||||
+ * display an error message to the user.
|
||||
+ *
|
||||
+ * @param loc the location of the sign
|
||||
+ * @param lines the new text on the sign or null to clear it
|
||||
+ * @param dyeColor the color of the sign
|
||||
* @throws IllegalArgumentException if location is null
|
||||
+ * @throws IllegalArgumentException if location is null
|
||||
+ * @throws IllegalArgumentException if dyeColor is null
|
||||
* @throws IllegalArgumentException if lines is non-null and has a length less than 4
|
||||
*/
|
||||
+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4
|
||||
+ */
|
||||
+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List<net.kyori.adventure.text.Component> lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException {
|
||||
+ this.sendSignChange(loc, lines, dyeColor, false);
|
||||
+ }
|
||||
|
@ -1835,22 +1840,15 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
+ throws IllegalArgumentException;
|
||||
+ // Paper end
|
||||
+
|
||||
+ /**
|
||||
+ * Send a sign change. This fakes a sign change packet for a user at
|
||||
+ * a certain location. This will not actually change the world in any way.
|
||||
+ * This method will use a sign at the location's block or a faked sign
|
||||
+ * sent via
|
||||
+ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}.
|
||||
+ * <p>
|
||||
+ * If the client does not have a sign at the given location it will
|
||||
+ * display an error message to the user.
|
||||
+ *
|
||||
+ * @param loc the location of the sign
|
||||
+ * @param lines the new text on the sign or null to clear it
|
||||
+ * @throws IllegalArgumentException if location is null
|
||||
+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4
|
||||
/**
|
||||
* Send a sign change. This fakes a sign change packet for a user at
|
||||
* a certain location. This will not actually change the world in any way.
|
||||
@@ -487,7 +652,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param lines the new text on the sign or null to clear it
|
||||
* @throws IllegalArgumentException if location is null
|
||||
* @throws IllegalArgumentException if lines is non-null and has a length less than 4
|
||||
+ * @deprecated in favour of {@link #sendSignChange(org.bukkit.Location, java.util.List)}
|
||||
+ */
|
||||
*/
|
||||
+ @Deprecated // Paper
|
||||
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines) throws IllegalArgumentException;
|
||||
|
||||
|
@ -1875,7 +1873,117 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
@@ -1192,7 +1363,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1008,6 +1179,54 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public void setResourcePack(@NotNull String url, @Nullable byte[] hash, @Nullable String prompt);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Request that the player's client download and switch resource packs.
|
||||
+ * <p>
|
||||
+ * The player's client will download the new resource pack asynchronously
|
||||
+ * in the background, and will automatically switch to it once the
|
||||
+ * download is complete. If the client has downloaded and cached a
|
||||
+ * resource pack with the same hash in the past it will not download but
|
||||
+ * directly apply the cached pack. If the hash is null and the client has
|
||||
+ * downloaded and cached the same resource pack in the past, it will
|
||||
+ * perform a file size check against the response content to determine if
|
||||
+ * the resource pack has changed and needs to be downloaded again. When
|
||||
+ * this request is sent for the very first time from a given server, the
|
||||
+ * client will first display a confirmation GUI to the player before
|
||||
+ * proceeding with the download.
|
||||
+ * <p>
|
||||
+ * Notes:
|
||||
+ * <ul>
|
||||
+ * <li>Players can disable server resources on their client, in which
|
||||
+ * case this method will have no affect on them. Use the
|
||||
+ * {@link PlayerResourcePackStatusEvent} to figure out whether or not
|
||||
+ * the player loaded the pack!
|
||||
+ * <li>There is no concept of resetting resource packs back to default
|
||||
+ * within Minecraft, so players will have to relog to do so or you
|
||||
+ * have to send an empty pack.
|
||||
+ * <li>The request is sent with empty string as the hash when the hash is
|
||||
+ * not provided. This might result in newer versions not loading the
|
||||
+ * pack correctly.
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @param url The URL from which the client will download the resource
|
||||
+ * pack. The string must contain only US-ASCII characters and should
|
||||
+ * be encoded as per RFC 1738.
|
||||
+ * @param hash The sha1 hash sum of the resource pack file which is used
|
||||
+ * to apply a cached version of the pack directly without downloading
|
||||
+ * if it is available. Hast to be 20 bytes long!
|
||||
+ * @param prompt The optional custom prompt message to be shown to client.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is null.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
|
||||
+ * length restriction is an implementation specific arbitrary value.
|
||||
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
|
||||
+ * long.
|
||||
+ */
|
||||
+ default void setResourcePack(@NotNull String url, byte @Nullable [] hash, net.kyori.adventure.text.@Nullable Component prompt) {
|
||||
+ this.setResourcePack(url, hash, prompt, false);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Request that the player's client download and switch resource packs.
|
||||
* <p>
|
||||
@@ -1099,6 +1318,54 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public void setResourcePack(@NotNull String url, @Nullable byte[] hash, @Nullable String prompt, boolean force);
|
||||
|
||||
+ // Paper end
|
||||
+ /**
|
||||
+ * Request that the player's client download and switch resource packs.
|
||||
+ * <p>
|
||||
+ * The player's client will download the new resource pack asynchronously
|
||||
+ * in the background, and will automatically switch to it once the
|
||||
+ * download is complete. If the client has downloaded and cached a
|
||||
+ * resource pack with the same hash in the past it will not download but
|
||||
+ * directly apply the cached pack. If the hash is null and the client has
|
||||
+ * downloaded and cached the same resource pack in the past, it will
|
||||
+ * perform a file size check against the response content to determine if
|
||||
+ * the resource pack has changed and needs to be downloaded again. When
|
||||
+ * this request is sent for the very first time from a given server, the
|
||||
+ * client will first display a confirmation GUI to the player before
|
||||
+ * proceeding with the download.
|
||||
+ * <p>
|
||||
+ * Notes:
|
||||
+ * <ul>
|
||||
+ * <li>Players can disable server resources on their client, in which
|
||||
+ * case this method will have no affect on them. Use the
|
||||
+ * {@link PlayerResourcePackStatusEvent} to figure out whether or not
|
||||
+ * the player loaded the pack!
|
||||
+ * <li>There is no concept of resetting resource packs back to default
|
||||
+ * within Minecraft, so players will have to relog to do so or you
|
||||
+ * have to send an empty pack.
|
||||
+ * <li>The request is sent with empty string as the hash when the hash is
|
||||
+ * not provided. This might result in newer versions not loading the
|
||||
+ * pack correctly.
|
||||
+ * </ul>
|
||||
+ *
|
||||
+ * @param url The URL from which the client will download the resource
|
||||
+ * pack. The string must contain only US-ASCII characters and should
|
||||
+ * be encoded as per RFC 1738.
|
||||
+ * @param hash The sha1 hash sum of the resource pack file which is used
|
||||
+ * to apply a cached version of the pack directly without downloading
|
||||
+ * if it is available. Hast to be 20 bytes long!
|
||||
+ * @param prompt The optional custom prompt message to be shown to client.
|
||||
+ * @param force If true, the client will be disconnected from the server
|
||||
+ * when it declines to use the resource pack.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is null.
|
||||
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
|
||||
+ * length restriction is an implementation specific arbitrary value.
|
||||
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
|
||||
+ * long.
|
||||
+ */
|
||||
+ public void setResourcePack(@NotNull String url, byte @Nullable [] hash, net.kyori.adventure.text.@Nullable Component prompt, boolean force);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the Scoreboard displayed to this player
|
||||
*
|
||||
@@ -1192,7 +1459,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*
|
||||
* @param title Title text
|
||||
* @param subtitle Subtitle text
|
||||
|
@ -1884,7 +1992,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
*/
|
||||
@Deprecated
|
||||
public void sendTitle(@Nullable String title, @Nullable String subtitle);
|
||||
@@ -1211,7 +1382,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1211,7 +1478,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param fadeIn time in ticks for titles to fade in. Defaults to 10.
|
||||
* @param stay time in ticks for titles to stay. Defaults to 70.
|
||||
* @param fadeOut time in ticks for titles to fade out. Defaults to 20.
|
||||
|
@ -1894,7 +2002,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
public void sendTitle(@Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut);
|
||||
|
||||
/**
|
||||
@@ -1438,6 +1611,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1438,6 +1707,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public int getClientViewDistance();
|
||||
|
||||
|
@ -1909,7 +2017,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
/**
|
||||
* Gets the player's estimated ping in milliseconds.
|
||||
*
|
||||
@@ -1463,8 +1644,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1463,8 +1740,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* they wish.
|
||||
*
|
||||
* @return the player's locale
|
||||
|
@ -1920,7 +2028,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
public String getLocale();
|
||||
|
||||
/**
|
||||
@@ -1506,6 +1689,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1506,6 +1785,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public boolean isAllowingServerListings();
|
||||
|
||||
|
@ -1935,7 +2043,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
// Spigot start
|
||||
public class Spigot extends Entity.Spigot {
|
||||
|
||||
@@ -1560,11 +1751,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1560,11 +1847,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
|
@ -1949,7 +2057,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
@Override
|
||||
public void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
@@ -1575,7 +1768,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1575,7 +1864,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*
|
||||
* @param position the screen position
|
||||
* @param component the components to send
|
||||
|
@ -1959,7 +2067,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
@@ -1585,7 +1780,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1585,7 +1876,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*
|
||||
* @param position the screen position
|
||||
* @param components the components to send
|
||||
|
@ -1969,7 +2077,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
@@ -1596,7 +1793,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1596,7 +1889,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param position the screen position
|
||||
* @param sender the sender of the message
|
||||
* @param component the components to send
|
||||
|
@ -1979,7 +2087,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
|
|||
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
@@ -1607,7 +1806,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1607,7 +1902,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param position the screen position
|
||||
* @param sender the sender of the message
|
||||
* @param components the components to send
|
||||
|
@ -4106,7 +4214,7 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..d5b39fb4fc16a342b5661e08df150685
|
|||
|
||||
/**
|
||||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
index c6a8a37a933cfc5a5885602a8a70fdda8fb6aa10..61441e56da69ee8cb92a2b1239f5406425a8344d 100644
|
||||
index c6a8a37a933cfc5a5885602a8a70fdda8fb6aa10..7f57b95727d0336f1f1548055574e0c129fe9643 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -26,6 +26,12 @@ import org.objectweb.asm.tree.ParameterNode;
|
||||
|
@ -4122,3 +4230,12 @@ index c6a8a37a933cfc5a5885602a8a70fdda8fb6aa10..61441e56da69ee8cb92a2b1239f54064
|
|||
"Lorg/jetbrains/annotations/Nullable;",
|
||||
"Lorg/jetbrains/annotations/NotNull;",
|
||||
"Lorg/jetbrains/annotations/Contract;",
|
||||
@@ -105,7 +111,7 @@ public class AnnotationTest {
|
||||
if (method.invisibleTypeAnnotations != null) {
|
||||
for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) {
|
||||
final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
|
||||
- if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) {
|
||||
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && org.apache.commons.lang.ArrayUtils.contains(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc)) {
|
||||
continue dancing;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Player affects spawning API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 32850ac21d59f962de10125e1b528856bc561d70..b3b53db0a74df795866677285fab4c943db42100 100644
|
||||
index e3cc40a54b48e8a90ccc93c272c1a2dca1da9595..a6f6dea965eee2de2183f189580d1b7141a9308f 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1650,6 +1650,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1746,6 +1746,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@Deprecated // Paper
|
||||
public String getLocale();
|
||||
|
||||
|
|
|
@ -65,10 +65,10 @@ index c58b1885662c6a234ffee75995051c9750c1a512..7b1fb280a86ab44756fc233b085f878d
|
|||
public class Spigot {
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index b3b53db0a74df795866677285fab4c943db42100..152f848d2f93a52999f093bd83b4732af9aab8d8 100644
|
||||
index a6f6dea965eee2de2183f189580d1b7141a9308f..bf60cc1beed41f6dc30b0df0bae9b937ddfa5553 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1664,6 +1664,62 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1760,6 +1760,62 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param affects Whether the player can affect mob spawning
|
||||
*/
|
||||
public void setAffectsSpawning(boolean affects);
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Complete resource pack API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 70e97db83071935dfe6cbf2a60660672d0205a96..8fa4606e187b4677d2302b4fec5c02adf652b3e5 100644
|
||||
index cd2c4ff23cdbcc3e4e9ae94477a372d25ad31e39..422f322b9623dcb33472744ddfd91d7dba817471 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1251,7 +1251,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
|
@ -18,7 +18,7 @@ index 70e97db83071935dfe6cbf2a60660672d0205a96..8fa4606e187b4677d2302b4fec5c02ad
|
|||
public void setResourcePack(@NotNull String url);
|
||||
|
||||
/**
|
||||
@@ -1929,6 +1931,124 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2025,6 +2027,124 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
default net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity> asHoverEvent(final @NotNull java.util.function.UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowEntity> op) {
|
||||
return net.kyori.adventure.text.event.HoverEvent.showEntity(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowEntity.of(this.getType().getKey(), this.getUniqueId(), this.displayName())));
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add String based Action Bar API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 8fa4606e187b4677d2302b4fec5c02adf652b3e5..d98029f01bc81c5bf33545fee54bdbce17960b50 100644
|
||||
index 422f322b9623dcb33472744ddfd91d7dba817471..9d9dd1f73b4c3ff143fbba87d8b5630017affd08 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -3,6 +3,7 @@ package org.bukkit.entity;
|
||||
|
@ -68,7 +68,7 @@ index 8fa4606e187b4677d2302b4fec5c02adf652b3e5..d98029f01bc81c5bf33545fee54bdbce
|
|||
public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
spigot().sendMessage(position, components);
|
||||
}
|
||||
@@ -2120,6 +2156,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2216,6 +2252,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
/**
|
||||
* Sends the component to the specified screen position of this player
|
||||
*
|
||||
|
@ -76,7 +76,7 @@ index 8fa4606e187b4677d2302b4fec5c02adf652b3e5..d98029f01bc81c5bf33545fee54bdbce
|
|||
* @param position the screen position
|
||||
* @param component the components to send
|
||||
* @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
@@ -2132,6 +2169,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2228,6 +2265,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
/**
|
||||
* Sends an array of components as a single message to the specified screen position of this player
|
||||
*
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Player.setPlayerProfile API
|
|||
This can be useful for changing name or skins after a player has logged in.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 4485542bcf3014364c2920026a07da6194d6ba29..1c3b5b1950b8b2cb660e160e455384780f2d4e75 100644
|
||||
index 7e390f5d7438f292ddd849f47964282a1ad889d1..ac94189b7bc76e1de0ae7d46fe581af57594ef64 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -4,6 +4,7 @@ import java.net.InetSocketAddress;
|
||||
|
@ -17,7 +17,7 @@ index 4485542bcf3014364c2920026a07da6194d6ba29..1c3b5b1950b8b2cb660e160e45538478
|
|||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
@@ -2106,6 +2107,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2202,6 +2203,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* was {@link org.bukkit.event.player.PlayerResourcePackStatusEvent.Status#SUCCESSFULLY_LOADED}
|
||||
*/
|
||||
boolean hasResourcePack();
|
||||
|
|
|
@ -24,10 +24,10 @@ index 396092fd249928ca01133eeeeb61f0ad90b2e332..5cc025b69c4f405be8f7098d0dcef40f
|
|||
/**
|
||||
* Make the entity drop the item in their hand.
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 1c3b5b1950b8b2cb660e160e455384780f2d4e75..7587483e96a842391e3711c165825682b58286cd 100644
|
||||
index ac94189b7bc76e1de0ae7d46fe581af57594ef64..dbfd062792b0cc1d8fbfc8a30b0143467e7aaef7 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1962,7 +1962,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2058,7 +2058,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
/**
|
||||
* Open a Sign for editing by the Player.
|
||||
*
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 55054303659544ac9ef0d69838e5f8fadb2d43c5..ecebe470f4b3579a5af39a4dfa541a7e470de181 100644
|
||||
index 62b41c809cec18b75ee83371f0ca97ccde141e30..fc44e75c52354d95fa7422e1d08ac4cba455be74 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2281,6 +2281,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2377,6 +2377,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param profile The new profile to use
|
||||
*/
|
||||
void setPlayerProfile(@NotNull PlayerProfile profile);
|
||||
|
|
|
@ -193,7 +193,7 @@ index 0000000000000000000000000000000000000000..f7f171c4ee0b8339b2f8fbe82442d65f
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index ecebe470f4b3579a5af39a4dfa541a7e470de181..b349b2c2a7c70e57b4c28c8b540d01a2c0e62959 100644
|
||||
index fc44e75c52354d95fa7422e1d08ac4cba455be74..2404864227694e357350a8080b4f609b28ef0a47 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2,6 +2,7 @@ package org.bukkit.entity;
|
||||
|
@ -204,7 +204,7 @@ index ecebe470f4b3579a5af39a4dfa541a7e470de181..b349b2c2a7c70e57b4c28c8b540d01a2
|
|||
import com.destroystokyo.paper.Title; // Paper
|
||||
import net.kyori.adventure.text.Component;
|
||||
import com.destroystokyo.paper.profile.PlayerProfile; // Paper
|
||||
@@ -2301,6 +2302,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2397,6 +2398,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* Reset the cooldown counter to 0, effectively starting the cooldown period.
|
||||
*/
|
||||
void resetCooldown();
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Brand support
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index b349b2c2a7c70e57b4c28c8b540d01a2c0e62959..f6137979701026f2acbd04d111afa79332bf08bf 100644
|
||||
index 2404864227694e357350a8080b4f609b28ef0a47..c04572b87fc59b9cf92558653d06c449e2210233 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2436,6 +2436,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2532,6 +2532,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
// Paper end
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Player elytra boost API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index f6137979701026f2acbd04d111afa79332bf08bf..4847db0673ea2a6587703a30f9f3b4e3c278514b 100644
|
||||
index c04572b87fc59b9cf92558653d06c449e2210233..116c75fa16fa544723c9a430ede3a46c3599d7e8 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2308,6 +2308,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2404,6 +2404,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
@NotNull
|
||||
<T> T getClientOption(@NotNull ClientOption<T> option);
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 4847db0673ea2a6587703a30f9f3b4e3c278514b..f31519b5208ed1426bb59499c62e82e49a192488 100644
|
||||
index 116c75fa16fa544723c9a430ede3a46c3599d7e8..3b24457a1d25515132613b7e4fdaa7901d00ab78 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2321,6 +2321,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2417,6 +2417,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
@Nullable
|
||||
Firework boostElytra(@NotNull ItemStack firework);
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add player health update API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 7f476ff106a641ef475899a9c6cfafdaa18fc63c..1b4b54741719252892a3a51491d49cd5423de499 100644
|
||||
index ecd1a8c13137adc880067f9e911e8b1a08c5cd14..5e4a9ce5f899624255e806152c59f60664bcf701 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1725,6 +1725,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -1821,6 +1821,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public double getHealthScale();
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ index 756a2ab6ad416f55fa3864cff9818473840b04fc..701a2ffd04df48d437b2cb963dd150af
|
|||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/AdventureComponent.java b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e597a90def72c5903382d7169fb7a2fb667b8a69
|
||||
index 0000000000000000000000000000000000000000..85546e1ac1d1ed7f70c3c0a1bf49937f865ad091
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java
|
||||
@@ -0,0 +1,82 @@
|
||||
|
@ -43,27 +43,27 @@ index 0000000000000000000000000000000000000000..e597a90def72c5903382d7169fb7a2fb
|
|||
+import net.minecraft.network.chat.Style;
|
||||
+import net.minecraft.util.FormattedCharSequence;
|
||||
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public final class AdventureComponent implements net.minecraft.network.chat.Component {
|
||||
+ final Component wrapped;
|
||||
+ private net.minecraft.network.chat.@MonotonicNonNull Component converted;
|
||||
+ final Component adventure;
|
||||
+ private net.minecraft.network.chat.@MonotonicNonNull Component vanilla;
|
||||
+
|
||||
+ public AdventureComponent(final Component wrapped) {
|
||||
+ this.wrapped = wrapped;
|
||||
+ public AdventureComponent(final Component adventure) {
|
||||
+ this.adventure = adventure;
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraft.network.chat.Component deepConverted() {
|
||||
+ net.minecraft.network.chat.Component converted = this.converted;
|
||||
+ if (converted == null) {
|
||||
+ converted = PaperAdventure.WRAPPER_AWARE_SERIALIZER.serialize(this.wrapped);
|
||||
+ this.converted = converted;
|
||||
+ net.minecraft.network.chat.Component vanilla = this.vanilla;
|
||||
+ if (vanilla == null) {
|
||||
+ vanilla = PaperAdventure.WRAPPER_AWARE_SERIALIZER.serialize(this.adventure);
|
||||
+ this.vanilla = vanilla;
|
||||
+ }
|
||||
+ return converted;
|
||||
+ return vanilla;
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraft.network.chat.@Nullable Component deepConvertedIfPresent() {
|
||||
+ return this.converted;
|
||||
+ return this.vanilla;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -73,8 +73,8 @@ index 0000000000000000000000000000000000000000..e597a90def72c5903382d7169fb7a2fb
|
|||
+
|
||||
+ @Override
|
||||
+ public String getContents() {
|
||||
+ if (this.wrapped instanceof TextComponent) {
|
||||
+ return ((TextComponent) this.wrapped).content();
|
||||
+ if (this.adventure instanceof TextComponent) {
|
||||
+ return ((TextComponent) this.adventure).content();
|
||||
+ } else {
|
||||
+ return this.deepConverted().getContents();
|
||||
+ }
|
||||
|
@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..e597a90def72c5903382d7169fb7a2fb
|
|||
+
|
||||
+ @Override
|
||||
+ public String getString() {
|
||||
+ return PaperAdventure.PLAIN.serialize(this.wrapped);
|
||||
+ return PaperAdventure.PLAIN.serialize(this.adventure);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -108,7 +108,7 @@ index 0000000000000000000000000000000000000000..e597a90def72c5903382d7169fb7a2fb
|
|||
+ public static class Serializer implements JsonSerializer<AdventureComponent> {
|
||||
+ @Override
|
||||
+ public JsonElement serialize(final AdventureComponent src, final Type type, final JsonSerializationContext context) {
|
||||
+ return PaperAdventure.GSON.serializer().toJsonTree(src.wrapped, Component.class);
|
||||
+ return PaperAdventure.GSON.serializer().toJsonTree(src.adventure, Component.class);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
|
@ -502,10 +502,10 @@ index 0000000000000000000000000000000000000000..eeedc30a45d9637d68f04f185b3dd90d
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f763a3ea5796737304e0c1f41349622e1d7adadf
|
||||
index 0000000000000000000000000000000000000000..f506244b4917b362a954d2bf73ba0b5f46c96843
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
|
||||
@@ -0,0 +1,381 @@
|
||||
@@ -0,0 +1,359 @@
|
||||
+package io.papermc.paper.adventure;
|
||||
+
|
||||
+import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
@ -527,7 +527,7 @@ index 0000000000000000000000000000000000000000..f763a3ea5796737304e0c1f41349622e
|
|||
+import net.kyori.adventure.text.format.TextColor;
|
||||
+import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
+import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer;
|
||||
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
+import net.kyori.adventure.translation.GlobalTranslator;
|
||||
+import net.kyori.adventure.translation.TranslationRegistry;
|
||||
+import net.kyori.adventure.translation.Translator;
|
||||
|
@ -544,8 +544,8 @@ index 0000000000000000000000000000000000000000..f763a3ea5796737304e0c1f41349622e
|
|||
+import net.minecraft.world.item.ItemStack;
|
||||
+import net.minecraft.world.item.WrittenBookItem;
|
||||
+import org.bukkit.ChatColor;
|
||||
+import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
+import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public final class PaperAdventure {
|
||||
+ public static final AttributeKey<Locale> LOCALE_ATTRIBUTE = AttributeKey.valueOf("adventure:locale");
|
||||
|
@ -560,7 +560,7 @@ index 0000000000000000000000000000000000000000..f763a3ea5796737304e0c1f41349622e
|
|||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ final @NonNull String translated = Language.getInstance().getOrDefault(translatable.key());
|
||||
+ final @NotNull String translated = Language.getInstance().getOrDefault(translatable.key());
|
||||
+
|
||||
+ final Matcher matcher = LOCALIZATION_PATTERN.matcher(translated);
|
||||
+ final List<Component> args = translatable.args();
|
||||
|
@ -599,7 +599,7 @@ index 0000000000000000000000000000000000000000..f763a3ea5796737304e0c1f41349622e
|
|||
+ })
|
||||
+ .build();
|
||||
+ public static final LegacyComponentSerializer LEGACY_SECTION_UXRC = LegacyComponentSerializer.builder().flattener(FLATTENER).hexColors().useUnusualXRepeatedCharacterHexFormat().build();
|
||||
+ public static final PlainComponentSerializer PLAIN = PlainComponentSerializer.builder().flattener(FLATTENER).build();
|
||||
+ public static final PlainTextComponentSerializer PLAIN = PlainTextComponentSerializer.builder().flattener(FLATTENER).build();
|
||||
+ public static final GsonComponentSerializer GSON = GsonComponentSerializer.builder()
|
||||
+ .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE)
|
||||
+ .build();
|
||||
|
@ -609,7 +609,7 @@ index 0000000000000000000000000000000000000000..f763a3ea5796737304e0c1f41349622e
|
|||
+ .build();
|
||||
+ private static final Codec<CompoundTag, String, IOException, IOException> NBT_CODEC = new Codec<CompoundTag, String, IOException, IOException>() {
|
||||
+ @Override
|
||||
+ public @NonNull CompoundTag decode(final @NonNull String encoded) throws IOException {
|
||||
+ public @NotNull CompoundTag decode(final @NotNull String encoded) throws IOException {
|
||||
+ try {
|
||||
+ return TagParser.parseTag(encoded);
|
||||
+ } catch (final CommandSyntaxException e) {
|
||||
|
@ -618,7 +618,7 @@ index 0000000000000000000000000000000000000000..f763a3ea5796737304e0c1f41349622e
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull String encode(final @NonNull CompoundTag decoded) {
|
||||
+ public @NotNull String encode(final @NotNull CompoundTag decoded) {
|
||||
+ return decoded.toString();
|
||||
+ }
|
||||
+ };
|
||||
|
@ -671,6 +671,7 @@ index 0000000000000000000000000000000000000000..f763a3ea5796737304e0c1f41349622e
|
|||
+ }
|
||||
+
|
||||
+ public static net.minecraft.network.chat.Component asVanilla(final Component component) {
|
||||
+ if (component == null) return null;
|
||||
+ if (true) return new AdventureComponent(component);
|
||||
+ return net.minecraft.network.chat.Component.Serializer.fromJson(GSON.serializer().toJsonTree(component));
|
||||
+ }
|
||||
|
@ -697,7 +698,7 @@ index 0000000000000000000000000000000000000000..f763a3ea5796737304e0c1f41349622e
|
|||
+
|
||||
+ public static String asJsonString(final net.minecraft.network.chat.Component component, final Locale locale) {
|
||||
+ if (component instanceof AdventureComponent) {
|
||||
+ return asJsonString(((AdventureComponent) component).wrapped, locale);
|
||||
+ return asJsonString(((AdventureComponent) component).adventure, locale);
|
||||
+ }
|
||||
+ return net.minecraft.network.chat.Component.Serializer.toJson(component);
|
||||
+ }
|
||||
|
@ -722,71 +723,47 @@ index 0000000000000000000000000000000000000000..f763a3ea5796737304e0c1f41349622e
|
|||
+ // BossBar
|
||||
+
|
||||
+ public static BossEvent.BossBarColor asVanilla(final BossBar.Color color) {
|
||||
+ if (color == BossBar.Color.PINK) {
|
||||
+ return BossEvent.BossBarColor.PINK;
|
||||
+ } else if (color == BossBar.Color.BLUE) {
|
||||
+ return BossEvent.BossBarColor.BLUE;
|
||||
+ } else if (color == BossBar.Color.RED) {
|
||||
+ return BossEvent.BossBarColor.RED;
|
||||
+ } else if (color == BossBar.Color.GREEN) {
|
||||
+ return BossEvent.BossBarColor.GREEN;
|
||||
+ } else if (color == BossBar.Color.YELLOW) {
|
||||
+ return BossEvent.BossBarColor.YELLOW;
|
||||
+ } else if (color == BossBar.Color.PURPLE) {
|
||||
+ return BossEvent.BossBarColor.PURPLE;
|
||||
+ } else if (color == BossBar.Color.WHITE) {
|
||||
+ return BossEvent.BossBarColor.WHITE;
|
||||
+ }
|
||||
+ throw new IllegalArgumentException(color.name());
|
||||
+ return switch (color) {
|
||||
+ case PINK -> BossEvent.BossBarColor.PINK;
|
||||
+ case BLUE -> BossEvent.BossBarColor.BLUE;
|
||||
+ case RED -> BossEvent.BossBarColor.RED;
|
||||
+ case GREEN -> BossEvent.BossBarColor.GREEN;
|
||||
+ case YELLOW -> BossEvent.BossBarColor.YELLOW;
|
||||
+ case PURPLE -> BossEvent.BossBarColor.PURPLE;
|
||||
+ case WHITE -> BossEvent.BossBarColor.WHITE;
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ public static BossBar.Color asAdventure(final BossEvent.BossBarColor color) {
|
||||
+ if(color == BossEvent.BossBarColor.PINK) {
|
||||
+ return BossBar.Color.PINK;
|
||||
+ } else if(color == BossEvent.BossBarColor.BLUE) {
|
||||
+ return BossBar.Color.BLUE;
|
||||
+ } else if(color == BossEvent.BossBarColor.RED) {
|
||||
+ return BossBar.Color.RED;
|
||||
+ } else if(color == BossEvent.BossBarColor.GREEN) {
|
||||
+ return BossBar.Color.GREEN;
|
||||
+ } else if(color == BossEvent.BossBarColor.YELLOW) {
|
||||
+ return BossBar.Color.YELLOW;
|
||||
+ } else if(color == BossEvent.BossBarColor.PURPLE) {
|
||||
+ return BossBar.Color.PURPLE;
|
||||
+ } else if(color == BossEvent.BossBarColor.WHITE) {
|
||||
+ return BossBar.Color.WHITE;
|
||||
+ }
|
||||
+ throw new IllegalArgumentException(color.name());
|
||||
+ return switch (color) {
|
||||
+ case PINK -> BossBar.Color.PINK;
|
||||
+ case BLUE -> BossBar.Color.BLUE;
|
||||
+ case RED -> BossBar.Color.RED;
|
||||
+ case GREEN -> BossBar.Color.GREEN;
|
||||
+ case YELLOW -> BossBar.Color.YELLOW;
|
||||
+ case PURPLE -> BossBar.Color.PURPLE;
|
||||
+ case WHITE -> BossBar.Color.WHITE;
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ public static BossEvent.BossBarOverlay asVanilla(final BossBar.Overlay overlay) {
|
||||
+ if (overlay == BossBar.Overlay.PROGRESS) {
|
||||
+ return BossEvent.BossBarOverlay.PROGRESS;
|
||||
+ } else if (overlay == BossBar.Overlay.NOTCHED_6) {
|
||||
+ return BossEvent.BossBarOverlay.NOTCHED_6;
|
||||
+ } else if (overlay == BossBar.Overlay.NOTCHED_10) {
|
||||
+ return BossEvent.BossBarOverlay.NOTCHED_10;
|
||||
+ } else if (overlay == BossBar.Overlay.NOTCHED_12) {
|
||||
+ return BossEvent.BossBarOverlay.NOTCHED_12;
|
||||
+ } else if (overlay == BossBar.Overlay.NOTCHED_20) {
|
||||
+ return BossEvent.BossBarOverlay.NOTCHED_20;
|
||||
+ }
|
||||
+ throw new IllegalArgumentException(overlay.name());
|
||||
+ return switch (overlay) {
|
||||
+ case PROGRESS -> BossEvent.BossBarOverlay.PROGRESS;
|
||||
+ case NOTCHED_6 -> BossEvent.BossBarOverlay.NOTCHED_6;
|
||||
+ case NOTCHED_10 -> BossEvent.BossBarOverlay.NOTCHED_10;
|
||||
+ case NOTCHED_12 -> BossEvent.BossBarOverlay.NOTCHED_12;
|
||||
+ case NOTCHED_20 -> BossEvent.BossBarOverlay.NOTCHED_20;
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ public static BossBar.Overlay asAdventure(final BossEvent.BossBarOverlay overlay) {
|
||||
+ if (overlay == BossEvent.BossBarOverlay.PROGRESS) {
|
||||
+ return BossBar.Overlay.PROGRESS;
|
||||
+ } else if (overlay == BossEvent.BossBarOverlay.NOTCHED_6) {
|
||||
+ return BossBar.Overlay.NOTCHED_6;
|
||||
+ } else if (overlay == BossEvent.BossBarOverlay.NOTCHED_10) {
|
||||
+ return BossBar.Overlay.NOTCHED_10;
|
||||
+ } else if (overlay == BossEvent.BossBarOverlay.NOTCHED_12) {
|
||||
+ return BossBar.Overlay.NOTCHED_12;
|
||||
+ } else if (overlay == BossEvent.BossBarOverlay.NOTCHED_20) {
|
||||
+ return BossBar.Overlay.NOTCHED_20;
|
||||
+ }
|
||||
+ throw new IllegalArgumentException(overlay.name());
|
||||
+ return switch (overlay) {
|
||||
+ case PROGRESS -> BossBar.Overlay.PROGRESS;
|
||||
+ case NOTCHED_6 -> BossBar.Overlay.NOTCHED_6;
|
||||
+ case NOTCHED_10 -> BossBar.Overlay.NOTCHED_10;
|
||||
+ case NOTCHED_12 -> BossBar.Overlay.NOTCHED_12;
|
||||
+ case NOTCHED_20 -> BossBar.Overlay.NOTCHED_20;
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
+ public static void setFlag(final BossBar bar, final BossBar.Flag flag, final boolean value) {
|
||||
|
@ -876,14 +853,15 @@ index 0000000000000000000000000000000000000000..f763a3ea5796737304e0c1f41349622e
|
|||
+
|
||||
+ // Colors
|
||||
+
|
||||
+ public static @NonNull TextColor asAdventure(ChatFormatting minecraftColor) {
|
||||
+ if (minecraftColor.getColor() == null) {
|
||||
+ public static @NotNull TextColor asAdventure(final ChatFormatting formatting) {
|
||||
+ final Integer color = formatting.getColor();
|
||||
+ if (color == null) {
|
||||
+ throw new IllegalArgumentException("Not a valid color");
|
||||
+ }
|
||||
+ return TextColor.color(minecraftColor.getColor());
|
||||
+ return TextColor.color(color);
|
||||
+ }
|
||||
+
|
||||
+ public static @Nullable ChatFormatting asVanilla(TextColor color) {
|
||||
+ public static @Nullable ChatFormatting asVanilla(final TextColor color) {
|
||||
+ return ChatFormatting.getByHexValue(color.value());
|
||||
+ }
|
||||
+}
|
||||
|
@ -939,7 +917,7 @@ index 0000000000000000000000000000000000000000..7493efba31403cbe7f26e493f165f1b8
|
|||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/WrapperAwareSerializer.java b/src/main/java/io/papermc/paper/adventure/WrapperAwareSerializer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6b202f4b3ddbe1f5dde188136f39414dc68ae4e4
|
||||
index 0000000000000000000000000000000000000000..76be058996599dd798d26a166d1a5139ee72761a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/WrapperAwareSerializer.java
|
||||
@@ -0,0 +1,19 @@
|
||||
|
@ -952,7 +930,7 @@ index 0000000000000000000000000000000000000000..6b202f4b3ddbe1f5dde188136f39414d
|
|||
+ @Override
|
||||
+ public Component deserialize(final net.minecraft.network.chat.Component input) {
|
||||
+ if (input instanceof AdventureComponent) {
|
||||
+ return ((AdventureComponent) input).wrapped;
|
||||
+ return ((AdventureComponent) input).adventure;
|
||||
+ }
|
||||
+ return PaperAdventure.GSON.serializer().fromJson(net.minecraft.network.chat.Component.Serializer.toJsonTree(input), Component.class);
|
||||
+ }
|
||||
|
@ -2368,7 +2346,7 @@ index 446fdca49a5a6999626a7ee3a1d5c168b15a09dd..f9863e138994f6c7a7975a852f106faa
|
|||
public boolean isOp() {
|
||||
return true;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index bfb1ced180ff4943ba15eb16f01530cd1b5b8a90..10e23477f58c7189dee1b3c06a21d656c9b50e82 100644
|
||||
index bfb1ced180ff4943ba15eb16f01530cd1b5b8a90..b62ddd41236b6561672eeedf4bbdd4fa220130e7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -252,14 +252,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
@ -2533,7 +2511,47 @@ index bfb1ced180ff4943ba15eb16f01530cd1b5b8a90..10e23477f58c7189dee1b3c06a21d656
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1740,6 +1804,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1305,7 +1369,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public void setResourcePack(String url) {
|
||||
- this.setResourcePack(url, null);
|
||||
+ this.setResourcePack(url, (byte[]) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1320,7 +1384,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public void setResourcePack(String url, byte[] hash, boolean force) {
|
||||
- this.setResourcePack(url, hash, null, force);
|
||||
+ this.setResourcePack(url, hash, (String) null, force);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1336,6 +1400,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void setResourcePack(String url, byte[] hashBytes, net.kyori.adventure.text.Component prompt, boolean force) {
|
||||
+ Validate.notNull(url, "Resource pack URL cannot be null");
|
||||
+ final String hash;
|
||||
+ if (hashBytes != null) {
|
||||
+ Validate.isTrue(hashBytes.length == 20, "Resource pack hash should be 20 bytes long but was " + hashBytes.length);
|
||||
+ hash = BaseEncoding.base16().lowerCase().encode(hashBytes);
|
||||
+ } else {
|
||||
+ hash = "";
|
||||
+ }
|
||||
+ this.getHandle().sendTexturePack(url, hash, force, io.papermc.paper.adventure.PaperAdventure.asVanilla(prompt));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public void addChannel(String channel) {
|
||||
Preconditions.checkState(this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel);
|
||||
channel = StandardMessenger.validateAndCorrectChannel(channel);
|
||||
@@ -1740,6 +1819,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return (this.getHandle().clientViewDistance == null) ? Bukkit.getViewDistance() : this.getHandle().clientViewDistance;
|
||||
}
|
||||
|
||||
|
@ -2546,7 +2564,7 @@ index bfb1ced180ff4943ba15eb16f01530cd1b5b8a90..10e23477f58c7189dee1b3c06a21d656
|
|||
@Override
|
||||
public int getPing() {
|
||||
return this.getHandle().latency;
|
||||
@@ -1785,6 +1855,194 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1785,6 +1870,194 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return this.getHandle().allowsListing();
|
||||
}
|
||||
|
||||
|
@ -3505,7 +3523,7 @@ index f9b7b8f7ccc95b73967a51420fd6ce88d80d75fe..0de5a46423ae0403dcbfca630dfd7c5a
|
|||
|
||||
boolean hadFormat = false;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index afdf4bc63dfaa469a16701541332e5380a027c22..4a25660971042322b1f9322b906e2775e81a6f01 100644
|
||||
index afdf4bc63dfaa469a16701541332e5380a027c22..8cbd488ee38a568d746ccb909710a2bce85ab762 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -57,6 +57,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
@ -3529,7 +3547,7 @@ index afdf4bc63dfaa469a16701541332e5380a027c22..4a25660971042322b1f9322b906e2775
|
|||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer() {
|
||||
+ public net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainComponentSerializer() {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.PLAIN;
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -117,10 +117,10 @@ index c65d1dc6eb0c1fc7c4a91faf0f1c6f26b3c2a76e..0dc46471f7247e5d36c3896a0c874730
|
|||
for(Player player : this.players()) {
|
||||
if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 10e23477f58c7189dee1b3c06a21d656c9b50e82..2f6a08b66c7451cbc9990062286199f25f7da36a 100644
|
||||
index 37f6e5f0e9b31c10769ae06dc99395330b0a5c55..ef2001db09ca1ca3412aa01c09a8ee3bd70ed228 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1818,8 +1818,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1833,8 +1833,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@Override
|
||||
public String getLocale() {
|
||||
return this.getHandle().locale;
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Only refresh abilities if needed
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 2f6a08b66c7451cbc9990062286199f25f7da36a..5fe5a4d12f53d340f9920e3fb3ae61d5b9711e59 100644
|
||||
index ef2001db09ca1ca3412aa01c09a8ee3bd70ed228..216c73d3b9f8c3e7f9c81a4349ac4989bb0209c3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1487,12 +1487,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1502,12 +1502,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public void setFlying(boolean value) {
|
||||
|
|
|
@ -30,10 +30,10 @@ index 88b6be62678fc09b5a39db28c6d71cc31b16dbcd..352bfe795aea26307de9c998d67a43af
|
|||
this.locale = packet.language;
|
||||
// Paper start
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 5fe5a4d12f53d340f9920e3fb3ae61d5b9711e59..1a27cc950e23fbdf91a7b700f7dc4f994e05b316 100644
|
||||
index 216c73d3b9f8c3e7f9c81a4349ac4989bb0209c3..c29ca680f3c639d284488bfd95c44ccdcfada2ee 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1818,8 +1818,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1833,8 +1833,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public String getLocale() {
|
||||
|
|
|
@ -23,7 +23,7 @@ index 25117f4b7f6139688c1845a1dc257f7d5c268fde..103d0afd73de68e3b07a9a4ef6d2f5af
|
|||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 1c5d31872ba125f6bc990fedb0c350b2825f301d..27d4b69bc3184869e9b66d1933ceb3fb8f8832ac 100644
|
||||
index 00e9f75a065b598358bc049027ee8896e168091f..4cb1cd3bd5905735daab669206d51ebcdecaea10 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -134,6 +134,7 @@ import org.bukkit.metadata.MetadataValue;
|
||||
|
@ -45,16 +45,7 @@ index 1c5d31872ba125f6bc990fedb0c350b2825f301d..27d4b69bc3184869e9b66d1933ceb3fb
|
|||
|
||||
public CraftPlayer(CraftServer server, ServerPlayer entity) {
|
||||
super(server, entity);
|
||||
@@ -1494,7 +1499,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public void setResourcePack(String url) {
|
||||
- this.setResourcePack(url, null);
|
||||
+ this.setResourcePack(url, (byte[]) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1958,6 +1963,45 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1973,6 +1978,45 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public boolean getAffectsSpawning() {
|
||||
return this.getHandle().affectsSpawning;
|
||||
}
|
||||
|
|
|
@ -44,10 +44,10 @@ index 76da306041b61f6c93e6f58f580054af7dfc234e..2277b06e3e13a1abb469064d5b23495a
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index a8cdb69c3d1187d28529fae3b4e35d0550980c2b..d47e9df3a0decca7a360be01d488ba21cef7091e 100644
|
||||
index 339e36932e2e5ef13a9123322f2d4a0d43e0d030..da201f9f65760aa6b1d94b5bc078e26863545526 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1763,6 +1763,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1778,6 +1778,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public void setRealHealth(double health) {
|
||||
|
|
|
@ -9,7 +9,7 @@ e.g. servers which allow and support the usage of mod packs.
|
|||
provide an optional flag to disable this check, at your own risk.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 54fe0cca4b45924ae6e27a8cbab0fc00e325ec50..0b193616a1a89857e22356c03d05f5fa0fc78aea 100644
|
||||
index 69b0566660b0ad8571782feddff7726dda474b4e..4c08a07b0f21e2f57c802a3b05142f4ad94fda9f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -155,6 +155,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
@ -20,8 +20,8 @@ index 54fe0cca4b45924ae6e27a8cbab0fc00e325ec50..0b193616a1a89857e22356c03d05f5fa
|
|||
// Paper end
|
||||
|
||||
public CraftPlayer(CraftServer server, ServerPlayer entity) {
|
||||
@@ -1660,7 +1661,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
@@ -1675,7 +1676,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
// Paper end
|
||||
|
||||
public void addChannel(String channel) {
|
||||
- Preconditions.checkState(this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel);
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index ec369a97fe3bdea9a75467a166a732674e497003..602164382586cc73704a776efebcd82ffba22e83 100644
|
||||
index b549107e022e036164a213ff22b03d8148271118..bce9305b736832abbc9de10a1bf6554c2e724fdf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2357,6 +2357,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2372,6 +2372,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
return this.adventure$pointers;
|
||||
}
|
||||
|
|
|
@ -295,10 +295,10 @@ index 91cf7728aee475cb36f2c02bbfb7e3d2e0d00576..a3a900d10440ed5ebe24370a77ccb6ca
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 602164382586cc73704a776efebcd82ffba22e83..e2c4f56d7bcf4c0c0be38a60d47b814fc615732b 100644
|
||||
index bce9305b736832abbc9de10a1bf6554c2e724fdf..076135ecdfcb589e39deef50c44196d5ffe53434 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1920,7 +1920,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -1935,7 +1935,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public void sendHealthUpdate() {
|
||||
|
|
|
@ -12,10 +12,10 @@ Player we will look at limiting the scope of this change. It appears to
|
|||
be unintentional in the few cases we've seen so far.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 133111bdb165fc2c98824c0592223fe435860368..5efda81f8028f3a939ba581ceaf328f4f537c225 100644
|
||||
index 03b7b95f8a571e2818a240415a96e09ee564158c..302ecb512dc5bfa7ff448810b25bed3bfab3d3ea 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2404,6 +2404,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2419,6 +2419,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void resetCooldown() {
|
||||
getHandle().resetAttackStrengthTicker();
|
||||
}
|
||||
|
|
|
@ -72,10 +72,10 @@ index 938e6ee89bdb398dc4e2ce1682727c0e63f28c26..4065a1cb1b4b68aa3ff9f1c3e86c270e
|
|||
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 9eb324b576cd9b50cf7cfad6470ae6a9b8de0a19..fa3554c96e87fc58c3e71e1635b5cf76fe18e27d 100644
|
||||
index 8429d6aa616c08520bdf7bf71f7e61895583e3ed..95dae09e710cc50905a6af3a33e8c4c0a29719da 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2548,6 +2548,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2563,6 +2563,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
// Paper end
|
||||
};
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index d392a02d996140ab8102e8b9243fd6119fe343a2..8e41be518510e559724f2f26c195f9a99ba343e5 100644
|
||||
index 4afa5667e58999b684376e2eda9cfe3c7832ec32..84d26ab488b0c13ce253d64a053e1aef8de78567 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2119,7 +2119,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2134,7 +2134,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
if (data != null && !particle.getDataType().isInstance(data)) {
|
||||
throw new IllegalArgumentException("data should be " + particle.getDataType() + " got " + data.getClass());
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add player health update API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 03888e95445147ed462233c0115d7e90411c192c..741a03430199cc28b64e2f7ab7167c1d7b7110bc 100644
|
||||
index f2cbfcb069e882ca117d1538e0e69c846bcffd85..cbb24244ec09ab25c7ff8da8bd3ee5a1ef4ae1cc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1998,9 +1998,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2013,9 +2013,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
this.getHandle().maxHealthCache = getMaxHealth();
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ index 03888e95445147ed462233c0115d7e90411c192c..741a03430199cc28b64e2f7ab7167c1d
|
|||
if (this.getHandle().queueHealthUpdatePacket) {
|
||||
this.getHandle().queuedHealthUpdatePacket = packet;
|
||||
} else {
|
||||
@@ -2008,7 +2010,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2023,7 +2025,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue