Error that I can't figure out how to fix

Discussion in 'Plugin Development' started by HahaPluginGoBrrrrrrrrrrr, Dec 3, 2020.

  1. StackTrace: 03.12 19:56:24
    Code:
     [Server] Server thread/ERROR Could not pass event PlayerDeathEvent to COD v1.0
    03.12 19:56:24 [Server] INFO org.bukkit.event.EventException: null
    03.12 19:56:24 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:319) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at org.bukkit.craftbukkit.v1_16_R3.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:782) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.EntityPlayer.die(EntityPlayer.java:566) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.EntityLiving.damageEntity(EntityLiving.java:1235) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.EntityHuman.damageEntity(EntityHuman.java:745) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.EntityPlayer.damageEntity(EntityPlayer.java:719) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.EntityLiving.entityBaseTick(EntityLiving.java:304) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.Entity.tick(Entity.java:364) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.EntityLiving.tick(EntityLiving.java:2349) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.EntityHuman.tick(EntityHuman.java:153) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.EntityPlayer.playerTick(EntityPlayer.java:446) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.PlayerConnection.tick(PlayerConnection.java:154) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.NetworkManager.a(NetworkManager.java:223) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.ServerConnection.c(ServerConnection.java:130) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1127) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:355) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1008) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:847) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:164) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at java.lang.Thread.run(Thread.java:748) [?:1.8.0_211]
    03.12 19:56:24 [Server] INFO Caused by: com.google.gson.JsonParseException: Don't know how to turn {"jformat":6,"jobject":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":"5","click_event_value":"177.34085941484275,56.0,-50.57391051721256","hover_event_type":"1","hover_event_value":"","hover_event_object":{},"hover_event_children":[{"bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"font":null,"color":"none","insertion":"","click_event_type":0,"click_event_value":"","hover_event_type":0,"hover_event_value":"","hover_event_object":{},"hover_event_children":[],"id":"bc024c75-5ede-456a-8a10-27d57e379476","text":"177.34085941484275,56.0,-50.57391051721256"}],"id":"67c78608-5042-493e-af90-5e8eaeeed8c6","text":"Get your death coordinates by clicking on this!"}],"command":"/tellraw @p %s","jtemplate":"tellraw"} into a Component
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.IChatBaseComponent$ChatSerializer.deserialize(IChatBaseComponent.java:205) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.IChatBaseComponent$ChatSerializer.deserialize(IChatBaseComponent.java:1) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.ChatDeserializer.a(SourceFile:493) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.ChatDeserializer.a(SourceFile:517) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at net.minecraft.server.v1_16_R3.IChatBaseComponent$ChatSerializer.a(IChatBaseComponent.java:357) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO at me.TA4.EventThingy.eventThingmajig(EventThingy.java:22) ~[?:?]
    03.12 19:56:24 [Server] INFO at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_211]
    03.12 19:56:24 [Server] INFO at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_211]
    03.12 19:56:24 [Server] INFO at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_211]
    03.12 19:56:24 [Server] INFO at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_211]
    03.12 19:56:24 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:315) ~[Spigot_Latest_1.16.4.jar:git-Spigot-a19903d-009f0ba]
    03.12 19:56:24 [Server] INFO ... 22 more
    Code:
    Code:
    package me.TA4;
    
    import org.bukkit.Location;
    import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.PlayerDeathEvent;
    import net.minecraft.server.v1_16_R3.ChatMessageType;
    import net.minecraft.server.v1_16_R3.IChatBaseComponent.ChatSerializer;
    import net.minecraft.server.v1_16_R3.PacketPlayOutChat;
    import net.minecraft.server.v1_16_R3.PlayerConnection;
    
    public class EventThingy implements Listener {
        @EventHandler
        public void eventThingmajig(PlayerDeathEvent e) {
            Player deadPlayer = e.getEntity();
            Location deathLocation = deadPlayer.getLocation();
            String string = "{\"jformat\":6,\"jobject\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"font\":null,\"color\":\"none\",\"insertion\":\"\",\"click_event_type\":\"5\",\"click_event_value\" :" + "\"" +  deathLocation.getX() + "," + deathLocation.getY() + "," + deathLocation.getZ() + "\",\"hover_event_type\":\"1\",\"hover_event_value\":\"\",\"hover_event_object\":{},\"hover_event_children\":[{\"bold\":true,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"font\":null,\"color\":\"none\",\"insertion\":\"\",\"click_event_type\":0,\"click_event_value\":\"\",\"hover_event_type\":0,\"hover_event_value\":\"\",\"hover_event_object\":{},\"hover_event_children\":[],\"id\":\"bc024c75-5ede-456a-8a10-27d57e379476\",\"text\":\"" + deathLocation.getX() + "," + deathLocation.getY() + "," + deathLocation.getZ() + "\"}],\"id\":\"67c78608-5042-493e-af90-5e8eaeeed8c6\",\"text\":\"Get your death coordinates by clicking on this!\"}],\"command\":\"/tellraw @p %s\",\"jtemplate\":\"tellraw\"}";
            PlayerConnection connection = ((CraftPlayer)deadPlayer).getHandle().playerConnection;
            PacketPlayOutChat packet = new PacketPlayOutChat(ChatSerializer.a(string), ChatMessageType.CHAT, deadPlayer.getUniqueId());
            connection.sendPacket(packet);
        }
    }
    Please help I dont know enough json parsing algorithm to fix the problem

    EDIT by Timtower: added code tags to trace
     
    Last edited by a moderator: Dec 3, 2020
  2. Offline

    MrDaniel

    Could you try to format the stacktrace? You can do this by pressing the paragraph with the I at the end at the toolbar, click code and paste in your code. You can also do "CODE" "/CODE" but replace " with [ and ]
     

Share This Page