Fixed Co-Leader Default Permissions
This commit is contained in:
parent
11d9f9230b
commit
91ca08e66b
@ -552,7 +552,6 @@ public class Conf {
|
||||
safeZoneNerfedCreatureTypes.add(EntityType.ZOMBIE);
|
||||
|
||||
// Is this called lazy load?
|
||||
defaultFactionPermissions.put("LEADER", new DefaultPermissions(true));
|
||||
defaultFactionPermissions.put("COLEADER", new DefaultPermissions(true));
|
||||
defaultFactionPermissions.put("MODERATOR", new DefaultPermissions(true));
|
||||
defaultFactionPermissions.put("NORMAL MEMBER", new DefaultPermissions(false));
|
||||
|
@ -37,7 +37,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
public HashMap<Integer, String> rules = new HashMap<Integer, String>();
|
||||
public HashMap<Integer, String> rules = new HashMap<>();
|
||||
public int tnt;
|
||||
public Location checkpoint;
|
||||
public LazyLocation vault;
|
||||
@ -186,7 +186,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
}
|
||||
|
||||
public void addAnnouncement(FPlayer fPlayer, String msg) {
|
||||
List<String> list = announcements.containsKey(fPlayer.getId()) ? announcements.get(fPlayer.getId()) : new ArrayList<String>();
|
||||
List<String> list = announcements.containsKey(fPlayer.getId()) ? announcements.get(fPlayer.getId()) : new ArrayList<>();
|
||||
list.add(msg);
|
||||
announcements.put(fPlayer.getId(), list);
|
||||
}
|
||||
@ -450,8 +450,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
vault = null;
|
||||
return;
|
||||
}
|
||||
LazyLocation newlocation = new LazyLocation(vaultLocation);
|
||||
vault = newlocation;
|
||||
vault = new LazyLocation(vaultLocation);
|
||||
}
|
||||
|
||||
public int getUpgrade(UpgradeType upgrade) {
|
||||
@ -899,46 +898,43 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
}
|
||||
|
||||
public void resetPerms() {
|
||||
FactionsPlugin.getInstance().log(Level.WARNING, "Resetting permissions for Faction: " + tag);
|
||||
FactionsPlugin.instance.log(Level.WARNING, "Resetting permissions for Faction: " + this.tag);
|
||||
|
||||
permissions.clear();
|
||||
|
||||
// First populate a map with undefined as the permission for each action.
|
||||
Map<PermissableAction, Access> freshMap = new HashMap<>();
|
||||
for (PermissableAction permissableAction : PermissableAction.values()) {
|
||||
freshMap.put(permissableAction, Access.UNDEFINED);
|
||||
}
|
||||
for (PermissableAction action : PermissableAction.values()) freshMap.put(action, Access.DENY);
|
||||
|
||||
// Put the map in there for each relation.
|
||||
for (Relation relation : Relation.values()) {
|
||||
if (relation != Relation.MEMBER) {
|
||||
if (relation == Relation.MEMBER) continue;
|
||||
permissions.put(relation, new HashMap<>(freshMap));
|
||||
}
|
||||
}
|
||||
|
||||
// And each role.
|
||||
for (Role role : Role.values()) {
|
||||
if (role != Role.LEADER) {
|
||||
if (role == Role.LEADER) continue;
|
||||
permissions.put(role, new HashMap<>(freshMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setDefaultPerms() {
|
||||
Map<PermissableAction, Access> defaultMap = new HashMap<>();
|
||||
for (PermissableAction action : PermissableAction.values()) defaultMap.put(action, Access.UNDEFINED);
|
||||
for (PermissableAction action : PermissableAction.values()) defaultMap.put(action, Access.DENY);
|
||||
|
||||
for (Relation rel : Relation.values()) {
|
||||
if (rel != Relation.MEMBER) {
|
||||
if (rel == Relation.MEMBER) continue;
|
||||
if (Conf.defaultFactionPermissions.containsKey(rel.nicename.toUpperCase())) {
|
||||
permissions.put(rel, PermissableAction.fromDefaults(Conf.defaultFactionPermissions.get(rel.nicename.toUpperCase())));
|
||||
} else permissions.put(rel, new HashMap<>(defaultMap));
|
||||
}
|
||||
}
|
||||
|
||||
for (Role rel : Role.values()) {
|
||||
if (Conf.defaultFactionPermissions.containsKey(rel.nicename.toUpperCase())) {
|
||||
permissions.put(rel, PermissableAction.fromDefaults(Conf.defaultFactionPermissions.get(rel.nicename.toUpperCase())));
|
||||
} else permissions.put(rel, new HashMap<>(defaultMap));
|
||||
for (Role role : Role.values()) {
|
||||
if (role == Role.LEADER) continue;
|
||||
if (Conf.defaultFactionPermissions.containsKey(role.nicename.toUpperCase())) {
|
||||
permissions.put(role, PermissableAction.fromDefaults(Conf.defaultFactionPermissions.get(role.nicename.toUpperCase())));
|
||||
} else permissions.put(role, new HashMap<>(defaultMap));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1145,11 +1145,11 @@ public enum TL {
|
||||
/**
|
||||
* Roles
|
||||
*/
|
||||
ROLE_LEADER("Leader"),
|
||||
ROLE_COLEADER("Co-Leader"),
|
||||
ROLE_MODERATOR("Moderator"),
|
||||
ROLE_NORMAL("Normal Member"),
|
||||
ROLE_RECRUIT("Recruit"),
|
||||
ROLE_LEADER("leader"),
|
||||
ROLE_COLEADER("coleader"),
|
||||
ROLE_MODERATOR("moderator"),
|
||||
ROLE_NORMAL("normal member"),
|
||||
ROLE_RECRUIT("recruit"),
|
||||
|
||||
/**
|
||||
* Region types.
|
||||
|
Loading…
Reference in New Issue
Block a user