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
I just want to know how to make the command which saves the server so if I did /save it would save it but not using "save-all"
Just masking? Code:java public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {if(cmd.getName().equalsIgnoreCase("Save")) {getServer().dispatchCommand(getServer().getConsoleSender(), "save-all");}} 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
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"
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' , Then I could get what you are trying to do. EDIT: in the Code:java 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?
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 public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (cmd.getName().equalsIgnoreCase("save") && sender instanceof Player) { Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "save-all"); return true; } 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.
Don't use essentials, sorry. My new edit solves that 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!
It's not so much the autosave, I've got the automatic bit sorted I just want to make my own /save command
K, so just this? (Using your code, I want to edit it! Code:java public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){if (cmd.getName().equalsIgnoreCase("save") && sender instanceof Player){Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "save-on");Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "save-off");return true;}
beachyboy18 /save-all is a Bukkit command (http://wiki.bukkit.org/CraftBukkit_commands), therefor the code for it will also be located in the source. https://github.com/Bukkit/Bukkit-Bl.../org/bukkit/command/defaults/SaveCommand.java
Ah, thank you , for some reason I thought save-all was apart of essentials, that's what made the problem xD