diff --git a/src/net/citizensnpcs/command/command/EditorCommands.java b/src/net/citizensnpcs/command/command/EditorCommands.java new file mode 100644 index 000000000..b20e3e130 --- /dev/null +++ b/src/net/citizensnpcs/command/command/EditorCommands.java @@ -0,0 +1,50 @@ +package net.citizensnpcs.command.command; + +import org.bukkit.entity.Player; + +import net.citizensnpcs.Citizens; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.command.CommandContext; +import net.citizensnpcs.command.annotation.Command; + +public class EditorCommands { + + public EditorCommands(Citizens plugin) { + } + + @Command( + aliases = { "npc" }, + usage = "equip", + desc = "Toggle equipment editor", + modifiers = { "equip" }, + min = 1, + max = 1, + permission = "npc.equip") + public void toggleEquipEditor(CommandContext args, Player player, NPC npc) { + // TODO + } + + @Command( + aliases = { "npc" }, + usage = "path", + desc = "Toggle path editor", + modifiers = { "path" }, + min = 1, + max = 1, + permission = "npc.path") + public void togglePathEditor(CommandContext args, Player player, NPC npc) { + // TODO + } + + @Command( + aliases = { "npc" }, + usage = "text", + desc = "Toggle text editor", + modifiers = { "text" }, + min = 1, + max = 1, + permission = "npc.text") + public void toggleTextEditor(CommandContext args, Player player, NPC npc) { + // TODO + } +} \ No newline at end of file diff --git a/src/net/citizensnpcs/command/command/NPCCommands.java b/src/net/citizensnpcs/command/command/NPCCommands.java index c14c9cb4e..e8946c148 100644 --- a/src/net/citizensnpcs/command/command/NPCCommands.java +++ b/src/net/citizensnpcs/command/command/NPCCommands.java @@ -6,6 +6,7 @@ import net.citizensnpcs.Template; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.trait.Character; import net.citizensnpcs.api.npc.trait.DefaultInstanceFactory; +import net.citizensnpcs.api.npc.trait.SaveId; import net.citizensnpcs.api.npc.trait.trait.MobType; import net.citizensnpcs.api.npc.trait.trait.Owner; import net.citizensnpcs.api.npc.trait.trait.Spawned; @@ -108,18 +109,6 @@ public class NPCCommands { npc.despawn(); Messaging.send(player, ChatColor.GREEN + "You despawned " + StringHelper.wrap(npc.getName()) + "."); } - - @Command( - aliases = { "npc" }, - usage = "editor [editor]", - desc = "Enter an NPC editor", - modifiers = { "editor" }, - min = 2, - max = 2, - permission = "npc.editor") - public void enterEditor(CommandContext args, Player player, NPC npc) { - // TODO - } @Command( aliases = { "npc" }, @@ -164,17 +153,31 @@ public class NPCCommands { npcManager.selectNPC(player, toSelect); Messaging.sendWithNPC(player, Setting.SELECTION_MESSAGE.asString(), toSelect); } - + @Command( - aliases = { "npc" }, - usage = "character [character]", - desc = "Sets the character of an NPC", - modifiers = { "character" }, - min = 2, - max = 2, - permission = "npc.character") + aliases = { "npc" }, + usage = "character [character]", + desc = "Sets the character of an NPC", + modifiers = { "character" }, + min = 2, + max = 2, + permission = "npc.character") public void setNPCCharacter(CommandContext args, Player player, NPC npc) { - // TODO + Character character = characterManager.getInstance(args.getString(1), npc); + if (character == null) { + Messaging.sendError(player, "The character '" + args.getString(1) + "' does not exist."); + return; + } + if (npc.getCharacter() != null + && npc.getCharacter().getClass().getAnnotation(SaveId.class).value() + .equalsIgnoreCase(character.getClass().getAnnotation(SaveId.class).value())) { + Messaging.sendError(player, "The NPC already has the character '" + args.getString(1) + "'."); + return; + } + Messaging.send(player, + StringHelper.wrap(npc.getName() + "'s") + " character is now '" + StringHelper.wrap(args.getString(1)) + + "'."); + npc.setCharacter(character); } @Command( @@ -234,14 +237,8 @@ public class NPCCommands { Messaging.send(player, ChatColor.GREEN + "You teleported to " + StringHelper.wrap(npc.getName()) + "."); } - @Command( - aliases = { "npc" }, - usage = "lookclose", - desc = "Toggle an NPC's look-close state", - modifiers = { "lookclose", "look", "rotate" }, - min = 1, - max = 1, - permission = "npc.look-close") + @Command(aliases = { "npc" }, usage = "lookclose", desc = "Toggle an NPC's look-close state", modifiers = { + "lookclose", "look", "rotate" }, min = 1, max = 1, permission = "npc.look-close") public void toggleNPCLookClose(CommandContext args, Player player, NPC npc) { LookClose trait = npc.getTrait(LookClose.class); trait.toggle(); diff --git a/src/net/citizensnpcs/editor/Editor.java b/src/net/citizensnpcs/editor/Editor.java new file mode 100644 index 000000000..30eb96f5b --- /dev/null +++ b/src/net/citizensnpcs/editor/Editor.java @@ -0,0 +1,8 @@ +package net.citizensnpcs.editor; + +public interface Editor { + + public void begin(); + + public void end(); +} \ No newline at end of file diff --git a/src/net/citizensnpcs/editor/EquipmentEditor.java b/src/net/citizensnpcs/editor/EquipmentEditor.java new file mode 100644 index 000000000..3bb6406ba --- /dev/null +++ b/src/net/citizensnpcs/editor/EquipmentEditor.java @@ -0,0 +1,16 @@ +package net.citizensnpcs.editor; + +public class EquipmentEditor implements Editor { + + @Override + public void begin() { + // TODO Auto-generated method stub + + } + + @Override + public void end() { + // TODO Auto-generated method stub + + } +} \ No newline at end of file diff --git a/src/net/citizensnpcs/editor/PathEditor.java b/src/net/citizensnpcs/editor/PathEditor.java new file mode 100644 index 000000000..104bd0b5b --- /dev/null +++ b/src/net/citizensnpcs/editor/PathEditor.java @@ -0,0 +1,16 @@ +package net.citizensnpcs.editor; + +public class PathEditor implements Editor { + + @Override + public void begin() { + // TODO Auto-generated method stub + + } + + @Override + public void end() { + // TODO Auto-generated method stub + + } +} \ No newline at end of file diff --git a/src/net/citizensnpcs/editor/TextEditor.java b/src/net/citizensnpcs/editor/TextEditor.java new file mode 100644 index 000000000..227fbbae9 --- /dev/null +++ b/src/net/citizensnpcs/editor/TextEditor.java @@ -0,0 +1,16 @@ +package net.citizensnpcs.editor; + +public class TextEditor implements Editor { + + @Override + public void begin() { + // TODO Auto-generated method stub + + } + + @Override + public void end() { + // TODO Auto-generated method stub + + } +} \ No newline at end of file