2020-12-29 15:04:24 +01: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
|
|
|
|
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
2021-03-16 14:04:28 +01:00
|
|
|
index 0cd0b268af5ef7903ce46387540e289f62077e7c..e00de9eba84de57b1b79d1860bd1eff8d1b71705 100644
|
2021-03-16 08:19:45 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
2021-03-16 14:04:28 +01:00
|
|
|
@@ -1138,6 +1138,11 @@ public abstract class PlayerList {
|
2020-12-29 15:04:24 +01: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-03-16 14:04:28 +01:00
|
|
|
@@ -1152,8 +1157,10 @@ public abstract class PlayerList {
|
2020-12-29 15:04:24 +01: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-03-16 14:04:28 +01:00
|
|
|
index adebc5b1d110983feb6d43f371bf2569ddca4088..89737dfb0244a6dfe3a2cc2d77a7b16a64f469bb 100644
|
2020-12-29 15:04:24 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2021-03-09 19:03:27 +01:00
|
|
|
@@ -2288,6 +2288,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2020-12-29 15:04:24 +01: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
|