geforkt von Mirrors/Paper
bc127ea819
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: eec4aab0 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent 205213c6 SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron CraftBukkit Changes: b8c522d5 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent f04a77dc SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron d1dbcebc SPIGOT-6653: Canceling snow bucket placement removes snow from bucket 4f34a67b #891: Fix scheduler task ID overflow and duplication issues Spigot Changes: d03d7f12 BUILDTOOLS-604: Rebuild patches
66 Zeilen
2.8 KiB
Diff
66 Zeilen
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Mariell Hoversholm <proximyst@proximyst.com>
|
|
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 6ac6d05390359bd858673c4941e7d90f4cf98a02..f80e4e2d8311ccfb62b7a61a71d8ae43d5d35cf4 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -1123,22 +1123,29 @@ public abstract class PlayerList {
|
|
}
|
|
|
|
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
|
|
- if (player.connection != null) {
|
|
+ // Paper start - add recalculatePermissions parameter
|
|
+ this.sendPlayerOperatorStatus(player, permissionLevel, true);
|
|
+ }
|
|
+ public void sendPlayerOperatorStatus(ServerPlayer entityplayer, int i, boolean recalculatePermissions) {
|
|
+ // Paper end
|
|
+ if (entityplayer.connection != null) {
|
|
byte b0;
|
|
|
|
- if (permissionLevel <= 0) {
|
|
+ if (i <= 0) {
|
|
b0 = 24;
|
|
- } else if (permissionLevel >= 4) {
|
|
+ } else if (i >= 4) {
|
|
b0 = 28;
|
|
} else {
|
|
- b0 = (byte) (24 + permissionLevel);
|
|
+ b0 = (byte) (24 + i);
|
|
}
|
|
|
|
- player.connection.send(new ClientboundEntityEventPacket(player, b0));
|
|
+ entityplayer.connection.send(new ClientboundEntityEventPacket(entityplayer, b0));
|
|
}
|
|
|
|
- player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
|
- this.server.getCommands().sendCommands(player);
|
|
+ if (recalculatePermissions) { // Paper
|
|
+ entityplayer.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
|
+ this.server.getCommands().sendCommands(entityplayer);
|
|
+ } // Paper
|
|
}
|
|
|
|
// Paper start
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 6a262955e0523db99d2b38cd7815968e8d6b41d1..0c04869f9859ad0ee6885b8a26964804bb9ea930 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -553,6 +553,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
? (org.bukkit.entity.Firework) entity.getBukkitEntity()
|
|
: null;
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public void sendOpLevel(byte level) {
|
|
+ Preconditions.checkArgument(level >= 0 && level <= 4, "Level must be within [0, 4]");
|
|
+
|
|
+ this.getHandle().getServer().getPlayerList().sendPlayerOperatorStatus(this.getHandle(), level, false);
|
|
+ }
|
|
// Paper end
|
|
|
|
@Override
|