Updated ServerConfiguration to support resourcepack and Arcade settings.
This commit is contained in:
parent
6f2a6a6ebd
commit
f931bd26e6
3
.gitignore
vendored
3
.gitignore
vendored
@ -26,3 +26,6 @@ Servers
|
|||||||
Debug
|
Debug
|
||||||
*.gitignore
|
*.gitignore
|
||||||
/Maps/GRASER UHC
|
/Maps/GRASER UHC
|
||||||
|
/MutualNDA (1)-signed.pdf
|
||||||
|
/MutualNDA - signed-signed.pdf
|
||||||
|
/MutualNDA - signed.pdf
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package mineplex.core.serverConfig;
|
package mineplex.core.serverConfig;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.PlayerList;
|
import net.minecraft.server.v1_7_R4.PlayerList;
|
||||||
|
|
||||||
@ -27,8 +25,6 @@ public class ServerConfiguration extends MiniPlugin
|
|||||||
|
|
||||||
for (ServerGroup serverGroup : ServerManager.getServerRepository(region).getServerGroups())
|
for (ServerGroup serverGroup : ServerManager.getServerRepository(region).getServerGroups())
|
||||||
{
|
{
|
||||||
System.out.println(serverGroup.getName());
|
|
||||||
|
|
||||||
if (serverGroup.getName().equalsIgnoreCase(plugin.getConfig().getString("serverstatus.group")))
|
if (serverGroup.getName().equalsIgnoreCase(plugin.getConfig().getString("serverstatus.group")))
|
||||||
{
|
{
|
||||||
_serverGroup = serverGroup;
|
_serverGroup = serverGroup;
|
||||||
@ -39,9 +35,6 @@ public class ServerConfiguration extends MiniPlugin
|
|||||||
if (_serverGroup == null)
|
if (_serverGroup == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_serverGroup.getWhitelist())
|
|
||||||
_plugin.getServer().setWhitelist(true);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_playerListMaxPlayers = PlayerList.class.getDeclaredField("maxPlayers");
|
_playerListMaxPlayers = PlayerList.class.getDeclaredField("maxPlayers");
|
||||||
@ -53,7 +46,9 @@ public class ServerConfiguration extends MiniPlugin
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_plugin.getServer().setWhitelist(_serverGroup.getWhitelist());
|
||||||
((CraftServer)_plugin.getServer()).getServer().setPvP(_serverGroup.getPvp());
|
((CraftServer)_plugin.getServer()).getServer().setPvP(_serverGroup.getPvp());
|
||||||
|
((CraftServer)_plugin.getServer()).getServer().setTexturePack(_serverGroup.getResourcePack());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServerGroup getServerGroup()
|
public ServerGroup getServerGroup()
|
||||||
|
@ -80,7 +80,7 @@ public class Hub extends JavaPlugin implements IRelation
|
|||||||
|
|
||||||
DonationManager donationManager = new DonationManager(this, webServerAddress);
|
DonationManager donationManager = new DonationManager(this, webServerAddress);
|
||||||
|
|
||||||
ServerConfiguration configuration = new ServerConfiguration(this);
|
new ServerConfiguration(this);
|
||||||
|
|
||||||
//Other Modules
|
//Other Modules
|
||||||
PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager);
|
PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager);
|
||||||
|
@ -68,6 +68,9 @@ public class ServerGroup
|
|||||||
private boolean _tournament;
|
private boolean _tournament;
|
||||||
public boolean getTournament() { return _tournament; }
|
public boolean getTournament() { return _tournament; }
|
||||||
|
|
||||||
|
private boolean _tournamentPoints;
|
||||||
|
public boolean getTournamentPoints() { return _tournamentPoints; }
|
||||||
|
|
||||||
private boolean _teamRejoin;
|
private boolean _teamRejoin;
|
||||||
public boolean getTeamRejoin() { return _teamRejoin; }
|
public boolean getTeamRejoin() { return _teamRejoin; }
|
||||||
|
|
||||||
@ -122,6 +125,8 @@ public class ServerGroup
|
|||||||
private boolean _staffOnly;
|
private boolean _staffOnly;
|
||||||
public boolean getStaffOnly() { return _staffOnly; }
|
public boolean getStaffOnly() { return _staffOnly; }
|
||||||
|
|
||||||
|
private String _resourcePack;
|
||||||
|
public String getResourcePack() { return _resourcePack; }
|
||||||
// The set of active MinecraftServers that belong to this server group
|
// The set of active MinecraftServers that belong to this server group
|
||||||
private Set<MinecraftServer> _servers;
|
private Set<MinecraftServer> _servers;
|
||||||
public Set<MinecraftServer> getServers() { return _servers; }
|
public Set<MinecraftServer> getServers() { return _servers; }
|
||||||
@ -150,6 +155,7 @@ public class ServerGroup
|
|||||||
_maxPlayers = Integer.valueOf(data.get("maxPlayers"));
|
_maxPlayers = Integer.valueOf(data.get("maxPlayers"));
|
||||||
_pvp = Boolean.valueOf(data.get("pvp"));
|
_pvp = Boolean.valueOf(data.get("pvp"));
|
||||||
_tournament = Boolean.valueOf(data.get("tournament"));
|
_tournament = Boolean.valueOf(data.get("tournament"));
|
||||||
|
_tournamentPoints = Boolean.valueOf(data.get("tournamentPoints"));
|
||||||
_generateFreeVersions = Boolean.valueOf(data.get("generateFreeVersions"));
|
_generateFreeVersions = Boolean.valueOf(data.get("generateFreeVersions"));
|
||||||
_games = data.get("games");
|
_games = data.get("games");
|
||||||
_serverType = data.get("serverType");
|
_serverType = data.get("serverType");
|
||||||
@ -168,6 +174,7 @@ public class ServerGroup
|
|||||||
_playerKickIdle = Boolean.valueOf(data.get("playerKickIdle"));
|
_playerKickIdle = Boolean.valueOf(data.get("playerKickIdle"));
|
||||||
_staffOnly = Boolean.valueOf(data.get("staffOnly"));
|
_staffOnly = Boolean.valueOf(data.get("staffOnly"));
|
||||||
_whitelist = Boolean.valueOf(data.get("whitelist"));
|
_whitelist = Boolean.valueOf(data.get("whitelist"));
|
||||||
|
_resourcePack = data.get("resourcePack");
|
||||||
|
|
||||||
fetchServers(region);
|
fetchServers(region);
|
||||||
}
|
}
|
||||||
|
@ -416,12 +416,12 @@ public class ServerMonitor
|
|||||||
|
|
||||||
private static void startServer(final DedicatedServer serverSpace, final ServerGroup serverGroup, final int serverNum, final boolean free)
|
private static void startServer(final DedicatedServer serverSpace, final ServerGroup serverGroup, final int serverNum, final boolean free)
|
||||||
{
|
{
|
||||||
String cmd = "/home/mineplex/easyRemoteStartServer.sh";
|
String cmd = "/home/mineplex/easyRemoteStartServerCustom.sh";
|
||||||
final String groupPrefix = serverGroup.getPrefix();
|
final String groupPrefix = serverGroup.getPrefix();
|
||||||
final String serverName = serverSpace.getName();
|
final String serverName = serverSpace.getName();
|
||||||
final String serverAddress = serverSpace.getPublicAddress();
|
final String serverAddress = serverSpace.getPublicAddress();
|
||||||
|
|
||||||
ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", cmd, serverAddress, serverSpace.getPrivateAddress(), (serverGroup.getPortSection() + serverNum) + "", serverGroup.getRequiredRam() + "", serverGroup.getWorldZip(), serverGroup.getPlugin(), serverGroup.getConfigPath(), serverGroup.getName(), serverGroup.getPrefix() + "-" + serverNum, serverGroup.getMinPlayers() + "", serverGroup.getMaxPlayers() + "", serverGroup.getPvp() + "", serverGroup.getTournament() + "", free + "", serverSpace.isUsRegion() ? "true" : "false", serverGroup.getArcadeGroup() + "", serverGroup.getGames(), serverGroup.getServerType(), serverGroup.getAddNoCheat() + "", serverGroup.getTeamAutoJoin() + "", serverGroup.getTeamForceBalance() + "", serverGroup.getTeamRejoin() + "", serverGroup.getGameAutoStart() + "", serverGroup.getGameTimeout() + "", serverGroup.getHotbarHubClock() + "", serverGroup.getHotbarInventory() + "", serverGroup.getPlayerKickIdle() + "", serverGroup.getRewardGems() + "", serverGroup.getRewardItems() + "", serverGroup.getRewardAchievements() + "", serverGroup.getRewardStats() + ""});
|
ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", cmd, serverAddress, serverSpace.getPrivateAddress(), (serverGroup.getPortSection() + serverNum) + "", serverGroup.getRequiredRam() + "", serverGroup.getWorldZip(), serverGroup.getPlugin(), serverGroup.getConfigPath(), serverGroup.getName(), serverGroup.getPrefix() + "-" + serverNum, serverSpace.isUsRegion() ? "true" : "false", serverGroup.getAddNoCheat() + "" });
|
||||||
pr.start(new GenericRunnable<Boolean>()
|
pr.start(new GenericRunnable<Boolean>()
|
||||||
{
|
{
|
||||||
public void run(Boolean error)
|
public void run(Boolean error)
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
package nautilus.game.arcade;
|
package nautilus.game.arcade;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@ -42,6 +36,7 @@ import mineplex.core.preferences.PreferencesManager;
|
|||||||
import mineplex.core.projectile.ProjectileManager;
|
import mineplex.core.projectile.ProjectileManager;
|
||||||
import mineplex.core.punish.Punish;
|
import mineplex.core.punish.Punish;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.serverConfig.ServerConfiguration;
|
||||||
import mineplex.core.spawn.Spawn;
|
import mineplex.core.spawn.Spawn;
|
||||||
import mineplex.core.status.ServerStatusManager;
|
import mineplex.core.status.ServerStatusManager;
|
||||||
import mineplex.core.teleport.Teleport;
|
import mineplex.core.teleport.Teleport;
|
||||||
@ -61,6 +56,8 @@ public class Arcade extends JavaPlugin
|
|||||||
private DamageManager _damageManager;
|
private DamageManager _damageManager;
|
||||||
|
|
||||||
private ArcadeManager _gameManager;
|
private ArcadeManager _gameManager;
|
||||||
|
|
||||||
|
private ServerConfiguration _serverConfiguration;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
@ -87,6 +84,8 @@ public class Arcade extends JavaPlugin
|
|||||||
|
|
||||||
_donationManager = new DonationManager(this, webServerAddress);
|
_donationManager = new DonationManager(this, webServerAddress);
|
||||||
|
|
||||||
|
_serverConfiguration = new ServerConfiguration(this);
|
||||||
|
|
||||||
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager);
|
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager);
|
||||||
new MessageManager(this, _clientManager, preferenceManager);
|
new MessageManager(this, _clientManager, preferenceManager);
|
||||||
|
|
||||||
@ -133,7 +132,6 @@ public class Arcade extends JavaPlugin
|
|||||||
MinecraftServer.getServer().getPropertyManager().setProperty("debug", true);
|
MinecraftServer.getServer().getPropertyManager().setProperty("debug", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
@ -149,124 +147,40 @@ public class Arcade extends JavaPlugin
|
|||||||
{
|
{
|
||||||
GameServerConfig config = new GameServerConfig();
|
GameServerConfig config = new GameServerConfig();
|
||||||
|
|
||||||
//Load Track Data
|
config.ServerType = _serverConfiguration.getServerGroup().getServerType();
|
||||||
String line = null;
|
config.MinPlayers = _serverConfiguration.getServerGroup().getMinPlayers();
|
||||||
|
config.MaxPlayers = _serverConfiguration.getServerGroup().getMaxPlayers();
|
||||||
try
|
config.Tournament = _serverConfiguration.getServerGroup().getTournament();
|
||||||
|
config.TournamentPoints = _serverConfiguration.getServerGroup().getTournamentPoints();
|
||||||
|
config.TeamRejoin = _serverConfiguration.getServerGroup().getTeamRejoin();
|
||||||
|
config.TeamAutoJoin = _serverConfiguration.getServerGroup().getTeamAutoJoin();
|
||||||
|
config.TeamForceBalance = _serverConfiguration.getServerGroup().getTeamForceBalance();
|
||||||
|
config.GameAutoStart = _serverConfiguration.getServerGroup().getGameAutoStart();
|
||||||
|
config.GameTimeout = _serverConfiguration.getServerGroup().getGameTimeout();
|
||||||
|
config.RewardGems = _serverConfiguration.getServerGroup().getRewardGems();
|
||||||
|
config.RewardItems = _serverConfiguration.getServerGroup().getRewardItems();
|
||||||
|
config.RewardStats = _serverConfiguration.getServerGroup().getRewardStats();
|
||||||
|
config.RewardAchievements = _serverConfiguration.getServerGroup().getRewardAchievements();
|
||||||
|
config.HotbarInventory = _serverConfiguration.getServerGroup().getHotbarInventory();
|
||||||
|
config.HotbarHubClock = _serverConfiguration.getServerGroup().getHotbarHubClock();
|
||||||
|
config.PlayerKickIdle = _serverConfiguration.getServerGroup().getPlayerKickIdle();
|
||||||
|
|
||||||
|
for (String gameName : _serverConfiguration.getServerGroup().getGames().split(","))
|
||||||
{
|
{
|
||||||
File file = new File("ArcadeSettings.config");
|
try
|
||||||
if (!file.exists())
|
{
|
||||||
WriteServerConfig(GetDefaultConfig());
|
GameType type = GameType.valueOf(gameName);
|
||||||
|
config.GameList.add(type);
|
||||||
FileInputStream fstream = new FileInputStream("ArcadeSettings.config");
|
}
|
||||||
DataInputStream in = new DataInputStream(fstream);
|
catch (Exception e)
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
|
||||||
|
|
||||||
while ((line = br.readLine()) != null)
|
|
||||||
{
|
{
|
||||||
String[] tokens = line.split("=");
|
|
||||||
|
|
||||||
if (tokens.length < 2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (tokens[0].equals("SERVER_TYPE"))
|
|
||||||
{
|
|
||||||
config.ServerType = tokens[1];
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("PLAYERS_MIN"))
|
|
||||||
{
|
|
||||||
config.MinPlayers = Integer.parseInt(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("PLAYERS_MAX"))
|
|
||||||
{
|
|
||||||
config.MaxPlayers = Integer.parseInt(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("TOURNAMENT"))
|
|
||||||
{
|
|
||||||
config.Tournament = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("TOURNAMENT_POINTS"))
|
|
||||||
{
|
|
||||||
config.TournamentPoints = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("TEAM_REJOIN"))
|
|
||||||
{
|
|
||||||
config.TeamRejoin = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("TEAM_AUTO_JOIN"))
|
|
||||||
{
|
|
||||||
config.TeamAutoJoin = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("TEAM_FORCE_BALANCE"))
|
|
||||||
{
|
|
||||||
config.TeamForceBalance = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("GAME_AUTO_START"))
|
|
||||||
{
|
|
||||||
config.GameAutoStart = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("GAME_TIMEOUT"))
|
|
||||||
{
|
|
||||||
config.GameTimeout = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("REWARD_GEMS"))
|
|
||||||
{
|
|
||||||
config.RewardGems = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("REWARD_ITEMS"))
|
|
||||||
{
|
|
||||||
config.RewardItems = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("REWARD_STATS"))
|
|
||||||
{
|
|
||||||
config.RewardStats = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("REWARD_ACHIEVEMENTS"))
|
|
||||||
{
|
|
||||||
config.RewardAchievements = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("HOTBAR_INVENTORY"))
|
|
||||||
{
|
|
||||||
config.HotbarInventory = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("HOTBAR_HUB_CLOCK"))
|
|
||||||
{
|
|
||||||
config.HotbarHubClock = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
else if (tokens[0].equals("PLAYER_KICK_IDLE"))
|
|
||||||
{
|
|
||||||
config.PlayerKickIdle = Boolean.parseBoolean(tokens[1]);
|
|
||||||
}
|
|
||||||
//Games
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
GameType type = GameType.valueOf(tokens[0]);
|
|
||||||
boolean enabled = Boolean.valueOf(tokens[1]);
|
|
||||||
|
|
||||||
if (enabled)
|
|
||||||
config.GameList.add(type);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
in.close();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.IsValid())
|
if (!config.IsValid())
|
||||||
config = GetDefaultConfig();
|
config = GetDefaultConfig();
|
||||||
|
|
||||||
WriteServerConfig(config);
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,53 +196,6 @@ public class Arcade extends JavaPlugin
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteServerConfig(GameServerConfig config)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FileWriter fstream = new FileWriter("ArcadeSettings.config");
|
|
||||||
BufferedWriter out = new BufferedWriter(fstream);
|
|
||||||
|
|
||||||
out.write("SERVER_TYPE=" + config.ServerType + "\n");
|
|
||||||
out.write("PLAYERS_MIN=" + config.MinPlayers + "\n");
|
|
||||||
out.write("PLAYERS_MAX=" + config.MaxPlayers + "\n");
|
|
||||||
|
|
||||||
out.write("\nTOURNAMENT=" + config.Tournament + "\n");
|
|
||||||
|
|
||||||
out.write("\nTOURNAMENT_POINTS=" + config.TournamentPoints + "\n");
|
|
||||||
|
|
||||||
out.write("\nTEAM_REJOIN=" + config.TeamRejoin + "\n");
|
|
||||||
out.write("TEAM_AUTO_JOIN=" + config.TeamAutoJoin + "\n");
|
|
||||||
out.write("TEAM_FORCE_BALANCE=" + config.TeamForceBalance + "\n");
|
|
||||||
|
|
||||||
out.write("\nGAME_AUTO_START=" + config.GameAutoStart + "\n");
|
|
||||||
out.write("GAME_TIMEOUT=" + config.GameTimeout + "\n");
|
|
||||||
|
|
||||||
out.write("\nREWARD_GEMS=" + config.RewardGems + "\n");
|
|
||||||
out.write("REWARD_ITEMS=" + config.RewardItems + "\n");
|
|
||||||
out.write("REWARD_STATS=" + config.RewardStats + "\n");
|
|
||||||
out.write("REWARD_ACHIEVEMENTS=" + config.RewardAchievements + "\n");
|
|
||||||
|
|
||||||
out.write("\nHOTBAR_INVENTORY=" + config.HotbarInventory + "\n");
|
|
||||||
out.write("HOTBAR_HUB_CLOCK=" + config.HotbarHubClock + "\n");
|
|
||||||
|
|
||||||
out.write("\nPLAYER_KICK_IDLE=" + config.PlayerKickIdle + "\n");
|
|
||||||
|
|
||||||
out.write("\n\nGames List;\n");
|
|
||||||
|
|
||||||
for (GameType type : GameType.values())
|
|
||||||
{
|
|
||||||
out.write(type.toString() + "=" + config.GameList.contains(type) + "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeleteFolders()
|
private void DeleteFolders()
|
||||||
{
|
{
|
||||||
File curDir = new File(".");
|
File curDir = new File(".");
|
||||||
|
Loading…
Reference in New Issue
Block a user