Solved NPC EntityHuman Causing Crashes

Discussion in 'Plugin Development' started by Visualizeding, Dec 16, 2018.

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

    Visualizeding

    I've been working with packets and creating NPCs the last couple of days, something I'm new to. I've been getting server crashes with stack-traces I can't read. I've tried taking the plugin out to see if it was the plugin and the crashes stop. Here is my code and here is the stack-trace. My other plugins include WorldEdit, VoxelSniper, and Essentials. The crashes can happen instantly once I join or after a while of the server running. Any assistance would be appreciated!
     
  2. Offline

    Zombie_Striker

    @Visualizeding
    The default crash reports most likely are not going to help in this situation, since this is not a problem with base minecraft but with your plugin. Could you post the console logs?
     
  3. Offline

    Visualizeding

    @Zombie_Striker https://pastebin.com/EN2c9ch2 This is right before the crash, I toggledownfall and that instantly crashed the server.
    EDIT:
    If needed I can post the full crash log but the gist is my console was spammed with the NullPointerException
     
  4. Offline

    Zombie_Striker

    @Visualizeding
    Okay, the error is stating that it is treating the fake player as though it was a real player, and it tried to send packets to it. I was looking around and found this bit of code, which may be the issue:
    Code:
      EntityHuman human = new EntityHuman(world, profile) {
                                public boolean v() {
                                    return false;
                                }
                            };
    The "v()" should control whether the player is a real player or one created by the server. If you have it return false, it should not crash the server. (BTW: It said it was for 1.8, but in case the method names changed between your versions, you may need to hunt for the correct name of the method)
     
  5. Offline

    Visualizeding

    @Zombie_Striker
    Still getting the same issue using that method, I tried using both EntityHuman and EntityPlayer but it isn't making any difference, I changed my code around and I still can't get anything to work. This is my code and my console, my server is instantly crashing when I join.

    Thanks to browsing around a bit, I finally found a solution.
    Code:
    entityPlayer.playerConnection = new PlayerConnection(playerList.getServer(), new NetworkManager(EnumProtocolDirection.SERVERBOUND), entityPlayer);
    
    Thanks for the help, regardless!

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

Share This Page