Adventure 4.9.1 (#6634)

Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
This commit is contained in:
Kezz 2021-09-23 22:07:44 +01:00 committed by GitHub
parent 1707c10395
commit 397349e0aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 343 additions and 158 deletions

View file

@ -7,14 +7,14 @@ 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 ccf5b30fa48e641fc8d04f185f9ffca55d4e2154..0ed6d9e6619db7559dc5b65a8da6e54e6e15d31c 100644
index 3a395a44ff50a77895341bbbfb8c81deede41b8b..6ebea1d9fafb08ede7e37dfe1b145a676c7aaaf9 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -10,6 +10,19 @@ java {
withJavadocJar()
}
+val adventureVersion = "4.8.1"
+val adventureVersion = "4.9.1"
+val apiAndDocs by configurations.creating {
+ attributes {
+ attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
@ -42,7 +42,7 @@ index ccf5b30fa48e641fc8d04f185f9ffca55d4e2154..0ed6d9e6619db7559dc5b65a8da6e54e
compileOnly("org.apache.maven:maven-resolver-provider:3.8.1")
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0")
@@ -61,10 +79,17 @@ tasks.jar {
@@ -67,10 +85,17 @@ tasks.jar {
}
tasks.withType<Javadoc>().configureEach {
@ -1401,7 +1401,7 @@ index 25a6f9313a1953def7470e411b53016f2ca14bef..03d8ac1b41659540d7eb3d7e218cdfaa
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 6c910e09eda6f4f08226ccc75189171015a72b85..d68b2c6044db7740ef4d737e1b2955dfa653edb3 100644
index 6c910e09eda6f4f08226ccc75189171015a72b85..696bf438012fd93f38495024ca49999cec151168 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -33,7 +33,28 @@ import org.jetbrains.annotations.Nullable;
@ -1697,7 +1697,26 @@ index 6c910e09eda6f4f08226ccc75189171015a72b85..d68b2c6044db7740ef4d737e1b2955df
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) throws IllegalArgumentException;
/**
@@ -1266,6 +1437,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1020,7 +1191,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param title Title text
* @param subtitle Subtitle text
- * @deprecated API behavior subject to change
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
*/
@Deprecated
public void sendTitle(@Nullable String title, @Nullable String subtitle);
@@ -1039,7 +1210,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.
+ * @deprecated Use {@link #showTitle(net.kyori.adventure.title.Title)} or {@link #sendTitlePart(net.kyori.adventure.title.TitlePart, Object)}
*/
+ @Deprecated // Paper - Adventure
public void sendTitle(@Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut);
/**
@@ -1266,6 +1439,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public int getClientViewDistance();
@ -1712,7 +1731,7 @@ index 6c910e09eda6f4f08226ccc75189171015a72b85..d68b2c6044db7740ef4d737e1b2955df
/**
* Gets the player's estimated ping in milliseconds.
*
@@ -1291,8 +1470,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1291,8 +1472,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* they wish.
*
* @return the player's locale
@ -1723,7 +1742,7 @@ index 6c910e09eda6f4f08226ccc75189171015a72b85..d68b2c6044db7740ef4d737e1b2955df
public String getLocale();
/**
@@ -1310,6 +1491,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1310,6 +1493,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void openBook(@NotNull ItemStack book);
@ -1738,7 +1757,7 @@ index 6c910e09eda6f4f08226ccc75189171015a72b85..d68b2c6044db7740ef4d737e1b2955df
// Spigot start
public class Spigot extends Entity.Spigot {
@@ -1364,11 +1553,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1364,11 +1555,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
throw new UnsupportedOperationException("Not supported yet.");
}
@ -1752,7 +1771,7 @@ index 6c910e09eda6f4f08226ccc75189171015a72b85..d68b2c6044db7740ef4d737e1b2955df
@Override
public void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
@@ -1379,7 +1570,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1379,7 +1572,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param position the screen position
* @param component the components to send
@ -1762,7 +1781,7 @@ index 6c910e09eda6f4f08226ccc75189171015a72b85..d68b2c6044db7740ef4d737e1b2955df
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.");
}
@@ -1389,7 +1582,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1389,7 +1584,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param position the screen position
* @param components the components to send
@ -1772,7 +1791,7 @@ index 6c910e09eda6f4f08226ccc75189171015a72b85..d68b2c6044db7740ef4d737e1b2955df
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.");
}
@@ -1400,7 +1595,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1400,7 +1597,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
@ -1782,7 +1801,7 @@ index 6c910e09eda6f4f08226ccc75189171015a72b85..d68b2c6044db7740ef4d737e1b2955df
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.");
}
@@ -1411,7 +1608,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1411,7 +1610,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
@ -3571,6 +3590,45 @@ index 4dba721aefe4fc6699b3b4bfa7ecb0b19c2a2a1a..01dec2c877df58c9dc22445e8b1f9ce2
+ public @NotNull MapCursor addCursor(int x, int y, byte direction, byte type, boolean visible, @Nullable net.kyori.adventure.text.Component caption) {
+ return addCursor(new MapCursor((byte) x, (byte) y, direction, type, visible, caption));
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/permissions/Permissible.java b/src/main/java/org/bukkit/permissions/Permissible.java
index 228421154913116069c20323afb519bdde2134df..26791db3c267670d5782f1d2b67ff7d5b55b9dac 100644
--- a/src/main/java/org/bukkit/permissions/Permissible.java
+++ b/src/main/java/org/bukkit/permissions/Permissible.java
@@ -126,4 +126,34 @@ public interface Permissible extends ServerOperator {
*/
@NotNull
public Set<PermissionAttachmentInfo> getEffectivePermissions();
+
+ // Paper start - add TriState permission checks
+ /**
+ * Checks if this object has a permission set and, if it is set, the value of the permission.
+ *
+ * @param permission the permission to check
+ * @return a tri-state of if the permission is set and, if it is set, it's value
+ */
+ default net.kyori.adventure.util.@NotNull TriState permissionValue(final @NotNull Permission permission) {
+ if (this.isPermissionSet(permission)) {
+ return net.kyori.adventure.util.TriState.byBoolean(this.hasPermission(permission));
+ } else {
+ return net.kyori.adventure.util.TriState.NOT_SET;
+ }
+ }
+
+ /**
+ * Checks if this object has a permission set and, if it is set, the value of the permission.
+ *
+ * @param permission the permission to check
+ * @return a tri-state of if the permission is set and, if it is set, it's value
+ */
+ default net.kyori.adventure.util.@NotNull TriState permissionValue(final @NotNull String permission) {
+ if (this.isPermissionSet(permission)) {
+ return net.kyori.adventure.util.TriState.byBoolean(this.hasPermission(permission));
+ } else {
+ return net.kyori.adventure.util.TriState.NOT_SET;
+ }
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java