save-all

Discussion in 'Plugin Development' started by beachyboy18, Jun 22, 2014.

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

    beachyboy18

    Basically I'm making an autosave plugin and the only way I can think of making it save is:
    Code:
    Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "save-all");
    But I don't want to use the "save-all" command, I want to how to make the save command myself and I can't seem to work it out :L
    I am relatively new to Java but I've made other plugins before which broadcast messages and stuff :3
     
  2. Offline

    ReggieMOL

  3. Offline

    beachyboy18

  4. Offline

    ChipDev

    Just masking?
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    2. if(cmd.getName().equalsIgnoreCase("Save")) {
    3. getServer().dispatchCommand(getServer().getConsoleSender(), "save-all");
    4. }
    5. }

    Think out of the box.
    Also, its good you know to keep your code tags in a syntax (You are new to bukkit/java! Welcome!)
    This triggers when doing /save , the console does /save-all
     
  5. Offline

    beachyboy18

    Yeah, I've done this for the "/save" command but I want to make my own save thing so I don't have to use "/save-all"
     
  6. Offline

    ChipDev

    Wait, Can you tell me what this is used for? I just don't get why you would need to create a new 'save-all' :p,
    Then I could get what you are trying to do.
    EDIT: in the
    Code:java
    1. if(cmd.getName().equalsIgnoreCase("") {

    In the equalsIgnoreCase, inside the " " 's, You can put whatever. cases don't matter.
    you could make it "BeachyBoySavingTimePowersGO!"
    I'm used to the beach, live right on it :)
    EDIT #2: Heh, Do you need it to do this?
    Code:
    if(cmd.getName().equalsIgnoreCase("Save") {
    getServer().dispatchCommand(getServer().getConsoleSender(), "save-on");
    getServer().dispatchCommand(getServer().getConsoleSender(), "save-off");
    Saves on and then off fast.
    then onDisable maybe save one more time?
     
  7. Offline

    beachyboy18

    So basically, I'm making a plugin which auto saves every set amount of time, there is also the /save command. When I made the /save command I put:
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
    2. {
    3.  
    4. if (cmd.getName().equalsIgnoreCase("save") && sender instanceof Player)
    5. {
    6.  
    7. Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "save-all");
    8.  
    9. return true;
    10.  
    11.  
    12. }

    Inside the box above, I use /save-all to save the server but I want to make my own /save command because /save-all is part of essentials and I do not want to use their command.
     
  8. Offline

    ChipDev

    Don't use essentials, sorry. My new edit solves that :D
    Srsly, don't use any other plugins other than mine, voxelsniper, and worldedit.
    Also, look into Bukkit runnables for auto-save.
    Or I can tell you if you want, its kinda hard to understand!
     
  9. Offline

    beachyboy18

    It's not so much the autosave, I've got the automatic bit sorted I just want to make my own /save command
     
  10. Offline

    ChipDev

    K, so just this? (Using your code, I want to edit it!
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
    2. if (cmd.getName().equalsIgnoreCase("save") && sender instanceof Player){
    3. Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "save-on");
    4. Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "save-off");
    5. return true;
    6. }
     
  11. Offline

    xTigerRebornx

    es359 likes this.
  12. Offline

    beachyboy18

Thread Status:
Not open for further replies.

Share This Page