Solved getDataFolder()

Discussion in 'Plugin Development' started by Codisimus, Aug 12, 2013.

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

    Codisimus

    There is a getDataFolder() method for plugins, does that mean that the data folder could be located somewhere else? I ask bc I want multiple servers to share a central plugins directory. Btw, they will only be reading the data, not writing.
     
  2. Offline

    xTrollxDudex

    Codisimus
    I think it should only be in the plugins folder of the server. Should.
     
  3. Offline

    Codisimus

    But if I wanted to change that, would it have to edit craftbukkit.jar? I don't see any settings for it.
     
  4. Offline

    Rocoty

    Create a new method, return type File. Call it something sensible (getUniversalDataFolder?). Return the folder you want as data folder for your plugin.
     
  5. Offline

    Codisimus

    I am looking to have the CraftBukkit server load plugins from a different directory.
     
  6. Offline

    Rocoty

    Oh, right. Well, if there isn't an option for it, you frankly might need to edit Craftbukkit

    Take a look at this: http://dev.bukkit.org/bukkit-plugins/globalplugins/

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

    Codisimus

    Wow that is a lot simple than wut I was going to do.
    That plugin goes in /plugins and then loads all of your other plugins.
    I was trying to modify the original /plugins dir.
    Thanks a lot for finding this for me Rocoty!
    Marking as solved.
     
  8. Offline

    lycano

    I do not see the benefit of loading plugins via a plugin from a different directory.

    1) If it is for "easy management" purposes then the person who administrates the server should use symlinks. This can be done via linux and via windows.

    2) If its because of "easy update" this is also redundant because of 1)
     
    Codisimus likes this.
  9. Offline

    Codisimus

    lycano That would be a good alternative. You would have to set that up each time but you can simply add that to the script you use that creates a new server.
    Have you or someone you know successfully used this with Multicraft?
     
  10. Offline

    lycano

    This depends weither the servers you are using are remote or on the same host.

    In any case you dont need to set it up each time. Only once and everytime you add a new plugin.

    If you want you could also do multi server plugin dir that are mounted or (linux) binded to that targets server plugin dir.

    Ex.

    Main/host1/plugins
    Main/host2/plugins
    Main/global/plugins

    Make global plugins your main plugin dir for all servers. Then create symlinks in each host dir if you only want to use some plugins but not all. If you need all plugins active on all servers just mount/bind the global plugin dir to the target host.
     
  11. Offline

    Codisimus

    That is wut I was thinking of doing. All of the files are on the same box. For an additional box we would just copy the global directory. Then it would only be like 3 folders rather than 50. Now all we have to do is figure out the permissions issues. I keep telling the admin to try changing the permissions of the global directory so that other servers can access it but I am not sure if he is doing it correctly. (I am the dev so I don't have root access)

    Anyway thanks again for the great idea.
     
  12. Offline

    lycano

    well if it is a linux machine its really easy to rebind an existing dir read only. He just has to check the permissions first but if he does 755 for directories and 644 for files it should be fine as you only need read only access to the dir ...

    He can checkout http://lwn.net/Articles/281157/ on how to rebind an existing dir. This can also be pushed to /etc/fstab so he does not have to do it everytime the host restarts.

    I would not copy as the OS can do so much more than just handling data =)
     
  13. Offline

    Codisimus

    I have bookmarked that link for him but wut do you mean by
     
  14. Offline

    lycano

    Well you said "For an additional box we would just copy the global directory".

    I would only copy the global directory to another host dir as i posted when the content differs. If its the same you can just rebind the same dir to the new servers plugin dir.
     
  15. Offline

    Codisimus

    So, if I understand correctly. You would even suggest this when it would be loading from another box? Seems like you would noticed the speed difference when accessing large files.
     
  16. Offline

    lycano

    Depends: if its on the same network then yes i would bind. If its on another subnet then no. I would then use rsync to mirror the plugin directories or drbd (distributed replicated block device) for easier maintainance.
     
  17. at craftbukkit, you can configure the plugins directory using bukkit.yml or using the -P argument when starting craftbukkit
     
    Codisimus and lycano like this.
  18. Offline

    Codisimus

    How? that isn't listed on http://wiki.bukkit.org/Bukkit.yml.
     
  19. Offline

    lycano

  20. Offline

    Codisimus

  21. Offline

    lycano

    +1 ferrybig for reporting this helpful tip! I also found out, thanks to you, that there is an option to set the "update plugin" folder which will be used to update a plugin on restart. If this works i can implement auto updates into my plugins =)
     
  22. Offline

    Codisimus

    ferrybig ditto! I also found that there is a log-limit which can be used to prevent having logs that are 3gb+
     
Thread Status:
Not open for further replies.

Share This Page