Adventure
Co-authored-by: zml <zml@stellardrift.ca> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Yannick Lamprecht <yannicklamprecht@live.de>
This commit is contained in:
@@ -269,12 +269,26 @@ public interface InventoryView {
|
||||
*/
|
||||
public boolean setProperty(@NotNull Property prop, int value);
|
||||
|
||||
// Paper start
|
||||
/**
|
||||
* Get the title of this inventory window.
|
||||
*
|
||||
* @return The title.
|
||||
*/
|
||||
@NotNull
|
||||
default net.kyori.adventure.text.Component title() {
|
||||
return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(this.getTitle());
|
||||
}
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
* Get the title of this inventory window.
|
||||
*
|
||||
* @return The title.
|
||||
* @deprecated in favour of {@link #title()}
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
@NotNull
|
||||
public String getTitle();
|
||||
|
||||
/**
|
||||
|
||||
@@ -200,4 +200,24 @@ public interface ItemFactory {
|
||||
*/
|
||||
@NotNull
|
||||
ItemStack enchantItem(@NotNull final ItemStack item, final int level, final boolean allowTreasures);
|
||||
|
||||
// Paper start - Adventure
|
||||
/**
|
||||
* Creates a hover event for the given item.
|
||||
*
|
||||
* @param item The item
|
||||
* @return A hover event
|
||||
*/
|
||||
@NotNull
|
||||
net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowItem> asHoverEvent(final @NotNull ItemStack item, final @NotNull java.util.function.UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowItem> op);
|
||||
|
||||
/**
|
||||
* Get the formatted display name of the {@link ItemStack}.
|
||||
*
|
||||
* @param itemStack the {@link ItemStack}
|
||||
* @return display name of the {@link ItemStack}
|
||||
*/
|
||||
@NotNull
|
||||
net.kyori.adventure.text.Component displayName(@NotNull ItemStack itemStack);
|
||||
// Paper end - Adventure
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* use this class to encapsulate Materials for which {@link Material#isItem()}
|
||||
* returns false.</b>
|
||||
*/
|
||||
public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable {
|
||||
public class ItemStack implements Cloneable, ConfigurationSerializable, Translatable, net.kyori.adventure.text.event.HoverEventSource<net.kyori.adventure.text.event.HoverEvent.ShowItem> { // Paper
|
||||
private Material type = Material.AIR;
|
||||
private int amount = 0;
|
||||
private MaterialData data = null;
|
||||
@@ -626,4 +626,21 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
public String getTranslationKey() {
|
||||
return Bukkit.getUnsafe().getTranslationKey(this);
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@NotNull
|
||||
@Override
|
||||
public net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowItem> asHoverEvent(final @NotNull java.util.function.UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowItem> op) {
|
||||
return org.bukkit.Bukkit.getServer().getItemFactory().asHoverEvent(this, op);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the formatted display name of the {@link ItemStack}.
|
||||
*
|
||||
* @return display name of the {@link ItemStack}
|
||||
*/
|
||||
public net.kyori.adventure.text.@NotNull Component displayName() {
|
||||
return Bukkit.getServer().getItemFactory().displayName(this);
|
||||
}
|
||||
// Paper end
|
||||
}
|
||||
|
||||
@@ -145,11 +145,45 @@ public interface MenuType extends Keyed {
|
||||
* @param player the player the view belongs to
|
||||
* @param title the title of the view
|
||||
* @return the created {@link InventoryView}
|
||||
* @deprecated Use {@link #create(HumanEntity, net.kyori.adventure.text.Component)} instead.
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(since = "1.21") // Paper - adventure
|
||||
V create(@NotNull HumanEntity player, @NotNull String title);
|
||||
|
||||
// Paper start - adventure
|
||||
/**
|
||||
* Creates a view of the specified menu type.
|
||||
* <p>
|
||||
* The player provided to create this view must be the player the view
|
||||
* is opened for. See {@link HumanEntity#openInventory(InventoryView)}
|
||||
* for more information.
|
||||
*
|
||||
* @param player the player the view belongs to
|
||||
* @param title the title of the view
|
||||
* @return the created {@link InventoryView}
|
||||
*/
|
||||
@NotNull
|
||||
V create(@NotNull HumanEntity player, @NotNull net.kyori.adventure.text.Component title);
|
||||
// Paper end - adventure
|
||||
}
|
||||
|
||||
// Paper start - adventure
|
||||
/**
|
||||
* Creates a view of the specified menu type.
|
||||
* <p>
|
||||
* The player provided to create this view must be the player the view
|
||||
* is opened for. See {@link HumanEntity#openInventory(InventoryView)}
|
||||
* for more information.
|
||||
*
|
||||
* @param player the player the view belongs to
|
||||
* @param title the title of the view
|
||||
* @return the created {@link InventoryView}
|
||||
*/
|
||||
@NotNull
|
||||
InventoryView create(@NotNull HumanEntity player, @NotNull net.kyori.adventure.text.Component title);
|
||||
// Paper end - adventure
|
||||
|
||||
/**
|
||||
* Yields this MenuType as a typed version of itself with a plain
|
||||
* {@link InventoryView} representing it.
|
||||
|
||||
@@ -7,10 +7,15 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Represents a {@link Material#WRITTEN_BOOK}) that can have a title, an author,
|
||||
* Represents a {@link Material#WRITTEN_BOOK} that can have a title, an author,
|
||||
* and pages.
|
||||
* <p>
|
||||
* Before using this type, make sure to check the itemstack's material with
|
||||
* {@link org.bukkit.inventory.ItemStack#getType()}. {@code instanceof} on
|
||||
* the meta instance is not sufficient due to unusual inheritance
|
||||
* with relation to {@link WritableBookMeta}.
|
||||
*/
|
||||
public interface BookMeta extends WritableBookMeta {
|
||||
public interface BookMeta extends WritableBookMeta, net.kyori.adventure.inventory.Book { // Paper - adventure
|
||||
|
||||
/**
|
||||
* Represents the generation (or level of copying) of a written book
|
||||
@@ -116,6 +121,153 @@ public interface BookMeta extends WritableBookMeta {
|
||||
@NotNull
|
||||
BookMeta clone();
|
||||
|
||||
// Paper start - adventure
|
||||
//<editor-fold desc="deprecations" defaultstate="collapsed">
|
||||
/**
|
||||
* @deprecated use {@link #page(int)}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
@NotNull String getPage(int page);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #page(int, net.kyori.adventure.text.Component)}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
void setPage(int page, @NotNull String data);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #pages()}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
@NotNull List<String> getPages();
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #pages(List)}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
void setPages(@NotNull List<String> pages);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #pages(net.kyori.adventure.text.Component...)}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
void setPages(@NotNull String... pages);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #addPages(net.kyori.adventure.text.Component...)}
|
||||
*/
|
||||
@Deprecated
|
||||
@Override
|
||||
void addPage(@NotNull String... pages);
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* 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 net.kyori.adventure.inventory.Book.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
|
||||
|
||||
// Spigot start
|
||||
public class Spigot {
|
||||
|
||||
@@ -124,8 +276,10 @@ public interface BookMeta extends WritableBookMeta {
|
||||
*
|
||||
* @param page the page number to get
|
||||
* @return the page from the book
|
||||
* @deprecated in favour of {@link #page(int)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated // Paper
|
||||
public BaseComponent[] getPage(int page) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
@@ -139,7 +293,9 @@ public interface BookMeta extends WritableBookMeta {
|
||||
*
|
||||
* @param page the page number to set
|
||||
* @param data the data to set for that page
|
||||
* @deprecated in favour of {@link #page(int, net.kyori.adventure.text.Component)}
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
public void setPage(int page, @Nullable BaseComponent... data) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
@@ -148,8 +304,10 @@ public interface BookMeta extends WritableBookMeta {
|
||||
* 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
|
||||
public List<BaseComponent[]> getPages() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
@@ -159,7 +317,9 @@ 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
|
||||
* @deprecated in favour of {@link #pages(java.util.List)}
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
public void setPages(@NotNull List<BaseComponent[]> pages) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
@@ -169,7 +329,9 @@ 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
|
||||
* @deprecated in favour of {@link #pages(net.kyori.adventure.text.Component...)}
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
public void setPages(@NotNull BaseComponent[]... pages) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
@@ -179,7 +341,9 @@ public interface BookMeta extends WritableBookMeta {
|
||||
* with 256 characters per page.
|
||||
*
|
||||
* @param pages A list of component arrays, each being a page
|
||||
* @deprecated in favour of {@link #addPages(net.kyori.adventure.text.Component...)}
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
public void addPage(@NotNull BaseComponent[]... pages) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@@ -38,12 +38,65 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public interface ItemMeta extends Cloneable, ConfigurationSerializable, PersistentDataHolder {
|
||||
|
||||
// Paper start
|
||||
/**
|
||||
* Checks for existence of a custom name.
|
||||
*
|
||||
* @return true if this has a custom name
|
||||
*/
|
||||
boolean hasCustomName();
|
||||
|
||||
/**
|
||||
* Gets the custom name.
|
||||
*
|
||||
* <p>Plugins should check that {@link #hasCustomName()} returns {@code true} before calling this method.</p>
|
||||
*
|
||||
* @return the custom name
|
||||
*/
|
||||
net.kyori.adventure.text.@Nullable Component customName();
|
||||
|
||||
/**
|
||||
* Sets the custom name.
|
||||
*
|
||||
* @param customName the custom name to set
|
||||
*/
|
||||
void customName(final net.kyori.adventure.text.@Nullable Component customName);
|
||||
|
||||
/**
|
||||
* Checks for existence of a display name.
|
||||
*
|
||||
* @apiNote This method is obsolete, use {@link #hasCustomName()} instead.
|
||||
* @return true if this has a display name
|
||||
*/
|
||||
boolean hasDisplayName();
|
||||
@ApiStatus.Obsolete(since = "1.21.4")
|
||||
default boolean hasDisplayName() {
|
||||
return this.hasCustomName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the display name.
|
||||
*
|
||||
* <p>Plugins should check that {@link #hasDisplayName()} returns <code>true</code> before calling this method.</p>
|
||||
*
|
||||
* @apiNote This method is obsolete, use {@link #customName()} instead.
|
||||
* @return the display name
|
||||
*/
|
||||
@ApiStatus.Obsolete(since = "1.21.4")
|
||||
default net.kyori.adventure.text.@Nullable Component displayName() {
|
||||
return this.customName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the display name.
|
||||
*
|
||||
* @param displayName the display name to set
|
||||
* @apiNote This method is obsolete, use {@link #customName(Component)} instead.
|
||||
*/
|
||||
@ApiStatus.Obsolete(since = "1.21.4")
|
||||
default void displayName(final net.kyori.adventure.text.@Nullable Component displayName) {
|
||||
this.customName(displayName);
|
||||
}
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
* Gets the display name that is set.
|
||||
@@ -52,7 +105,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
* before calling this method.
|
||||
*
|
||||
* @return the display name that is set
|
||||
* @deprecated in favour of {@link #displayName()}
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
@NotNull
|
||||
String getDisplayName();
|
||||
|
||||
@@ -60,7 +115,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
* Sets the display name.
|
||||
*
|
||||
* @param name the name to set
|
||||
* @deprecated in favour of {@link #displayName(net.kyori.adventure.text.Component)}
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
void setDisplayName(@Nullable String name);
|
||||
|
||||
/**
|
||||
@@ -73,6 +130,32 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
*/
|
||||
boolean hasItemName();
|
||||
|
||||
// Paper start
|
||||
/**
|
||||
* Gets the item name component that is set.
|
||||
* <br>
|
||||
* Item name differs from display name in that it is cannot be edited by an
|
||||
* anvil, is not styled with italics, and does not show labels.
|
||||
* <p>
|
||||
* Plugins should check that {@link #hasItemName()} returns <code>true</code> before
|
||||
* calling this method.
|
||||
*
|
||||
* @return the item name that is set
|
||||
* @see #hasItemName()
|
||||
*/
|
||||
@org.jetbrains.annotations.NotNull
|
||||
Component itemName();
|
||||
|
||||
/**
|
||||
* Sets the item name.
|
||||
* <br>
|
||||
* Item name differs from display name in that it is cannot be edited by an
|
||||
* anvil, is not styled with italics, and does not show labels.
|
||||
*
|
||||
* @param name the name to set, null to remove it
|
||||
*/
|
||||
void itemName(@Nullable final Component name);
|
||||
// Paper end
|
||||
/**
|
||||
* Gets the item name that is set.
|
||||
* <br>
|
||||
@@ -83,7 +166,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
* calling this method.
|
||||
*
|
||||
* @return the item name that is set
|
||||
* @deprecated in favour of {@link #itemName()}
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
@NotNull
|
||||
String getItemName();
|
||||
|
||||
@@ -94,7 +179,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
* anvil, is not styled with italics, and does not show labels.
|
||||
*
|
||||
* @param name the name to set
|
||||
* @deprecated in favour of {@link #itemName(Component)}
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
void setItemName(@Nullable String name);
|
||||
|
||||
/**
|
||||
@@ -135,6 +222,24 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
*/
|
||||
boolean hasLore();
|
||||
|
||||
// Paper start
|
||||
/**
|
||||
* Gets the lore.
|
||||
*
|
||||
* <p>Plugins should check that {@link #hasLore()} returns <code>true</code> before calling this method.</p>
|
||||
*
|
||||
* @return the lore
|
||||
*/
|
||||
@Nullable List<net.kyori.adventure.text.Component> lore();
|
||||
|
||||
/**
|
||||
* Sets the lore.
|
||||
*
|
||||
* @param lore the lore to set
|
||||
*/
|
||||
void lore(final @Nullable List<? extends net.kyori.adventure.text.Component> lore);
|
||||
// Paper end
|
||||
|
||||
/**
|
||||
* Gets the lore that is set.
|
||||
* <p>
|
||||
@@ -142,7 +247,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
* calling this method.
|
||||
*
|
||||
* @return a list of lore that is set
|
||||
* @deprecated in favour of {@link #lore()}
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
@Nullable
|
||||
List<String> getLore();
|
||||
|
||||
@@ -151,7 +258,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
* Removes lore when given null.
|
||||
*
|
||||
* @param lore the lore that will be set
|
||||
* @deprecated in favour of {@link #lore(List)}
|
||||
*/
|
||||
@Deprecated // Paper
|
||||
void setLore(@Nullable List<String> lore);
|
||||
|
||||
/**
|
||||
|
||||
@@ -149,27 +149,64 @@ public interface PotionMeta extends ItemMeta {
|
||||
/**
|
||||
* Checks for existence of a custom potion name translation suffix.
|
||||
*
|
||||
* @deprecated conflicting name, use {@link #hasCustomPotionName()}
|
||||
* @return true if this has a custom potion name
|
||||
*/
|
||||
boolean hasCustomName();
|
||||
@Deprecated(forRemoval = true, since = "1.21.4")
|
||||
default boolean hasCustomName() {
|
||||
return this.hasCustomPotionName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the potion name translation suffix that is set.
|
||||
* <p>
|
||||
* Plugins should check that hasCustomName() returns <code>true</code>
|
||||
* Plugins should check that {@link #hasCustomPotionName()} returns {@code true}
|
||||
* before calling this method.
|
||||
*
|
||||
* @deprecated conflicting name, use {@link #getCustomPotionName()}
|
||||
* @return the potion name that is set
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.21.4")
|
||||
@Nullable
|
||||
default String getCustomName() {
|
||||
return this.getCustomPotionName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the potion name translation suffix.
|
||||
*
|
||||
* @deprecated conflicting name, use {@link #setCustomPotionName(String)}
|
||||
* @param name the name to set
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "1.21.4")
|
||||
default void setCustomName(@Nullable String name) {
|
||||
this.setCustomPotionName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for existence of a custom potion name translation suffix.
|
||||
*
|
||||
* @return true if this has a custom potion name
|
||||
*/
|
||||
boolean hasCustomPotionName();
|
||||
|
||||
/**
|
||||
* Gets the potion name translation suffix that is set.
|
||||
* <p>
|
||||
* Plugins should check that {@link #hasCustomPotionName()} returns {@code true}
|
||||
* before calling this method.
|
||||
*
|
||||
* @return the potion name that is set
|
||||
*/
|
||||
@Nullable
|
||||
String getCustomName();
|
||||
String getCustomPotionName();
|
||||
|
||||
/**
|
||||
* Sets the potion name translation suffix.
|
||||
*
|
||||
* @param name the name to set
|
||||
*/
|
||||
void setCustomName(@Nullable String name);
|
||||
void setCustomPotionName(@Nullable String name);
|
||||
|
||||
@Override
|
||||
PotionMeta clone();
|
||||
|
||||
@@ -5,8 +5,14 @@ import org.bukkit.Material;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents a book ({@link Material#WRITABLE_BOOK} or {@link
|
||||
* Material#WRITTEN_BOOK}) that can have pages.
|
||||
* Represents a book ({@link Material#WRITABLE_BOOK}) that can have pages.
|
||||
* <p>
|
||||
* For {@link Material#WRITTEN_BOOK}, use {@link BookMeta}.
|
||||
* <p>
|
||||
* Before using this type, make sure to check the itemstack's material with
|
||||
* {@link org.bukkit.inventory.ItemStack#getType()}. {@code instanceof} on
|
||||
* the meta instance is not sufficient due to unusual inheritance
|
||||
* with relation to {@link BookMeta}.
|
||||
*/
|
||||
public interface WritableBookMeta extends ItemMeta {
|
||||
|
||||
|
||||
@@ -61,4 +61,21 @@ public interface TrimMaterial extends Keyed, Translatable {
|
||||
private static TrimMaterial getTrimMaterial(@NotNull String key) {
|
||||
return Registry.TRIM_MATERIAL.getOrThrow(NamespacedKey.minecraft(key));
|
||||
}
|
||||
|
||||
// Paper start - adventure
|
||||
/**
|
||||
* Get the description of this {@link TrimMaterial}.
|
||||
*
|
||||
* @return the description
|
||||
*/
|
||||
net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component description();
|
||||
|
||||
/**
|
||||
* @deprecated this method assumes that {@link #description()} will
|
||||
* always be a translatable component which is not guaranteed.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated(forRemoval = true)
|
||||
@org.jetbrains.annotations.NotNull String getTranslationKey();
|
||||
// Paper end - adventure
|
||||
}
|
||||
|
||||
@@ -89,4 +89,21 @@ public interface TrimPattern extends Keyed, Translatable {
|
||||
private static TrimPattern getTrimPattern(@NotNull String key) {
|
||||
return Registry.TRIM_PATTERN.getOrThrow(NamespacedKey.minecraft(key));
|
||||
}
|
||||
|
||||
// Paper start - adventure
|
||||
/**
|
||||
* Get the description of this {@link TrimPattern}.
|
||||
*
|
||||
* @return the description
|
||||
*/
|
||||
net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component description();
|
||||
|
||||
/**
|
||||
* @deprecated this method assumes that {@link #description()} will
|
||||
* always be a translatable component which is not guaranteed.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated(forRemoval = true)
|
||||
@org.jetbrains.annotations.NotNull String getTranslationKey();
|
||||
// Paper end - adventure
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user