1
0

servergroup fallback data

This commit is contained in:
labalityowo
2023-05-20 09:59:06 +07:00
parent 576577fbd6
commit 3a14c4fc2d
6 changed files with 26 additions and 23 deletions

View File

@ -76,26 +76,26 @@ public class ServerGroup
{ {
_name = data.get("name"); _name = data.get("name");
_prefix = data.get("prefix"); _prefix = data.get("prefix");
_requiredRam = Integer.valueOf(data.get("ram")); _requiredRam = Integer.valueOf(data.getOrDefault("ram", "512"));
_requiredCpu = Integer.valueOf(data.get("cpu")); _requiredCpu = Integer.valueOf(data.getOrDefault("cpu", "1"));
_requiredTotalServers = Integer.valueOf(data.get("totalServers")); _requiredTotalServers = Integer.valueOf(data.getOrDefault("totalServers", "1"));
_requiredJoinableServers = Integer.valueOf(data.get("joinableServers")); _requiredJoinableServers = Integer.valueOf(data.getOrDefault("joinableServers", "1"));
_portSection = Integer.valueOf(data.get("portSection")); _portSection = Integer.valueOf(data.getOrDefault("portSection", "25565"));
_uptimes = data.getOrDefault("uptimes", ""); _uptimes = data.getOrDefault("uptimes", "");
_arcadeGroup = Boolean.valueOf(data.get("arcadeGroup")); _arcadeGroup = Boolean.valueOf(data.getOrDefault("arcadeGroup", "true")); //assuming you use this for arcade only, who tf runs hub ??
_worldZip = data.get("worldZip"); _worldZip = data.get("worldZip");
_plugin = data.get("plugin"); _plugin = data.get("plugin");
_configPath = data.get("configPath"); _configPath = data.get("configPath");
_minPlayers = Integer.valueOf(data.get("minPlayers")); _minPlayers = Integer.valueOf(data.getOrDefault("minPlayers", "1"));
_maxPlayers = Integer.valueOf(data.get("maxPlayers")); _maxPlayers = Integer.valueOf(data.getOrDefault("maxPlayers", "100"));
_pvp = Boolean.valueOf(data.get("pvp")); _pvp = Boolean.valueOf(data.getOrDefault("pvp", "true"));
_tournament = Boolean.valueOf(data.get("tournament")); _tournament = Boolean.valueOf(data.get("tournament"));
_tournamentPoints = Boolean.valueOf(data.get("tournamentPoints")); _tournamentPoints = Boolean.valueOf(data.get("tournamentPoints"));
_hardMaxPlayerCap = Boolean.valueOf(data.get("hardMaxPlayerCap")); _hardMaxPlayerCap = Boolean.valueOf(data.get("hardMaxPlayerCap"));
_games = data.get("games"); _games = data.get("games");
_modes = data.get("modes"); _modes = data.get("modes");
_boosterGroup = data.get("boosterGroup"); _boosterGroup = data.get("boosterGroup");
_serverType = data.get("serverType"); _serverType = data.getOrDefault("serverType", "dedicated");
_addNoCheat = Boolean.valueOf(data.get("addNoCheat")); _addNoCheat = Boolean.valueOf(data.get("addNoCheat"));
_addWorldEdit = Boolean.valueOf(data.get("addWorldEdit")); _addWorldEdit = Boolean.valueOf(data.get("addWorldEdit"));
_teamRejoin = Boolean.valueOf(data.get("teamRejoin")); _teamRejoin = Boolean.valueOf(data.get("teamRejoin"));

View File

@ -8,6 +8,7 @@ import java.nio.file.Files;
import java.sql.Connection; import java.sql.Connection;
import java.util.List; import java.util.List;
import mineplex.serverdata.data.Data;
import org.apache.commons.dbcp2.BasicDataSource; import org.apache.commons.dbcp2.BasicDataSource;
public final class DBPool public final class DBPool
@ -133,22 +134,22 @@ public final class DBPool
String userName = args[2]; String userName = args[2];
String password = args[3]; String password = args[3];
// System.out.println(dbSource + " " + dbHost + " " + userName + " " + password); DataSource dataSource = openDataSource("jdbc:mysql://" + dbHost + "/" + dbSource.toLowerCase(), userName, password);;
if (dbSource.toUpperCase().equalsIgnoreCase("ACCOUNT")) if (dbSource.toUpperCase().equalsIgnoreCase("ACCOUNT"))
ACCOUNT = openDataSource("jdbc:mysql://" + dbHost, userName, password); ACCOUNT = dataSource;
else if (dbSource.toUpperCase().equalsIgnoreCase("QUEUE")) else if (dbSource.toUpperCase().equalsIgnoreCase("QUEUE"))
QUEUE = openDataSource("jdbc:mysql://" + dbHost, userName, password); QUEUE = dataSource;
else if (dbSource.toUpperCase().equalsIgnoreCase("MINEPLEX")) else if (dbSource.toUpperCase().equalsIgnoreCase("MINEPLEX"))
MINEPLEX = openDataSource("jdbc:mysql://" + dbHost, userName, password); MINEPLEX = dataSource;
else if (dbSource.toUpperCase().equalsIgnoreCase("MINEPLEX_STATS")) else if (dbSource.toUpperCase().equalsIgnoreCase("MINEPLEX_STATS"))
MINEPLEX_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password); MINEPLEX_STATS = dataSource;
else if (dbSource.toUpperCase().equalsIgnoreCase("PLAYER_STATS")) else if (dbSource.toUpperCase().equalsIgnoreCase("PLAYER_STATS"))
PLAYER_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password); PLAYER_STATS = dataSource;
else if (dbSource.toUpperCase().equalsIgnoreCase("SERVER_STATS")) else if (dbSource.toUpperCase().equalsIgnoreCase("SERVER_STATS"))
SERVER_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password); SERVER_STATS = dataSource;
else if (dbSource.toUpperCase().equalsIgnoreCase("MSSQL_MOCK")) else if (dbSource.toUpperCase().equalsIgnoreCase("MSSQL_MOCK"))
MSSQL_MOCK = openDataSource("jdbc:mysql://" + dbHost, userName, password); MSSQL_MOCK = dataSource;
} }
} }
} }

