Reloading server.properties

Discussion in 'Plugin Development' started by Zachster, Jun 29, 2012.

  1. Is there a way to reload server.properties, similar to the reload command except for server.properties?
     
  2. I dont think it cant reload al the properties from that file, like world-name port, ip and that kind of properties, because of this, I dont think there is an way
     
  3. You can't reload server.properties
    You need to restart the server
     
  4. Why do people always give up at the first sign of challenge?
    Of course it is possible, obviously changes to stuff that is only cared about on startup (socket ip, port, etc.) don't actually change (unless you feel like closing the socket and re-opening it again with the new settings, effectively kicking all connected clients, kind of not very productive).

    Assuming that you want to use it in a somewhat sane way, the basic properties are in fact very easily changed (heck, they're even public and non-final!):
    https://github.com/Bukkit/CraftBukk...et/minecraft/server/MinecraftServer.java#L134

    The code shows what happens on startup. Depending on whether you want to update all (sane) properties or not, go through what is in there and set it again.
    The part that actually reads from the file is the PropertyManager. Invoking its constructor with the options in theory does its job of reloading.
    Then you only need to override all relevant attributes in the MinecraftServer class with the new values. Done.

    I'll stop at this theoretical part. If you feel like actually digging as deep as that, let me know and I'll try to explain how to do it code-wise. It's not that hard, just one reflection call to get the instance of MinecraftServer, (most of) the rest is public anyway.
     
  5. Offline

    the3rdnumber_

    Everyone is talking about that, but noone is telling the command.
     
  6. the3rdnumber_ I don't think there is one. Bone008 sounds like he is telling you how to make one.
     
  7. Offline

    the3rdnumber_

    teej107 bone should be posting a plugin, instead of teaching everyone how to code.
     
  8. the3rdnumber_ You do realize the section of the forums your in right? Follow what he says and you'll get there.
     
  9. Offline

    bobnixon1

    Wrong. Though telling you the code is useful, you don't learn. You copy and paste it into your plugin. If you follow his directions, you will learn from it because you typed and figured it out, and hopefully it will work.
     

Share This Page