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:
Riley Park
2021-01-29 17:21:55 +01:00
parent 8888031206
commit 15081a5912
70 changed files with 3298 additions and 160 deletions

View File

@@ -423,7 +423,9 @@ public final class Bukkit {
*
* @param message the message
* @return the number of players
* @deprecated in favour of {@link Server#broadcast(net.kyori.adventure.text.Component)}
*/
@Deprecated // Paper
public static int broadcastMessage(@NotNull String message) {
return server.broadcastMessage(message);
}
@@ -1227,6 +1229,19 @@ public final class Bukkit {
server.shutdown();
}
// Paper start
/**
* Broadcast a message to all players.
* <p>
* This is the same as calling {@link #broadcast(net.kyori.adventure.text.Component,
* java.lang.String)} with the {@link Server#BROADCAST_CHANNEL_USERS} permission.
*
* @param message the message
* @return the number of players
*/
public static int broadcast(net.kyori.adventure.text.@NotNull Component message) {
return server.broadcast(message);
}
/**
* Broadcasts the specified message to every user with the given
* permission name.
@@ -1236,6 +1251,21 @@ public final class Bukkit {
* permissibles} must have to receive the broadcast
* @return number of message recipients
*/
public static int broadcast(net.kyori.adventure.text.@NotNull Component message, @NotNull String permission) {
return server.broadcast(message, permission);
}
// Paper end
/**
* Broadcasts the specified message to every user with the given
* permission name.
*
* @param message message to broadcast
* @param permission the required permission {@link Permissible
* permissibles} must have to receive the broadcast
* @return number of message recipients
* @deprecated in favour of {@link #broadcast(net.kyori.adventure.text.Component, String)}
*/
@Deprecated // Paper
public static int broadcast(@NotNull String message, @NotNull String permission) {
return server.broadcast(message, permission);
}
@@ -1497,6 +1527,7 @@ public final class Bukkit {
return server.createInventory(owner, type);
}
// Paper start
/**
* Creates an empty inventory with the specified type and title. If the type
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
@@ -1522,6 +1553,38 @@ public final class Bukkit {
* @see InventoryType#isCreatable()
*/
@NotNull
public static Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, net.kyori.adventure.text.@NotNull Component title) {
return server.createInventory(owner, type, title);
}
// Paper end
/**
* Creates an empty inventory with the specified type and title. If the type
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
* otherwise the new inventory has the normal size for its type.<br>
* It should be noted that some inventory types do not support titles and
* may not render with said titles on the Minecraft client.
* <br>
* {@link InventoryType#WORKBENCH} will not process crafting recipes if
* created with this method. Use
* {@link Player#openWorkbench(Location, boolean)} instead.
* <br>
* {@link InventoryType#ENCHANTING} will not process {@link ItemStack}s
* for possible enchanting results. Use
* {@link Player#openEnchanting(Location, boolean)} instead.
*
* @param owner The holder of the inventory; can be null if there's no holder.
* @param type The type of inventory to create.
* @param title The title of the inventory, to be displayed when it is viewed.
* @return The new inventory.
* @throws IllegalArgumentException if the {@link InventoryType} cannot be
* viewed.
* @deprecated in favour of {@link #createInventory(InventoryHolder, InventoryType, net.kyori.adventure.text.Component)}
*
* @see InventoryType#isCreatable()
*/
@Deprecated // Paper
@NotNull
public static Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull String title) {
return server.createInventory(owner, type, title);
}
@@ -1540,6 +1603,7 @@ public final class Bukkit {
return server.createInventory(owner, size);
}
// Paper start
/**
* Creates an empty inventory of type {@link InventoryType#CHEST} with the
* specified size and title.
@@ -1552,10 +1616,30 @@ public final class Bukkit {
* @throws IllegalArgumentException if the size is not a multiple of 9
*/
@NotNull
public static Inventory createInventory(@Nullable InventoryHolder owner, int size, net.kyori.adventure.text.@NotNull Component title) throws IllegalArgumentException {
return server.createInventory(owner, size, title);
}
// Paper end
/**
* Creates an empty inventory of type {@link InventoryType#CHEST} with the
* specified size and title.
*
* @param owner the holder of the inventory, or null to indicate no holder
* @param size a multiple of 9 as the size of inventory to create
* @param title the title of the inventory, displayed when inventory is
* viewed
* @return a new inventory
* @throws IllegalArgumentException if the size is not a multiple of 9
* @deprecated in favour of {@link #createInventory(InventoryHolder, InventoryType, net.kyori.adventure.text.Component)}
*/
@Deprecated // Paper
@NotNull
public static Inventory createInventory(@Nullable InventoryHolder owner, int size, @NotNull String title) throws IllegalArgumentException {
return server.createInventory(owner, size, title);
}
// Paper start
/**
* Creates an empty merchant.
*
@@ -1563,7 +1647,20 @@ public final class Bukkit {
* when the merchant inventory is viewed
* @return a new merchant
*/
public static @NotNull Merchant createMerchant(net.kyori.adventure.text.@Nullable Component title) {
return server.createMerchant(title);
}
// Paper start
/**
* Creates an empty merchant.
*
* @param title the title of the corresponding merchant inventory, displayed
* when the merchant inventory is viewed
* @return a new merchant
* @deprecated in favour of {@link #createMerchant(net.kyori.adventure.text.Component)}
*/
@NotNull
@Deprecated // Paper
public static Merchant createMerchant(@Nullable String title) {
return server.createMerchant(title);
}
@@ -1680,12 +1777,43 @@ public final class Bukkit {
return server.isPrimaryThread();
}
// Paper start
/**
* Gets the message that is displayed on the server list.
*
* @return the server's MOTD
*/
@NotNull public static net.kyori.adventure.text.Component motd() {
return server.motd();
}
/**
* Set the message that is displayed on the server list.
*
* @param motd The message to be displayed
*/
public static void motd(final net.kyori.adventure.text.@NotNull Component motd) {
server.motd(motd);
}
/**
* Gets the default message that is displayed when the server is stopped.
*
* @return the shutdown message
*/
public static net.kyori.adventure.text.@Nullable Component shutdownMessage() {
return server.shutdownMessage();
}
// Paper end
/**
* Gets the message that is displayed on the server list.
*
* @return the servers MOTD
* @deprecated in favour of {@link #motd()}
*/
@NotNull
@Deprecated // Paper
public static String getMotd() {
return server.getMotd();
}
@@ -1694,7 +1822,9 @@ public final class Bukkit {
* Set the message that is displayed on the server list.
*
* @param motd The message to be displayed
* @deprecated in favour of {@link #motd(net.kyori.adventure.text.Component)}
*/
@Deprecated // Paper
public static void setMotd(@NotNull String motd) {
server.setMotd(motd);
}
@@ -1714,8 +1844,10 @@ public final class Bukkit {
* Gets the default message that is displayed when the server is stopped.
*
* @return the shutdown message
* @deprecated in favour of {@link #shutdownMessage()}
*/
@Nullable
@Deprecated // Paper
public static String getShutdownMessage() {
return server.getShutdownMessage();
}