From 472c85652a3a00de4fba911e85877fb486739361 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 82b22cd..feb4050 100644 --- a/src/main/java/com/moulberry/axiom/AxiomPaper.java +++ b/src/main/java/com/moulberry/axiom/AxiomPaper.java @@ -304,12 +304,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; } @@ -317,11 +317,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 3e4d413..b74a0e4 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 2323a7e..b1d3a2c 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 516dfa5..0902d2c 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 3714440..90543ee 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