2021-06-11 12:02:28 +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/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
2022-07-27 22:10:27 +00:00
|
|
|
index 2287f62e9a228822e7da43ddd42946335078ec01..65469cfe4dfb87a05a9060fbd8e0aa2fc4bbe066 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
2022-07-27 22:10:27 +00:00
|
|
|
@@ -1124,6 +1124,11 @@ public abstract class PlayerList {
|
2021-06-11 12:02:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
|
|
|
|
+ // Paper start - add recalculatePermissions parameter
|
2021-08-24 23:30:26 +00:00
|
|
|
+ this.sendPlayerPermissionLevel(player, permissionLevel, true);
|
2021-06-11 12:02:28 +00:00
|
|
|
+ }
|
2021-08-24 23:30:26 +00:00
|
|
|
+ public void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel, boolean recalculatePermissions) {
|
2021-06-11 12:02:28 +00:00
|
|
|
+ // Paper end
|
2021-08-24 23:30:26 +00:00
|
|
|
if (player.connection != null) {
|
2021-06-11 12:02:28 +00:00
|
|
|
byte b0;
|
|
|
|
|
2022-07-27 22:10:27 +00:00
|
|
|
@@ -1138,8 +1143,10 @@ public abstract class PlayerList {
|
2021-08-24 23:30:26 +00:00
|
|
|
player.connection.send(new ClientboundEntityEventPacket(player, b0));
|
2021-06-11 12:02:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ if (recalculatePermissions) { // Paper
|
2021-08-24 23:30:26 +00:00
|
|
|
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
|
|
|
this.server.getCommands().sendCommands(player);
|
2021-06-11 12:02:28 +00:00
|
|
|
+ } // Paper
|
|
|
|
}
|
|
|
|
|
2022-06-08 07:30:41 +00:00
|
|
|
public boolean isWhiteListed(GameProfile profile) {
|
2021-06-11 12:02:28 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2022-07-27 20:55:55 +00:00
|
|
|
index ced1fd7ac0cbc80d5d65c95163ee271b26281773..e3ea73cc055a0738bc575f7f523bd61ff050e171 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2022-06-08 07:49:02 +00:00
|
|
|
@@ -606,6 +606,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2021-06-11 12:02:28 +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]");
|
|
|
|
+
|
2021-08-24 23:30:26 +00:00
|
|
|
+ this.getHandle().getServer().getPlayerList().sendPlayerPermissionLevel(this.getHandle(), level, false);
|
2021-06-11 12:02:28 +00:00
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
|
2021-06-14 19:58:32 +00:00
|
|
|
@Override
|