PlayerMoveEvent returns null

Discussion in 'Plugin Development' started by eediego, Jan 10, 2021.

  1. Offline

    eediego

    Hey everyone, so after watching Tommy's video where he made Wilbur become the Ender Dragon, I thought of trying to make the plugin myself. However, the server keeps saying that PlayerMoveEvent returns null, which is why I am here posting this for someone to help me out with where the plugin is incorrect. Also, I wanted someone with more experience to help me check if the code is correct, since the last time I tested it out, it would repeatedly report the same error, which I believe is because of some loop that I made incorrectly, causing the server to overload or something like that. In the video the Ender Dragon was able to instantly break blocks around him, so I tried to make the same thing by getting the player's location, substract by 5 in each coordinate and do a loop for each axis 10 times, thus breaking each block in a 10x10x10 "radius" around the player. I think I may have wrote something incorrectly, causing the server to send that error message.
    Summary:
    2 errors: first is PlayerMoveEvent returns null, second is (in my opinion) loop done incorrectly.
    Extra notes:
    I used the plugin libsdisguises to make the player become an Ender Dragon. This plugin is probably not the cause of the issues since I used it to create another plugin and it works properly.

    Tommy's video:
     

    Attached Files:

  2. Offline

    marcelo.mb

    • My professor at the university already praised writing all the code in English. So ... also variable names. It is a good practice for further goals and a big gift for other developers who are reading through your code.
    • Please add an @Override above your onEnable() method. Often it works without it, but keeping good and correct syntax keeps bugs away. (Read more about this: https://bukkit.org/threads/when-do-...ures that a method,when the class is compiled.)
    • In your command class: Please check first if the sender is a player before continuing with the player object. It will throw errors if it is not a player.
    • About your three for loops. I would programme this with the Cuboid class. The Cuboid class contains many good functions and is very easy to use. (https://www.spigotmc.org/threads/region-cuboid.329859/) With using this class you can get only two important corner locations to create a cube and then return a block list. After this, you can loop through this block list and do your stuff in there.
    • NullPointerException: Which line is line 28 in BlockBreak class?
    Also please make your pluginquestion.txt better structured. For example, your code of the command class is listed twice. Or easily implement parts of code directly into your question. The better structured and overview able your question and code is the more people are going to help you.;)
     

Share This Page