Begin update to 1.20.5

This commit is contained in:
Jake Potrebic 2024-04-23 10:02:08 -07:00
parent 73da69c09e
commit 47ee5579ff
1080 changed files with 381 additions and 528 deletions

View file

@ -1771,13 +1771,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return false;
@@ -0,0 +0,0 @@ public abstract class Command {
* command
*
* @return Permission check failed message
+ * @deprecated use {@link #permissionMessage()}
*/
@Deprecated
@Nullable
+ @Deprecated // Paper
public String getPermissionMessage() {
- return permissionMessage;
+ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serializeOrNull(permissionMessage); // Paper
@ -1785,13 +1780,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/**
@@ -0,0 +0,0 @@ public abstract class Command {
* @param permissionMessage new permission message, null to indicate
* default message, or an empty string to indicate no message
* @return this command object, for chaining
+ * @deprecated use {@link #permissionMessage(net.kyori.adventure.text.Component)}
*/
@Deprecated
@NotNull
+ @Deprecated // Paper
public Command setPermissionMessage(@Nullable String permissionMessage) {
- this.permissionMessage = permissionMessage;
+ this.permissionMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserializeOrNull(permissionMessage); // Paper
@ -1807,7 +1797,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Gets the permission message.
+ *
+ * @return the permission message
+ * @deprecated permission messages have not worked for player-executed
+ * commands since 1.13 as clients without permission to execute a command
+ * are unaware of its existence and therefore will not send an unknown
+ * command execution to the server. This message will only ever be shown to
+ * consoles or when this command is executed with
+ * {@link Bukkit#dispatchCommand(CommandSender, String)}.
+ */
+ @Deprecated
+ public net.kyori.adventure.text.@Nullable Component permissionMessage() {
+ return this.permissionMessage;
+ }
@ -1816,7 +1813,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * Sets the permission message.
+ *
+ * @param permissionMessage the permission message
+ * @deprecated permission messages have not worked for player-executed
+ * commands since 1.13 as clients without permission to execute a command
+ * are unaware of its existence and therefore will not send an unknown
+ * command execution to the server. This message will only ever be shown to
+ * consoles or when this command is executed with
+ * {@link Bukkit#dispatchCommand(CommandSender, String)}.
+ */
+ @Deprecated
+ public void permissionMessage(net.kyori.adventure.text.@Nullable Component permissionMessage) {
+ this.permissionMessage = permissionMessage;
+ }
@ -3354,7 +3358,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final InetAddress ipAddress;
private final UUID uniqueId;
@@ -0,0 +0,0 @@ public class AsyncPlayerPreLoginEvent extends Event {
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId) {
public AsyncPlayerPreLoginEvent(@NotNull final String name, @NotNull final InetAddress ipAddress, @NotNull final UUID uniqueId, boolean transferred) {
super(true);
this.result = Result.ALLOWED;
- this.message = "";
@ -4357,187 +4361,7 @@ diff --git a/src/main/java/org/bukkit/inventory/meta/BookMeta.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/inventory/meta/BookMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/BookMeta.java
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
* Represents a book ({@link Material#WRITABLE_BOOK} or {@link
* Material#WRITTEN_BOOK}) that can have a title, an author, and pages.
*/
-public interface BookMeta extends ItemMeta {
+public interface BookMeta extends ItemMeta, net.kyori.adventure.inventory.Book { // Paper
/**
* Represents the generation (or level of copying) of a written book
@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta {
*/
boolean hasPages();
+ // Paper start
+ /**
+ * Gets the title of the book.
+ * <p>
+ * Plugins should check that hasTitle() returns true before calling this
+ * method.
+ *
+ * @return the title of the book
+ */
+ @Override
+ net.kyori.adventure.text.@Nullable Component title();
+
+ /**
+ * Sets the title of the book.
+ * <p>
+ * Limited to 32 characters. Removes title when given null.
+ *
+ * @param title the title to set
+ * @return the same {@link BookMeta} instance
+ */
+ @org.jetbrains.annotations.Contract(value = "_ -> this", pure = false)
+ @Override
+ @NotNull BookMeta title(net.kyori.adventure.text.@Nullable Component title);
+
+ /**
+ * Gets the author of the book.
+ * <p>
+ * Plugins should check that hasAuthor() returns true before calling this
+ * method.
+ *
+ * @return the author of the book
+ */
+ @Override
+ net.kyori.adventure.text.@Nullable Component author();
+
+ /**
+ * Sets the author of the book. Removes author when given null.
+ *
+ * @param author the author to set
+ * @return the same {@link BookMeta} instance
+ */
+ @org.jetbrains.annotations.Contract(value = "_ -> this", pure = false)
+ @Override
+ @NotNull BookMeta author(net.kyori.adventure.text.@Nullable Component author);
+
+ /**
+ * Gets the specified page in the book. The page must exist.
+ * <p>
+ * Pages are 1-indexed.
+ *
+ * @param page the page number to get, in range [1, getPageCount()]
+ * @return the page from the book
+ */
+ net.kyori.adventure.text.@NotNull Component page(int page);
+
+ /**
+ * Sets the specified page in the book. Pages of the book must be
+ * contiguous.
+ * <p>
+ * The data can be up to 1024 characters in length, additional characters
+ * are truncated.
+ * <p>
+ * Pages are 1-indexed.
+ *
+ * @param page the page number to set, in range [1, getPageCount()]
+ * @param data the data to set for that page
+ */
+ void page(int page, net.kyori.adventure.text.@NotNull Component data);
+
+ /**
+ * Adds new pages to the end of the book. Up to a maximum of 100 pages with
+ * 1024 characters per page.
+ *
+ * @param pages A list of strings, each being a page
+ */
+ void addPages(net.kyori.adventure.text.@NotNull Component @NotNull ... pages);
+
+ interface BookMetaBuilder extends Builder {
+
+ @Override
+ @NotNull BookMetaBuilder title(net.kyori.adventure.text.@Nullable Component title);
+
+ @Override
+ @NotNull BookMetaBuilder author(net.kyori.adventure.text.@Nullable Component author);
+
+ @Override
+ @NotNull BookMetaBuilder addPage(net.kyori.adventure.text.@NotNull Component page);
+
+ @Override
+ @NotNull BookMetaBuilder pages(net.kyori.adventure.text.@NotNull Component @NotNull ... pages);
+
+ @Override
+ @NotNull BookMetaBuilder pages(java.util.@NotNull Collection<net.kyori.adventure.text.Component> pages);
+
+ @Override
+ @NotNull BookMeta build();
+ }
+
+ @Override
+ @NotNull BookMetaBuilder toBuilder();
+
+ // Paper end
+
/**
* Gets the specified page in the book. The given page must exist.
* <p>
@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta {
*
* @param page the page number to get, in range [1, getPageCount()]
* @return the page from the book
+ * @deprecated in favour of {@link #page(int)}
*/
@NotNull
+ @Deprecated // Paper
String getPage(int page);
/**
@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta {
*
* @param page the page number to set, in range [1, getPageCount()]
* @param data the data to set for that page
+ * @deprecated in favour of {@link #page(int, net.kyori.adventure.text.Component)}
*/
+ @Deprecated // Paper
void setPage(int page, @NotNull String data);
/**
* Gets all the pages in the book.
*
* @return list of all the pages in the book
+ * @deprecated in favour of {@link #pages()}
*/
@NotNull
+ @Deprecated // Paper
List<String> getPages();
/**
@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta {
* pages. Maximum 100 pages with 1024 characters per page.
*
* @param pages A list of pages to set the book to use
+ * @deprecated in favour of {@link #pages(List)}
*/
+ @Deprecated // Paper
void setPages(@NotNull List<String> pages);
/**
@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta {
* pages. Maximum 100 pages with 1024 characters per page.
*
* @param pages A list of strings, each being a page
+ * @deprecated in favour of {@link #pages(net.kyori.adventure.text.Component...)}
*/
+ @Deprecated // Paper
void setPages(@NotNull String... pages);
/**
@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta {
* 1024 characters per page.
*
* @param pages A list of strings, each being a page
+ * @deprecated in favour of {@link #addPages(net.kyori.adventure.text.Component...)}
*/
+ @Deprecated // Paper
void addPage(@NotNull String... pages);
/**
@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta {
@@ -0,0 +0,0 @@ public interface BookMeta extends WritableBookMeta {
*
* @param page the page number to get
* @return the page from the book
@ -4548,7 +4372,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public BaseComponent[] getPage(int page) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta {
@@ -0,0 +0,0 @@ public interface BookMeta extends WritableBookMeta {
*
* @param page the page number to set
* @param data the data to set for that page
@ -4558,7 +4382,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void setPage(int page, @Nullable BaseComponent... data) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta {
@@ -0,0 +0,0 @@ public interface BookMeta extends WritableBookMeta {
* Gets all the pages in the book.
*
* @return list of all the pages in the book
@ -4569,7 +4393,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public List<BaseComponent[]> getPages() {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta {
@@ -0,0 +0,0 @@ public interface BookMeta extends WritableBookMeta {
* pages. Maximum 50 pages with 256 characters per page.
*
* @param pages A list of pages to set the book to use
@ -4579,7 +4403,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void setPages(@NotNull List<BaseComponent[]> pages) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta {
@@ -0,0 +0,0 @@ public interface BookMeta extends WritableBookMeta {
* pages. Maximum 50 pages with 256 characters per page.
*
* @param pages A list of component arrays, each being a page
@ -4589,7 +4413,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void setPages(@NotNull BaseComponent[]... pages) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -0,0 +0,0 @@ public interface BookMeta extends ItemMeta {
@@ -0,0 +0,0 @@ public interface BookMeta extends WritableBookMeta {
* with 256 characters per page.
*
* @param pages A list of component arrays, each being a page
@ -4692,6 +4516,189 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Deprecated // Paper
void setLore(@Nullable List<String> lore);
/**
diff --git a/src/main/java/org/bukkit/inventory/meta/WritableBookMeta.java b/src/main/java/org/bukkit/inventory/meta/WritableBookMeta.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/inventory/meta/WritableBookMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/WritableBookMeta.java
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull;
* Represents a book ({@link Material#WRITABLE_BOOK} or {@link
* Material#WRITTEN_BOOK}) that can have pages.
*/
-public interface WritableBookMeta extends ItemMeta {
+public interface WritableBookMeta extends ItemMeta, net.kyori.adventure.inventory.Book { // Paper
/**
* Checks for the existence of pages in the book.
@@ -0,0 +0,0 @@ public interface WritableBookMeta extends ItemMeta {
*/
boolean hasPages();
+ // Paper start
+ /**
+ * Gets the title of the book.
+ * <p>
+ * Plugins should check that hasTitle() returns true before calling this
+ * method.
+ *
+ * @return the title of the book
+ */
+ @Override
+ net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component title();
+
+ /**
+ * Sets the title of the book.
+ * <p>
+ * Limited to 32 characters. Removes title when given null.
+ *
+ * @param title the title to set
+ * @return the same {@link BookMeta} instance
+ */
+ @org.jetbrains.annotations.Contract(value = "_ -> this", pure = false)
+ @Override
+ @NotNull BookMeta title(net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component title);
+
+ /**
+ * Gets the author of the book.
+ * <p>
+ * Plugins should check that hasAuthor() returns true before calling this
+ * method.
+ *
+ * @return the author of the book
+ */
+ @Override
+ net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component author();
+
+ /**
+ * Sets the author of the book. Removes author when given null.
+ *
+ * @param author the author to set
+ * @return the same {@link BookMeta} instance
+ */
+ @org.jetbrains.annotations.Contract(value = "_ -> this", pure = false)
+ @Override
+ @NotNull BookMeta author(net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component author);
+
+ /**
+ * Gets the specified page in the book. The page must exist.
+ * <p>
+ * Pages are 1-indexed.
+ *
+ * @param page the page number to get, in range [1, getPageCount()]
+ * @return the page from the book
+ */
+ net.kyori.adventure.text.@NotNull Component page(int page);
+
+ /**
+ * Sets the specified page in the book. Pages of the book must be
+ * contiguous.
+ * <p>
+ * The data can be up to 1024 characters in length, additional characters
+ * are truncated.
+ * <p>
+ * Pages are 1-indexed.
+ *
+ * @param page the page number to set, in range [1, getPageCount()]
+ * @param data the data to set for that page
+ */
+ void page(int page, net.kyori.adventure.text.@NotNull Component data);
+
+ /**
+ * Adds new pages to the end of the book. Up to a maximum of 100 pages with
+ * 1024 characters per page.
+ *
+ * @param pages A list of strings, each being a page
+ */
+ void addPages(net.kyori.adventure.text.@NotNull Component @NotNull ... pages);
+
+ interface BookMetaBuilder extends net.kyori.adventure.inventory.Book.Builder {
+
+ @Override
+ @NotNull BookMetaBuilder title(net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component title);
+
+ @Override
+ @NotNull BookMetaBuilder author(net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component author);
+
+ @Override
+ @NotNull BookMetaBuilder addPage(net.kyori.adventure.text.@NotNull Component page);
+
+ @Override
+ @NotNull BookMetaBuilder pages(net.kyori.adventure.text.@NotNull Component @NotNull ... pages);
+
+ @Override
+ @NotNull BookMetaBuilder pages(java.util.@NotNull Collection<net.kyori.adventure.text.Component> pages);
+
+ @Override
+ @NotNull BookMeta build();
+ }
+
+ @Override
+ @NotNull BookMetaBuilder toBuilder();
+ // Paper end
+
/**
* Gets the specified page in the book. The given page must exist.
* <p>
@@ -0,0 +0,0 @@ public interface WritableBookMeta extends ItemMeta {
*
* @param page the page number to get, in range [1, getPageCount()]
* @return the page from the book
+ * @deprecated in favour of {@link #page(int)}
*/
@NotNull
+ @Deprecated // Paper
String getPage(int page);
/**
@@ -0,0 +0,0 @@ public interface WritableBookMeta extends ItemMeta {
*
* @param page the page number to set, in range [1, getPageCount()]
* @param data the data to set for that page
+ * @deprecated in favour of {@link #page(int, net.kyori.adventure.text.Component)}
*/
+ @Deprecated // Paper
void setPage(int page, @NotNull String data);
/**
* Gets all the pages in the book.
*
* @return list of all the pages in the book
+ * @deprecated in favour of {@link #pages()}
*/
@NotNull
+ @Deprecated // Paper
List<String> getPages();
/**
@@ -0,0 +0,0 @@ public interface WritableBookMeta extends ItemMeta {
* pages. Maximum 100 pages with 1024 characters per page.
*
* @param pages A list of pages to set the book to use
+ * @deprecated in favour of {@link #pages(List)}
*/
+ @Deprecated // Paper
void setPages(@NotNull List<String> pages);
/**
@@ -0,0 +0,0 @@ public interface WritableBookMeta extends ItemMeta {
* pages. Maximum 100 pages with 1024 characters per page.
*
* @param pages A list of strings, each being a page
+ * @deprecated in favour of {@link #pages(net.kyori.adventure.text.Component...)}
*/
+ @Deprecated // Paper
void setPages(@NotNull String... pages);
/**
@@ -0,0 +0,0 @@ public interface WritableBookMeta extends ItemMeta {
* 1024 characters per page.
*
* @param pages A list of strings, each being a page
+ * @deprecated in favour of {@link #addPages(net.kyori.adventure.text.Component...)}
*/
+ @Deprecated // Paper
void addPage(@NotNull String... pages);
/**
diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -4724,9 +4731,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
@@ -0,0 +0,0 @@ public interface TrimPattern extends Keyed, Translatable {
* {@link Material#HOST_ARMOR_TRIM_SMITHING_TEMPLATE}.
* {@link Material#BOLT_ARMOR_TRIM_SMITHING_TEMPLATE}.
*/
public static final TrimPattern HOST = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("host"));
public static final TrimPattern BOLT = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft("bolt"));
+
+ // Paper start - adventure
+ /**