Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
54 Zeilen
2.4 KiB
Diff
54 Zeilen
2.4 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 8137afc62e5430666ee9e74460109f7408baeffd..32f93ed20f5f2cec71850d7e0ce8a633fd5efc82 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -1105,6 +1105,11 @@ public abstract class PlayerList {
|
|
}
|
|
|
|
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
|
|
+ // Paper start - add recalculatePermissions parameter
|
|
+ this.sendPlayerPermissionLevel(player, permissionLevel, true);
|
|
+ }
|
|
+ public void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel, boolean recalculatePermissions) {
|
|
+ // Paper end
|
|
if (player.connection != null) {
|
|
byte b0;
|
|
|
|
@@ -1119,8 +1124,10 @@ public abstract class PlayerList {
|
|
player.connection.send(new ClientboundEntityEventPacket(player, b0));
|
|
}
|
|
|
|
+ if (recalculatePermissions) { // Paper
|
|
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
|
this.server.getCommands().sendCommands(player);
|
|
+ } // Paper
|
|
}
|
|
|
|
public boolean isWhiteListed(GameProfile profile) {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index ba30c5e17a294cee9f408fdd4e31849c0e5d28ed..8a924ae677a93a177651aa1ec0728e3b8d5528a6 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -633,6 +633,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
}
|
|
// Paper end
|
|
|
|
+ // Paper start - sendOpLevel API
|
|
+ @Override
|
|
+ public void sendOpLevel(byte level) {
|
|
+ Preconditions.checkArgument(level >= 0 && level <= 4, "Level must be within [0, 4]");
|
|
+
|
|
+ this.getHandle().getServer().getPlayerList().sendPlayerPermissionLevel(this.getHandle(), level, false);
|
|
+ }
|
|
+ // Paper end - sendOpLevel API
|
|
+
|
|
@Override
|
|
public void setCompassTarget(Location loc) {
|
|
Preconditions.checkArgument(loc != null, "Location cannot be null");
|