From 3c461089155f4d5d8b6ef4fa87589fdf986ee8c5 Mon Sep 17 00:00:00 2001 From: frafol Date: Fri, 22 Nov 2024 10:00:26 +0100 Subject: [PATCH] Make ping command work for OP users (second time). --- .../java/it/frafol/cleanping/bukkit/commands/PingCommand.java | 4 ++-- .../frafol/cleanping/bukkit/commands/legacy/PingCommand.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/it/frafol/cleanping/bukkit/commands/PingCommand.java b/src/main/java/it/frafol/cleanping/bukkit/commands/PingCommand.java index 421c443..19c8f2f 100644 --- a/src/main/java/it/frafol/cleanping/bukkit/commands/PingCommand.java +++ b/src/main/java/it/frafol/cleanping/bukkit/commands/PingCommand.java @@ -55,7 +55,7 @@ public boolean onCommand(org.bukkit.command.@NotNull CommandSender source, @NotN } else if (args.length == 1) { - if (!source.hasPermission(Placeholder.translate(SpigotConfig.PING_OTHERS_PERMISSION.get(String.class)))) { + if (!source.isOp() && !source.hasPermission(Placeholder.translate(SpigotConfig.PING_OTHERS_PERMISSION.get(String.class)))) { source.sendMessage(Placeholder.translate(SpigotMessages.NO_PERMISSION.get(String.class)) .replace("%prefix%", Placeholder.translate(SpigotMessages.PREFIX.get(String.class)))); return false; @@ -91,7 +91,7 @@ public boolean onCommand(org.bukkit.command.@NotNull CommandSender source, @NotN } else if (args.length == 2) { - if (!source.hasPermission(Placeholder.translate(SpigotConfig.DIFFERENCE_PING_PERMISSION.get(String.class)))) { + if (!source.isOp() && !source.hasPermission(Placeholder.translate(SpigotConfig.DIFFERENCE_PING_PERMISSION.get(String.class)))) { source.sendMessage(Placeholder.translate(SpigotMessages.NO_PERMISSION.get(String.class)) .replace("%prefix%", Placeholder.translate(SpigotMessages.PREFIX.get(String.class)))); return false; diff --git a/src/main/java/it/frafol/cleanping/bukkit/commands/legacy/PingCommand.java b/src/main/java/it/frafol/cleanping/bukkit/commands/legacy/PingCommand.java index 45b1488..c553f8e 100644 --- a/src/main/java/it/frafol/cleanping/bukkit/commands/legacy/PingCommand.java +++ b/src/main/java/it/frafol/cleanping/bukkit/commands/legacy/PingCommand.java @@ -52,7 +52,7 @@ public boolean onCommand(@NotNull CommandSender source, @NotNull Command command } else if (args.length == 1) { - if (!source.hasPermission(SpigotConfig.PING_OTHERS_PERMISSION.get(String.class))) { + if (!source.isOp() && !source.hasPermission(SpigotConfig.PING_OTHERS_PERMISSION.get(String.class))) { source.sendMessage(SpigotMessages.NO_PERMISSION.color() .replace("%prefix%", SpigotMessages.PREFIX.color())); return false; @@ -88,7 +88,7 @@ public boolean onCommand(@NotNull CommandSender source, @NotNull Command command } else if (args.length == 2) { - if (!source.hasPermission(SpigotConfig.DIFFERENCE_PING_PERMISSION.get(String.class))) { + if (!source.isOp() && !source.hasPermission(SpigotConfig.DIFFERENCE_PING_PERMISSION.get(String.class))) { source.sendMessage(SpigotMessages.NO_PERMISSION.color() .replace("%prefix%", Placeholder.translate(SpigotMessages.PREFIX.get(String.class)))); return false;