From 23ab9b720efdf53785dc639c83ecbfcc2f92c052 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 38c373b..9825007 100644 --- a/src/main/java/com/moulberry/axiom/AxiomPaper.java +++ b/src/main/java/com/moulberry/axiom/AxiomPaper.java @@ -305,12 +305,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; } @@ -318,11 +318,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 9128215..361b254 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 0d24850..97ec956 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 98ceedb..340e55e 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 c9a4a82..0669c4a 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