Making My Plugin Automated.

Discussion in 'Plugin Development' started by Inthezone, Sep 30, 2012.

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

    Inthezone

    So basically I want my plugin, when there is 1 players left, to stop the server, and then delete the world files, then start the server, would anyone know how to do this, and is it possible to do this with FTP, so it accesses my FTP and then deletes the world ?
    <hint hint> its hunger games
     
  2. Offline

    HouseMD

    Code:
        File world = new File("/world");
     
        @EventHandler
        public void delWorld(PlayerQuitEvent event) {
            if (Bukkit.getOnlinePlayers().length <= 1) {
                world.delete();
            }
        }
     
  3. Offline

    Inthezone

    I know that but, would that delete it recursively? and the /world do I have to put in the exact location of the world file? or leave it like that HouseMD

    EDIT: By Recursively I mean all the files within it
     
  4. Offline

    HouseMD

    in java a folder is a file. if you delete it, everything inside will be deleted too since nothing is containing it anymore.
     
  5. Offline

    Inthezone

    HouseMD and also do I put like C:/Desktop/ and all that stuff?
    EDIT: For the world file I mean

    Bump; I put in the stuff housemd told me to, It still does not work.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  6. If you realy need FTP, I can give you some classes I delevoped some time earlier
     
  7. Offline

    Inthezone

    yes I really need it, and if you would give me it, you would be a god <3 ferrybig
     
  8. I will give them, let me look for it if its 100% complete for the things you want (like folder/directory deleting)
    (found out I need to code file deleting first will do it quick)
     
  9. Offline

    Inthezone

    Ok thanks !
     
  10. https://dl.dropbox.com/u/60864086/FTP client.jar
    if you open it whit the java -jar command, then it will connect to localhost using username "test"and password "123", the source .java files are also included inside the jar file itself (notice, it may lag of documentation because I writting it some tim in the past and its a pretty complex implementation of ftp, just look how the main class "FTPClient" handles the file removing, and base your own methode on that. If somebody knows a better library for ftp, plz say it.
     
  11. Offline

    HouseMD

    You don't need ftp... Since its all done locally. You just need the local world files location to delete it ._.
     
Thread Status:
Not open for further replies.

Share This Page