RedProtect Anti-Grief

RedProtect Anti-Grief

73.3k Downloads

[BUG] `rp flag info` not working -- wrong handling of command arguments

EtaoinWu opened this issue ยท 2 comments

commented

Describe the bug
It's impossible to use rp flag info <region> <world> to obtain the flag status of a region.

To Reproduce
Steps to reproduce the behavior:

  1. Run a server, create a region in the overworld
  2. Run rp flag info <name of region just created> world in the server command
  3. The plugin displays the help message instead of the flag info

Expected behavior
Should display as if a user inside the region typed /rp flag info.

Server and plugins versions (please complete the following information):

  • Server: Purpur 1.20.4 (git 2143)
  • Plugin Version: 8.1.1-SNAPSHOT
  • Java Version: Java 18

Additional context
First of all, amazing plugin! Thanks for the great work.

I browsed through the source code, and I believe the issue is in here:

if (args.length == 3 && /* some other conditions */ && args[2].equalsIgnoreCase("info")) {
    if (Bukkit.getWorld(args[2]) != null) {
        // ... send getFlagInfo()
    }
}

This code requires args[2] to be both info and a world name, which is impossible. I guess this should be instead

if (args.length == 3 && /* some other conditions */ && args[0].equalsIgnoreCase("info")) {
commented

Hi,
I have tested on a test server, used the command and working as expected:
image

Tested on 1.21 using the latest dev build from our jenkins

commented

I forgot to highlight this in the issue description, but this only happens in the server console; the command worked fine for me if typed by a player.