2020-12-29 14:04:24 +00:00
|
|
|
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/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
2021-02-24 09:32:17 +00:00
|
|
|
index ec5ad68f77b14a449ff6f9206d1cd95c74c0577c..bbaaafbb9b2299a1f67e336d8b94b02cc5ed2c28 100644
|
2020-12-29 14:04:24 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
2021-02-22 08:03:03 +00:00
|
|
|
@@ -1059,6 +1059,11 @@ public abstract class PlayerList {
|
2020-12-29 14:04:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void a(EntityPlayer entityplayer, int i) {
|
|
|
|
+ // Paper start - add recalculatePermissions parameter
|
|
|
|
+ this.sendPlayerOperatorStatus(entityplayer, i, true);
|
|
|
|
+ }
|
|
|
|
+ public void sendPlayerOperatorStatus(EntityPlayer entityplayer, int i, boolean recalculatePermissions) {
|
|
|
|
+ // Paper end
|
|
|
|
if (entityplayer.playerConnection != null) {
|
|
|
|
byte b0;
|
|
|
|
|
2021-02-22 08:03:03 +00:00
|
|
|
@@ -1073,8 +1078,10 @@ public abstract class PlayerList {
|
2020-12-29 14:04:24 +00:00
|
|
|
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (recalculatePermissions) { // Paper
|
|
|
|
entityplayer.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
|
|
|
this.server.getCommandDispatcher().a(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
|
2021-02-24 09:32:17 +00:00
|
|
|
index 4cd9bdc16e1bf8f7ad75424ac52c3754fab7d540..8a6340c1eeda638e70d3da6ad30e51b98fd66947 100644
|
2020-12-29 14:04:24 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2021-02-24 09:32:17 +00:00
|
|
|
@@ -2317,6 +2317,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2020-12-29 14:04:24 +00:00
|
|
|
? (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().getMinecraftServer().getPlayerList().sendPlayerOperatorStatus(this.getHandle(), level, false);
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
// Spigot start
|