b490c5f196
/f map now has a nifty faction name key (LexManos) There are now War Zones; these work similar to Safe Zones, except PvP is enabled and monsters are not blocked (Brettflan) Players now only regenerate power while actually online (Brettflan) New command available to prevent power loss in specific worlds (Brettflan) New command available to prevent faction land claims in specific worlds (doesn't affect safezone and warzone claims) (Brettflan) New command to unclaim all safezone areas (Brettflan) Players are now prevented from using /f home if an enemy is nearby, and the players isn't in a safezone or their own faction territory (Brettflan) New option to make membership default to closed for newly created factions (Brettflan) When an admin has bypass mode enabled (/f bypass), they can now unclaim any faction land they're standing on (Brettflan)
147 lines
5.1 KiB
Java
147 lines
5.1 KiB
Java
package org.mcteam.factions;
|
|
|
|
import java.io.File;
|
|
import java.util.*;
|
|
import org.bukkit.*;
|
|
import org.bukkit.entity.CreatureType;
|
|
import org.mcteam.factions.util.DiscUtil;
|
|
|
|
|
|
public class Conf {
|
|
public static transient File file = new File(Factions.instance.getDataFolder(), "conf.json");
|
|
|
|
// Colors
|
|
public static ChatColor colorMember = ChatColor.GREEN;
|
|
public static ChatColor colorAlly = ChatColor.LIGHT_PURPLE;
|
|
public static ChatColor colorNeutral = ChatColor.WHITE;
|
|
public static ChatColor colorEnemy = ChatColor.RED;
|
|
|
|
public static ChatColor colorSystem = ChatColor.YELLOW;
|
|
public static ChatColor colorChrome = ChatColor.GOLD;
|
|
public static ChatColor colorCommand = ChatColor.AQUA;
|
|
public static ChatColor colorParameter = ChatColor.DARK_AQUA;
|
|
|
|
// Power
|
|
public static double powerPlayerMax = 10;
|
|
public static double powerPlayerMin = -10;
|
|
public static double powerPerMinute = 0.2; // Default health rate... it takes 5 min to heal one power
|
|
public static double powerPerDeath = 2; //A death makes you loose 2 power
|
|
|
|
public static String prefixAdmin = "**";
|
|
public static String prefixMod = "*";
|
|
|
|
public static int factionTagLengthMin = 3;
|
|
public static int factionTagLengthMax = 10;
|
|
public static boolean factionTagForceUpperCase = false;
|
|
|
|
public static boolean newFactionsDefaultOpen = true;
|
|
|
|
public static boolean showMapFactionKey = true;
|
|
|
|
// Configuration on the Faction tag in chat messages.
|
|
|
|
public static boolean chatTagEnabled = true;
|
|
public static boolean chatTagRelationColored = true;
|
|
public static int chatTagInsertIndex = 1;
|
|
public static String chatTagFormat = "%s"+ChatColor.WHITE+" ";
|
|
public static String factionChatFormat = "%s"+ChatColor.WHITE+" %s";
|
|
|
|
public static boolean allowNoSlashCommand = true;
|
|
|
|
public static double autoLeaveAfterDaysOfInactivity = 14;
|
|
|
|
public static boolean homesEnabled = true;
|
|
public static boolean homesTeleportToOnDeath = true;
|
|
public static double homesTeleportAllowedEnemyDistance = 32;
|
|
|
|
public static double territoryShieldFactor = 0.5;
|
|
public static boolean territoryBlockCreepers = false;
|
|
public static boolean territoryBlockFireballs = false;
|
|
public static boolean territoryBlockTNT = false;
|
|
|
|
public static boolean safeZoneDenyBuild = true;
|
|
public static boolean safeZoneDenyUseage = true;
|
|
public static boolean safeZoneBlockTNT = true;
|
|
|
|
public static boolean warZoneBlockCreepers = false;
|
|
public static boolean warZoneBlockFireballs = false;
|
|
public static boolean warZoneBlockTNT = true;
|
|
public static boolean warZoneDenyBuild = true;
|
|
public static boolean warZoneDenyUseage = true;
|
|
public static boolean warZonePowerLoss = true;
|
|
|
|
public static Set<Material> territoryProtectedMaterials = new HashSet<Material>();
|
|
public static Set<Material> territoryDenyUseageMaterials = new HashSet<Material>();
|
|
|
|
public static transient Set<CreatureType> safeZoneNerfedCreatureTypes = new HashSet<CreatureType>();
|
|
|
|
public static Set<String> worldsNoClaiming = new HashSet<String>();
|
|
public static Set<String> worldsNoPowerLoss = new HashSet<String>();
|
|
|
|
public static transient int mapHeight = 8;
|
|
public static transient int mapWidth = 39;
|
|
public static transient char[] mapKeyChrs = "\\/#?$%=&^ABCDEFGHJKLMNOPQRSTUVWXYZ1234567890abcdeghjmnopqrsuvwxyz".toCharArray();
|
|
|
|
static {
|
|
territoryProtectedMaterials.add(Material.WOODEN_DOOR);
|
|
territoryProtectedMaterials.add(Material.DISPENSER);
|
|
territoryProtectedMaterials.add(Material.CHEST);
|
|
territoryProtectedMaterials.add(Material.FURNACE);
|
|
|
|
territoryDenyUseageMaterials.add(Material.FLINT_AND_STEEL);
|
|
territoryDenyUseageMaterials.add(Material.BUCKET);
|
|
territoryDenyUseageMaterials.add(Material.WATER_BUCKET);
|
|
territoryDenyUseageMaterials.add(Material.LAVA_BUCKET);
|
|
|
|
safeZoneNerfedCreatureTypes.add(CreatureType.CREEPER);
|
|
safeZoneNerfedCreatureTypes.add(CreatureType.GHAST);
|
|
safeZoneNerfedCreatureTypes.add(CreatureType.PIG_ZOMBIE);
|
|
safeZoneNerfedCreatureTypes.add(CreatureType.SKELETON);
|
|
safeZoneNerfedCreatureTypes.add(CreatureType.SPIDER);
|
|
safeZoneNerfedCreatureTypes.add(CreatureType.SLIME);
|
|
safeZoneNerfedCreatureTypes.add(CreatureType.ZOMBIE);
|
|
}
|
|
|
|
// track players with admin access who have enabled "admin bypass" mode, and should therefore be able to build anywhere
|
|
// not worth saving between server restarts, I think
|
|
public static transient Set<String> adminBypassPlayers = Collections.synchronizedSet(new HashSet<String>());
|
|
|
|
// -------------------------------------------- //
|
|
// Persistance
|
|
// -------------------------------------------- //
|
|
|
|
public static boolean save() {
|
|
//Factions.log("Saving config to disk.");
|
|
|
|
try {
|
|
DiscUtil.write(file, Factions.gson.toJson(new Conf()));
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
Factions.log("Failed to save the config to disk.");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public static boolean load() {
|
|
Factions.log("Loading conf from disk");
|
|
|
|
if ( ! file.exists()) {
|
|
Factions.log("No conf to load from disk. Creating new file.");
|
|
save();
|
|
return true;
|
|
}
|
|
|
|
try {
|
|
Factions.gson.fromJson(DiscUtil.read(file), Conf.class);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
Factions.log("Failed to load the config from disk.");
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|