Add per-class lobby-permissions node.
This commit is contained in:
@@ -985,6 +985,10 @@ public class ArenaImpl implements Arena
|
||||
|
||||
arenaPlayer.setArenaClass(arenaClass);
|
||||
arenaClass.grantItems(p);
|
||||
|
||||
PermissionAttachment pa = arenaClass.grantLobbyPermissions(plugin, p);
|
||||
replacePermissions(p, pa);
|
||||
|
||||
autoReady(p);
|
||||
}
|
||||
|
||||
@@ -1032,8 +1036,24 @@ public class ArenaImpl implements Arena
|
||||
}
|
||||
}
|
||||
p.getInventory().setContents(contents);
|
||||
|
||||
PermissionAttachment pa = arenaClass.grantLobbyPermissions(plugin, p);
|
||||
replacePermissions(p, pa);
|
||||
|
||||
autoReady(p);
|
||||
}
|
||||
|
||||
private void replacePermissions(Player p, PermissionAttachment rep) {
|
||||
PermissionAttachment old = attachments.get(p);
|
||||
if (old != null) {
|
||||
p.removeAttachment(old);
|
||||
p.recalculatePermissions();
|
||||
}
|
||||
if (rep != null) {
|
||||
attachments.put(p, rep);
|
||||
p.recalculatePermissions();
|
||||
}
|
||||
}
|
||||
|
||||
private void autoReady(Player p) {
|
||||
if (settings.getBoolean("auto-ready", false)) {
|
||||
@@ -1076,10 +1096,7 @@ public class ArenaImpl implements Arena
|
||||
public void assignClassPermissions(Player p)
|
||||
{
|
||||
PermissionAttachment pa = arenaPlayerMap.get(p).getArenaClass().grantPermissions(plugin, p);
|
||||
if (pa == null) return;
|
||||
|
||||
attachments.put(p, pa);
|
||||
p.recalculatePermissions();
|
||||
replacePermissions(p, pa);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user