geforkt von Mirrors/Paper
f79c0daece
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 5c21a63f PR-717: Add PlayerHideEntityEvent and PlayerShowEntityEvent CraftBukkit Changes: c26a7b54d PR-1000: Add PlayerHideEntityEvent and PlayerShowEntityEvent
52 Zeilen
2.3 KiB
Diff
52 Zeilen
2.3 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 f4e74b0bc3d192d7f7c2bc1dbfef92a28863a57c..b7f3be857d9ffb166e99f20753dbc671bb3b5451 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -1123,6 +1123,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;
|
|
|
|
@@ -1137,8 +1142,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
|
|
}
|
|
|
|
// Paper start
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index daec735dd2510d2cb3089036a341efd41f8f8aaa..5de0093188f3dd142ef478b2654f6bf48fa90d06 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -581,6 +581,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
? (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().getServer().getPlayerList().sendPlayerPermissionLevel(this.getHandle(), level, false);
|
|
+ }
|
|
// Paper end
|
|
|
|
@Override
|