2011-03-18 17:33:23 +01:00
|
|
|
package com.bukkit.mcteam.factions;
|
2011-02-06 13:36:11 +01:00
|
|
|
|
2011-03-18 17:33:23 +01:00
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
2011-02-06 13:36:11 +01:00
|
|
|
import java.util.*;
|
|
|
|
import org.bukkit.*;
|
2011-03-23 17:39:56 +01:00
|
|
|
import org.bukkit.entity.CreatureType;
|
2011-02-06 13:36:11 +01:00
|
|
|
|
2011-03-18 17:33:23 +01:00
|
|
|
import com.bukkit.mcteam.util.DiscUtil;
|
|
|
|
|
2011-02-06 13:36:11 +01:00
|
|
|
public class Conf {
|
2011-03-18 17:33:23 +01:00
|
|
|
public static transient File file = new File(Factions.instance.getDataFolder(), "conf.json");
|
|
|
|
|
2011-02-12 18:05:05 +01:00
|
|
|
// 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;
|
2011-02-06 13:36:11 +01:00
|
|
|
|
2011-02-12 18:05:05 +01:00
|
|
|
// 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
|
2011-02-06 13:36:11 +01:00
|
|
|
|
2011-02-12 18:05:05 +01:00
|
|
|
public static String prefixAdmin = "**";
|
|
|
|
public static String prefixMod = "*";
|
2011-02-06 13:36:11 +01:00
|
|
|
|
2011-02-12 18:05:05 +01:00
|
|
|
public static int factionTagLengthMin = 3;
|
2011-02-13 16:37:21 +01:00
|
|
|
public static int factionTagLengthMax = 10;
|
|
|
|
public static boolean factionTagForceUpperCase = false;
|
2011-02-06 13:36:11 +01:00
|
|
|
|
2011-02-12 18:05:05 +01:00
|
|
|
// Configuration on the Faction tag in chat messages.
|
2011-02-06 13:36:11 +01:00
|
|
|
|
2011-02-12 18:05:05 +01:00
|
|
|
public static boolean chatTagEnabled = true;
|
|
|
|
public static boolean chatTagRelationColored = true;
|
|
|
|
public static int chatTagInsertIndex = 1;
|
|
|
|
public static String chatTagFormat = "%s"+ChatColor.WHITE+" ";
|
2011-02-12 18:52:45 +01:00
|
|
|
public static String factionChatFormat = "%s"+ChatColor.WHITE+" %s";
|
2011-02-12 18:05:05 +01:00
|
|
|
|
2011-03-23 17:39:56 +01:00
|
|
|
public static boolean allowNoSlashCommand = true;
|
|
|
|
|
|
|
|
public static double autoLeaveAfterDaysOfInactivity = 14;
|
|
|
|
|
|
|
|
public static boolean homesEnabled = true;
|
|
|
|
public static boolean homesTeleportToOnDeath = true;
|
2011-02-12 18:05:05 +01:00
|
|
|
|
|
|
|
public static double territoryShieldFactor = 0.5;
|
2011-03-06 21:13:48 +01:00
|
|
|
public static boolean territoryBlockCreepers = false;
|
2011-03-18 00:02:29 +01:00
|
|
|
public static boolean territoryBlockFireballs = false;
|
|
|
|
|
2011-03-23 12:00:38 +01:00
|
|
|
public static Set<Material> territoryProtectedMaterials = new HashSet<Material>();
|
|
|
|
public static Set<Material> territoryDenyUseageMaterials = new HashSet<Material>();
|
2011-03-22 20:36:33 +01:00
|
|
|
|
2011-03-23 17:39:56 +01:00
|
|
|
public static transient Set<CreatureType> safeZoneNerfedCreatureTypes = new HashSet<CreatureType>();
|
|
|
|
|
|
|
|
public static transient Set<Material> instaDestroyMaterials = new HashSet<Material>(); // This one is not really configuration therefore transient
|
|
|
|
public static transient int mapHeight = 8;
|
|
|
|
public static transient int mapWidth = 49;
|
2011-02-06 13:36:11 +01:00
|
|
|
|
|
|
|
static {
|
2011-02-07 21:42:14 +01:00
|
|
|
territoryProtectedMaterials.add(Material.WOODEN_DOOR);
|
|
|
|
territoryProtectedMaterials.add(Material.DISPENSER);
|
|
|
|
territoryProtectedMaterials.add(Material.CHEST);
|
|
|
|
territoryProtectedMaterials.add(Material.FURNACE);
|
2011-03-23 12:00:38 +01:00
|
|
|
|
|
|
|
territoryDenyUseageMaterials.add(Material.REDSTONE);
|
|
|
|
territoryDenyUseageMaterials.add(Material.SIGN);
|
|
|
|
territoryDenyUseageMaterials.add(Material.FLINT_AND_STEEL);
|
|
|
|
territoryDenyUseageMaterials.add(Material.BED);
|
|
|
|
territoryDenyUseageMaterials.add(Material.BUCKET);
|
|
|
|
territoryDenyUseageMaterials.add(Material.WATER_BUCKET);
|
|
|
|
territoryDenyUseageMaterials.add(Material.DIODE);
|
|
|
|
territoryDenyUseageMaterials.add(Material.SUGAR_CANE);
|
|
|
|
|
|
|
|
instaDestroyMaterials.add(Material.SAPLING);
|
|
|
|
instaDestroyMaterials.add(Material.TORCH);
|
|
|
|
instaDestroyMaterials.add(Material.REDSTONE_WIRE);
|
|
|
|
instaDestroyMaterials.add(Material.CROPS);
|
|
|
|
instaDestroyMaterials.add(Material.REDSTONE_TORCH_OFF);
|
|
|
|
instaDestroyMaterials.add(Material.REDSTONE_TORCH_ON);
|
|
|
|
instaDestroyMaterials.add(Material.SUGAR_CANE_BLOCK);
|
|
|
|
instaDestroyMaterials.add(Material.DIODE_BLOCK_OFF);
|
|
|
|
instaDestroyMaterials.add(Material.DIODE_BLOCK_ON);
|
2011-03-24 19:05:45 +01:00
|
|
|
instaDestroyMaterials.add(Material.PAINTING);
|
|
|
|
instaDestroyMaterials.add(Material.RED_ROSE);
|
|
|
|
instaDestroyMaterials.add(Material.YELLOW_FLOWER);
|
2011-03-23 17:39:56 +01:00
|
|
|
|
|
|
|
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);
|
2011-02-06 13:36:11 +01:00
|
|
|
}
|
|
|
|
|
2011-03-18 17:33:23 +01:00
|
|
|
// -------------------------------------------- //
|
2011-02-06 13:36:11 +01:00
|
|
|
// Persistance
|
2011-03-18 17:33:23 +01:00
|
|
|
// -------------------------------------------- //
|
2011-02-06 13:36:11 +01:00
|
|
|
|
|
|
|
public static boolean save() {
|
2011-03-22 22:31:04 +01:00
|
|
|
//Factions.log("Saving config to disk.");
|
|
|
|
|
2011-03-18 17:33:23 +01:00
|
|
|
try {
|
|
|
|
DiscUtil.write(file, Factions.gson.toJson(new Conf()));
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
Factions.log("Failed to save the config to disk.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean load() {
|
2011-03-23 12:00:38 +01:00
|
|
|
Factions.log("Loading conf from disk");
|
|
|
|
|
2011-03-18 17:33:23 +01:00
|
|
|
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 (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
Factions.log("Failed to load the config from disk.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2011-02-06 13:36:11 +01:00
|
|
|
}
|
|
|
|
}
|
2011-03-23 12:00:38 +01:00
|
|
|
|