[TuT] How To Disable Your Plugin

Discussion in 'Resources' started by RobotA69, Jun 14, 2012.

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

    RobotA69

    This is my second tutorial. Yay party time! :cool: Just kidding, nonetheless. Let's get started. For those who want to know "well what about enabling my plugin", well when the server first starts, it enables the plugins, but when we disable it, we can't re-enable it because Bukkit pretty much trashes it until the next reload/restart. Hope you enjoy the tutorial!
    Example Plugin : My plugin kills everyone when 5 or less people are on and disables when 6 are on, how do I do this??
    1. Create a int for the number of people on.
    2. If more than 5 people get on, disable plugin! Pseudocode below!
    PHP:
    Step 1.
    private int people Bukkit.getServer().getOnlinePlayers().length;
     
    Step 2.
    if(people 5) {
    className.Bukkit.getPluginManager().disablePlugin(className);
    }
    Hopefully, this tutorial both encourages and inspires developers to make more tutorials and/or to try to make more creative and advanced plugins! Thanks for reading. Leave a like if this tutorial helped you or comment if I should add more tutorials!
     
  2. Offline

    xtreampb

    what if i wanted to replace the jar file. I can't replace the file with a simple 'disable' provided here. do you know how to 'stop' the jar without stopping the server?
     
  3. Not possible without a ton of reflection, and replacing the jar itself isn't actually possible without a third person program
     
  4. xtreampb
    You can use the update folder, default: plugins/update/, place your jars there and then reload, all jars will be moved and replace the existing ones in the plugins folder.
     
  5. Offline

    xtreampb

    Digi i got that now thanks
     
  6. Offline

    kaZep

    I really love your tutorial. 'Thanked'! You're great.
     
    RobotA69 likes this.
Thread Status:
Not open for further replies.

Share This Page