mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
54 lines
2.5 KiB
Diff
54 lines
2.5 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 6fed863a0400ba23e0e299b0f0a0f28af19fa226..65c11774b9e3c724b5ac67a557bd84efcd53fbab 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -1101,6 +1101,11 @@ public abstract class PlayerList {
|
|
}
|
|
|
|
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
|
|
+ // Paper start - Add sendOpLevel API
|
|
+ this.sendPlayerPermissionLevel(player, permissionLevel, true);
|
|
+ }
|
|
+ public void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel, boolean recalculatePermissions) {
|
|
+ // Paper end - Add sendOpLevel API
|
|
if (player.connection != null) {
|
|
byte b0;
|
|
|
|
@@ -1115,8 +1120,10 @@ public abstract class PlayerList {
|
|
player.connection.send(new ClientboundEntityEventPacket(player, b0));
|
|
}
|
|
|
|
+ if (recalculatePermissions) { // Paper - Add sendOpLevel API
|
|
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
|
this.server.getCommands().sendCommands(player);
|
|
+ } // Paper - Add sendOpLevel API
|
|
}
|
|
|
|
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 f9188664f868c0c55c92c0ec7ca43204d267b91e..f4cf8cc4cf085c621cc0d3e71f3ad10b8ef9f15a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -597,6 +597,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
}
|
|
// Paper end
|
|
|
|
+ // Paper start - Add 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 - Add sendOpLevel API
|
|
+
|
|
@Override
|
|
public void setCompassTarget(Location loc) {
|
|
Preconditions.checkArgument(loc != null, "Location cannot be null");
|