diff --git a/src/main/java/fr/moribus/imageonmap/ImageOnMap.java b/src/main/java/fr/moribus/imageonmap/ImageOnMap.java index f16aa90..92ea105 100644 --- a/src/main/java/fr/moribus/imageonmap/ImageOnMap.java +++ b/src/main/java/fr/moribus/imageonmap/ImageOnMap.java @@ -18,13 +18,7 @@ package fr.moribus.imageonmap; -import fr.moribus.imageonmap.commands.maptool.DeleteCommand; -import fr.moribus.imageonmap.commands.maptool.ExploreCommand; -import fr.moribus.imageonmap.commands.maptool.GetCommand; -import fr.moribus.imageonmap.commands.maptool.GetRemainingCommand; -import fr.moribus.imageonmap.commands.maptool.ListCommand; -import fr.moribus.imageonmap.commands.maptool.MigrateCommand; -import fr.moribus.imageonmap.commands.maptool.NewCommand; +import fr.moribus.imageonmap.commands.maptool.*; import fr.moribus.imageonmap.image.ImageIOExecutor; import fr.moribus.imageonmap.image.ImageRendererExecutor; import fr.moribus.imageonmap.image.MapInitEvent; @@ -106,7 +100,8 @@ public final class ImageOnMap extends ZPlugin DeleteCommand.class, GetRemainingCommand.class, ExploreCommand.class, - MigrateCommand.class + MigrateCommand.class, + RenameCommand.class ); Commands.registerShortcut("maptool", NewCommand.class, "tomap"); diff --git a/src/main/java/fr/moribus/imageonmap/commands/maptool/RenameCommand.java b/src/main/java/fr/moribus/imageonmap/commands/maptool/RenameCommand.java new file mode 100644 index 0000000..36f8be5 --- /dev/null +++ b/src/main/java/fr/moribus/imageonmap/commands/maptool/RenameCommand.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2013 Moribus + * Copyright (C) 2015 ProkopyL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package fr.moribus.imageonmap.commands.maptool; + +import fr.moribus.imageonmap.commands.IoMCommand; +import fr.moribus.imageonmap.map.ImageMap; +import fr.zcraft.zlib.components.commands.CommandException; +import fr.zcraft.zlib.components.commands.CommandInfo; + +import java.util.List; + +@CommandInfo(name = "rename",usageParameters = " ") +public class RenameCommand extends IoMCommand { + @Override + protected void run() throws CommandException + { + if(args.length == 2) + { + ImageMap map = getMapFromArgs(); + map.rename(args[1]); + } else { + info("Not Enough Or To Many Arguments"); + } + } + @Override + protected List complete() throws CommandException + { + if(args.length == 1) + return getMatchingMapNames(playerSender(), args[0]); + return null; + } +}