View File

@ -10,7 +10,7 @@ import mineplex.serverdata.servers.ConnectionData.ConnectionType;
public class RedisConfig public class RedisConfig
{ {
// Failsafe values in case configuration is not provided // Failsafe values in case configuration is not provided
private static final String DEFAULT_IP = "10.3.203.80"; private static final String DEFAULT_IP = "127.0.0.1";
private static final int DEFAULT_PORT = 6379; private static final int DEFAULT_PORT = 6379;
private static Random random = new Random(); // Utility random private static Random random = new Random(); // Utility random

View File

@ -2,7 +2,7 @@ package nautilus.game.arcade;
import java.io.File; import java.io.File;
import mineplex.core.TwitchIntegrationFix; //import mineplex.core.TwitchIntegrationFix;
import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -71,7 +71,7 @@ import mineplex.core.stats.StatsManager;
import mineplex.core.status.ServerStatusManager; import mineplex.core.status.ServerStatusManager;
import mineplex.core.teleport.Teleport; import mineplex.core.teleport.Teleport;
import mineplex.core.thank.ThankManager; import mineplex.core.thank.ThankManager;
import mineplex.core.twofactor.TwoFactorAuth; //import mineplex.core.twofactor.TwoFactorAuth;
import mineplex.core.updater.FileUpdater; import mineplex.core.updater.FileUpdater;
import mineplex.core.updater.Updater; import mineplex.core.updater.Updater;
import mineplex.core.velocity.VelocityFix; import mineplex.core.velocity.VelocityFix;
@ -205,9 +205,10 @@ public class Arcade extends JavaPlugin
new PacketsInteractionFix(this, packetHandler); new PacketsInteractionFix(this, packetHandler);
new FoodDupeFix(this); new FoodDupeFix(this);
require(TwoFactorAuth.class); //two factor is mad annoying`
//require(TwoFactorAuth.class);
require(WebsiteLinkManager.class); require(WebsiteLinkManager.class);
require(TwitchIntegrationFix.class); //require(TwitchIntegrationFix.class);
AprilFoolsManager.getInstance(); AprilFoolsManager.getInstance();

View File

@ -265,6 +265,7 @@ public abstract class GameTutorial
_hasEnded = true; _hasEnded = true;
Thread thread = _currentPhase.getThread(); Thread thread = _currentPhase.getThread();
if (thread.isAlive()) if (thread.isAlive())
//?
thread.destroy(); thread.destroy();
endTutorial(); endTutorial();

Binary file not shown.