2021-06-11 14:02:28 +02: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
|
2023-01-27 21:52:04 +01:00
|
|
|
index 3d05b2f37b192bf707414f4a574f79423b0f0be1..ad6a9e238d21a821e7d5c3634fbc8fc9bdfc38a3 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
2022-12-19 11:46:55 +01:00
|
|
|
@@ -1063,6 +1063,11 @@ public abstract class PlayerList {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
|
|
|
|
+ // Paper start - add recalculatePermissions parameter
|
2021-08-25 01:30:26 +02:00
|
|
|
+ this.sendPlayerPermissionLevel(player, permissionLevel, true);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
2021-08-25 01:30:26 +02:00
|
|
|
+ public void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel, boolean recalculatePermissions) {
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper end
|
2021-08-25 01:30:26 +02:00
|
|
|
if (player.connection != null) {
|
2021-06-11 14:02:28 +02:00
|
|
|
byte b0;
|
|
|
|
|
2022-12-19 11:46:55 +01:00
|
|
|
@@ -1077,8 +1082,10 @@ public abstract class PlayerList {
|
2021-08-25 01:30:26 +02:00
|
|
|
player.connection.send(new ClientboundEntityEventPacket(player, b0));
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+ if (recalculatePermissions) { // Paper
|
2021-08-25 01:30:26 +02:00
|
|
|
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
|
|
|
this.server.getCommands().sendCommands(player);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ } // Paper
|
|
|
|
}
|
|
|
|
|
2022-06-08 09:30:41 +02:00
|
|
|
public boolean isWhiteListed(GameProfile profile) {
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2023-02-13 18:52:27 +01:00
|
|
|
index 943cfb59907cb519b2f324a9e9185723ebead60d..69cfbe2c3ba14d7ebf4b29a89161b6d1d00ebc91 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
2022-12-07 21:16:54 +01:00
|
|
|
@@ -653,6 +653,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2021-06-11 14:02:28 +02: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-25 01:30:26 +02:00
|
|
|
+ this.getHandle().getServer().getPlayerList().sendPlayerPermissionLevel(this.getHandle(), level, false);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
|
2021-06-14 21:58:32 +02:00
|
|
|
@Override
|