diff options
author | Jake Potrebic <[email protected]> | 2024-05-29 13:58:57 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-29 22:58:57 +0200 |
commit | a31dc90741ed9c121a13a3c124c9ebf5bafd0da7 (patch) | |
tree | 81963bd94fe7772ee08bd21710230de21b6b25da /patches/server/0480-Add-sendOpLevel-API.patch | |
parent | ed85aac53cfd93d29fa24e6071dbdddd0e49624b (diff) | |
download | Paper-a31dc90741ed9c121a13a3c124c9ebf5bafd0da7.tar.gz Paper-a31dc90741ed9c121a13a3c124c9ebf5bafd0da7.zip |
Several fixes and new api for experience merging/stacking (#9242)
Diffstat (limited to 'patches/server/0480-Add-sendOpLevel-API.patch')
-rw-r--r-- | patches/server/0480-Add-sendOpLevel-API.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/patches/server/0480-Add-sendOpLevel-API.patch b/patches/server/0480-Add-sendOpLevel-API.patch new file mode 100644 index 0000000000..6e3e5ff4d6 --- /dev/null +++ b/patches/server/0480-Add-sendOpLevel-API.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm <[email protected]> +Date: Tue, 29 Dec 2020 15:03:03 +0100 +Subject: [PATCH] Add sendOpLevel API + + +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 505af87eaf8209437978848be1dde86f879f82f2..d5071f9f2d433706fc378f77906bb5f04fca0540 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -1100,6 +1100,11 @@ public abstract class PlayerList { + } + + private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) { ++ // Paper start - Add sendOpLevel API ++ this.sendPlayerPermissionLevel(player, permissionLevel, true); ++ } ++ public void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel, boolean recalculatePermissions) { ++ // Paper end - Add sendOpLevel API + if (player.connection != null) { + byte b0; + +@@ -1114,8 +1119,10 @@ public abstract class PlayerList { + player.connection.send(new ClientboundEntityEventPacket(player, b0)); + } + ++ if (recalculatePermissions) { // Paper - Add sendOpLevel API + player.getBukkitEntity().recalculatePermissions(); // CraftBukkit + this.server.getCommands().sendCommands(player); ++ } // Paper - Add sendOpLevel API + } + + public boolean isWhiteListed(GameProfile profile) { +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index c47681e2192cc498abb6b47c82f29ec298decd4e..330e9c37c889b1573520090173401a0615d19592 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -675,6 +675,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + // Paper end + ++ // Paper start - Add 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 - Add sendOpLevel API ++ + @Override + public void setCompassTarget(Location loc) { + Preconditions.checkArgument(loc != null, "Location cannot be null"); |