From 287e0f12f7f2a85fc532bc9751dc55ec28a4ab79 Mon Sep 17 00:00:00 2001 From: Rubenicos <44579213+Rubenicos@users.noreply.github.com> Date: Sun, 19 May 2024 11:40:47 -0600 Subject: [PATCH] Fix backwards compatibility --- src/main/java/com/moulberry/axiom/AxiomPaper.java | 14 +++++++++----- .../axiom/packet/DeleteEntityPacketListener.java | 2 +- .../packet/ManipulateEntityPacketListener.java | 2 +- .../packet/MarkerNbtRequestPacketListener.java | 2 +- .../axiom/packet/SpawnEntityPacketListener.java | 2 +- src/main/resources/plugin.yml | 4 +++- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/moulberry/axiom/AxiomPaper.java b/src/main/java/com/moulberry/axiom/AxiomPaper.java index d763bf3..69b8a23 100644 --- a/src/main/java/com/moulberry/axiom/AxiomPaper.java +++ b/src/main/java/com/moulberry/axiom/AxiomPaper.java @@ -307,12 +307,12 @@ public class AxiomPaper extends JavaPlugin implements Listener { } public boolean hasAxiomPermission(Player player) { - return hasAxiomPermission(player, null); + return hasAxiomPermission(player, null, false); } - public boolean hasAxiomPermission(Player player, String permission) { + public boolean hasAxiomPermission(Player player, String permission, boolean strict) { if (player.hasPermission("axiom.*") || player.isOp()) { - return true; + return !strict || permission == null || player.hasPermission("axiom.all") || player.hasPermission(permission); } else if (permission != null && !player.hasPermission(permission)) { return false; } @@ -320,11 +320,15 @@ public class AxiomPaper extends JavaPlugin implements Listener { } public boolean canUseAxiom(Player player) { - return canUseAxiom(player, null); + return canUseAxiom(player, null, false); } public boolean canUseAxiom(Player player, String permission) { - return activeAxiomPlayers.contains(player.getUniqueId()) && hasAxiomPermission(player, permission); + return canUseAxiom(player, permission, false); + } + + public boolean canUseAxiom(Player player, String permission, boolean strict) { + return activeAxiomPlayers.contains(player.getUniqueId()) && hasAxiomPermission(player, permission, strict); } public @Nullable RateLimiter getBlockBufferRateLimiter(UUID uuid) { diff --git a/src/main/java/com/moulberry/axiom/packet/DeleteEntityPacketListener.java b/src/main/java/com/moulberry/axiom/packet/DeleteEntityPacketListener.java index 61bffcb..d53d2a7 100644 --- a/src/main/java/com/moulberry/axiom/packet/DeleteEntityPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/DeleteEntityPacketListener.java @@ -35,7 +35,7 @@ public class DeleteEntityPacketListener implements PluginMessageListener { } private void process(Player player, byte[] message) { - if (!this.plugin.canUseAxiom(player, "axiom.entity.delete")) { + if (!this.plugin.canUseAxiom(player, "axiom.entity.delete", true)) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/ManipulateEntityPacketListener.java b/src/main/java/com/moulberry/axiom/packet/ManipulateEntityPacketListener.java index c470f53..be8f07f 100644 --- a/src/main/java/com/moulberry/axiom/packet/ManipulateEntityPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/ManipulateEntityPacketListener.java @@ -90,7 +90,7 @@ public class ManipulateEntityPacketListener implements PluginMessageListener { } private void process(Player player, byte[] message) { - if (!this.plugin.canUseAxiom(player, "axiom.entity.manipulate")) { + if (!this.plugin.canUseAxiom(player, "axiom.entity.manipulate", true)) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/MarkerNbtRequestPacketListener.java b/src/main/java/com/moulberry/axiom/packet/MarkerNbtRequestPacketListener.java index dce8860..1711f6b 100644 --- a/src/main/java/com/moulberry/axiom/packet/MarkerNbtRequestPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/MarkerNbtRequestPacketListener.java @@ -33,7 +33,7 @@ public class MarkerNbtRequestPacketListener implements PluginMessageListener { } private void process(Player player, byte[] message) { - if (!this.plugin.canUseAxiom(player, "axiom.entity.manipulate")) { + if (!this.plugin.canUseAxiom(player, "axiom.entity.manipulate", true)) { return; } diff --git a/src/main/java/com/moulberry/axiom/packet/SpawnEntityPacketListener.java b/src/main/java/com/moulberry/axiom/packet/SpawnEntityPacketListener.java index 953d36f..734c6b3 100644 --- a/src/main/java/com/moulberry/axiom/packet/SpawnEntityPacketListener.java +++ b/src/main/java/com/moulberry/axiom/packet/SpawnEntityPacketListener.java @@ -55,7 +55,7 @@ public class SpawnEntityPacketListener implements PluginMessageListener { } private void process(Player player, byte[] message) { - if (!this.plugin.canUseAxiom(player, "axiom.entity.spawn")) { + if (!this.plugin.canUseAxiom(player, "axiom.entity.spawn", true)) { return; } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 0adda57..1d567d9 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -10,9 +10,11 @@ softdepend: - WorldGuard - PlotSquared permissions: - axiom.*: + axiom.all: description: Allows use of all default Axiom features default: op + children: + axiom.*: true axiom.use: description: Allows basic use of axiom default: op