TPS in plugins

Discussion in 'Plugin Development' started by nanerz_123, Aug 29, 2014.

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

    nanerz_123

    Hello, I am making a plugin so when someone says "lag!!!" then the plugin will check the tps to see if the server is really lagging. If it is really lagging, then it will restart the server, if it isn't it will send a message to the player explaining that the server isn't lagging. Anyway, I don't know how to get the TPS with a plugin. Can someone help? thx!
     
  2. Offline

    Gamecube762

    Tick rate for servers is 20 ticks per second.

    Create a looping task and an Integer. In the looping class check the date and get the seconds, if the second is different than the last tick, reset the Integer to 0, else add 1 to the Integer.

    When the second changes, you have the tick rate for the last second.
     
  3. Offline

    nanerz_123

    Wow, very clever! Gamecube762 Although Im bad at math
     
  4. Offline

    Gamecube762

    Considering that this is mostly "X + 1" and "if A == B".

    Thing is, you will always find yourself having to do math when coding.
     
  5. Offline

    chasechocolate

Thread Status:
Not open for further replies.

Share This Page