Вопрос Не получается сделать /reload команду

Версия Minecraft
1.19.X

KainMPGSS

Пользователь
Сообщения
35
Решения
2
Делаю релоад команду для плагина и нифига не работает!
Помогите пожалуйста!

Ошибка:
Код:
[11:35:12 WARN]: Unexpected exception while parsing console command "fastlogger reload"
org.bukkit.command.CommandException: Unhandled exception executing command 'fastlogger' in plugin FastLogger v0.1-TEST
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_19_R3.CraftServer.dispatchCommand(CraftServer.java:929) ~[paper-1.19.4.jar:git-Paper-550]
        at org.bukkit.craftbukkit.v1_19_R3.CraftServer.dispatchServerCommand(CraftServer.java:892) ~[paper-1.19.4.jar:git-Paper-550]
        at net.minecraft.server.dedicated.DedicatedServer.handleConsoleInputs(DedicatedServer.java:501) ~[paper-1.19.4.jar:git-Paper-550]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:448) ~[paper-1.19.4.jar:git-Paper-550]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1397) ~[paper-1.19.4.jar:git-Paper-550]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1174) ~[paper-1.19.4.jar:git-Paper-550]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[paper-1.19.4.jar:git-Paper-550]
        at java.lang.Thread.run(Thread.java:842) ~[?:?]
Caused by: java.lang.ClassCastException: class com.destroystokyo.paper.console.TerminalConsoleCommandSender cannot be cast to class org.bukkit.entity.Player (com.destroystokyo.paper.console.TerminalConsoleCommandSender and org.bukkit.entity.Player are in unnamed module of loader java.net.URLClassLoader @1b9e1916)
        at ru.quarkus.flCommand.onCommand(flCommand.java:21) ~[QSLogger.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.4-R0.1-SNAPSHOT.jar:?]
        ... 9 more

Код команды:
Java:
package ru.quarkus;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;

public class flCommand implements CommandExecutor, TabCompleter {

    private Plugin plugin;

    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String[] args) {
        Player p = (Player) sender;
        if (sender.hasPermission("fastlogger.reload")) {
            if (args.length == 0) {
                p.sendMessage(Color.get("&d&lFastLogger Commands:"));
                p.sendMessage(Color.get("  &d/fl reload &7(Alias: /fastlogger reload)"));
            } else if (args.length == 1 && args[0].equals("reload")) {
                this.plugin.getConfig();
            }
        } else {
            p.sendMessage(Color.get("&d&lFastLogger &7» &cNo permission!"));
        }
        return true;
    }

    @Override
    public @Nullable List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
        if (commandSender instanceof Player) {
            List<String> completions = new ArrayList<>();
            if (strings.length == 1 && "reload".startsWith(strings[0])) {
                completions.add("reload");
            }
            return completions;
        }
        return null;
    }


}
 
Назад
Сверху Снизу