public ArrayList<String> validateName(String str) { ArrayList<String> errors = new ArrayList<String>(); if (MiscUtil.getComparisonString(str).length() < MConf.get().factionNameLengthMin) { errors.add( Txt.parse( "<i>The faction name can't be shorter than <h>%s<i> chars.", MConf.get().factionNameLengthMin)); } if (str.length() > MConf.get().factionNameLengthMax) { errors.add( Txt.parse( "<i>The faction name can't be longer than <h>%s<i> chars.", MConf.get().factionNameLengthMax)); } for (char c : str.toCharArray()) { if (!MiscUtil.substanceChars.contains(String.valueOf(c))) { errors.add( Txt.parse("<i>Faction name must be alphanumeric. \"<h>%s<i>\" is not allowed.", c)); } } return errors; }
public void econLandRewardRoutine() { if (!Econ.isEnabled()) return; double econLandReward = MConf.get().econLandReward; if (econLandReward == 0.0) return; Factions.get().log("Running econLandRewardRoutine..."); for (Faction faction : this.getAll()) { int landCount = faction.getLandCount(); if (!faction.getFlag(MFlag.getFlagPeaceful()) && landCount > 0) { List<MPlayer> players = faction.getMPlayers(); int playerCount = players.size(); double reward = econLandReward * landCount / playerCount; for (MPlayer player : players) { Econ.modifyMoney( player, reward, "own " + landCount + " faction land divided among " + playerCount + " members"); } } } }