JorelAli / CommandAPI

A Bukkit/Spigot API for the command UI introduced in Minecraft 1.13

Home Page:https://commandapi.jorel.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Command works, Unexpected Error Appeared

ImNotStable opened this issue · comments

CommandAPI version

9.20

Minecraft version

1.20.1

Are you shading the CommandAPI?

Yes

What I did

  • I added all the prerequisites for CommandAPI & everything is working besides receiving an unexpected error.
  • I joined, then ran the command.
  • An error appeared, but the command worked.

What actually happened

The command worked as it should. All that happened was an error appeared in the console.

What should have happened

No error

Server logs and CommandAPI config

[22:07:01 ERROR]: Caught previously unhandled exception :
[22:07:01 ERROR]: Caught previously unhandled exception :
[22:07:01 ERROR]: Paper Async Command Builder Thread Pool - 1
java.util.ConcurrentModificationException: null
        at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1486) ~[?:?]
        at java.util.TreeMap$ValueIterator.next(TreeMap.java:1531) ~[?:?]
        at net.minecraft.commands.Commands.fillUsableCommands(Commands.java:483) ~[?:?]
        at net.minecraft.commands.Commands.sendAsync(Commands.java:443) ~[?:?]
        at net.minecraft.commands.Commands.lambda$sendCommands$5(Commands.java:422) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
[22:07:01 ERROR]: Paper Async Command Builder Thread Pool - 0
java.util.ConcurrentModificationException: null
        at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1486) ~[?:?]
        at java.util.TreeMap$ValueIterator.next(TreeMap.java:1531) ~[?:?]
        at net.minecraft.commands.Commands.fillUsableCommands(Commands.java:483) ~[?:?]
        at net.minecraft.commands.Commands.sendAsync(Commands.java:443) ~[?:?]
        at net.minecraft.commands.Commands.lambda$sendCommands$5(Commands.java:422) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
[22:07:01 ERROR]: Caught previously unhandled exception :
[22:07:01 ERROR]: Paper Async Command Builder Thread Pool - 2
java.util.ConcurrentModificationException: null
        at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1486) ~[?:?]
        at java.util.TreeMap$ValueIterator.next(TreeMap.java:1531) ~[?:?]
        at net.minecraft.commands.Commands.fillUsableCommands(Commands.java:483) ~[?:?]
        at net.minecraft.commands.Commands.sendAsync(Commands.java:443) ~[?:?]
        at net.minecraft.commands.Commands.lambda$sendCommands$5(Commands.java:422) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
[22:07:01 ERROR]: Caught previously unhandled exception :
[22:07:01 ERROR]: Paper Async Command Builder Thread Pool - 3
java.util.ConcurrentModificationException: null
        at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1486) ~[?:?]
        at java.util.TreeMap$ValueIterator.next(TreeMap.java:1531) ~[?:?]
        at net.minecraft.commands.Commands.fillUsableCommands(Commands.java:483) ~[?:?]
        at net.minecraft.commands.Commands.sendAsync(Commands.java:443) ~[?:?]
        at net.minecraft.commands.Commands.lambda$sendCommands$5(Commands.java:422) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
[22:07:01 ERROR]: Caught previously unhandled exception :
[22:07:01 ERROR]: Paper Async Command Builder Thread Pool - 4
java.util.ConcurrentModificationException: null
        at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1486) ~[?:?]
        at java.util.TreeMap$ValueIterator.next(TreeMap.java:1531) ~[?:?]
        at net.minecraft.commands.Commands.fillUsableCommands(Commands.java:483) ~[?:?]
        at net.minecraft.commands.Commands.sendAsync(Commands.java:443) ~[?:?]
        at net.minecraft.commands.Commands.lambda$sendCommands$5(Commands.java:422) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]

Other

    new CommandTree("qualityeconomy")
      .withAliases("qe")
      .withPermission("qualityeconomy.admin")
      .then(new LiteralArgument("reload")
        .executes((sender, args) -> {
          reload();
          sender.sendMessage(Component.text("Reloading QualityEconomy...", NamedTextColor.GRAY));
        })
        .then(new LiteralArgument("messages")
          .executes((sender, args) -> {
            Messages.loadMessages();
            sender.sendMessage(Component.text("Reloading QualityEconomy messages.yml...", NamedTextColor.GRAY));
          }))
        .then(new LiteralArgument("configuration")
          .executes((sender, args) -> {
            Configuration.loadConfiguration();
            sender.sendMessage(Component.text("Reloading QualityEconomy config.yml...", NamedTextColor.GRAY));
          })))
      .then(new LiteralArgument("database")
        .then(new LiteralArgument("import")
          .then(new GreedyStringArgument("fileName")
            .includeSuggestions(ArgumentSuggestions.strings(getImportableFiles()))
            .executes((sender, args) -> {
              sender.sendMessage(Component.text("Importing Database...", NamedTextColor.GRAY));
              StorageManager.importDatabase(args.get("fileName").toString());
              sender.sendMessage(Component.text("Imported Database", NamedTextColor.GREEN));
            })))
        .then(new LiteralArgument("export")
          .executes((sender, args) -> {
            sender.sendMessage(Component.text("Exporting Database...", NamedTextColor.GRAY));
            StorageManager.exportDatabase("plugins/QualityEconomy/");
            sender.sendMessage(Component.text("Exported Database", NamedTextColor.GREEN));
          }))
        .then(new LiteralArgument("createFakeEntries")
          .withRequirement(sender -> TestToolkit.DEBUG_MODE)
          .then(new IntegerArgument("entries", 1, 9999)
            .executes((sender, args) -> {
              try {
                int entries = (int) args.get("entries");
                AccountManager.createFakeAccounts(entries != 0 ? entries : 10);
              } catch (NumberFormatException ignored) {
                sender.sendMessage(Component.text("Invalid amount.", NamedTextColor.RED));
              }
            }))))
      .register();

I'm using 1.20.2, but the option wasn't there by the way.

This looks similar to #494. There is currently PR #501 that tries to fix #494. If you're able to, you could try using the CommandAPI branch for #501 and see if that resolves this problem. Unfortunately, #501 isn't ready for release yet since it does not resolve the issue on older versions of Paper, but I have tried it with 1.20.2 and it seems to help there.

Alright, thank you!