Add citizens.npc.createall permission for PEX users

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

View File

@ -293,7 +293,7 @@ public class NPCCommands {
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();

View File

@ -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())
@ -36,22 +36,22 @@ public abstract class Editor implements Listener {
}
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();
}
}