I need code: if TPS get lower then 16, plugin automatic disable! and when is 19 automatic enable!

Discussion in 'Spigot Plugin Help' started by talentoman, Jun 15, 2015.

  1. I need code: if TPS get lower then 16, plugin automatic disable! and when is 19 automatic enable!
     
  2. Hmm double posting
     
    • Useful Useful x 1
  3. First you must declare a new Plugin. This you should make it in the Main Class. For example:
    Code (Text):
    public static Plugin plugin;
    Now you must initate the plugin Variable in your onEnable and onDisable method. This you should make with:
    Code (Text):
    @Override
    public void onEnable(){

    plugin = this;

    }

    @Override
    public void onDisable(){

    plugin = null;

    }
    Now you can disable your Plugin easy with:
    Code (Text):
    Bukkit.getPluginManager().disablePlugin(YOURMAINCLASS.plugin);
    I hope I can helped you.
     
  4. yea but i need to plugin automatic Check every secound TPS, if is lower then 16 disable plugin, and if is higher then 16 enable plugin..
     
    • Funny Funny x 4
  5. Some basic knowledge you should have in this forum. The TPS find out and make an if statement you will probably can. In addition, you can start a scheduler from the server at startup , then every second makes this an if statement.
     
    • Agree Agree x 1