Plugin Lagging out server

Discussion in 'Plugin Development' started by ShadowDragon7015, Jul 7, 2016.

Thread Status:
Not open for further replies.
  1. Hello :( i'm not sure if this is a bad request or not but I have been having issues with a plugin i have been making. It is less than halfway finished yet it already lags out the server to the point where no one is able to do anything and i am forced to shut down the server. I was wondering if anyone would be able to help me optimize the code to prevent these things from happening. I am not very good with optimization so i have trouble finding places that are too repetitive or should be removed. Please help me. This is the code it is quite a lot so if you do not wish to help please do not feel that you have to:
    Code is here
    If you see things in the code that you know will not work please point those out also. Thank you everyone and have a pleasant day :)
  2. Offline


    @ShadowDragon7015 As I can't see anything after a quick look, I suggest you, that you monitor the JVM of your server.

    Either by using a JVM monitoring tool/program or if you are using a spigot build, you might want to try the timings command
  3. Offline


    I personally think making multiple minigames in 1 class was a bad idea, that's all your choice though. Not my plugin :p.

    Anyway, lag sometimes is server dependant because of the server's ability to run tasks fast and efficiently.
    One thing I might think is causing the lag is the runnable you're starting inside the onEnable()
    You're making a bunch of items constantly to update the GUI, when all you need to do is change the metadata of the items already in it.
  4. I might try to move it into multiple classes if that would make it more organized, though for looking at all of the code having it all in one class makes it easier. How would i change only the metadata of the items? I dont know how things like that work, i haven't dealt much with metadata in items.
    I am using spigot 1.8.8 for the server, what is the timings command? I know i can see the tps drop immediately after i start the plugin.
  5. Offline


  6. Offline


    You can just get the item from the certain slots in the GUI and use getItemMeta().setDisplayName() or whatever you're wanting to do
Thread Status:
Not open for further replies.

Share This Page