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
|
2024-04-25 22:34:46 +02:00
|
|
|
index 505af87eaf8209437978848be1dde86f879f82f2..d5071f9f2d433706fc378f77906bb5f04fca0540 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
|
2024-04-24 15:46:45 +02:00
|
|
|
@@ -1100,6 +1100,11 @@ public abstract class PlayerList {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // Paper start - Add sendOpLevel API
|
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) {
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // Paper end - Add sendOpLevel API
|
2021-08-25 01:30:26 +02:00
|
|
|
if (player.connection != null) {
|
2021-06-11 14:02:28 +02:00
|
|
|
byte b0;
|
|
|
|
|
2024-04-24 15:46:45 +02:00
|
|
|
@@ -1114,8 +1119,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
|
|
|
}
|
|
|
|
|
2024-01-19 22:13:42 +01:00
|
|
|
+ if (recalculatePermissions) { // Paper - Add sendOpLevel API
|
2021-08-25 01:30:26 +02:00
|
|
|
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
|
|
|
this.server.getCommands().sendCommands(player);
|
2024-01-19 22:13:42 +01:00
|
|
|
+ } // Paper - Add sendOpLevel API
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
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
|
2024-04-26 03:51:28 +02:00
|
|
|
index 5550586022538be993a7b1d9f3d33c6785df73b5..36aaf37154c01c7a8f8543149e6bedec1386f5e7 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
|
2024-04-25 23:21:18 +02:00
|
|
|
@@ -675,6 +675,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
2023-11-04 21:20:13 +01:00
|
|
|
// Paper end
|
|
|
|
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // Paper start - Add sendOpLevel API
|
2021-06-11 14:02:28 +02:00
|
|
|
+ @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
|
|
|
+ }
|
2024-01-19 22:13:42 +01:00
|
|
|
+ // Paper end - Add sendOpLevel API
|
2023-11-04 21:20:13 +01:00
|
|
|
+
|
2021-06-14 21:58:32 +02:00
|
|
|
@Override
|
2023-11-04 21:20:13 +01:00
|
|
|
public void setCompassTarget(Location loc) {
|
|
|
|
Preconditions.checkArgument(loc != null, "Location cannot be null");
|