Solved How can I delete plugins without stopping the server?

Discussion in 'Plugin Development' started by REALDrummer, Jul 3, 2013.

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

    REALDrummer

    I have been trying desperately to find a way to delete or replace plugin files on a CraftBukkit server without shutting down a server and interfering with everyone's actions on the server. Can anyone tell me how I might be able to achieve this?

    I have tried using PlugMan and PluginManager plugins to try and unload the plugins, but this still does not allow me to delete the plugin .jars without stopping the server.

    Just disabling the plugin will not work, so the Essentials command for disabling plugins or any other plugin disabling commands are useless.

    If anyone can help me with this problem, I would be very grateful. I would use this information to add a new auto-updater that would automatically download new versions of the plugin, add the new version to the server, and delete the old version. If that happens, I will formally thank you for your help in developing this advanced auto-updater both on the page for each plugin and in the changelog for each plugin that has the updater.

    Thank you in advance for your help.

    Note: If your comment is just going to say that it's impossible, please explain why. If your comment says something like "you can't" and that's all, I will be angry with you.
     
  2. Offline

    snake4212

    This is the wrong section plus its simply not possible
     
    Tooner101 likes this.
  3. Offline

    pkt

    If you are really really really desperate, use the /reload command, HIGHLY unrecommended, but I think it would work
     
  4. Offline

    REALDrummer

    1. It's not the wrong section. This is relevant to plugin development in the way that I explained in the first post in the fourth paragraph.

    2. You ignored the note at the bottom and did not explain why "its simply not possible".

    Please read posts before commenting on them in the future for the sake of others who have problems.

    How might you use the /reload command to delete plugins without stopping the server?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  5. Offline

    ERROR372

    If you delete the plugin's jar file and any files/folders related to it, and do a /reload, it won't load the plugin you deleted because it doesn't exist anymore. Simple as that. Though as others said, a /restart or /stop would be better.


    Actually, from what it sounds like you want it to do... you should just have to replace the jar file with the new jar. Then do a /reload or restarting your server. I do a /reload all the time when testing plugins and fixing problems. I just put the new jar in the directory, replacing the old one, do a /reload, and it uses the new jar information.
     
  6. Offline

    REALDrummer


    The problem with that is that I can't replace or delete the .jar file unless I stop the server. I get the whole 'This program is open in Java SE binary and can't be modified' thing. If I can get past that step, the rest is easy.
     
  7. Offline

    pkt

    Simple! Get a host and stop hosting on your computer
     
  8. Offline

    ERROR372

    Really? I can... I do it all the time, no problem, otherwise it'd be a pain to test my plugins when making minor changes or debugging problems...

    How are you handling the removal/replacement?


    pkt:

    That shouldn't matter either though. I develop and test my plugins on my laptop, so replacing the jar shouldn't be an issue, since it's all I ever do...
     
  9. Offline

    REALDrummer

    1. I do have a server host.

    2. It happens on the remote host and the computer.
     
  10. Offline

    pkt

    ERROR372 you can't replace files in use on your computer, however, you can using FTP (used to get to your server files when it is hosted on a server)
     
  11. Offline

    ERROR372

    My computer must be weird then, because I replace my plugin jars all the time when testing >_>

    I'll just drag it over, click "Copy and Replace". It does, and I do a /reload in the console.
     
  12. Offline

    REALDrummer

    I use FileZilla for my F.T.P. remote file management and when I try to replace .jars while the server is running, I get a critical error when I would normally not be able to replace the file on a computer.
     
  13. Offline

    pkt

    That is weird.... what OS are you using?

    I do it all the time on FTP while my server is running....

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  14. Offline

    ERROR372

    I'm using Windows 7. That's my local server for developing and testing plugins.

    Using Ubuntu for my big server that other people play on. I can do the same thing on there, with replacing and doing a /reload.
     
  15. Offline

    pkt

    I'm so confused from this topic... :confused:
     
  16. Offline

    ERROR372

    You aren't the only one =P

    From all my experiences with both Windows 7 and Ubuntu, you should be able to replace a jar file, and then reload it no problem. Apparently that isn't the case for everyone (and seemingly just me >_>)

    I can do just about anything. Sure it might cause a few problems if I delete a file it's using, but I can still delete it =P
     
  17. Offline

    REALDrummer

    Is there a way to unlock the file, then, so that I can modify it? How can I get Java and/or CraftBukkit to detach from it?
     
  18. Offline

    pkt

    There's probably something in the control panel of windows that allows this....
     
  19. Offline

    REALDrummer

    Well, that doesn't work for people who have remote server hosting (which means most servers). Besides, I want to implement this method for modifying plugin files into a code for a plugin, so it has to be a method that works on just about any operating system, setup, or configuration -- F.T.P. remote host, direct computer interaction, Mac, Windows, anything...

    Do you have a remote server F.T.P. file managing program and if you do, what program do you use?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  20. Offline

    ERROR372

    REALDrummer:

    I use both a file managing system (provided courtesy of the hosting service) and an SSH terminal. If I need to upload my programs, I use the file managing system (Parallels Power Panel). Both ways I can just replace/delete jar files at will, no problem (well, until the server tries to access the plugin or a variable it made =P, then lovely errors pop up, unless it was replaced and reloaded)
     
  21. Offline

    REALDrummer

    ERROR372

    Well, in my experience, if I try to write a plugin that involves modifying files, the files that it's modifying must be unlocked and not in use. Therefore, the only way to make this happen is to tell Java and CraftBukkit to completely disregard the whole plugin file. Basically, I have to find a way to be able to modify plugin files (including the .jars themselves) even if I were running a server from my own computer. How can I do that?
     
  22. Offline

    ERROR372

    Wait so your plugin(s) won't let you edit a file if the server is running?

    And about the whole "This file is in use", I've never gotten that and I haven't touched any of my computer's core files or anything that would allow me to sidestep that. Sorry I'm not much help, I really don't know why I can easily replace/delete files at a whim while others can't. Hope that doesn't cause a problem with my plugins ._.
     
  23. Offline

    REALDrummer

    ERROR372

    Okay. That's fine. I understand. Thanks for your help.

    pkt

    Any other thoughts?

    Well, that's nice for Apple, but I need a solution that will work on any operating system with virtually any operating system. I know there has to be a way to get CraftBukkit and/or Java to pretend for just a moment that a plugin .jar doesn't exist like a complete plugin disable/unload.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  24. Offline

    Technius

    This bug is fixed in the development version of PluginManager, which should come out soon. If you want it, PM me and I will send it to you.
     
  25. Offline

    Steffion

    I have no problems with deleting active plugins on my Mac ^^, but unfortunally Windows doesn't support that...
     
  26. Offline

    ferrybig

    you can do it this way:
    remove plugin.yml from the target jar file
    reload server
    run garbage collect on the server
    if there aren't any memory leaks, you can delete the plugin now
     
  27. Offline

    REALDrummer

    ferrybig

    Good idea, but it won't work. I can't delete the plugin.yml in the plugin .jar file for the same reason that I can't delete the rest of the .jar.

    Steffion
    I still wouldn't take a Mac.

    Finally, there is a solution! PluginManager is supposed to be able to unload plugins completely. The only reason it wasn't working when I tried it is there's a bug, but the creator of the plugin told me they worked on a fix and now it works! Get PluginManager! The /pm unload command is the answer! Thank you, Technius! I will cite you in my changelogs and plugin pages!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
Thread Status:
Not open for further replies.

Share This Page