geforkt von Mirrors/Paper
Deprecate Player#boostElytra (#9899)
The Paper method was chosen for deprecation because it was more restrictive in that it has an isGliding check.
Dieser Commit ist enthalten in:
Ursprung
0609eeadec
Commit
5a34a7c895
@ -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>
|
||||
@ -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 {
|
||||
|
||||
|
@ -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.
|
||||
@ -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 {
|
||||
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
@ -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(
|
||||
@ -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");
|
||||
|
@ -1,31 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Trigary <trigary0@gmail.com>
|
||||
Date: Tue, 14 Apr 2020 12:05:22 +0200
|
||||
Subject: [PATCH] Player elytra boost API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- 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 {
|
||||
}
|
||||
throw new RuntimeException("Unknown settings type");
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.entity.Firework boostElytra(ItemStack firework) {
|
||||
+ Preconditions.checkState(this.isGliding(), "Player must be gliding");
|
||||
+ Preconditions.checkArgument(firework != null, "firework == null");
|
||||
+ Preconditions.checkArgument(firework.getType() == Material.FIREWORK_ROCKET, "Firework must be Material.FIREWORK_ROCKET");
|
||||
+
|
||||
+ net.minecraft.world.item.ItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(firework);
|
||||
+ net.minecraft.world.level.Level world = ((CraftWorld) getWorld()).getHandle();
|
||||
+ net.minecraft.world.entity.projectile.FireworkRocketEntity entity = new net.minecraft.world.entity.projectile.FireworkRocketEntity(world, item, getHandle());
|
||||
+ return world.addFreshEntity(entity)
|
||||
+ ? (org.bukkit.entity.Firework) entity.getBukkitEntity()
|
||||
+ : null;
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@Override
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren