summaryrefslogtreewikicommitdiff
path: root/src/main/java/net/tylermurphy/hideAndSeek/configuration
diff options
context:
space:
mode:
authorTyler Murphy <tylermurphy534@gmail.com>2022-04-28 16:02:01 -0400
committerGitHub <noreply@github.com>2022-04-28 16:02:01 -0400
commit52d6f450ed17acb656a1540e6a29c0ef66ce73cc (patch)
treee9d5e253fa5fadd5a9657efffe6e7329077d73d1 /src/main/java/net/tylermurphy/hideAndSeek/configuration
parent1.4.1 Hotfix (diff)
parentchange lobby start item to start permission from op (diff)
downloadkenshinshideandseek-52d6f450ed17acb656a1540e6a29c0ef66ce73cc.tar.gz
kenshinshideandseek-52d6f450ed17acb656a1540e6a29c0ef66ce73cc.tar.bz2
kenshinshideandseek-52d6f450ed17acb656a1540e6a29c0ef66ce73cc.zip
Merge pull request #25 from tylermurphy534/1.4.2
1.4.2
Diffstat (limited to 'src/main/java/net/tylermurphy/hideAndSeek/configuration')
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java55
-rw-r--r--src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java1
2 files changed, 50 insertions, 6 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java
index 4b13e1c..c021fce 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java
@@ -19,9 +19,14 @@
package net.tylermurphy.hideAndSeek.configuration;
+import com.cryptomorin.xseries.XItemStack;
import com.cryptomorin.xseries.XMaterial;
import net.tylermurphy.hideAndSeek.util.Version;
+import org.bukkit.ChatColor;
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 java.util.ArrayList;
@@ -44,7 +49,8 @@ public class Config {
spawnWorld,
exitWorld,
lobbyWorld,
- locale;
+ locale,
+ leaveServer;
public static Vector
spawnPosition,
@@ -66,13 +72,16 @@ public class Config {
autoJoin,
teleportToExit,
lobbyCountdownEnabled,
- seekerPing;
+ seekerPing,
+ bungeeLeave,
+ lobbyItemStartAdmin;
public static int
minPlayers,
worldborderSize,
worldborderDelay,
currentWorldborderSize,
+ worldborderChange,
gameLength,
saveMinX,
saveMinZ,
@@ -86,7 +95,9 @@ public class Config {
lobbyMax,
seekerPingLevel1,
seekerPingLevel2,
- seekerPingLevel3;
+ seekerPingLevel3,
+ lobbyItemLeavePosition,
+ lobbyItemStartPosition;
public static List<String>
blockedCommands,
@@ -109,6 +120,10 @@ public class Config {
public static List<String>
LOBBY_CONTENTS,
GAME_CONTENTS;
+
+ public static ItemStack
+ lobbyLeaveItem,
+ lobbyStartItem;
public static void loadConfig() {
@@ -119,7 +134,7 @@ public class Config {
//Spawn
spawnPosition = new Vector(
config.getDouble("spawns.game.x"),
- Math.max(0, Math.min(255, config.getDouble("spawns.game.y"))),
+ Math.max(Version.atLeast("1.18") ? -64 : 0, Math.min(255, config.getDouble("spawns.game.y"))),
config.getDouble("spawns.game.z")
);
spawnWorld = config.getString("spawns.game.world");
@@ -127,7 +142,7 @@ public class Config {
///Lobby
lobbyPosition = new Vector(
config.getDouble("spawns.lobby.x"),
- Math.max(0, Math.min(255, config.getDouble("spawns.lobby.y"))),
+ Math.max(Version.atLeast("1.18") ? -64 : 0, Math.min(255, config.getDouble("spawns.lobby.y"))),
config.getDouble("spawns.lobby.z")
);
lobbyWorld = config.getString("spawns.lobby.world");
@@ -136,7 +151,7 @@ public class Config {
exitPosition = new Vector(
config.getDouble("spawns.exit.x"),
- Math.max(0, Math.min(255, config.getDouble("spawns.exit.y"))),
+ Math.max(Version.atLeast("1.18") ? -64 : 0, Math.min(255, config.getDouble("spawns.exit.y"))),
config.getDouble("spawns.exit.z")
);
exitWorld = config.getString("spawns.exit.world");
@@ -150,6 +165,7 @@ public class Config {
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';
@@ -214,6 +230,8 @@ public class Config {
}
}
}
+ bungeeLeave = config.getString("leaveType") == null || config.getString("leaveType").equalsIgnoreCase("proxy");
+ leaveServer = config.getString("leaveServer");
//Leaderboard
LOBBY_TITLE = leaderboard.getString("lobby.title");
@@ -232,6 +250,31 @@ public class Config {
GLOW_INACTIVE = leaderboard.getString("glow.inactive");
BORDER_COUNTING = leaderboard.getString("border.counting");
BORDER_DECREASING = leaderboard.getString("border.decreasing");
+
+ //Lobby Items
+ if(config.getBoolean("lobbyItems.leave.enabled")) {
+ ConfigurationSection item = new YamlConfiguration().createSection("temp");
+ item.set("name", ChatColor.translateAlternateColorCodes('&',config.getString("lobbyItems.leave.name")));
+ item.set("material", config.getString("lobbyItems.leave.material"));
+ List<String> lore = config.getStringList("lobbyItems.leave.lore");
+ if (lore != null && !lore.isEmpty()) item.set("lore", lore);
+ ItemStack temp = null;
+ try{ temp = XItemStack.deserialize(item); } catch(Exception ignored){}
+ lobbyLeaveItem = temp;
+ lobbyItemLeavePosition = config.getInt("lobbyItems.leave.position");
+ }
+ if(config.getBoolean("lobbyItems.start.enabled")) {
+ ConfigurationSection item = new YamlConfiguration().createSection("temp");
+ item.set("name", ChatColor.translateAlternateColorCodes('&',config.getString("lobbyItems.start.name")));
+ item.set("material", config.getString("lobbyItems.start.material"));
+ List<String> lore = config.getStringList("lobbyItems.start.lore");
+ if (lore != null && !lore.isEmpty()) item.set("lore", lore);
+ ItemStack temp = null;
+ try{ temp = XItemStack.deserialize(item); } catch(Exception ignored){}
+ lobbyStartItem = temp;
+ lobbyItemStartAdmin = config.getBoolean("lobbyItems.start.adminOnly");
+ lobbyItemStartPosition = config.getInt("lobbyItems.start.position");
+ }
}
public static void addToConfig(String path, Object value) {
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java
index 8b85ae6..1684896 100644
--- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java
+++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java
@@ -232,6 +232,7 @@ public class ConfigManager {
if(end == -1) end = yamlString.length();
String replace;
if(entry.getValue() instanceof List){
+ if(((List<?>) entry.getValue()).isEmpty()) continue;
replace = "[";
for(Object o : (List<Object>)entry.getValue()){
replace = replace + o.toString() + ", ";