Solved Could not pass event AsyncPlayerChatEvent

Discussion in 'Plugin Development' started by dracconi, May 23, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    dracconi

    I can't fix this. I have no idea, no lines in error.
    Stack Trace (open)

    Code:
    [14:43:10 ERROR]: Could not pass event AsyncPlayerChatEvent to Chatix v1.0
    org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:509) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:491) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
        at net.minecraft.server.v1_7_R4.PlayerConnection.chat(PlayerConnection.java:965) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
        at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:905) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
        at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
        at net.minecraft.server.v1_7_R4.PacketPlayInChat$1.run(PacketPlayInChat.java:59) [spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_91]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_91]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
    Caused by: java.lang.NullPointerException
        at org.bukkit.event.player.AsyncPlayerChatEvent.setFormat(AsyncPlayerChatEvent.java:100) ~[spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
        at me.dracconi.chatix.ChatListener.onPlayerChat(ChatListener.java:17) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_91]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:298) ~[spigot-1.7.10-SNAPSHOT-b1657.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
        ... 12 more
    


    I have this code:
    main.java
    Show Spoiler

    Code:
    package me.dracconi.chatix;
    
    import org.bukkit.Bukkit;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.ChatColor;
    
    import me.dracconi.chatix.ChatListener;
    
    /**
    * Created by dracconi on 22.05.16.
    */
    public class main extends JavaPlugin{
        public void loadConfiguration(){
    ////        See "Creating you're defaults"
    //        getConfig().options().copyDefaults(true); // NOTE: You do not have to use "plugin." if the class extends the java plugin
    //        //Save the config whenever you manipulate it
    //        saveConfig();
        }
    
        @Override
        public void onEnable(){
            loadConfiguration();
            getServer().getPluginManager().registerEvents(new ChatListener(),this);
            getLogger().info("CHATIX launched");
    
        }
        @Override
        public void onDisable(){}
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
        {
            if(cmd.getName().equalsIgnoreCase("chatix")) {
                Player p = (Player) sender;
    
                if (args.length == 0) {
                    if (sender instanceof Player) {
                        p.sendMessage(ChatColor.AQUA + "Hi");}
                } else {
                    if (args[0].equalsIgnoreCase("reload")) {
                        reloadConfig();
                        getLogger().info("Reloaded!");
                        p.sendMessage(ChatColor.GREEN + "Reloaded!");
                    }
                }
            }
          return false;
        }
    
    }
    


    ChatListener.java
    Show Spoiler

    Code:
    package me.dracconi.chatix;
    
    import org.bukkit.Bukkit;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.AsyncPlayerChatEvent;
    
    /**
    * Created by dracconi on 23.05.16.
    */
    public class ChatListener implements Listener {
    
        @EventHandler
        public void onPlayerChat(AsyncPlayerChatEvent e){
    
        }
    }
    


    Fixed. I don't know how.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 23, 2016
Thread Status:
Not open for further replies.

Share This Page