From 7fcdbcb9d1a0f269006b77c20649c2f33075016c 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 ac5a9ce..bc1ec4a 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 988ca7f..c781b65 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 09e4b6f..bb9fa56 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 4f13193..bc35773 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 b1cb8fe..395bf46 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