kangarko / Foundation

Foundation™ helps you create highly customized Minecraft plugins (based on Spigot/Paper API) that support multiple MC versions.

Home Page:https://mineacademy.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1.18.2: SimpleCommand

Bruce0203 opened this issue · comments

org.mineacademy.fo.command.SimpleCommand has args field but if code of below executed, the bug appeared because it is not thread-safe

is this problem ?

        for (int i = 0; i < 100; i++) {
            Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
                player.performCommand("command");
            });
        }
commented

It's a faulty code. If anything it should be:

            Bukkit.getScheduler().runTaskLater(plugin, () -> {
                for (int i = 0; i < 100; i++) 
                    player.performCommand("command");
            });
commented

Bukkit does not properly supports running commands async anyways.