1.16.5 Going Crazy ChatUtil.jar

Discussion in 'Spigot Plugin Development' started by Hamburger123598, Jul 20, 2021.

  1. Hi i feel like i am going crazy... any help would be amazing!

    I have used this code before so i am even reading my old uses and i cant see what i did diffrent!

    Code (Text):
    public class ChatUtil {

        public static String color(String string) {
            return ChatColor.translateAlternateColorCodes('&', string);
        }

        public static List<String> color(List<String> list) {
            List<String> coloredList = new ArrayList<>();
            for (String line : list) {
                coloredList.add(ChatUtil.color(line));
            }
            return coloredList;
        }

        public static void sendNoPermission(Player player) {
            player.sendMessage(ChatUtil.color(Skyblock.config.getString("messages.no-permission")));
        }

        public static void sendNoPermission(CommandSender sender) {
            sender.sendMessage(ChatUtil.color(Skyblock.config.getString("messages.no-permission")));
        }

        public static void broadcast(String msg){
            for (Player player : Bukkit.getOnlinePlayers())
                player.sendMessage( msg);
        }

    }
     
    Code (Text):
    public class Jack implements CommandExecutor {

        private final Skyblock instance;

        public Jack(Skyblock instance) {
            this.instance = instance;
        }

        @Override
        public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
            Player player = (Player) sender;
            ChatUtil.broadcast("Test");

            return true;
        }
    }
     

    Code (Text):
    [13:40:37 ERROR]: null
    org.bukkit.command.CommandException: Unhandled exception executing command 'jack' in plugin NewVanaSkyblock v1.0-SNAPSHOT
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched_1.16.5.jar:git-Paper-782]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.16.5.jar:git-Paper-782]
            at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:826) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.PlayerConnection.handleCommand(PlayerConnection.java:2185) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:2000) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1953) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:49) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:7) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:35) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1266) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1259) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:1220) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1134) ~[patched_1.16.5.jar:git-Paper-782]
            at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-782]
            at java.lang.Thread.run(Thread.java:831) [?:?]
    Caused by: java.lang.IllegalStateException: zip file closed
            at java.util.zip.ZipFile.ensureOpen(ZipFile.java:828) ~[?:?]
            at java.util.zip.ZipFile.getEntry(ZipFile.java:327) ~[?:?]
            at java.util.jar.JarFile.getEntry(JarFile.java:514) ~[?:?]
            at java.util.jar.JarFile.getJarEntry(JarFile.java:469) ~[?:?]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:167) ~[patched_1.16.5.jar:git-Paper-782]
            at java.lang.ClassLoader.loadClass(ClassLoader.java:586) ~[?:?]
            at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:119) ~[patched_1.16.5.jar:git-Paper-782]
            at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:114) ~[patched_1.16.5.jar:git-Paper-782]
            at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
            at jackgnuk.skyblock.Commands.Jack.onCommand(Jack.java:21) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.16.5.jar:git-Paper-782]
            ... 19 more
     
  2. Do you have the command in your plugin.yml and remembering to register it with the Jack class?
     
  3. Code (Text):
    name: NewVanaSkyblock
    version: ${project.version}
    main: jackgnuk.skyblock.Skyblock
    api-version: 1.16
    prefix: Newvana-MENUS
    load: STARTUP
    authors: [ JackGNUK ]
    description: Skyblock menus
    website: **************
    commands:
      Jack:
        description: jack command
        aliases: [jk, ja]
      GMA:
        permission: ls.admin
        permission-message: no permission.

    Code (Text):
     @Override
        public void onEnable() {
            // Plugin startup logic
            registerListeners();
            registerCommands();


    //register stuff here
        private void registerCommands() {
            this.getCommand("Jack").setExecutor(new Jack(this));
            this.getCommand("GMA").setExecutor(new GMA(this));
        }
        private void registerListeners() {
            PluginManager manager = getServer().getPluginManager();
            manager.registerEvents(new playerevents(this), this);
            manager.registerEvents(new worldevents(this), this);
            manager.registerEvents(new chatevents(this), this);
        }

     
     
  4. Can you make sure the account running the Minecraft server instance has permissions to read/write the plugin folders? I had the same issue with map files, that fixed it for me
     
  5. I get the Zip File Closed error sometimes when I reload the server or a specific plugin as opposed to restarting. Might not be your issue here but worth double checking.
     
    • Agree Agree x 1
  6. Post a startup log to https://pastebin.com or something because your jar isn't loading, there is something happening when the plugin at startup.