diff options
author | Tyler Murphy <tylermurphy534@gmail.com> | 2022-10-30 15:39:34 -0400 |
---|---|---|
committer | Tyler Murphy <tylermurphy534@gmail.com> | 2022-10-30 15:39:34 -0400 |
commit | 667a365e7b406063617e336798ec95a0e524e2b1 (patch) | |
tree | 6c0e9c96474801be2c41ab6bb201b53ef4e2fe97 /src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java | |
parent | Update 'README.md' (diff) | |
download | kenshinshideandseek-667a365e7b406063617e336798ec95a0e524e2b1.tar.gz kenshinshideandseek-667a365e7b406063617e336798ec95a0e524e2b1.tar.bz2 kenshinshideandseek-667a365e7b406063617e336798ec95a0e524e2b1.zip |
start adding multi map support
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java | 100 |
1 files changed, 15 insertions, 85 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java index a71369f..3a43e15 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java @@ -24,12 +24,13 @@ import com.cryptomorin.xseries.XMaterial; import com.cryptomorin.xseries.XSound; import net.tylermurphy.hideAndSeek.Main; import net.tylermurphy.hideAndSeek.game.util.CountdownDisplay; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -49,10 +50,6 @@ public class Config { abortPrefix, gameOverPrefix, warningPrefix, - spawnWorld, - seekerLobbyWorld, - exitWorld, - lobbyWorld, locale, leaveServer, placeholderError, @@ -62,20 +59,13 @@ public class Config { databasePort, databaseUser, databasePass, - databaseName; - - public static Vector - spawnPosition, - lobbyPosition, - exitPosition, - seekerLobbyPosition, - worldBorderPosition; + databaseName, + exitWorld; public static boolean nameTagsVisible, permissionsRequired, announceMessagesToNonPlayers, - worldBorderEnabled, tauntEnabled, tauntCountdown, tauntLast, @@ -93,20 +83,11 @@ public class Config { mapSaveEnabled, allowNaturalCauses, saveInventory, - blockhuntEnabled, delayedRespawn; public static int minPlayers, - worldBorderSize, - worldBorderDelay, - currentWorldborderSize, - worldBorderChange, gameLength, - saveMinX, - saveMinZ, - saveMaxX, - saveMaxZ, tauntDelay, glowLength, countdown, @@ -132,9 +113,6 @@ public class Config { blockedCommands, blockedInteracts; - public static List<Material> - blockhuntBlocks; - public static String LOBBY_TITLE, GAME_TITLE, @@ -166,6 +144,9 @@ public class Config { public static CountdownDisplay countdownDisplay; + + public static Location + exitPosition; public static void loadConfig() { @@ -173,50 +154,8 @@ public class Config { config.saveConfig(); ConfigManager leaderboard = ConfigManager.create("leaderboard.yml"); - //Spawn - spawnPosition = new Vector( - config.getDouble("spawns.game.x"), - Math.max(Main.getInstance().supports(18) ? -64 : 0, Math.min(255, config.getDouble("spawns.game.y"))), - config.getDouble("spawns.game.z") - ); - spawnWorld = config.getString("spawns.game.world"); - - ///Lobby - lobbyPosition = new Vector( - config.getDouble("spawns.lobby.x"), - Math.max(Main.getInstance().supports(18) ? -64 : 0, Math.min(255, config.getDouble("spawns.lobby.y"))), - config.getDouble("spawns.lobby.z") - ); - lobbyWorld = config.getString("spawns.lobby.world"); - - ///Seeker Lobby - seekerLobbyPosition = new Vector( - config.getDouble("spawns.seeker.x"), - Math.max(Main.getInstance().supports(18) ? -64 : 0, Math.min(255, config.getDouble("spawns.seeker.y"))), - config.getDouble("spawns.seeker.z") - ); - seekerLobbyWorld = config.getString("spawns.seeker.world"); - announceMessagesToNonPlayers = config.getBoolean("announceMessagesToNonPlayers"); - exitPosition = new Vector( - config.getDouble("spawns.exit.x"), - Math.max(Main.getInstance().supports(18) ? -64 : 0, Math.min(255, config.getDouble("spawns.exit.y"))), - config.getDouble("spawns.exit.z") - ); - exitWorld = config.getString("spawns.exit.world"); - - //World border - worldBorderPosition = new Vector( - config.getInt("worldBorder.x"), - 0, - config.getInt("worldBorder.z") - ); - worldBorderSize = Math.max(100, config.getInt("worldBorder.size")); - worldBorderDelay = Math.max(1, config.getInt("worldBorder.delay")); - worldBorderEnabled = config.getBoolean("worldBorder.enabled"); - worldBorderChange = config.getInt("worldBorder.moveAmount"); - //Prefix char SYMBOLE = '\u00A7'; String SYMBOLE_STRING = String.valueOf(SYMBOLE); @@ -229,11 +168,14 @@ public class Config { gameOverPrefix = config.getString("prefix.gameover").replace("&", SYMBOLE_STRING); warningPrefix = config.getString("prefix.warning").replace("&", SYMBOLE_STRING); - //Map Bounds - saveMinX = config.getInt("bounds.min.x"); - saveMinZ = config.getInt("bounds.min.z"); - saveMaxX = config.getInt("bounds.max.x"); - saveMaxZ = config.getInt("bounds.max.z"); + // Locations + exitPosition = new Location( + Bukkit.getWorld(config.getString("exit.world")), + config.getInt("exit.x"), + config.getInt("exit.y"), + config.getInt("exit.z") + ); + exitWorld = config.getString("exit.world"); mapSaveEnabled = config.getBoolean("mapSaveEnabled"); //Taunt @@ -305,18 +247,6 @@ public class Config { } bungeeLeave = config.getString("leaveType") == null || config.getString("leaveType").equalsIgnoreCase("proxy"); leaveServer = config.getString("leaveServer"); - blockhuntEnabled = config.getBoolean("blockhunt.enabled") && Main.getInstance().supports(9); - blockhuntBlocks = new ArrayList<>(); - tempInteracts = config.getStringList("blockhunt.blocks"); - for(String id : tempInteracts) { - Optional<XMaterial> optional_mat = XMaterial.matchXMaterial(id); - if (optional_mat.isPresent()) { - Material mat = optional_mat.get().parseMaterial(); - if (mat != null) { - blockhuntBlocks.add(mat); - } - } - } solidifyTime = Math.max(20,config.getInt("blockhunt.solidifyTime")); //Leaderboard |