use of com.alessiodp.parties.players.objects.RankImpl in project Parties by AlessioDP.
the class ConfigurationManager method handleRanks.
private void handleRanks(ConfigurationSection cfg, String path) {
Set<Rank> ranks = new HashSet<Rank>();
Rank def = null;
Rank lower = null;
Rank higher = null;
ConfigurationSection csRanks = cfg.getConfigurationSection(path);
if (csRanks != null) {
for (String key : csRanks.getKeys(false)) {
int rank = csRanks.getInt(key + ".rank", 1);
String name = csRanks.getString(key + ".name", key);
String chat = csRanks.getString(key + ".chat", name);
boolean dft = csRanks.getBoolean(key + ".default", false);
List<String> perm = csRanks.getStringList(key + ".permissions");
Rank newRank = new RankImpl(rank, key, name, chat, dft, perm);
ranks.add(newRank);
if (dft)
def = newRank;
if (lower == null || newRank.getLevel() < lower.getLevel())
lower = newRank;
if (higher == null || newRank.getLevel() > higher.getLevel())
higher = newRank;
}
if (lower != null) {
if (def == null) {
// Give error: default rank not found
def = lower;
plugin.log(Level.WARNING, ConsoleColor.RED.getCode() + "Cannot find default rank, set lower one.");
}
// Save rank list
ConfigParties.RANK_LIST = ranks;
ConfigParties.RANK_SET_DEFAULT = def.getLevel();
ConfigParties.RANK_SET_HIGHER = higher.getLevel();
} else {
// Give error: no ranks found
plugin.log(Level.WARNING, ConsoleColor.RED.getCode() + "Rank list empty, restoring default one.");
}
} else {
// Give error: no ranks node found
plugin.log(Level.WARNING, ConsoleColor.RED.getCode() + "Cannot find rank list, restoring default one.");
}
}
use of com.alessiodp.parties.players.objects.RankImpl in project Parties by AlessioDP.
the class ConfigParties method loadDefaults.
public void loadDefaults() {
// General settings
GENERAL_MEMBERSLIMIT = -1;
GENERAL_NAME_ALLOWEDCHARS = "[a-zA-Z0-9]+";
GENERAL_NAME_MINLENGTH = 3;
GENERAL_NAME_MAXLENGTH = 10;
GENERAL_NAME_RENAMECD = 300;
GENERAL_INVITE_TIMEOUT = 20;
GENERAL_INVITE_REVOKE = true;
GENERAL_INVITE_PREVENTINVITEPERM = true;
GENERAL_INVITE_COOLDOWN_ENABLE = false;
GENERAL_INVITE_COOLDOWN_GLOBAL = 60;
GENERAL_INVITE_COOLDOWN_INDIVIDUAL = 0;
GENERAL_CHAT_ALLOWCOLORS = false;
GENERAL_CHAT_TOGGLECHATCMD = true;
GENERAL_CHAT_CHATCD = 0;
GENERAL_CHAT_FORMAT_PARTY = "&b[Party] %rank_chat% %player%&r&7: &b%message%";
GENERAL_CHAT_FORMAT_SPY = "&7[SPY] [Party:%party%] %player%: %message%";
GENERAL_CHAT_FORMAT_BROADCAST = "&b[Party] %message%";
// Ranks settings
RANK_LIST = new HashSet<Rank>();
List<String> perms = new ArrayList<String>();
perms.add("party.sendmessage");
perms.add("party.home");
perms.add("party.desc");
perms.add("party.motd");
perms.add("party.claim");
Rank rank = new RankImpl(5, "member", "Member", "&bMember", true, perms);
RANK_LIST.add(rank);
RANK_SET_DEFAULT = 5;
perms = new ArrayList<String>();
perms.add("-party.edit.home");
perms.add("-party.edit.desc");
perms.add("-party.edit.motd");
perms.add("-party.edit.color");
perms.add("-party.edit.prefix");
perms.add("-party.edit.suffix");
perms.add("-party.edit.password");
perms.add("-party.admin.rename");
perms.add("-party.admin.rank");
perms.add("-party.admin.teleport");
perms.add("-party.autocommand");
perms.add("*");
rank = new RankImpl(10, "moderator", "Moderator", "&cModerator", false, perms);
RANK_LIST.add(rank);
perms = new ArrayList<String>();
perms.add("*");
rank = new RankImpl(20, "leader", "Leader", "&4&lLeader", false, perms);
RANK_LIST.add(rank);
RANK_SET_HIGHER = 20;
// Additional settings
COLOR_ENABLE = false;
COLOR_COLORCMD = true;
COLOR_DYNAMIC = false;
COLOR_LIST = new HashSet<Color>();
COLOR_LIST.add(new ColorImpl("red", "red", "&c", -1, -1, -1));
COLOR_LIST.add(new ColorImpl("green", "green", "&a", -1, -1, -1));
COLOR_LIST.add(new ColorImpl("yourcustomcolor", "special", "&9&n", -1, -1, -1));
DESC_ENABLE = true;
DESC_MINLENGTH = 3;
DESC_MAXLENGTH = 16;
DESC_ALLOWEDCHARS = "[a-zA-Z0-9\\ \\.\\,\\-\\_]+";
FIXED_ENABLE = false;
FIXED_DEFAULT_ENABLE = false;
FIXED_DEFAULT_PARTY = "default";
FRIENDLYFIRE_ENABLE = true;
FRIENDLYFIRE_WARNONFIGHT = true;
FRIENDLYFIRE_LISTWORLDS = new ArrayList<String>();
FRIENDLYFIRE_CRACKSHOT_ENABLE = false;
HOME_ENABLE = false;
HOME_DELAY = 0;
HOME_HIT = true;
HOME_MOVING = true;
HOME_DISTANCE = 3;
PASSWORD_ENABLE = false;
PASSWORD_ALLOWECHARS = "[a-zA-Z0-9]+";
PASSWORD_HASH = "MD5";
PASSWORD_ENCODE = "UTF-8";
PASSWORD_MINLENGTH = 1;
PASSWORD_MAXLENGTH = 16;
KILLS_ENABLE = false;
KILLS_SAVEKILLS = true;
KILLS_MOB_NEUTRAL = false;
KILLS_MOB_HOSTILE = false;
KILLS_MOB_PLAYERS = true;
LIST_ENABLE = true;
LIST_ORDEREDBY = "players";
LIST_FILTERMIN = 1;
LIST_PERPAGE = 8;
LIST_LIMITPARTIES = -1;
LIST_HIDDENPARTIES = new ArrayList<String>();
MOTD_ENABLE = true;
MOTD_MINLENGTH = 3;
MOTD_MAXLENGTH = 100;
MOTD_DELAY = 20;
MOTD_ALLOWEDCHARS = "[a-zA-Z0-9\\ \\.\\,\\-\\_]+";
MOTD_NEWLINECODE = "\\\\n";
TELEPORT_ENABLE = false;
TELEPORT_COOLDOWN = 60;
}
Aggregations