From 35dc3ce40ac88f190ca9e0ff828fd66a2fa8c94a Mon Sep 17 00:00:00 2001 From: aPunch Date: Sat, 25 Feb 2012 00:07:53 -0600 Subject: [PATCH] changes to editors --- plugin.yml | 8 ++-- .../command/command/EditorCommands.java | 40 +++---------------- .../command/command/NPCCommands.java | 2 +- src/net/citizensnpcs/editor/Editor.java | 6 +-- .../citizensnpcs/editor/EquipmentEditor.java | 9 +---- src/net/citizensnpcs/editor/PathEditor.java | 13 +----- src/net/citizensnpcs/editor/TextEditor.java | 9 +---- 7 files changed, 17 insertions(+), 70 deletions(-) diff --git a/plugin.yml b/plugin.yml index 87a3833c9..b222748a2 100644 --- a/plugin.yml +++ b/plugin.yml @@ -19,15 +19,17 @@ permissions: citizens.npc.character.*: true citizens.npc.create: true citizens.npc.despawn: true - citizens.npc.equip: true + citizens.npc.edit.*: + children: + citizens.npc.edit.equip: true + citizens.npc.edit.path: true + citizens.npc.edit.text: true citizens.npc.help: true - citizens.npc.path: true citizens.npc.remove: true citizens.npc.remove.all: true citizens.npc.rename: true citizens.npc.select: true citizens.npc.spawn: true - citizens.npc.text: true citizens.npc.tp: true citizens.npc.tphere: true citizens.npc.lookclose: true \ No newline at end of file diff --git a/src/net/citizensnpcs/command/command/EditorCommands.java b/src/net/citizensnpcs/command/command/EditorCommands.java index a4fe9799c..a6cdc6f53 100644 --- a/src/net/citizensnpcs/command/command/EditorCommands.java +++ b/src/net/citizensnpcs/command/command/EditorCommands.java @@ -6,7 +6,6 @@ import net.citizensnpcs.Citizens; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.command.Command; import net.citizensnpcs.command.CommandContext; -import net.citizensnpcs.util.Messaging; public class EditorCommands { @@ -15,40 +14,11 @@ public class EditorCommands { @Command( aliases = { "npc" }, - usage = "equip", - desc = "Toggle equipment editor", - modifiers = { "equip" }, - min = 1, - max = 1, - permission = "npc.equip") + usage = "edit (editor)", + desc = "Toggle an NPC editor", + modifiers = { "edit" }, + min = 2, + max = 2) public void toggleEquipEditor(CommandContext args, Player player, NPC npc) { - if (!(npc instanceof Player)) { - Messaging.sendError(player, "The NPC must be a human to equip armor and items."); - return; - } - } - - @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 3a4461b64..eaa25a9c8 100644 --- a/src/net/citizensnpcs/command/command/NPCCommands.java +++ b/src/net/citizensnpcs/command/command/NPCCommands.java @@ -202,7 +202,7 @@ public class NPCCommands { return; } if (!player.hasPermission("citizens.npc.character." + character.getName()) - && !player.hasPermission("citizens.npc.character.*")) { + && !player.hasPermission("citizens.npc.character.*") && !player.hasPermission("citizens.admin")) { Messaging.sendError(player, "You don't have permission to execute that command."); return; } diff --git a/src/net/citizensnpcs/editor/Editor.java b/src/net/citizensnpcs/editor/Editor.java index 30eb96f5b..d13348107 100644 --- a/src/net/citizensnpcs/editor/Editor.java +++ b/src/net/citizensnpcs/editor/Editor.java @@ -1,8 +1,8 @@ package net.citizensnpcs.editor; -public interface Editor { +public abstract class Editor { - public void begin(); + public abstract void begin(); - public void end(); + public abstract void end(); } \ No newline at end of file diff --git a/src/net/citizensnpcs/editor/EquipmentEditor.java b/src/net/citizensnpcs/editor/EquipmentEditor.java index fd73c6801..becc2d36b 100644 --- a/src/net/citizensnpcs/editor/EquipmentEditor.java +++ b/src/net/citizensnpcs/editor/EquipmentEditor.java @@ -1,13 +1,6 @@ package net.citizensnpcs.editor; -import org.bukkit.entity.Player; - -public class EquipmentEditor implements Editor { - private Player player; - - public EquipmentEditor(Player player) { - this.player = player; - } +public class EquipmentEditor extends Editor { @Override public void begin() { diff --git a/src/net/citizensnpcs/editor/PathEditor.java b/src/net/citizensnpcs/editor/PathEditor.java index 5eb1e2c83..4c1357b66 100644 --- a/src/net/citizensnpcs/editor/PathEditor.java +++ b/src/net/citizensnpcs/editor/PathEditor.java @@ -1,23 +1,12 @@ package net.citizensnpcs.editor; -import org.bukkit.entity.Player; - -public class PathEditor implements Editor { - private final Player player; - - public PathEditor(Player player) { - this.player = player; - } +public class PathEditor extends 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 index 2683e0448..4778c4a86 100644 --- a/src/net/citizensnpcs/editor/TextEditor.java +++ b/src/net/citizensnpcs/editor/TextEditor.java @@ -1,13 +1,6 @@ package net.citizensnpcs.editor; -import org.bukkit.entity.Player; - -public class TextEditor implements Editor { - private Player player; - - public TextEditor(Player player) { - this.player = player; - } +public class TextEditor extends Editor { @Override public void begin() {