Skip to content

Commit

Permalink
Make ping command work for OP users.
Browse files Browse the repository at this point in the history
  • Loading branch information
frafol committed Nov 22, 2024
1 parent 5411ff0 commit 237c4db
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public boolean onCommand(org.bukkit.command.@NotNull CommandSender source, @NotN
final Player player = (Player) source;
final long ping = player.getPing();

if (source.hasPermission(SpigotConfig.PING_PERMISSION.get(String.class))) {
if (source.isOp() || source.hasPermission(SpigotConfig.PING_PERMISSION.get(String.class))) {

if (!(SpigotConfig.DYNAMIC_PING.get(Boolean.class))) {
source.sendMessage(Placeholder.translate(SpigotMessages.PING.get(String.class))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public ReloadCommand(CleanPing plugin) {
@Override
public boolean onCommand(@NotNull CommandSender source, @NotNull Command command, @NotNull String s, String[] args) {

if (!source.hasPermission(SpigotConfig.RELOAD_PERMISSION.get(String.class))) {
if (!source.isOp() && !source.hasPermission(SpigotConfig.RELOAD_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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public boolean onCommand(@NotNull CommandSender source, @NotNull Command command
final Player player = (Player) source;
final long ping = plugin.getPing(player);

if (source.hasPermission(SpigotConfig.PING_PERMISSION.get(String.class))) {
if (source.isOp() || source.hasPermission(SpigotConfig.PING_PERMISSION.get(String.class))) {

if (!(SpigotConfig.DYNAMIC_PING.get(Boolean.class))) {
source.sendMessage(SpigotMessages.PING.color()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ReloadCommand(CleanPing plugin) {
@Override
public boolean onCommand(@NotNull CommandSender source, @NotNull Command command, @NotNull String s, String[] args) {

if (!source.hasPermission(SpigotConfig.RELOAD_PERMISSION.get(String.class))) {
if (!source.isOp() && !source.hasPermission(SpigotConfig.RELOAD_PERMISSION.get(String.class))) {
source.sendMessage(SpigotMessages.NO_PERMISSION.color()
.replace("%prefix%", SpigotMessages.PREFIX.color()));
return false;
Expand Down

0 comments on commit 237c4db

Please sign in to comment.