Skip to content

Commit

Permalink
Deprecate Player#boostElytra (#9899)
Browse files Browse the repository at this point in the history
The Paper method was chosen for deprecation because it was more
restrictive in that it has an isGliding check.
  • Loading branch information
notTamion committed Nov 4, 2023
1 parent 0609eea commit 5a34a7c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 53 deletions.
14 changes: 8 additions & 6 deletions patches/api/Add-sendOpLevel-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
@Nullable
Firework boostElytra(@NotNull ItemStack firework);
+
}
// Paper end

+ // Paper start - sendOpLevel API
+ /**
+ * Send a packet to the player indicating its operator status level.
+ * <p>
Expand All @@ -23,6 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @throws IllegalArgumentException If the level is negative or greater than {@code 4} (i.e. not within {@code [0, 4]}).
+ */
+ void sendOpLevel(byte level);
// Paper end
+ // Paper end - sendOpLevel API
+
// Spigot start
public class Spigot extends Entity.Spigot {

12 changes: 7 additions & 5 deletions patches/api/Custom-Chat-Completion-Suggestions-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException If the level is negative or greater than {@code 4} (i.e. not within {@code [0, 4]}).
*/
void sendOpLevel(byte level);
+
// Paper end - sendOpLevel API

+ // Paper start - custom chat completions API
+ /**
+ * Adds custom chat completion suggestions that the client will
+ * suggest when typing in chat.
Expand All @@ -35,6 +35,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+ @Deprecated(since = "1.20.1")
+ void removeAdditionalChatCompletions(@NotNull java.util.Collection<String> completions);
// Paper end
+ // Paper end - custom chat completions API
+
// Spigot start
public class Spigot extends Entity.Spigot {

7 changes: 6 additions & 1 deletion patches/api/Player-elytra-boost-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return The {@link Firework} boosting the Player or null if the spawning of the entity was cancelled
+ * @throws IllegalArgumentException if {@link #isGliding()} is false
+ * or if the {@code firework} isn't a {@link Material#FIREWORK_ROCKET}
+ * @deprecated use {@link HumanEntity#fireworkBoost(ItemStack)} instead. Note that this method <b>does not</b>
+ * check if the player is gliding or not.
+ */
+ @Nullable
+ Firework boostElytra(@NotNull ItemStack firework);
+ default Firework boostElytra(@NotNull ItemStack firework) {
+ com.google.common.base.Preconditions.checkState(this.isGliding(), "Player must be gliding");
+ return this.fireworkBoost(firework);
+ }
// Paper end

// Spigot start
12 changes: 7 additions & 5 deletions patches/server/Add-sendOpLevel-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
? (org.bukkit.entity.Firework) entity.getBukkitEntity()
: null;
}
+
// Paper end

+ // Paper start - sendOpLevel API
+ @Override
+ public void sendOpLevel(byte level) {
+ Preconditions.checkArgument(level >= 0 && level <= 4, "Level must be within [0, 4]");
+
+ this.getHandle().getServer().getPlayerList().sendPlayerPermissionLevel(this.getHandle(), level, false);
+ }
// Paper end
+ // Paper end - sendOpLevel API
+
@Override
public void setCompassTarget(Location loc) {
Preconditions.checkArgument(loc != null, "Location cannot be null");
12 changes: 7 additions & 5 deletions patches/server/Custom-Chat-Completion-Suggestions-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

this.getHandle().getServer().getPlayerList().sendPlayerPermissionLevel(this.getHandle(), level, false);
}
+
// Paper end - sendOpLevel API

+ // Paper start - custom chat completions API
+ @Override
+ public void addAdditionalChatCompletions(@NotNull Collection<String> completions) {
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundCustomChatCompletionsPacket(
Expand All @@ -28,6 +28,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ new ArrayList<>(completions)
+ ));
+ }
// Paper end
+ // Paper end - custom chat completions API
+
@Override
public void setCompassTarget(Location loc) {
Preconditions.checkArgument(loc != null, "Location cannot be null");
31 changes: 0 additions & 31 deletions patches/server/Player-elytra-boost-API.patch

This file was deleted.

0 comments on commit 5a34a7c

Please sign in to comment.