Skip to content

Commit

Permalink
Add citizens.npc.createall permission for PEX users
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Apr 17, 2013
1 parent fc53c6e commit c542a8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/citizensnpcs/commands/NPCCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public void create(CommandContext args, CommandSender sender, NPC npc) throws Co
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("_", "")))
throw new NoPermissionsException();

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/net/citizensnpcs/editor/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ public abstract class Editor implements Listener {

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) {
editor.begin();
player.getServer().getPluginManager()
.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) {
Editor edit = editing.get(player.getName());
Editor edit = EDITING.get(player.getName());
if (edit == null)
enter(player, editor);
else if (edit.getClass() == editor.getClass())
Expand All @@ -36,22 +36,22 @@ else if (edit.getClass() == editor.getClass())
}

public static boolean hasEditor(Player player) {
return editing.containsKey(player.getName());
return EDITING.containsKey(player.getName());
}

public static void leave(Player player) {
if (!hasEditor(player))
return;
Editor editor = editing.remove(player.getName());
Editor editor = EDITING.remove(player.getName());
HandlerList.unregisterAll(editor);
editor.end();
}

public static void leaveAll() {
for (Entry<String, Editor> entry : editing.entrySet()) {
for (Entry<String, Editor> entry : EDITING.entrySet()) {
entry.getValue().end();
HandlerList.unregisterAll(entry.getValue());
}
editing.clear();
EDITING.clear();
}
}

0 comments on commit c542a8f

Please sign in to comment.