mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-31 20:51:47 +01:00
Add sendOpLevel API
This commit is contained in:
parent
8ece26c15f
commit
08145dcb9d
28
Spigot-API-Patches/Add-sendOpLevel-API.patch
Normal file
28
Spigot-API-Patches/Add-sendOpLevel-API.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Tue, 29 Dec 2020 15:02:57 +0100
|
||||
Subject: [PATCH] Add sendOpLevel API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
@Nullable
|
||||
Firework boostElytra(@NotNull ItemStack firework);
|
||||
+
|
||||
+ /**
|
||||
+ * Send a packet to the player indicating its operator status level.
|
||||
+ * <p>
|
||||
+ * <b>Note:</b> This will not persist across more than the current connection, and setting the player's operator
|
||||
+ * status as a later point <i>will</i> override the effects of this.
|
||||
+ *
|
||||
+ * @param level The level to send to the player. Must be in {@code [0, 4]}.
|
||||
+ * @throws IllegalArgumentException If the level is negative or greater than {@code 4} (i.e. not within {@code [0, 4]}).
|
||||
+ */
|
||||
+ void sendOpLevel(byte level);
|
||||
// Paper end
|
||||
|
||||
// Spigot start
|
51
Spigot-Server-Patches/Add-sendOpLevel-API.patch
Normal file
51
Spigot-Server-Patches/Add-sendOpLevel-API.patch
Normal file
@ -0,0 +1,51 @@
|
||||
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/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
private void a(EntityPlayer entityplayer, int i) {
|
||||
+ // Paper start - add recalculatePermissions parameter
|
||||
+ this.sendPlayerOperatorStatus(entityplayer, i, true);
|
||||
+ }
|
||||
+ public void sendPlayerOperatorStatus(EntityPlayer entityplayer, int i, boolean recalculatePermissions) {
|
||||
+ // Paper end
|
||||
if (entityplayer.playerConnection != null) {
|
||||
byte b0;
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
}
|
||||
|
||||
+ if (recalculatePermissions) { // Paper
|
||||
entityplayer.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
||||
this.server.getCommandDispatcher().a(entityplayer);
|
||||
+ } // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -0,0 +0,0 @@ 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().getMinecraftServer().getPlayerList().sendPlayerOperatorStatus(this.getHandle(), level, false);
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
// Spigot start
|
Loading…
Reference in New Issue
Block a user