F Perm GUI (#1045)
This commit is contained in:
@@ -7,6 +7,8 @@ import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.Permissable;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.fperms.gui.PermissableActionGUI;
|
||||
import com.massivecraft.factions.zcore.fperms.gui.PermissableRelationGUI;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
import java.util.*;
|
||||
@@ -36,9 +38,10 @@ public class CmdPerm extends FCommand {
|
||||
@Override
|
||||
public void perform() {
|
||||
if (args.size() == 0) {
|
||||
for (String s : getLines()) {
|
||||
msg(s);
|
||||
}
|
||||
me.openInventory(new PermissableRelationGUI(fme).getInventory());
|
||||
return;
|
||||
} else if (args.size() == 1 && getPermissable(argAsString(0)) != null) {
|
||||
me.openInventory(new PermissableActionGUI(fme, getPermissable(argAsString(0))).getInventory());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -109,35 +112,6 @@ public class CmdPerm extends FCommand {
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<String> getLines() {
|
||||
List<String> lines = new ArrayList<>();
|
||||
|
||||
lines.add(TL.COMMAND_PERM_TOP.toString());
|
||||
|
||||
for (PermissableAction action : PermissableAction.values()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(action.getName()).append(" ");
|
||||
|
||||
// Roles except admin
|
||||
for (Role role : Role.values()) {
|
||||
if (role != Role.ADMIN) {
|
||||
sb.append(myFaction.getAccess(role, action).getName()).append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
// Relations except Member
|
||||
for (Relation relation : Relation.values()) {
|
||||
if (relation != Relation.MEMBER) {
|
||||
sb.append(myFaction.getAccess(relation, action).getName()).append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
lines.add(sb.toString().trim());
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_PERM_DESCRIPTION;
|
||||
|
||||
Reference in New Issue
Block a user