[ADMN/DEV] PluginReloader v0.1 - Load/Unload/Reload individual plugins [1240]

Discussion in 'Inactive/Unsupported Plugins' started by MadJawa, Aug 21, 2011.

  1. Offline

    MadJawa

    PluginReloader - Load/Unload/Reload individual plugins:
    Version: v0.1

    Download PluginReloader :
    Thanks to @Jon for making it work with the recents revisions of CraftBukkit!

    Source code on GitHub

    This plugin allows you to load, unload or reload a plugin without reloading all of the others.

    I made this plugin because I had enough using the expensive /reload command just to update or install one plugin.

    With PluginReloader, you can upload the .jar, then do /plugin load PluginName, and voilĂ ! The plugin is installed. No need to reload everything. A new version came out? Upload the .jar, type /plugin reload PluginName, and it's updated :D

    It's also very useful for developers, it's possible to reload any plugin if you update it (it's not simply disabling/enabling the plugin, it reloads the whole .jar file)

    Usage: (it's pretty straightforward)
    • Load a plugin: /plugin load PluginName
    • Reload a plugin: /plugin reload PluginName
    • Unload a plugin: /plugin unload PluginName
    You can specify more than one plugin if you want to load/reload/unload more than one at once.

    A word of advice: This plugin is a beta at the moment. Bukkit doesn't provide methods to properly unload plugins (yet) so I'm doing ugly things in the code. I tried to replicate what exactly happens when doing a true /reload, so it should work as expected but things may go wrong.

    It should also works with dependencies, I tried reloading iConomy, and all plugins depending on them redetected it properly when it was reenabled.

    Please report any errors you encounter using this with the full stack trace from the server's console, along with the plugin name and version so I can test.

    Permissions nodes:
    The plugin supports PermissionsBukkit. If not installed, only ops can use the commands
    • pluginreloader.load: grants access to the /plugin load command
    • pluginreloader.reload: same with the /plugin reload command
    • pluginreloader.unload: same with the /plugin unload command
    • pluginreloader.* : all of the above
    Changelog:
    Version 0.1
    • Initial release
     
  2. Offline

    iPhysX

    I like it :) Ill give some feedback after i've put it to use!
     
  3. Offline

    SwearWord

    Perfect I was just about to start on something like this.
     
  4. Offline

    joby890

    i will test this now
     
  5. Offline

    andune

    Saw this pop up in my new plugin feed and thought 'That sounds like PlugMan, did something happen to PlugMan?'. Nope, Plugman is still there and does this already. Sounds like you still had some more work to do to get this working right; I'm not trying to stop you, but just letting you know about PlugMan in case you overlooked it, possibly to save you a bunch of working writing a plugin that does the exact same thing.
     
  6. Offline

    SwearWord

  7. Offline

    MadJawa

    @SwearWord
    I submitted it :) Also, /reload does reload the .jar from the drive. Maybe that's why it's so resource consuming. I actually looked at bukkit's reload method to see how I could reload only one plugin.

    @morganm
    I tried PlugMan, the loading works fine but the reloading only disables and enables the plugin. So if you uploaded an updated .jar, it won't load that one. Also, using /plugman load a second time will load the plugin twice, so that's why I made my own plugin.
     
  8. Offline

    andune

    @MadJawa ah sounds like it IS different then and definitely more useful to be able to load a new JAR on-the-fly (if that part is working). Good work and I look forward to using it!
     
  9. Offline

    MadJawa

    @morganm From my tests, the .jar reloading is working quite well. I'm using it to develop a plugin on my server and it did not bug once. There is one thing though, I made a little addon for HeroicDeath that broadcasts messages to IRC. If I reload HeroicDeath without unloading my addon, I get java.lang.LinkageError exceptions afterwards. I don't know if that's bad coding on my addon or if it's related to PluginReloader. I'll look into that.

    But anyway, if anything "bad" happens, a /reload should restore everything back to normal
     
  10. Offline

    Azur

    I use Permissions 3.x on my server (running craftbukkit 1000), not PermissionsBukkit, so I would have assumed this would make the permissions default back to ops, but even as an op on my server it gives me the "you do not have permissions to use this" error.
     
  11. Offline

    algiuxas

    Aaw maan, now I have to use /reload to load this awesome plugin :( This needs a plugin to load this plugin.
     
  12. Offline

    andune

    @MadJawa thanks for writing this, I've already used it in production several times to avoid reboots, it is indeed different than what PlugMan offers and very handy!
     
  13. Offline

    Sahee

    when i give this permission to my "helper" he stil dont have permissions to do this ;/
     
  14. Offline

    ashley

    Could you tell me how to reload files with space between names ex: Safe Creeper.jar ?
    thank you
     
  15. Offline

    chuiby

    Thanks a lot, really useful. But somehow my DynamicShopWrapper says "[DMWrapper] Is now disabled!" (but it still works) when i reload a unload/load/reload a plugin.. (DynamicShopWrapper is a wrapper for DynamicShop plugin, making shops region-based instead of server-wide).
     
  16. Offline

    wachnlurn

    [INFO] WorldGuard 5.2.2 disabled.
    2011-09-22 08:19:00 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'plugin' in plugin PluginReloader v0.1
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:41)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:163)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:353)
    at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:756)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:721)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:714)
    at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:33)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:92)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:464)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    Caused by: java.lang.NoSuchMethodError: org.bukkit.plugin.PluginDescriptionFile.getPermissions()Ljava/util/ArrayList;
    at net.madjawa.pluginreloader.PluginReloader.unloadPlugin(PluginReloader.java:195)
    at net.madjawa.pluginreloader.PluginReloader.onCommand(PluginReloader.java:79)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:39)
    ... 12 more
     
  17. Offline

    Switch0r

    I really need this plugin to work but it does not work on my server.
    Code:
    >plugin unload nocheat
    08:04:52 [INFO] [NoCheat] version [2.07] is disabled.
    08:04:52 [WARNING] Unexpected exception while parsing console command
    org.bukkit.command.CommandException: Unhandled exception executing command 'plug
    in' in plugin PluginReloader v0.1
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:41)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:16
    3)
            at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:3
    53)
            at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:3
    49)
            at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:506)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:485)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    Caused by: java.lang.NoSuchMethodError: org.bukkit.plugin.PluginDescriptionFile.
    getPermissions()Ljava/util/ArrayList;
            at net.madjawa.pluginreloader.PluginReloader.unloadPlugin(PluginReloader
    .java:195)
            at net.madjawa.pluginreloader.PluginReloader.onCommand(PluginReloader.ja
    va:69)
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:39)
            ... 7 more
    
     
  18. Offline

    Ptibiscuit

    I fixed the problem, you can download the new "non-official" version:
    PluginReloader
     
  19. Offline

    Switch0r

    Ok thanks i think it works now:
    >plugin unload worldedit
    13:31:03 [INFO] Unloaded worldedit successfully!
    But i cant remove or move a plugin out of the server folder.
    I thought i could remove or update a plugin with this.
     
  20. Offline

    jungalist81

    Hey MadJawa, this plugin is really great. Its essential for server owners like me to have when we are checking out different plugins and trying a bunch at the same time.

    I wish I saw this plugin couple months ago, this would have saved a few secs of lag. No more using /reload!!!

    What will it take for you to continue working on this plugin?? So far it is working on my 1185 minecraft server, perhaps edit the title?

    Ptibiscuit made a fix on this plugin? Maybe use that as the latest version?
     
  21. Offline

    Xmillsa

    You should be able to copy and paste an updated version of the plugin into the plugin folder while the server is running, then just reload the plugin you want to update using this plugin, works fine for me.
    Removing them is a bit different, I think bukkit "holds" onto the plugins while running, you can only disable them, I could be wrong though.

    Just wanted to say this plugin is great, use it all the time, thanks!
    Just hope to see it updated for newer bukkit builds later on.
     
  22. Offline

    chuiby

    I get this error whatever plugin i choose to reload/unload/load.


    Code:
    >plugin reload worldedit
    2011-10-02 17:41:01 [WARNING] Unexpected exception while parsing console command
    
    org.bukkit.command.CommandException: Unhandled exception executing command 'plug
    in' in plugin PluginReloader v0.1
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:41)
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:16
    3)
            at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:3
    53)
            at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:3
    49)
            at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:499)
            at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:478)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    Caused by: java.lang.NoSuchMethodError: org.bukkit.plugin.PluginDescriptionFile.
    getPermissions()Ljava/util/ArrayList;
            at net.madjawa.pluginreloader.PluginReloader.unloadPlugin(PluginReloader
    .java:195)
            at net.madjawa.pluginreloader.PluginReloader.onCommand(PluginReloader.ja
    va:79)
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:39)
            ... 7 more
    >
    
    I don't know if its just that your plugin isn't made for #1185 and needs a bit of changes or its a plugin conflict, it was working fine on #1060.

    Plugins:
    Show Spoiler

    BlockHat
    Commands LoggingConrolORBle
    CopyCat
    CraftBukkitUpToDate
    DMWrapper
    EnderMod
    Essentials
    EssentialsSpawn
    GodMode
    Graveyard
    iConomy
    InstaBreak
    LazyRoad
    LivingForest
    LogBlockQuestioner
    mcbans
    MCSL
    MobDisguise
    MultiInv
    mxAntiPVPCheat
    NarrowtuxLib
    NoCheat
    nSpleef
    OpenInv
    PluginReloader
    Ptweaks
    Quantum Connectors
    RawcriticsOreObfuscationPluginSpout
    rTriggers
    Spout
    SpoutFlight
    Stargate
    Permissions
    uCreate
    VanishNoPacket
    WirelessRedstone
    WorldGuard
    WorldManager
    AntiGuest
    BookWorm
    dynmap
    JukeBukkit
    PermissionsBukkit
    Showcase
    LWC
    LWCpp
    ChessCraft
    Citizens
    DynaMark
    Factions
    Jail
    LogBlock
    mChat
    mChatEssentials
     
  23. Offline

    Technius

    Can I use your unloading code for my plugin? I will give you credit! :D
     
  24. Offline

    SwearWord

  25. Offline

    chuiby

    Thanks :)


    Edit: doesnt work

    error:
    Code:
    2011-10-04 18:03:25 [GRAVE] Could not load      'plugins\PluginReloader.jar' in folder 'plugins':
     java.lang.UnsupportedClassVersionError:      net/madjawa/pluginreloader/PluginReloader : Unsupported major.minor      version 51.0 
     at java.lang.ClassLoader.defineClass1(Native      Method) 
     at java.lang.ClassLoader.defineClassCond(Unknown      Source) 
     at java.lang.ClassLoader.defineClass(Unknown      Source) 
     at      java.security.SecureClassLoader.defineClass(Unknown Source) 
     at java.net.URLClassLoader.defineClass(Unknown      Source) 
     at java.net.URLClassLoader.access$000(Unknown      Source) 
     at java.net.URLClassLoader$1.run(Unknown Source) 
     at      java.security.AccessController.doPrivileged(Native Method) 
     at java.net.URLClassLoader.findClass(Unknown      Source) 
     at      org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:36)      
     at      org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:24)      
     at java.lang.ClassLoader.loadClass(Unknown      Source) 
     at java.lang.ClassLoader.loadClass(Unknown      Source) 
     at java.lang.Class.forName0(Native Method) 
     at java.lang.Class.forName(Unknown Source) 
     at      org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:168)      
     at      org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:215)      
     at      org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136)      
     at      org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:139) 
     at      org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:104) 
     at      net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:52)      
     at      net.minecraft.server.MinecraftServer.init(MinecraftServer.java:136) 
     at      net.minecraft.server.MinecraftServer.run(MinecraftServer.java:348) 
     at      net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    
     
  26. Offline

    Jon

  27. Offline

    Azur

    Thanks so much, this works amazingly!
     
  28. Offline

    MadJawa

    Thank you! Sorry for not updating it recently, I got back to the university and I'm a bit busy at the moment.

    What is actually the difference between the two jar you posted?

    I'll host them on GitHub and put them in the OP.

    Thanks again
     
  29. Offline

    chuiby

    @MadJawa
    When unloading plugins, they are still "in-use" (on wind0ws). I use Unlocker to unlock locked files. It removes the program's handle-lock on a file. It's really useful for updating plugins without restarting the server.

    I really doubt that you could do the same with Java. I've done this on C# (Visual C#)... But java?

    Let me know if you find any way to unlock plugin's files
     
  30. Offline

    Jon

    Besides being built against the separate versions, all that is different between the two is that 1185 uses an ArrayList for plugin permissions whereas 1240 uses a normal List.
     

Share This Page