WorldEdit

WorldEdit

42M Downloads

Exception when tab completinging with leading space

mdsimmo opened this issue ยท 1 comments

commented

Versions
WorldEdit version:
Bukkit-Official(7.1.0;8e55131)
Platform version:
Paper version git-Paper-173 (MC: 1.15.2) (Implementing API version 1.15.2-R0.1-SNAPSHOT)

Describe the bug
Trying to tab compete in the server console with a leading space causes a StringIndexOutOfBoundsException

To Reproduce

  1. Go to server console
  2. Type " /s" (no quotes but include the leading space)
  3. Press tab

Expected behavior
Command either auto completes as normal or does nothing

Exception message

[20:37:06 ERROR]: Could not pass event AsyncTabCompleteEvent to WorldEdit v7.1.0;8e55131
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(Unknown Source) ~[?:1.8.0_251]
        at com.sk89q.worldedit.bukkit.WorldEditPlugin$AsyncTabCompleteListener.onAsyncTabComplete(WorldEditPlugin.java:507) ~[?:?]
        at com.destroystokyo.paper.event.executor.MethodHandleEventExecutor.execute(MethodHandleEventExecutor.java:37) ~[patched_1.15.2.jar:git-Paper-173]
        at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[patched_1.15.2.jar:git-Paper-173]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.15.2.jar:git-Paper-173]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.15.2.jar:git-Paper-173]
        at org.bukkit.event.Event.callEvent(Event.java:45) ~[patched_1.15.2.jar:git-Paper-173]
        at org.bukkit.craftbukkit.v1_15_R1.command.ConsoleCommandCompleter.complete(ConsoleCommandCompleter.java:36) ~[patched_1.15.2.jar:git-Paper-173]
        at org.jline.reader.impl.LineReaderImpl.doComplete(LineReaderImpl.java:4147) ~[patched_1.15.2.jar:git-Paper-173]
        at org.jline.reader.impl.LineReaderImpl.expandOrComplete(LineReaderImpl.java:4060) ~[patched_1.15.2.jar:git-Paper-173]
        at org.jline.reader.impl.LineReaderImpl$1.apply(LineReaderImpl.java:3630) ~[patched_1.15.2.jar:git-Paper-173]
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:603) ~[patched_1.15.2.jar:git-Paper-173]
        at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:418) ~[patched_1.15.2.jar:git-Paper-173]
        at net.minecrell.terminalconsole.SimpleTerminalConsole.readCommands(SimpleTerminalConsole.java:158) ~[patched_1.15.2.jar:git-Paper-173]
        at net.minecrell.terminalconsole.SimpleTerminalConsole.start(SimpleTerminalConsole.java:141) ~[patched_1.15.2.jar:git-Paper-173]
        at net.minecraft.server.v1_15_R1.DedicatedServer$2.run(DedicatedServer.java:90) ~[patched_1.15.2.jar:git-Paper-173]
>  /s
commented

Duplicate of #1281