Add citizens.npc.createall permission for PEX users

This commit is contained in:
fullwall 2013-04-17 11:41:51 +08:00
parent cfefa87081
commit 26fee2eccc
2 changed files with 8 additions and 8 deletions

View File

@ -293,7 +293,7 @@ public class NPCCommands {
type = EntityType.PLAYER; type = EntityType.PLAYER;
} }
} }
if (!sender.hasPermission("citizens.npc.create.*") if (!sender.hasPermission("citizens.npc.create.*") && !sender.hasPermission("citizens.npc.createall")
&& !sender.hasPermission("citizens.npc.create." + type.name().toLowerCase().replace("_", ""))) && !sender.hasPermission("citizens.npc.create." + type.name().toLowerCase().replace("_", "")))
throw new NoPermissionsException(); throw new NoPermissionsException();

View File

@ -16,17 +16,17 @@ public abstract class Editor implements Listener {
public abstract void end(); public abstract void end();
private static final Map<String, Editor> editing = new HashMap<String, Editor>(); private static final Map<String, Editor> EDITING = new HashMap<String, Editor>();
private static void enter(Player player, Editor editor) { private static void enter(Player player, Editor editor) {
editor.begin(); editor.begin();
player.getServer().getPluginManager() player.getServer().getPluginManager()
.registerEvents(editor, player.getServer().getPluginManager().getPlugin("Citizens")); .registerEvents(editor, player.getServer().getPluginManager().getPlugin("Citizens"));
editing.put(player.getName(), editor); EDITING.put(player.getName(), editor);
} }
public static void enterOrLeave(Player player, Editor editor) { public static void enterOrLeave(Player player, Editor editor) {
Editor edit = editing.get(player.getName()); Editor edit = EDITING.get(player.getName());
if (edit == null) if (edit == null)
enter(player, editor); enter(player, editor);
else if (edit.getClass() == editor.getClass()) else if (edit.getClass() == editor.getClass())
@ -36,22 +36,22 @@ public abstract class Editor implements Listener {
} }
public static boolean hasEditor(Player player) { public static boolean hasEditor(Player player) {
return editing.containsKey(player.getName()); return EDITING.containsKey(player.getName());
} }
public static void leave(Player player) { public static void leave(Player player) {
if (!hasEditor(player)) if (!hasEditor(player))
return; return;
Editor editor = editing.remove(player.getName()); Editor editor = EDITING.remove(player.getName());
HandlerList.unregisterAll(editor); HandlerList.unregisterAll(editor);
editor.end(); editor.end();
} }
public static void leaveAll() { public static void leaveAll() {
for (Entry<String, Editor> entry : editing.entrySet()) { for (Entry<String, Editor> entry : EDITING.entrySet()) {
entry.getValue().end(); entry.getValue().end();
HandlerList.unregisterAll(entry.getValue()); HandlerList.unregisterAll(entry.getValue());
} }
editing.clear(); EDITING.clear();
} }
} }