mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-22 18:55:17 +01:00
ConfigAPI - Implementing the basic functionnalities
a lot of unused/useless Settings has been removed Settings class has been moved to the main package, because the config package would then only contain it I need feedback about it
This commit is contained in:
parent
b7f1d68bcf
commit
1430eda5ce
@ -8,7 +8,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import us.tastybento.bskyblock.commands.AdminCommand;
|
||||
import us.tastybento.bskyblock.commands.IslandCommand;
|
||||
import us.tastybento.bskyblock.config.PluginConfig;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.database.BSBDatabase;
|
||||
import us.tastybento.bskyblock.database.managers.PlayersManager;
|
||||
import us.tastybento.bskyblock.database.managers.island.IslandsManager;
|
||||
@ -52,14 +51,9 @@ public class BSkyBlock extends JavaPlugin {
|
||||
playersManager = new PlayersManager(this);
|
||||
islandsManager = new IslandsManager(this);
|
||||
|
||||
// Only load metrics if set to true in config
|
||||
|
||||
if(Settings.metrics) {
|
||||
metrics = new Metrics(plugin);
|
||||
|
||||
registerCustomCharts();
|
||||
|
||||
}
|
||||
// Load metrics
|
||||
metrics = new Metrics(plugin);
|
||||
registerCustomCharts();
|
||||
|
||||
// Set up commands
|
||||
commandsManager = new CommandsManager();
|
||||
|
251
src/main/java/us/tastybento/bskyblock/Settings.java
Normal file
251
src/main/java/us/tastybento/bskyblock/Settings.java
Normal file
@ -0,0 +1,251 @@
|
||||
package us.tastybento.bskyblock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import us.tastybento.bskyblock.api.configuration.ConfigEntry;
|
||||
import us.tastybento.bskyblock.api.configuration.ISettings;
|
||||
import us.tastybento.bskyblock.api.flags.Flag;
|
||||
import us.tastybento.bskyblock.database.BSBDatabase.DatabaseType;
|
||||
|
||||
/**
|
||||
* All the plugin settings are here
|
||||
* @author Tastybento
|
||||
*/
|
||||
public class Settings implements ISettings {
|
||||
// ----------------- Constants -----------------
|
||||
|
||||
// Game Type BSKYBLOCK or ACIDISLAND
|
||||
public enum GameType {
|
||||
BSKYBLOCK, ACIDISLAND
|
||||
}
|
||||
/*
|
||||
public final static GameType GAMETYPE = GameType.ACIDISLAND;
|
||||
// The spawn command (Essentials spawn for example)
|
||||
public final static String SPAWNCOMMAND = "spawn";
|
||||
// Permission prefix
|
||||
public final static String PERMPREFIX = "acidisland.";
|
||||
// The island command
|
||||
public final static String ISLANDCOMMAND = "ai";
|
||||
// The challenge command
|
||||
public static final String CHALLENGECOMMAND = "aic";
|
||||
// Admin command
|
||||
public static final String ADMINCOMMAND = "acid";
|
||||
*/
|
||||
public final static GameType GAMETYPE = GameType.BSKYBLOCK;
|
||||
// Permission prefix
|
||||
public final static String PERMPREFIX = "bskyblock.";
|
||||
// The island command
|
||||
public final static String ISLANDCOMMAND = "island";
|
||||
// The challenge command
|
||||
public static final String CHALLENGECOMMAND = "bsc";
|
||||
// The spawn command (Essentials spawn for example)
|
||||
public final static String SPAWNCOMMAND = "spawn";
|
||||
// Admin command
|
||||
public static final String ADMINCOMMAND = "bsadmin";
|
||||
|
||||
// ---------------------------------------------
|
||||
|
||||
/* GENERAL */
|
||||
|
||||
@ConfigEntry(path = "general.check-updates")
|
||||
public static boolean checkUpdates = true;
|
||||
|
||||
@ConfigEntry(path = "general.default-language")
|
||||
public static String defaultLanguage = "en-US";
|
||||
|
||||
@ConfigEntry(path = "general.use-economy")
|
||||
public static boolean useEconomy = true;
|
||||
|
||||
// Purge
|
||||
@ConfigEntry(path = "general.purge.max-islands")
|
||||
public static int purgeMaxIslands = 50;
|
||||
|
||||
@ConfigEntry(path = "general.purge.remove-user-data")
|
||||
public static boolean purgeRemoveUserData = false;
|
||||
|
||||
// Database
|
||||
@ConfigEntry(path = "general.database.type")
|
||||
public static DatabaseType databaseType = DatabaseType.FLATFILE;
|
||||
|
||||
@ConfigEntry(path = "general.database.settings.host")
|
||||
public static String dbHost = "localhost";
|
||||
|
||||
@ConfigEntry(path = "general.database.settings.port")
|
||||
public static int dbPort = 3306;
|
||||
|
||||
@ConfigEntry(path = "general.database.settings.name")
|
||||
public static String dbName = "BSkyBlock";
|
||||
|
||||
@ConfigEntry(path = "general.database.settings.username")
|
||||
public static String dbUsername = "username";
|
||||
|
||||
@ConfigEntry(path = "general.database.settings.password")
|
||||
public static String dbPassword = "password";
|
||||
|
||||
@ConfigEntry(path = "general.database.backup-period")
|
||||
public static int databaseBackupPeriod = 5;
|
||||
|
||||
//TODO change allowAutoActivator to the fakePlayers introduced in ASB 3.0.8
|
||||
@ConfigEntry(path = "general.allow-FTB-auto-activators")
|
||||
public static boolean allowAutoActivator = false;
|
||||
|
||||
@ConfigEntry(path = "general.allow-obsidian-scooping")
|
||||
public static boolean allowObsidianScooping = true;
|
||||
|
||||
// ---------------------------------------------
|
||||
|
||||
/* WORLD */
|
||||
@ConfigEntry(path = "world.world-name", needsReset = true)
|
||||
public static String worldName = "BSkyBlock";
|
||||
|
||||
@ConfigEntry(path = "world.distance-between-islands", needsReset = true)
|
||||
public static int islandDistance = 200;
|
||||
|
||||
@ConfigEntry(path = "world.protection-range", overrideOnChange = true)
|
||||
public static int islandProtectionRange = 100;
|
||||
|
||||
@ConfigEntry(path = "world.start-x", needsReset = true)
|
||||
public static int islandStartX = 0;
|
||||
|
||||
@ConfigEntry(path = "world.start-z", needsReset = true)
|
||||
public static int islandStartZ = 0;
|
||||
|
||||
public static int islandXOffset;
|
||||
public static int islandZOffset;
|
||||
|
||||
@ConfigEntry(path = "world.sea-height", specificTo = ConfigEntry.GameType.ACIDISLAND)
|
||||
public static int seaHeight = 100;
|
||||
|
||||
@ConfigEntry(path = "world.island-height")
|
||||
public static int islandHeight = 100;
|
||||
|
||||
@ConfigEntry(path = "world.max-islands")
|
||||
public static int maxIslands = -1;
|
||||
|
||||
// Nether
|
||||
@ConfigEntry(path = "world.nether.generate")
|
||||
public static boolean netherGenerate = true;
|
||||
|
||||
@ConfigEntry(path = "world.nether.islands", needsReset = true)
|
||||
public static boolean netherIslands = true;
|
||||
|
||||
@ConfigEntry(path = "world.nether.trees")
|
||||
public static boolean netherTrees = true;
|
||||
|
||||
@ConfigEntry(path = "world.nether.roof")
|
||||
public static boolean netherRoof = true;
|
||||
|
||||
@ConfigEntry(path = "world.nether.spawn-radius")
|
||||
public static int netherSpawnRadius = 32;
|
||||
|
||||
// End
|
||||
@ConfigEntry(path = "world.end.generate")
|
||||
public static boolean endGenerate = true;
|
||||
|
||||
@ConfigEntry(path = "world.end.islands", needsReset = true)
|
||||
public static boolean endIslands = true;
|
||||
|
||||
// Entities
|
||||
public static HashMap<EntityType, Integer> entityLimits;
|
||||
public static HashMap<String, Integer> tileEntityLimits;
|
||||
|
||||
// ---------------------------------------------
|
||||
|
||||
/* ISLAND */
|
||||
public static int maxTeamSize;
|
||||
public static int maxHomes;
|
||||
public static int nameMinLength;
|
||||
public static int nameMaxLength;
|
||||
public static int inviteWait;
|
||||
|
||||
// Reset
|
||||
public static int resetLimit;
|
||||
public static int resetWait;
|
||||
public static boolean leaversLoseReset;
|
||||
public static boolean kickedKeepInventory;
|
||||
|
||||
// Remove mobs
|
||||
public static boolean removeMobsOnLogin;
|
||||
public static boolean removeMobsOnIsland;
|
||||
public static List<String> removeMobsWhitelist;
|
||||
|
||||
public static boolean makeIslandIfNone;
|
||||
public static boolean immediateTeleportOnIsland;
|
||||
public static boolean respawnOnIsland;
|
||||
|
||||
// Deaths
|
||||
@ConfigEntry(path = "island.deaths.max")
|
||||
public static int deathsMax = 10;
|
||||
|
||||
@ConfigEntry(path = "island.deaths.sum-team")
|
||||
public static boolean deathsSumTeam = false;
|
||||
|
||||
// ---------------------------------------------
|
||||
|
||||
/* PROTECTION */
|
||||
@ConfigEntry(path = "protection.allow-piston-push")
|
||||
public static boolean allowPistonPush = false;
|
||||
|
||||
@ConfigEntry(path = "protection.restrict-flying-mobs")
|
||||
public static boolean restrictFlyingMobs = true;
|
||||
|
||||
public static int togglePvPCooldown;
|
||||
|
||||
public static HashMap<Flag, Boolean> defaultFlags;
|
||||
|
||||
//TODO transform these options below into flags
|
||||
public static boolean allowEndermanGriefing;
|
||||
public static boolean endermanDeathDrop;
|
||||
public static boolean allowTNTDamage;
|
||||
public static boolean allowChestDamage;
|
||||
public static boolean allowCreeperDamage;
|
||||
public static boolean allowCreeperGriefing;
|
||||
public static boolean allowMobDamageToItemFrames;
|
||||
|
||||
//TODO flags
|
||||
|
||||
// ---------------------------------------------
|
||||
|
||||
/* ACID */
|
||||
|
||||
/*
|
||||
* This settings category only exists if the GameType is ACIDISLAND.
|
||||
*/
|
||||
|
||||
@ConfigEntry(path = "acid.options.damage-op", specificTo = ConfigEntry.GameType.ACIDISLAND)
|
||||
public static boolean acidDamageOp = false;
|
||||
|
||||
@ConfigEntry(path = "acid.options.damage-chickens", specificTo = ConfigEntry.GameType.ACIDISLAND)
|
||||
public static boolean acidDamageChickens = false;
|
||||
|
||||
@ConfigEntry(path = "acid.options.item-destroy-time", specificTo = ConfigEntry.GameType.ACIDISLAND)
|
||||
public static int acidDestroyItemTime = 0;
|
||||
|
||||
// Damage
|
||||
@ConfigEntry(path = "acid.damage", specificTo = ConfigEntry.GameType.ACIDISLAND)
|
||||
public static int acidDamage = 10;
|
||||
|
||||
@ConfigEntry(path = "acid.rain-damage", specificTo = ConfigEntry.GameType.ACIDISLAND)
|
||||
public static int acidRainDamage = 1;
|
||||
|
||||
@ConfigEntry(path = "acid.effects", specificTo = ConfigEntry.GameType.ACIDISLAND)
|
||||
public static List<PotionEffectType> acidEffects = new ArrayList<>(Arrays.asList(PotionEffectType.CONFUSION, PotionEffectType.SLOW));
|
||||
|
||||
/* SCHEMATICS */
|
||||
public static List<String> companionNames;
|
||||
public static ItemStack[] chestItems;
|
||||
public static EntityType companionType;
|
||||
|
||||
public static boolean useOwnGenerator;
|
||||
|
||||
public static HashMap<String,Integer> limitedBlocks;
|
||||
public static boolean teamJoinDeathReset;
|
||||
}
|
@ -17,7 +17,7 @@ import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
/**
|
||||
* BSB's user object. Wraps Player.
|
||||
|
@ -0,0 +1,31 @@
|
||||
package us.tastybento.bskyblock.api.configuration;
|
||||
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Poslovitch
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface ConfigEntry {
|
||||
|
||||
String path();
|
||||
String since() default "1.0";
|
||||
boolean overrideOnChange() default false;
|
||||
boolean experimental() default false;
|
||||
boolean needsReset() default false;
|
||||
GameType specificTo() default GameType.BOTH;
|
||||
|
||||
enum GameType {
|
||||
BSKYBLOCK,
|
||||
ACIDISLAND,
|
||||
BOTH
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package us.tastybento.bskyblock.api.configuration;
|
||||
|
||||
/**
|
||||
* Simple interface for tagging all classes containing ConfigEntries.
|
||||
*
|
||||
* @author Poslovitch
|
||||
*/
|
||||
public interface ISettings {}
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.commands.admin.AdminVersionCommand;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
public class AdminCommand extends CompositeCommand {
|
||||
|
||||
|
@ -12,7 +12,7 @@ import us.tastybento.bskyblock.commands.island.IslandResetnameCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandSethomeCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandSetnameCommand;
|
||||
import us.tastybento.bskyblock.commands.island.teams.IslandTeamCommand;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
public class IslandCommand extends CompositeCommand {
|
||||
|
||||
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
public class AdminVersionCommand extends CompositeCommand {
|
||||
|
||||
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
/**
|
||||
|
@ -10,7 +10,7 @@ import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
|
||||
import us.tastybento.bskyblock.commands.IslandCommand;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.database.managers.island.NewIsland;
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.ChatColor;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.commands.IslandCommand;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
/**
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.database.managers.island.NewIsland;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
|
@ -8,7 +8,7 @@ import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
|
@ -5,7 +5,7 @@ import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
public class IslandSethomeCommand extends CompositeCommand {
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
|
@ -13,7 +13,7 @@ import com.google.common.collect.HashBiMap;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
/**
|
||||
* A safe common space for team commands to share data
|
||||
|
@ -11,7 +11,7 @@ import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
public class IslandTeamCommand extends AbstractIslandTeamCommand {
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.Location;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
public class IslandTeamInviteAcceptCommand extends AbstractIslandTeamCommand {
|
||||
|
@ -14,7 +14,7 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
public class IslandTeamInviteCommand extends AbstractIslandTeamCommand {
|
||||
|
@ -6,7 +6,7 @@ import java.util.UUID;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
public class IslandTeamInviteRejectCommand extends AbstractIslandTeamCommand {
|
||||
|
||||
|
@ -3,7 +3,7 @@ package us.tastybento.bskyblock.commands.island.teams;
|
||||
import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
public class IslandTeamLeaveCommand extends AbstractIslandTeamCommand {
|
||||
|
||||
|
@ -3,7 +3,7 @@ package us.tastybento.bskyblock.commands.island.teams;
|
||||
import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
public class IslandTeamPromoteCommand extends AbstractIslandTeamCommand {
|
||||
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
|
@ -3,6 +3,7 @@ package us.tastybento.bskyblock.config;
|
||||
import java.util.HashMap;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.config.NotSetup.ConfigError;
|
||||
import us.tastybento.bskyblock.database.BSBDatabase.DatabaseType;
|
||||
|
||||
@ -31,7 +32,6 @@ public class PluginConfig {
|
||||
// The order in this file should match the order in config.yml so that it's easy to check that everything is covered
|
||||
|
||||
// ********************* General *********************
|
||||
Settings.metrics = plugin.getConfig().getBoolean("general.metrics", true);
|
||||
Settings.checkUpdates = plugin.getConfig().getBoolean("general.check-updates", true);
|
||||
|
||||
//loadLocales(plugin);
|
||||
@ -39,12 +39,9 @@ public class PluginConfig {
|
||||
//if(!plugin.getLocales().containsKey(Settings.defaultLanguage)) errors.put(ConfigError.UNKNOWN_LANGUAGE, Settings.defaultLanguage);
|
||||
|
||||
Settings.useEconomy = plugin.getConfig().getBoolean("general.use-economy", true);
|
||||
Settings.startingMoney = plugin.getConfig().getDouble("general.starting-money", 10.0);
|
||||
//Settings.useControlPanel = plugin.getConfig().getBoolean("general.use-control-panel", true);
|
||||
|
||||
// Purge
|
||||
Settings.purgeMaxIslandLevel = plugin.getConfig().getInt("general.purge.max-island-level", 50);
|
||||
if(Settings.purgeMaxIslandLevel < 0) errors.put(ConfigError.PURGE_ISLAND_LEVEL_TOO_LOW, Settings.purgeMaxIslandLevel);
|
||||
Settings.purgeRemoveUserData = plugin.getConfig().getBoolean("general.purge.remove-user-data", false);
|
||||
|
||||
// Database
|
||||
@ -67,9 +64,6 @@ public class PluginConfig {
|
||||
Settings.dbUsername = plugin.getConfig().getString("general.database.username");
|
||||
Settings.dbPassword = plugin.getConfig().getString("general.database.password");
|
||||
|
||||
|
||||
Settings.recoverSuperFlat = plugin.getConfig().getBoolean("general.recover-super-flat", false);
|
||||
Settings.muteDeathMessages = plugin.getConfig().getBoolean("general.mute-death-messages", false);
|
||||
//Settings.ftbAutoActivator = plugin.getConfig().getBoolean("general.FTB-auto-activator", false);
|
||||
Settings.allowObsidianScooping = plugin.getConfig().getBoolean("general.allow-obsidian-scooping", true);
|
||||
|
||||
@ -114,7 +108,7 @@ public class PluginConfig {
|
||||
Settings.endGenerate = true;
|
||||
Settings.endIslands = false;
|
||||
Settings.limitedBlocks = new HashMap<>();
|
||||
Settings.defaultWorldSettings = new HashMap<>();
|
||||
Settings.defaultFlags = new HashMap<>();
|
||||
|
||||
// Team
|
||||
Settings.maxTeamSize = plugin.getConfig().getInt("island.max-team-size", 4);
|
||||
|
@ -1,181 +0,0 @@
|
||||
package us.tastybento.bskyblock.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import us.tastybento.bskyblock.api.flags.Flag;
|
||||
import us.tastybento.bskyblock.database.BSBDatabase.DatabaseType;
|
||||
|
||||
/**
|
||||
* All the plugin settings are here
|
||||
* @author Tastybento
|
||||
*/
|
||||
public class Settings {
|
||||
/* The settings variables should follow the config order */
|
||||
|
||||
|
||||
// Constants
|
||||
// Game Type BSKYBLOCK or ACIDISLAND
|
||||
public enum GameType {
|
||||
BSKYBLOCK, ACIDISLAND
|
||||
}
|
||||
/*
|
||||
public final static GameType GAMETYPE = GameType.ACIDISLAND;
|
||||
// The spawn command (Essentials spawn for example)
|
||||
public final static String SPAWNCOMMAND = "spawn";
|
||||
// Permission prefix
|
||||
public final static String PERMPREFIX = "acidisland.";
|
||||
// The island command
|
||||
public final static String ISLANDCOMMAND = "ai";
|
||||
// The challenge command
|
||||
public static final String CHALLENGECOMMAND = "aic";
|
||||
// Admin command
|
||||
public static final String ADMINCOMMAND = "acid";
|
||||
*/
|
||||
public final static GameType GAMETYPE = GameType.BSKYBLOCK;
|
||||
// Permission prefix
|
||||
public final static String PERMPREFIX = "bskyblock.";
|
||||
// The island command
|
||||
public final static String ISLANDCOMMAND = "island";
|
||||
// The challenge command
|
||||
public static final String CHALLENGECOMMAND = "bsc";
|
||||
// The spawn command (Essentials spawn for example)
|
||||
public final static String SPAWNCOMMAND = "spawn";
|
||||
// Admin command
|
||||
public static final String ADMINCOMMAND = "bsadmin";
|
||||
|
||||
/* GENERAL */
|
||||
public static boolean metrics;
|
||||
public static boolean checkUpdates;
|
||||
public static String defaultLanguage;
|
||||
public static boolean useEconomy;
|
||||
public static double startingMoney;
|
||||
|
||||
// Purge
|
||||
public static int purgeMaxIslandLevel;
|
||||
public static boolean purgeRemoveUserData;
|
||||
|
||||
// TODO Database
|
||||
public static int databaseBackupPeriod;
|
||||
|
||||
public static boolean recoverSuperFlat;
|
||||
public static boolean muteDeathMessages;
|
||||
public static boolean allowAutoActivator;
|
||||
public static boolean allowObsidianScooping;
|
||||
|
||||
/* WORLD */
|
||||
public static String worldName;
|
||||
public static int islandDistance;
|
||||
public static int islandProtectionRange;
|
||||
public static int islandStartX;
|
||||
public static int islandStartZ;
|
||||
public static int islandXOffset;
|
||||
public static int islandZOffset;
|
||||
public static int seaHeight;
|
||||
public static int islandHeight;
|
||||
public static int maxIslands;
|
||||
|
||||
// Nether
|
||||
public static boolean netherGenerate;
|
||||
public static boolean netherIslands;
|
||||
public static boolean netherTrees;
|
||||
public static boolean netherRoof;
|
||||
public static int netherSpawnRadius;
|
||||
|
||||
// Entities
|
||||
public static int spawnLimitMonsters;
|
||||
public static int spawnLimitAnimals;
|
||||
public static HashMap<EntityType, Integer> entityLimits;
|
||||
public static HashMap<String, Integer> tileEntityLimits;
|
||||
|
||||
/* ISLAND */
|
||||
public static int maxTeamSize;
|
||||
public static int maxHomes;
|
||||
public static int nameMinLength;
|
||||
public static int nameMaxLength;
|
||||
public static int inviteWait;
|
||||
|
||||
// Reset
|
||||
public static int resetLimit;
|
||||
public static int resetWait;
|
||||
public static boolean leaversLoseReset;
|
||||
public static boolean kickedKeepInventory;
|
||||
public static boolean onJoinResetMoney;
|
||||
public static boolean onJoinResetInventory;
|
||||
public static boolean onJoinResetEnderChest;
|
||||
public static boolean onLeaveResetMoney;
|
||||
public static boolean onLeaveResetInventory;
|
||||
public static boolean onLeaveResetEnderChest;
|
||||
|
||||
// Remove mobs
|
||||
public static boolean removeMobsOnLogin;
|
||||
public static boolean removeMobsOnIsland;
|
||||
public static List<String> removeMobsWhitelist;
|
||||
|
||||
public static boolean makeIslandIfNone;
|
||||
public static boolean immediateTeleportOnIsland;
|
||||
public static boolean respawnOnIsland;
|
||||
|
||||
// Deaths
|
||||
public static int deathsMax;
|
||||
public static boolean deathsSumTeam;
|
||||
|
||||
/* PROTECTION */
|
||||
public static boolean allowPistonPush;
|
||||
public static boolean restrictWither;
|
||||
|
||||
// Invincible visitors
|
||||
public static boolean invincibleVisitor;
|
||||
public static List<DamageCause> invincibleVisitorOptions;
|
||||
|
||||
public static int togglePvPCooldown;
|
||||
|
||||
//TODO flags
|
||||
|
||||
/* ACID */
|
||||
public static boolean acidDamageOp;
|
||||
public static boolean acidDamageChickens;
|
||||
|
||||
// Damage
|
||||
public static int acidDamage;
|
||||
public static int acidDestroyItemTime;
|
||||
public static int acidRainDamage;
|
||||
public static List<PotionEffectType> acidEffects;
|
||||
|
||||
/* SCHEMATICS */
|
||||
public static List<String> companionNames;
|
||||
public static ItemStack[] chestItems;
|
||||
public static EntityType companionType;
|
||||
|
||||
// Database settings
|
||||
public static DatabaseType databaseType;
|
||||
public static String dbHost;
|
||||
public static int dbPort;
|
||||
public static String dbName;
|
||||
public static String dbUsername;
|
||||
public static String dbPassword;
|
||||
|
||||
public static boolean useOwnGenerator;
|
||||
|
||||
public static boolean endGenerate;
|
||||
|
||||
public static boolean endIslands;
|
||||
|
||||
public static HashMap<Flag, Boolean> defaultWorldSettings;
|
||||
public static boolean allowEndermanGriefing;
|
||||
public static boolean endermanDeathDrop;
|
||||
public static boolean allowTNTDamage;
|
||||
public static boolean allowChestDamage;
|
||||
public static boolean allowCreeperDamage;
|
||||
public static boolean allowCreeperGriefing;
|
||||
public static boolean allowMobDamageToItemFrames;
|
||||
public static HashMap<String,Integer> limitedBlocks;
|
||||
public static boolean allowTNTPushing;
|
||||
public static boolean showInActionBar;
|
||||
public static boolean teamJoinDeathReset;
|
||||
}
|
@ -2,7 +2,7 @@ package us.tastybento.bskyblock.database;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.database.flatfile.FlatFileDatabase;
|
||||
import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler;
|
||||
import us.tastybento.bskyblock.database.mysql.MySQLDatabase;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package us.tastybento.bskyblock.database;
|
||||
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
public class DatabaseConnectionSettingsImpl {
|
||||
private String host;
|
||||
|
@ -15,7 +15,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.database.BSBDatabase;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.database.objects.Players;
|
||||
|
@ -17,7 +17,7 @@ import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
|
@ -21,7 +21,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.database.BSBDatabase;
|
||||
import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
@ -10,7 +10,7 @@ import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.generators.IslandWorld;
|
||||
import us.tastybento.bskyblock.island.builders.IslandBuilder;
|
||||
|
@ -19,7 +19,7 @@ import us.tastybento.bskyblock.api.events.island.IslandEvent.IslandLockEvent;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent.IslandUnlockEvent;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
|
||||
import us.tastybento.bskyblock.api.flags.Flag;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
/**
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
/**
|
||||
* Tracks the following info on the player
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.util.noise.PerlinOctaveGenerator;
|
||||
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
|
@ -6,7 +6,7 @@ import org.bukkit.WorldCreator;
|
||||
import org.bukkit.WorldType;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
|
||||
public class IslandWorld {
|
||||
|
||||
|
@ -17,8 +17,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.Chest;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.config.Settings.GameType;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.Settings.GameType;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.generators.IslandWorld;
|
||||
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.database.managers.PlayersManager;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
|
@ -8,7 +8,7 @@ import java.util.Locale;
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.localization.BSBLocale;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.util.FileLister;
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,7 @@ import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.generators.IslandWorld;
|
||||
|
||||
|
@ -27,7 +27,7 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.generators.IslandWorld;
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@ import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.config.Settings;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
public class TestBSkyBlock {
|
||||
|
Loading…
Reference in New Issue
Block a user