Search in sources :

Example 1 with Color

use of com.alessiodp.partiesapi.interfaces.Color in project Parties by AlessioDP.

the class ConfigurationManager method handleColors.

private void handleColors(ConfigurationSection cfg, String path) {
    Set<Color> colors = new HashSet<Color>();
    ConfigurationSection csColors = cfg.getConfigurationSection(path);
    if (csColors != null) {
        for (String key : csColors.getKeys(false)) {
            String name = key;
            String command = csColors.getString(key + ".command", "");
            String code = csColors.getString(key + ".code", "");
            int dynP = csColors.getInt(key + ".dynamic.priority", -1);
            int dynM = csColors.getInt(key + ".dynamic.members", -1);
            int dynK = csColors.getInt(key + ".dynamic.kills", -1);
            ColorImpl pc = new ColorImpl(name, command, code, dynP, dynM, dynK);
            colors.add(pc);
        }
        ConfigParties.COLOR_LIST = colors;
    } else {
        // Give error: no ranks node found
        plugin.log(Level.WARNING, ConsoleColor.RED.getCode() + "Cannot find color list, restoring default one.");
    }
}
Also used : Color(com.alessiodp.partiesapi.interfaces.Color) ConsoleColor(com.alessiodp.parties.utils.ConsoleColor) ColorImpl(com.alessiodp.parties.parties.objects.ColorImpl) HashSet(java.util.HashSet) ConfigurationSection(org.bukkit.configuration.ConfigurationSection)

Example 2 with Color

use of com.alessiodp.partiesapi.interfaces.Color 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;
}
Also used : RankImpl(com.alessiodp.parties.players.objects.RankImpl) Color(com.alessiodp.partiesapi.interfaces.Color) ArrayList(java.util.ArrayList) Rank(com.alessiodp.partiesapi.interfaces.Rank) ColorImpl(com.alessiodp.parties.parties.objects.ColorImpl)

Example 3 with Color

use of com.alessiodp.partiesapi.interfaces.Color in project Parties by AlessioDP.

the class CommandColor method onCommand.

@Override
public void onCommand(CommandData commandData) {
    PartyPlayerEntity pp = commandData.getPartyPlayer();
    PartyEntity party = commandData.getParty();
    /*
		 * Command handling
		 */
    if (commandData.getArgs().length == 1) {
        // Automatically pp.sendMessage put color placeholders
        if (party.getColor() != null)
            pp.sendMessage(Messages.ADDCMD_COLOR_INFO);
        else
            pp.sendMessage(Messages.ADDCMD_COLOR_EMPTY);
        return;
    }
    boolean isRemove = false;
    Color color = null;
    if (commandData.getArgs()[1].equalsIgnoreCase(ConfigMain.COMMANDS_SUB_REMOVE)) {
        // Remove command
        isRemove = true;
    } else {
        // Normal command
        color = plugin.getColorManager().searchColorByCommand(commandData.getArgs()[1]);
        if (color == null) {
            // Color doesn't exist
            pp.sendMessage(Messages.ADDCMD_COLOR_WRONGCOLOR);
            return;
        }
        if (VaultHandler.payCommand(VaultHandler.VaultCommand.COLOR, pp, commandData.getCommandLabel(), commandData.getArgs()))
            return;
    }
    /*
		 * Command starts
		 */
    party.setColor(color);
    party.updateParty();
    party.callChange();
    if (isRemove) {
        pp.sendMessage(Messages.ADDCMD_COLOR_REMOVED);
        LoggerManager.log(LogLevel.MEDIUM, Constants.DEBUG_CMD_COLOR_REM.replace("{player}", pp.getName()).replace("{party}", party.getName()), true);
    } else {
        pp.sendMessage(Messages.ADDCMD_COLOR_CHANGED, party);
        party.sendBroadcast(pp, Messages.ADDCMD_COLOR_BROADCAST);
        LoggerManager.log(LogLevel.MEDIUM, Constants.DEBUG_CMD_COLOR.replace("{player}", pp.getName()).replace("{party}", party.getName()).replace("{value}", color.getName()), true);
    }
}
Also used : PartyPlayerEntity(com.alessiodp.parties.players.objects.PartyPlayerEntity) Color(com.alessiodp.partiesapi.interfaces.Color) PartyEntity(com.alessiodp.parties.parties.objects.PartyEntity)

Aggregations

Color (com.alessiodp.partiesapi.interfaces.Color)3 ColorImpl (com.alessiodp.parties.parties.objects.ColorImpl)2 PartyEntity (com.alessiodp.parties.parties.objects.PartyEntity)1 PartyPlayerEntity (com.alessiodp.parties.players.objects.PartyPlayerEntity)1 RankImpl (com.alessiodp.parties.players.objects.RankImpl)1 ConsoleColor (com.alessiodp.parties.utils.ConsoleColor)1 Rank (com.alessiodp.partiesapi.interfaces.Rank)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 ConfigurationSection (org.bukkit.configuration.ConfigurationSection)1