Allow Map and Game Voting to be set within the ServerGroup
This commit is contained in:
parent
de061fe80c
commit
96921063f0
@ -150,7 +150,7 @@ public class PersonalServerManager extends MiniPlugin
|
||||
}
|
||||
|
||||
final ServerGroup serverGroup = new ServerGroup("COM-" + community.getId(), "COM-" + community.getName(), "COM-" + community.getId(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, "", true, "Lobby_MCS.zip", "Arcade.jar", "plugins/Arcade/", 15, 20,
|
||||
true, false, false, community.getFavoriteGame().name(), "", "", "Community", true, false, false, true, false, false, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
|
||||
true, false, false, community.getFavoriteGame().name(), "", "", "Community", true, false, false, true, false, false, true, false, false, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
|
||||
|
||||
_repository.updateServerGroup(serverGroup);
|
||||
runSync(() ->
|
||||
@ -183,7 +183,7 @@ public class PersonalServerManager extends MiniPlugin
|
||||
}
|
||||
|
||||
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, "", true, "Lobby_MPS.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
|
||||
true, false, false, games, "", "", "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
|
||||
true, false, false, games, "", "", "Player", true, event, false, true, false, true, true, false, false, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
|
||||
|
||||
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), () ->
|
||||
{
|
||||
|
@ -41,11 +41,12 @@ public class ServerGroup
|
||||
|
||||
private boolean _gameAutoStart;
|
||||
private boolean _gameTimeout;
|
||||
private boolean _gameVoting, _mapVoting;
|
||||
private boolean _rewardGems;
|
||||
private boolean _rewardItems;
|
||||
|
||||
private boolean _rewardStats;
|
||||
private boolean _rewardAchievements;
|
||||
|
||||
private boolean _hotbarInventory;
|
||||
private boolean _hotbarHubClock;
|
||||
private boolean _playerKickIdle;
|
||||
@ -80,7 +81,7 @@ public class ServerGroup
|
||||
_requiredTotalServers = Integer.valueOf(data.get("totalServers"));
|
||||
_requiredJoinableServers = Integer.valueOf(data.get("joinableServers"));
|
||||
_portSection = Integer.valueOf(data.get("portSection"));
|
||||
_uptimes = data.containsKey("uptimes") ? data.get("uptimes") : "";
|
||||
_uptimes = data.getOrDefault("uptimes", "");
|
||||
_arcadeGroup = Boolean.valueOf(data.get("arcadeGroup"));
|
||||
_worldZip = data.get("worldZip");
|
||||
_plugin = data.get("plugin");
|
||||
@ -102,6 +103,8 @@ public class ServerGroup
|
||||
_teamForceBalance = Boolean.valueOf(data.get("teamForceBalance"));
|
||||
_gameAutoStart = Boolean.valueOf(data.get("gameAutoStart"));
|
||||
_gameTimeout = Boolean.valueOf(data.get("gameTimeout"));
|
||||
_gameVoting = Boolean.valueOf(data.get("gameVoting"));
|
||||
_mapVoting = Boolean.valueOf(data.get("mapVoting"));
|
||||
_rewardGems = Boolean.valueOf(data.get("rewardGems"));
|
||||
_rewardItems = Boolean.valueOf(data.get("rewardItems"));
|
||||
_rewardStats = Boolean.valueOf(data.get("rewardStats"));
|
||||
@ -111,13 +114,13 @@ public class ServerGroup
|
||||
_playerKickIdle = Boolean.valueOf(data.get("playerKickIdle"));
|
||||
_staffOnly = Boolean.valueOf(data.get("staffOnly"));
|
||||
_whitelist = Boolean.valueOf(data.get("whitelist"));
|
||||
_resourcePack = data.containsKey("resourcePack") ? data.get("resourcePack") : "";
|
||||
_resourcePack = data.getOrDefault("resourcePack", "");
|
||||
_host = data.get("host");
|
||||
_region = data.containsKey("region") ? Region.valueOf(data.get("region")) : Region.ALL;
|
||||
_teamServerKey = data.containsKey("teamServerKey") ? data.get("teamServerKey") : "";
|
||||
_portalBottomCornerLocation = data.containsKey("portalBottomCornerLocation") ? data.get("portalBottomCornerLocation") : "";
|
||||
_portalTopCornerLocation = data.containsKey("portalTopCornerLocation") ? data.get("portalTopCornerLocation") : "";
|
||||
_npcName = data.containsKey("npcName") ? data.get("npcName") : "";
|
||||
_teamServerKey = data.getOrDefault("teamServerKey", "");
|
||||
_portalBottomCornerLocation = data.getOrDefault("portalBottomCornerLocation", "");
|
||||
_portalTopCornerLocation = data.getOrDefault("portalTopCornerLocation", "");
|
||||
_npcName = data.getOrDefault("npcName", "");
|
||||
|
||||
if (serverStatuses != null)
|
||||
parseServers(serverStatuses);
|
||||
@ -125,7 +128,7 @@ public class ServerGroup
|
||||
|
||||
public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, String uptimes, boolean arcade, String worldZip, String plugin, String configPath
|
||||
, int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String modes, String boosterGroup, String serverType, boolean noCheat, boolean worldEdit, boolean teamRejoin
|
||||
, boolean teamAutoJoin, boolean teamForceBalance, boolean gameAutoStart, boolean gameTimeout, boolean rewardGems, boolean rewardItems, boolean rewardStats
|
||||
, boolean teamAutoJoin, boolean teamForceBalance, boolean gameAutoStart, boolean gameTimeout, boolean gameVoting, boolean mapVoting, boolean rewardGems, boolean rewardItems, boolean rewardStats
|
||||
, boolean rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region
|
||||
, String teamServerKey, String portalBottomCornerLocation, String portalTopCornerLocation, String npcName)
|
||||
{
|
||||
@ -158,6 +161,8 @@ public class ServerGroup
|
||||
_teamForceBalance = teamForceBalance;
|
||||
_gameAutoStart = gameAutoStart;
|
||||
_gameTimeout = gameTimeout;
|
||||
_gameVoting = gameVoting;
|
||||
_mapVoting = mapVoting;
|
||||
_rewardGems = rewardGems;
|
||||
_rewardItems = rewardItems;
|
||||
_rewardStats = rewardStats;
|
||||
@ -209,11 +214,13 @@ public class ServerGroup
|
||||
public boolean getTeamForceBalance() { return _teamForceBalance; }
|
||||
public boolean getGameAutoStart() { return _gameAutoStart; }
|
||||
public boolean getGameTimeout() { return _gameTimeout; }
|
||||
public boolean getGameVoting() { return _gameVoting; }
|
||||
public boolean getMapVoting() { return _mapVoting; }
|
||||
public boolean getRewardGems() { return _rewardGems; }
|
||||
public boolean getRewardItems() { return _rewardItems; }
|
||||
|
||||
public boolean getRewardStats() { return _rewardStats; }
|
||||
public boolean getRewardAchievements() { return _rewardAchievements; }
|
||||
|
||||
public boolean getHotbarInventory() { return _hotbarInventory; }
|
||||
public boolean getHotbarHubClock() { return _hotbarHubClock; }
|
||||
public boolean getPlayerKickIdle() { return _playerKickIdle; }
|
||||
@ -301,7 +308,7 @@ public class ServerGroup
|
||||
|
||||
private void parseServers(Collection<MinecraftServer> servers)
|
||||
{
|
||||
_servers = new HashSet<MinecraftServer>();
|
||||
_servers = new HashSet<>();
|
||||
|
||||
for (MinecraftServer server : servers)
|
||||
{
|
||||
@ -355,7 +362,7 @@ public class ServerGroup
|
||||
{
|
||||
if (_dataMap == null)
|
||||
{
|
||||
_dataMap = new HashMap<String, String>();
|
||||
_dataMap = new HashMap<>();
|
||||
|
||||
_dataMap.put("name", _name);
|
||||
_dataMap.put("prefix", _prefix);
|
||||
@ -383,6 +390,8 @@ public class ServerGroup
|
||||
_dataMap.put("teamForceBalance", _teamForceBalance + "");
|
||||
_dataMap.put("gameAutoStart", _gameAutoStart + "");
|
||||
_dataMap.put("gameTimeout", _gameTimeout + "");
|
||||
_dataMap.put("gameVoting", String.valueOf(_gameVoting));
|
||||
_dataMap.put("mapVoting", String.valueOf(_mapVoting));
|
||||
_dataMap.put("rewardGems", _rewardGems + "");
|
||||
_dataMap.put("rewardItems", _rewardItems + "");
|
||||
_dataMap.put("rewardStats", _rewardStats + "");
|
||||
@ -396,7 +405,6 @@ public class ServerGroup
|
||||
_dataMap.put("host", _host);
|
||||
_dataMap.put("region", _region.name());
|
||||
_dataMap.put("teamServerKey", _teamServerKey);
|
||||
_dataMap.put("modes", _modes);
|
||||
_dataMap.put("boosterGroup", _boosterGroup);
|
||||
_dataMap.put("portalBottomCornerLocation", _portalBottomCornerLocation);
|
||||
_dataMap.put("portalTopCornerLocation", _portalTopCornerLocation);
|
||||
|
@ -6,7 +6,6 @@ import java.util.HashMap;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.ServicePriority;
|
||||
@ -83,16 +82,11 @@ import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
|
||||
import nautilus.game.arcade.anticheatmetadata.GameInfoMetadata;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameServerConfig;
|
||||
import static mineplex.core.Managers.require;
|
||||
|
||||
public class Arcade extends JavaPlugin
|
||||
{
|
||||
//Modules
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
private DamageManager _damageManager;
|
||||
|
||||
private ArcadeManager _gameManager;
|
||||
|
||||
@ -101,23 +95,15 @@ public class Arcade extends JavaPlugin
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
getServer().getServicesManager().register(RelationProvider.class, new RelationProvider()
|
||||
{
|
||||
@Override
|
||||
public boolean canDamage(Player player, Entity target)
|
||||
getServer().getServicesManager().register(RelationProvider.class, (player, target) ->
|
||||
{
|
||||
if (target instanceof Player)
|
||||
{
|
||||
return _gameManager.canHurt(player, (Player) target);
|
||||
}
|
||||
else if (target instanceof LivingEntity)
|
||||
{
|
||||
return _gameManager.GetGame() != null && _gameManager.GetGame().GetState() == Game.GameState.Live;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return target instanceof LivingEntity && _gameManager.GetGame() != null && _gameManager.GetGame().IsLive();
|
||||
}
|
||||
}, this, ServicePriority.Normal);
|
||||
|
||||
@ -134,8 +120,8 @@ public class Arcade extends JavaPlugin
|
||||
|
||||
//Static Modules
|
||||
CommandCenter.Initialize(this);
|
||||
_clientManager = new CoreClientManager(this);
|
||||
CommandCenter.Instance.setClientManager(_clientManager);
|
||||
CoreClientManager clientManager = new CoreClientManager(this);
|
||||
CommandCenter.Instance.setClientManager(clientManager);
|
||||
require(ProfileCacheManager.class);
|
||||
|
||||
|
||||
@ -145,47 +131,47 @@ public class Arcade extends JavaPlugin
|
||||
Give.Initialize(this);
|
||||
|
||||
// Publish our server status now, to give us more time to start up
|
||||
ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager));
|
||||
ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager));
|
||||
|
||||
//Velocity Fix
|
||||
new VelocityFix(this);
|
||||
|
||||
_donationManager = require(DonationManager.class);
|
||||
DonationManager donationManager = require(DonationManager.class);
|
||||
|
||||
_serverConfiguration = new ServerConfiguration(this, _clientManager);
|
||||
_serverConfiguration = new ServerConfiguration(this, clientManager);
|
||||
|
||||
PacketHandler packetHandler = require(PacketHandler.class);
|
||||
|
||||
IncognitoManager incognito = new IncognitoManager(this, _clientManager, packetHandler);
|
||||
PreferencesManager preferenceManager = new PreferencesManager(this, incognito, _clientManager);
|
||||
IncognitoManager incognito = new IncognitoManager(this, clientManager, packetHandler);
|
||||
PreferencesManager preferenceManager = new PreferencesManager(this, incognito, clientManager);
|
||||
|
||||
incognito.setPreferencesManager(preferenceManager);
|
||||
|
||||
Creature creature = new Creature(this);
|
||||
Teleport teleport = new Teleport(this, _clientManager);
|
||||
Teleport teleport = new Teleport(this, clientManager);
|
||||
Portal portal = new Portal();
|
||||
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB);
|
||||
|
||||
DisguiseManager disguiseManager = require(DisguiseManager.class);
|
||||
|
||||
NpcManager npcmanager = new NpcManager(this, creature);
|
||||
_damageManager = new DamageManager(this, require(CombatManager.class), npcmanager, disguiseManager, null);
|
||||
DamageManager damageManager = new DamageManager(this, require(CombatManager.class), npcmanager, disguiseManager, null);
|
||||
|
||||
Punish punish = new Punish(this, _clientManager);
|
||||
Punish punish = new Punish(this, clientManager);
|
||||
|
||||
require(AntiHack.class);
|
||||
|
||||
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
|
||||
StatsManager statsManager = new StatsManager(this, _clientManager);
|
||||
EloManager eloManager = new EloManager(this, _clientManager);
|
||||
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, _donationManager, incognito, eloManager);
|
||||
FriendManager friendManager = new FriendManager(this, _clientManager, preferenceManager, portal);
|
||||
IgnoreManager ignoreManager = new IgnoreManager(this, clientManager, preferenceManager, portal);
|
||||
StatsManager statsManager = new StatsManager(this, clientManager);
|
||||
EloManager eloManager = new EloManager(this, clientManager);
|
||||
AchievementManager achievementManager = new AchievementManager(statsManager, clientManager, donationManager, incognito, eloManager);
|
||||
FriendManager friendManager = new FriendManager(this, clientManager, preferenceManager, portal);
|
||||
Chat chat = new Chat();
|
||||
new MessageManager(this, incognito, _clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
|
||||
new MessageManager(this, incognito, clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
|
||||
|
||||
SnapshotManager snapshotManager = new SnapshotManager(this, new SnapshotRepository(serverStatusManager.getCurrentServerName(), getLogger()));
|
||||
ReportManager reportManager = new ReportManager(this, snapshotManager, _clientManager, incognito, punish, serverStatusManager.getRegion(), serverStatusManager.getCurrentServerName(), 1);
|
||||
new SnapshotPlugin(this, snapshotManager, _clientManager);
|
||||
ReportManager reportManager = new ReportManager(this, snapshotManager, clientManager, incognito, punish, serverStatusManager.getRegion(), serverStatusManager.getCurrentServerName(), 1);
|
||||
new SnapshotPlugin(this, snapshotManager, clientManager);
|
||||
new ReportPlugin(this, reportManager);
|
||||
|
||||
BlockRestore blockRestore = require(BlockRestore.class);
|
||||
@ -194,13 +180,13 @@ public class Arcade extends JavaPlugin
|
||||
HologramManager hologramManager = require(HologramManager.class);
|
||||
|
||||
//Inventory
|
||||
InventoryManager inventoryManager = new InventoryManager(this, _clientManager);
|
||||
CastleManager castleManager = new CastleManager(this, _clientManager, hologramManager, false);
|
||||
PetManager petManager = new PetManager(this, _clientManager, _donationManager, inventoryManager, disguiseManager, creature, blockRestore);
|
||||
InventoryManager inventoryManager = new InventoryManager(this, clientManager);
|
||||
CastleManager castleManager = new CastleManager(this, clientManager, hologramManager, false);
|
||||
PetManager petManager = new PetManager(this, clientManager, donationManager, inventoryManager, disguiseManager, creature, blockRestore);
|
||||
GadgetManager gadgetManager = require(GadgetManager.class);
|
||||
ThankManager thankManager = new ThankManager(this, _clientManager, _donationManager);
|
||||
BoosterManager boosterManager = new BoosterManager(this, _serverConfiguration.getServerGroup().getBoosterGroup(), _clientManager, _donationManager, inventoryManager, thankManager);
|
||||
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, petManager, null, boosterManager, punish);
|
||||
ThankManager thankManager = new ThankManager(this, clientManager, donationManager);
|
||||
BoosterManager boosterManager = new BoosterManager(this, _serverConfiguration.getServerGroup().getBoosterGroup(), clientManager, donationManager, inventoryManager, thankManager);
|
||||
CosmeticManager cosmeticManager = new CosmeticManager(this, clientManager, donationManager, inventoryManager, gadgetManager, petManager, null, boosterManager, punish);
|
||||
cosmeticManager.setInterfaceSlot(6);
|
||||
gadgetManager.setActiveItemSlot(3);
|
||||
cosmeticManager.disableTeamArmor();
|
||||
@ -209,8 +195,8 @@ public class Arcade extends JavaPlugin
|
||||
CustomDataManager customDataManager = require(CustomDataManager.class);
|
||||
|
||||
//Arcade Manager
|
||||
PollManager pollManager = new PollManager(this, _clientManager, _donationManager);
|
||||
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, incognito, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, pollManager, npcmanager, customDataManager, punish, eloManager, thankManager, boosterManager);
|
||||
PollManager pollManager = new PollManager(this, clientManager, donationManager);
|
||||
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), clientManager, donationManager, damageManager, statsManager, incognito, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, pollManager, npcmanager, customDataManager, punish, eloManager, thankManager, boosterManager);
|
||||
|
||||
require(AntihackLogger.class).registerMetadata(new GameInfoMetadata());
|
||||
|
||||
@ -222,7 +208,7 @@ public class Arcade extends JavaPlugin
|
||||
new FoodDupeFix(this);
|
||||
|
||||
require(TwoFactorAuth.class);
|
||||
new WebsiteLinkManager(this, _clientManager);
|
||||
new WebsiteLinkManager(this, clientManager);
|
||||
require(TwitchIntegrationFix.class);
|
||||
|
||||
AprilFoolsManager.getInstance();
|
||||
@ -277,6 +263,8 @@ public class Arcade extends JavaPlugin
|
||||
config.HotbarInventory = _serverConfiguration.getServerGroup().getHotbarInventory();
|
||||
config.HotbarHubClock = _serverConfiguration.getServerGroup().getHotbarHubClock();
|
||||
config.PlayerKickIdle = _serverConfiguration.getServerGroup().getPlayerKickIdle();
|
||||
config.GameVoting = _serverConfiguration.getServerGroup().getGameVoting();
|
||||
config.MapVoting = _serverConfiguration.getServerGroup().getMapVoting();
|
||||
|
||||
for (String gameName : _serverConfiguration.getServerGroup().getGames().split(","))
|
||||
{
|
||||
|
@ -15,8 +15,8 @@ public class GameServerConfig
|
||||
|
||||
public String Uptimes;
|
||||
|
||||
public ArrayList<GameType> GameList = new ArrayList<GameType>();
|
||||
public ArrayList<String> GameModeList = new ArrayList<String>();
|
||||
public ArrayList<GameType> GameList = new ArrayList<>();
|
||||
public ArrayList<String> GameModeList = new ArrayList<>();
|
||||
|
||||
public HashMap<String, HashMap<String, String>> GameModeMods = new HashMap<>();
|
||||
|
||||
@ -48,8 +48,8 @@ public class GameServerConfig
|
||||
|
||||
public boolean PlayerServerWhitelist = false;
|
||||
|
||||
public boolean GameVoting = true;
|
||||
public boolean MapVoting = true;
|
||||
public boolean GameVoting = false;
|
||||
public boolean MapVoting = false;
|
||||
|
||||
public boolean IsValid()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user