diff --git a/Plugins/BuildFiles/common.xml b/Plugins/BuildFiles/common.xml index bc70c93b2..397965bce 100644 --- a/Plugins/BuildFiles/common.xml +++ b/Plugins/BuildFiles/common.xml @@ -293,4 +293,19 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plugins/Core/src/me/chiss/Core/ClientData/ClientClass.java b/Plugins/Core/src/me/chiss/Core/ClientData/ClientClass.java deleted file mode 100644 index 883e44701..000000000 --- a/Plugins/Core/src/me/chiss/Core/ClientData/ClientClass.java +++ /dev/null @@ -1,483 +0,0 @@ -package me.chiss.Core.ClientData; - -import java.util.AbstractMap; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map.Entry; - - -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; - -import me.chiss.Core.Class.IPvpClass; -import me.chiss.Core.Skill.ISkill; -import me.chiss.Core.Skill.ISkill.SkillType; -import mineplex.core.account.CoreClient; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.itemstack.ItemStackFactory; -import mineplex.minecraft.game.core.classcombat.Class.IPvpClass.ClassType; -import mineplex.minecraft.game.core.classcombat.Class.repository.token.CustomBuildToken; - -public class ClientClass extends ClientDataBase implements IClientClass -{ - //Class and Skills - private IPvpClass _gameClass; - private HashMap> _skillMap; - - //Temp - private IPvpClass _lastClass; - private ItemStack[] _lastArmor; - private HashMap _lastItems; - private HashMap> _lastSkillMap; - - public ClientClass(CoreClient client) - { - super(client, "Class", null); - - _lastItems = new HashMap(); - _lastArmor = new ItemStack[4]; - _lastSkillMap = new HashMap>(); - } - - @Override - public void Load() - { - - } - - @Override - protected void LoadToken(Object token) - { - // TODO Auto-generated method stub - - } - - @Override - public String GetName() - { - return Client.GetPlayerName(); - } - - @Override - public void ResetToDefaults(boolean equipItems, boolean equipDefaultArmor) - { - if (equipDefaultArmor) - { - if (_lastArmor[3] != null) - GetInventory().setHelmet(_lastArmor[3].clone()); - - if (_lastArmor[2] != null) - GetInventory().setChestplate(_lastArmor[2].clone()); - - if (_lastArmor[1] != null) - GetInventory().setLeggings(_lastArmor[1].clone()); - - if (_lastArmor[0] != null) - GetInventory().setBoots(_lastArmor[0].clone()); - } - - if (equipItems) - { - for (Entry defaultItem : _lastItems.entrySet()) - { - GetInventory().setItem(defaultItem.getKey(), (defaultItem.getValue() == null ? new ItemStack(Material.AIR) : defaultItem.getValue().clone())); - } - } - - SetGameClass(_lastClass, false); - - NewSkills(); - for (Entry> entry : _lastSkillMap.entrySet()) - AddSkill(entry.getValue().getKey(), entry.getValue().getValue()); - } - - @Override - public void SetGameClass(IPvpClass gameClass) - { - SetGameClass(gameClass, true); - } - - @Override - public void SetGameClass(IPvpClass gameClass, boolean addDefaultSkills) - { - ClearSkills(); - - _gameClass = gameClass; - - if (_gameClass == null) - return; - - //Load Saved - if (Client.Manager.Classes().GetRestore().IsActive()) - { - Collection> skills = Client.Manager.Classes().GetRestore().GetBuild(Client.GetPlayerName(), gameClass); - - if (skills != null) - { - for (Entry skill : skills) - AddSkill(skill.getKey(), skill.getValue()); - - //Inform - UtilPlayer.message(Client.GetPlayer(), F.main("Class", "Armor Class: " + F.oo(_gameClass.GetName(), true))); - return; - } - } - - _lastClass = gameClass; - - for (ISkill cur : gameClass.GetDefaultSkills().keySet()) - { - if (addDefaultSkills || cur.GetSkillType() == SkillType.Class) - AddSkill(cur, gameClass.GetDefaultSkills().get(cur)); - } - - //Inform - UtilPlayer.message(Client.GetPlayer(), F.main("Class", "Armor Class: " + F.oo(_gameClass.GetName(), true))); - } - - @Override - public IPvpClass GetGameClass() - { - return _gameClass; - } - - @Override - public void ClearDefaults() - { - _lastItems.clear(); - _lastArmor = new ItemStack[4]; - _lastSkillMap.clear(); - } - - public String GetGameClassTag() - { - IPvpClass gameClass = GetGameClass(); - if (gameClass == null) return ""; - return gameClass.GetName().charAt(0)+"."; - } - - public void NewSkills() - { - ClearSkills(); - _skillMap = new HashMap>(); - } - - public void ClearSkills() - { - if (_skillMap != null) - for (Entry entry : _skillMap.values()) - entry.getKey().RemoveUser(Client.GetPlayer()); - - _skillMap = null; - } - - public void AddSkill(String skillName, int level) - { - ISkill skill = Client.Manager.Skills().GetSkill(skillName); - if (skill == null) - return; - - AddSkill(skill, level); - } - - @Override - public void AddSkill(ISkill skill, int level) - { - if (level <= 0) - return; - - if (_skillMap == null) - _skillMap = new HashMap>(); - - if (_skillMap.get(skill.GetSkillType()) != null) - _skillMap.get(skill.GetSkillType()).getKey().RemoveUser(Client.GetPlayer()); - - _skillMap.put(skill.GetSkillType(), new AbstractMap.SimpleEntry(skill, level)); - _lastSkillMap.put(skill.GetSkillType(), new AbstractMap.SimpleEntry(skill, level)); - - skill.AddUser(Client.GetPlayer(), level); - - //Save - if (Client.Manager.Classes().GetRestore().IsActive()) - Client.Manager.Classes().GetRestore().SaveBuild(Client.GetPlayerName(), _gameClass, GetSkills()); - } - - @Override - public void RemoveSkill(ISkill skill) - { - if (skill == null) - return; - - if (_skillMap == null) - return; - - _skillMap.remove(skill.GetSkillType()); - _lastSkillMap.remove(skill.GetSkillType()); - - skill.RemoveUser(Client.GetPlayer()); - } - - @Override - public Collection> GetSkills() - { - if (_skillMap == null) - _skillMap = new HashMap>(); - - return _skillMap.values(); - } - - @Override - public Collection> GetDefaultSkills() - { - return _lastSkillMap.values(); - } - - @Override - public void ResetSkills() - { - for (Entry entry : GetSkills()) - { - entry.getKey().Reset(Client.GetPlayer()); - } - } - - public void ClearDefaultSkills() - { - _lastSkillMap = new HashMap>(); - } - - public boolean IsGameClass(ClassType type) - { - if (GetGameClass() == null) - return false; - - return GetGameClass().GetType() == type; - } - - public ISkill GetSkillByType(SkillType skillType) - { - if (_skillMap == null) - _skillMap = new HashMap>(); - - if (_skillMap.containsKey(skillType)) - return _skillMap.get(skillType).getKey(); - - return null; - } - - public int GetSkillLevel(ISkill skill) - { - //No Class - if (_skillMap == null) - return 0; - - if (_skillMap.containsKey(skill.GetSkillType()) && _skillMap.get(skill.GetSkillType()).getKey() == skill) - return _skillMap.get(skill.GetSkillType()).getValue(); - - return 0; - } - - public void SetSkillLevel(ISkill skill, int level) - { - _skillMap.put(skill.GetSkillType(), new AbstractMap.SimpleEntry(skill, level)); - } - - @Override - public PlayerInventory GetInventory() - { - if (Client.GetPlayer() == null) - return null; - - return Client.GetPlayer().getInventory(); - } - - @Override - public void OpenInventory(Inventory skillsCategory) - { - if (Client.GetPlayer() == null) - return; - - Client.GetPlayer().openInventory(skillsCategory); - } - - @Override - public void CloseInventory() - { - if (Client.GetPlayer() == null) - return; - - Client.GetPlayer().closeInventory(); - } - - @SuppressWarnings("deprecation") - @Override - public void UpdateInventory() - { - if (Client.GetPlayer() == null) - return; - - Client.GetPlayer().updateInventory(); - } - - public void ListSkills(Player caller) - { - UtilPlayer.message(caller, F.main("Skill", "Listing Class Skills;")); - - for (SkillType type : SkillType.values()) - if (caller.isOp() || type != SkillType.Class) - if (_skillMap.containsKey(type)) - UtilPlayer.message(caller, F.desc(type.toString(), _skillMap.get(type).getKey().GetName() + " " + F.elem(_skillMap.get(type).getValue() + "/" + _skillMap.get(type).getKey().GetMaxLevel()))); - } - - @Override - public void AddDefaultArmor(ItemStack[] armorContents) - { - _lastArmor = armorContents; - } - - @Override - public void PutDefaultItem(ItemStack deliverable, int slot) - { - _lastItems.put(slot, deliverable); - } - - @Override - public ItemStack[] GetDefaultArmor() - { - if (_lastArmor[0] == null || _lastArmor[1] == null || _lastArmor[2] == null || _lastArmor[3] == null) - return new ItemStack[4]; - - ItemStack[] armorReturn = new ItemStack[4]; - - armorReturn[3] = _lastArmor[3].clone(); - armorReturn[2] = _lastArmor[2].clone(); - armorReturn[1] = _lastArmor[1].clone(); - armorReturn[0] = _lastArmor[0].clone(); - - return armorReturn; - } - - @Override - public HashMap GetDefaultItems() - { - return _lastItems; - } - - @Override - public void SetDefaultHead(ItemStack armor) - { - _lastArmor[3] = armor; - } - - @Override - public void SetDefaultChest(ItemStack armor) - { - _lastArmor[2] = armor; - } - - @Override - public void SetDefaultLegs(ItemStack armor) - { - _lastArmor[1] = armor; - } - - @Override - public void SetDefaultFeet(ItemStack armor) - { - _lastArmor[0] = armor; - } - - public void EquipCustomBuild(CustomBuildToken customBuild) - { - EquipCustomBuild(customBuild, true, true); - } - - public void EquipCustomBuild(CustomBuildToken customBuild, boolean equipItems, boolean equipDefaultArmor) - { - _lastClass = Client.Manager.Classes().GetClass(customBuild.PvpClassId); - - if (_lastClass == null) - return; - - _lastSkillMap.remove(SkillType.Class); - - if (equipDefaultArmor) - { - SetDefaultHead(ItemStackFactory.Instance.CreateStack(_lastClass.GetHead())); - SetDefaultChest(ItemStackFactory.Instance.CreateStack(_lastClass.GetChestplate())); - SetDefaultLegs(ItemStackFactory.Instance.CreateStack(_lastClass.GetLeggings())); - SetDefaultFeet(ItemStackFactory.Instance.CreateStack(_lastClass.GetBoots())); - } - - if (equipItems) - { - for (int i=0; i < 9; i++) - { - if (customBuild.Slots == null || customBuild.Slots.size() <= i || customBuild.Slots.get(i).Material == "AIR" || customBuild.Slots.get(i).Material == "NULL") - _lastItems.put(i, null); - else - { - /* - if (ItemFactory.Instance.GetItem(customBuild.Slots.get(i).Material) != null) - _lastItems.put(i, ItemFactory.Instance.GetItem(customBuild.Slots.get(i).Material).); - */ - _lastItems.put(i, ItemStackFactory.Instance.CreateStack(Material.getMaterial(customBuild.Slots.get(i).Material), customBuild.Slots.get(i).Amount)); - } - } - } - - if (customBuild.SwordSkillId != -1) - _lastSkillMap.put(SkillType.Sword, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.SwordSkillId)); - else - _lastSkillMap.remove(SkillType.Sword); - - if (customBuild.AxeSkillId != -1) - _lastSkillMap.put(SkillType.Axe, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.AxeSkillId)); - else - _lastSkillMap.remove(SkillType.Axe); - - if (customBuild.BowSkillId != -1) - _lastSkillMap.put(SkillType.Bow, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.BowSkillId)); - else - _lastSkillMap.remove(SkillType.Bow); - - if (customBuild.ClassPassiveASkillId != -1) - _lastSkillMap.put(SkillType.PassiveA, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.ClassPassiveASkillId)); - else - _lastSkillMap.remove(SkillType.PassiveA); - - if (customBuild.ClassPassiveBSkillId != -1) - _lastSkillMap.put(SkillType.PassiveB, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.ClassPassiveBSkillId)); - else - _lastSkillMap.remove(SkillType.PassiveB); - - if (customBuild.GlobalPassiveASkillId != -1) - _lastSkillMap.put(SkillType.PassiveC, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.GlobalPassiveASkillId)); - else - _lastSkillMap.remove(SkillType.PassiveC); - - if (customBuild.GlobalPassiveBSkillId != -1) - _lastSkillMap.put(SkillType.PassiveD, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.GlobalPassiveBSkillId)); - else - _lastSkillMap.remove(SkillType.PassiveD); - - if (customBuild.GlobalPassiveCSkillId != -1) - _lastSkillMap.put(SkillType.PassiveE, Client.Manager.Skills().GetSkillBySalesPackageId(customBuild.GlobalPassiveCSkillId)); - else - _lastSkillMap.remove(SkillType.PassiveE); - - ResetToDefaults(equipItems, equipDefaultArmor); - - Client.Donor().SetTokens(customBuild.SkillTokensBalance, customBuild.ItemTokensBalance); - - ListSkills(Client.GetPlayer()); - Client.GetPlayer().getWorld().playSound(Client.GetPlayer().getLocation(), Sound.LEVEL_UP, 1f, 1f); - - Client.GetPlayer().sendMessage(F.main("Class", "You equipped " + F.skill(customBuild.Name) + ".")); - } -} diff --git a/Plugins/Libraries/mysql.zip b/Plugins/Libraries/mysql.zip new file mode 100644 index 000000000..13f3b4c2a Binary files /dev/null and b/Plugins/Libraries/mysql.zip differ diff --git a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java index f4d6dd31c..19bf74191 100644 --- a/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java +++ b/Plugins/Mineplex.Bungee.Mineplexer/src/mineplex/bungee/lobbyBalancer/LobbyBalancer.java @@ -43,7 +43,6 @@ public class LobbyBalancer implements Listener, Runnable synchronized (_serverLock) { - long timeStart = System.currentTimeMillis(); if (_playersSentToBestServer >= _maxPlayersToSendToBestServer) { _playersSentToBestServer = 0; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusRepository.java index 0d4ebe245..1d99114ce 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/status/ServerStatusRepository.java @@ -15,9 +15,10 @@ public class ServerStatusRepository private String _userName; private String _password; - private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS ServerStatus (id INT NOT NULL AUTO_INCREMENT, serverName VARCHAR(256), serverGroup VARCHAR(256), address VARCHAR(256), updated LONG, motd VARCHAR(256), players INT, maxPlayers INT, tps INT, ram INT, maxRam INT, PRIMARY KEY (id));"; - private static String INSERT_PLAYER_COUNT = "INSERT INTO ServerStatus values(default, ?, ?, ?, now(), 'Configuring server.', ?, ?, 0, ?, ?);"; - private static String UPDATE_PLAYER_COUNT = "UPDATE ServerStatus SET updated = now(), serverName = ?, serverGroup = ?, motd = ?, players = ?, maxPlayers = ?, tps = ?, ram = ?, maxRam = ? WHERE id = ?;"; + private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS ServerStatus (id INT NOT NULL AUTO_INCREMENT, serverName VARCHAR(256), serverGroup VARCHAR(256), address VARCHAR(256), updated LONG, lastTimeWithPlayers LONG, motd VARCHAR(256), players INT, maxPlayers INT, tps INT, ram INT, maxRam INT, PRIMARY KEY (id));"; + private static String INSERT_PLAYER_COUNT = "INSERT INTO ServerStatus (serverName, serverGroup, address, updated, motd, players, maxPlayers, tps, ram, maxRam) values(default, ?, ?, ?, now(), 'Configuring server.', ?, ?, 0, ?, ?);"; + private static String UPDATE_PLAYER_COUNT_WITH_PLAYERS = "UPDATE ServerStatus SET updated = now(), serverName = ?, serverGroup = ?, motd = ?, players = ?, maxPlayers = ?, tps = ?, ram = ?, maxRam = ?, lastTimeWithPlayers = now() WHERE id = ?;"; + private static String UPDATE_PLAYER_COUNT_WITHOUT_PLAYERS = "UPDATE ServerStatus SET updated = now(), serverName = ?, serverGroup = ?, motd = ?, players = ?, maxPlayers = ?, tps = ?, ram = ?, maxRam = ? WHERE id = ?;"; private static String RETRIEVE_ID = "SELECT id FROM ServerStatus WHERE address = ?;"; private static String RETRIEVE_SERVER_STATUSES = "SELECT serverName, motd, players, maxPlayers FROM ServerStatus WHERE TIME_TO_SEC(TIMEDIFF(now(), ServerStatus.updated)) < 10;"; @@ -173,7 +174,7 @@ public class ServerStatusRepository { connection = DriverManager.getConnection(_connectionString, _userName, _password); - preparedStatement = connection.prepareStatement(UPDATE_PLAYER_COUNT, Statement.RETURN_GENERATED_KEYS); + preparedStatement = connection.prepareStatement(players != 0 ? UPDATE_PLAYER_COUNT_WITH_PLAYERS : UPDATE_PLAYER_COUNT_WITHOUT_PLAYERS, Statement.RETURN_GENERATED_KEYS); preparedStatement.setString(1, _serverName); preparedStatement.setString(2, _serverGroup); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/LobbyMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/LobbyMenu.java index b954d90b8..9548f2c2e 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/LobbyMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/LobbyMenu.java @@ -55,7 +55,7 @@ public class LobbyMenu extends ShopPageBase implements Material status = Material.IRON_BLOCK; List lore = new ArrayList(); - if (slot >= 27) + if (slot >= 36) break; if (serverInfo.Name.equalsIgnoreCase(Plugin.getStatusManager().getCurrentServerName())) @@ -83,7 +83,7 @@ public class LobbyMenu extends ShopPageBase implements slot += 1; } - while (slot < 27) + while (slot < 36) { setItem(slot, null); slot++; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java index 977bc2ce7..ead4e5594 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerGameMenu.java @@ -102,7 +102,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "One in the Quiver", ChatColor.RESET + "Dragon Escape", ChatColor.RESET + "Milk the Cow", - ChatColor.RESET + "A Barbarian's Life", + ChatColor.RESET + "Super Paintball", ChatColor.RESET + "Turf Forts", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", @@ -120,7 +120,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "One in the Quiver", ChatColor.RESET + "Dragon Escape", ChatColor.RESET + "Milk the Cow", - ChatColor.RESET + "A Barbarian's Life", + ChatColor.RESET + "Super Paintball", ChatColor.RESET + "Turf Forts", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", @@ -138,7 +138,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "One in the Quiver", ChatColor.RESET + "Dragon Escape", ChatColor.RESET + "Milk the Cow", - ChatColor.RESET + "A Barbarian's Life", + ChatColor.RESET + "Super Paintball", ChatColor.RESET + "Turf Forts", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", @@ -156,7 +156,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + C.Bold + ChatColor.GREEN + "One in the Quiver", ChatColor.RESET + "Dragon Escape", ChatColor.RESET + "Milk the Cow", - ChatColor.RESET + "A Barbarian's Life", + ChatColor.RESET + "Super Paintball", ChatColor.RESET + "Turf Forts", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", @@ -174,7 +174,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "One in the Quiver", ChatColor.RESET + C.Bold + ChatColor.GREEN + "Dragon Escape", ChatColor.RESET + "Milk the Cow", - ChatColor.RESET + "A Barbarian's Life", + ChatColor.RESET + "Super Paintball", ChatColor.RESET + "Turf Forts", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", @@ -192,14 +192,14 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "One in the Quiver", ChatColor.RESET + "Dragon Escape", ChatColor.RESET + C.Bold + ChatColor.GREEN + "Milk the Cow", - ChatColor.RESET + "A Barbarian's Life", + ChatColor.RESET + "Super Paintball", ChatColor.RESET + "Turf Forts", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", ChatColor.RESET + "Squid Sauce" })); - _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] + _minigameCycle.add(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BARDING.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Arcade " + C.cGray + "Mixed Games", new String [] { ChatColor.RESET + "", ChatColor.RESET + "Play all of these fun minigames:", @@ -210,7 +210,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "One in the Quiver", ChatColor.RESET + "Dragon Escape", ChatColor.RESET + "Milk the Cow", - ChatColor.RESET + C.Bold + ChatColor.GREEN + "A Barbarian's Life", + ChatColor.RESET + C.Bold + ChatColor.GREEN + "Super Paintball", ChatColor.RESET + "Turf Forts", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", @@ -228,7 +228,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "One in the Quiver", ChatColor.RESET + "Dragon Escape", ChatColor.RESET + "Milk the Cow", - ChatColor.RESET + "A Barbarian's Life", + ChatColor.RESET + "Super Paintball", ChatColor.RESET + C.Bold + ChatColor.GREEN + "Turf Forts", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", @@ -246,7 +246,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "One in the Quiver", ChatColor.RESET + "Dragon Escape", ChatColor.RESET + "Milk the Cow", - ChatColor.RESET + "A Barbarian's Life", + ChatColor.RESET + "Super Paintball", ChatColor.RESET + "Turf Forts", ChatColor.RESET + C.Bold + ChatColor.GREEN + "Death Tag", ChatColor.RESET + "Bacon Brawl", @@ -264,7 +264,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "One in the Quiver", ChatColor.RESET + "Dragon Escape", ChatColor.RESET + "Milk the Cow", - ChatColor.RESET + "A Barbarian's Life", + ChatColor.RESET + "Super Paintball", ChatColor.RESET + "Turf Forts", ChatColor.RESET + "Death Tag", ChatColor.RESET + C.Bold + ChatColor.GREEN + "Bacon Brawl", @@ -282,7 +282,7 @@ public class ServerGameMenu extends ShopPageBase ChatColor.RESET + "One in the Quiver", ChatColor.RESET + "Dragon Escape", ChatColor.RESET + "Milk the Cow", - ChatColor.RESET + "A Barbarian's Life", + ChatColor.RESET + "Super Paintball", ChatColor.RESET + "Turf Forts", ChatColor.RESET + "Death Tag", ChatColor.RESET + "Bacon Brawl", diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java index 5ffd7b653..c1029e5f9 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java @@ -11,6 +11,7 @@ import mineplex.core.shop.page.ShopPageBase; import mineplex.core.common.CurrencyType; import mineplex.core.common.util.NautHashMap; import mineplex.minecraft.game.classcombat.Class.ClientClass; +import mineplex.minecraft.game.classcombat.shop.page.ArmorPage; import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage; public class ClassCombatShop extends ShopBase @@ -29,13 +30,13 @@ public class ClassCombatShop extends ShopBase @Override protected ShopPageBase BuildPagesFor(Player player) { - return new CustomBuildPage(Plugin, this, ClientManager, DonationManager, player); + return new ArmorPage(Plugin, this, ClientManager, DonationManager, player, Purchasing); } @Override protected ShopPageBase> GetOpeningPageForPlayer(Player player) { - return new CustomBuildPage(Plugin, this, ClientManager, DonationManager, player); + return new ArmorPage(Plugin, this, ClientManager, DonationManager, player, Purchasing); } @Override diff --git a/Plugins/Mineplex.ServerMonitor/.classpath b/Plugins/Mineplex.ServerMonitor/.classpath index fb5011632..8325d3454 100644 --- a/Plugins/Mineplex.ServerMonitor/.classpath +++ b/Plugins/Mineplex.ServerMonitor/.classpath @@ -1,6 +1,6 @@ - + diff --git a/Plugins/Mineplex.ServerMonitor/.externalToolBuilders/New_Builder.launch b/Plugins/Mineplex.ServerMonitor/.externalToolBuilders/New_Builder.launch new file mode 100644 index 000000000..0c6e0f696 --- /dev/null +++ b/Plugins/Mineplex.ServerMonitor/.externalToolBuilders/New_Builder.launch @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicMonitor.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicMonitor.java deleted file mode 100644 index 1b7ad77da..000000000 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicMonitor.java +++ /dev/null @@ -1,6 +0,0 @@ -package mineplex.servermonitor; - -public class DynamicMonitor -{ - -} diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicServerData.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicServerData.java new file mode 100644 index 000000000..56b25f9cd --- /dev/null +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicServerData.java @@ -0,0 +1,26 @@ +package mineplex.servermonitor; + +import java.util.HashMap; + +public class DynamicServerData +{ + public String Name; + public String Address; + public int AvailableCPU = 32; + public int AvailableRAM = 26624; + + public HashMap ServerGroupCount = new HashMap(); + + public void setServerGroupCount(ServerGroupData groupData, int count) + { + if (ServerGroupCount.containsKey(groupData.Name)) + { + AvailableCPU += groupData.RequiredCPU * ServerGroupCount.get(groupData.Name); + AvailableRAM += groupData.RequiredRAM * ServerGroupCount.get(groupData.Name); + } + + ServerGroupCount.put(groupData.Name, count); + AvailableCPU -= groupData.RequiredCPU * count; + AvailableRAM -= groupData.RequiredRAM * count; + } +} diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicServerSorter.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicServerSorter.java new file mode 100644 index 000000000..d2fc1a589 --- /dev/null +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/DynamicServerSorter.java @@ -0,0 +1,30 @@ +package mineplex.servermonitor; + +import java.util.Comparator; + +public class DynamicServerSorter implements Comparator +{ + @Override + public int compare(DynamicServerData first, DynamicServerData second) + { + if (second.AvailableRAM <= 1024) + return -1; + + if (first.AvailableRAM <= 1024) + return 1; + + if (first.AvailableRAM > second.AvailableRAM) + return -1; + + if (second.AvailableRAM > first.AvailableRAM) + return 1; + + if (first.AvailableCPU > second.AvailableCPU) + return -1; + + if (second.AvailableCPU < first.AvailableCPU) + return 1; + + return 1; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/GroupStatusData.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/GroupStatusData.java index c8f4de139..471666d49 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/GroupStatusData.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/GroupStatusData.java @@ -5,9 +5,54 @@ import java.util.List; public class GroupStatusData { - public String Name; + private int _totalCount = 0; + private int _joinableCount = 0; + public int Players; public int MaxPlayers; + public List EmptyServers = new ArrayList(); public List Servers = new ArrayList(); + + public void addServer(ServerStatusData serverStatusData) + { + Players += serverStatusData.Players; + MaxPlayers += serverStatusData.MaxPlayers; + + if (serverStatusData.Motd.contains("Starting") || serverStatusData.Motd.contains("Recruiting") || serverStatusData.Motd.contains("Waiting") || serverStatusData.Motd.contains("Cup") || serverStatusData.Motd.isEmpty() || serverStatusData.Motd.equals("")) + { + if (serverStatusData.Players < serverStatusData.MaxPlayers) + { + // Lobby joinable checking + if (serverStatusData.Motd.isEmpty() || serverStatusData.Motd.equals("")) + { + if (serverStatusData.Players / serverStatusData.MaxPlayers < .9) + _joinableCount++; + } + else + { + _joinableCount++; + } + } + } + + _totalCount++; + + if (serverStatusData.Empty) + { + EmptyServers.add(serverStatusData); + } + + Servers.add(serverStatusData); + } + + public int getTotalServers() + { + return _totalCount; + } + + public int getJoinableCount() + { + return _joinableCount; + } } diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/Repository.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/Repository.java index 7debf6a20..2ca8fb5c4 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/Repository.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/Repository.java @@ -5,7 +5,10 @@ import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; import java.util.List; public class Repository @@ -14,9 +17,14 @@ public class Repository private String _userName = "root"; private String _password = "y2D4atu3Pene2asw"; - private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS ServerStatus (id INT NOT NULL AUTO_INCREMENT, serverName VARCHAR(256), serverGroup VARCHAR(256), address VARCHAR(256), updated LONG, motd VARCHAR(256), players INT, maxPlayers INT, tps INT, ram INT, maxRam INT, PRIMARY KEY (id));"; + private static String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS ServerStatus (id INT NOT NULL AUTO_INCREMENT, serverName VARCHAR(256), serverGroup VARCHAR(256), address VARCHAR(256), updated LONG, lastTimeWithPlayers LONG, motd VARCHAR(256), players INT, maxPlayers INT, tps INT, ram INT, maxRam INT, PRIMARY KEY (id));"; private static String RETRIEVE_OLD_SERVER_STATUSES = "SELECT serverName, address, motd, players, maxPlayers FROM ServerStatus WHERE TIME_TO_SEC(TIMEDIFF(now(), ServerStatus.updated)) > 10;"; - private static String RETRIEVE_SERVER_STATUSES = "SELECT serverName, address, motd, players, maxPlayers FROM ServerStatus WHERE TIME_TO_SEC(TIMEDIFF(now(), ServerStatus.updated)) <= 10;"; + + private static String CREATE_DYNAMIC_TABLE = "CREATE TABLE IF NOT EXISTS DynamicServers (id INT NOT NULL AUTO_INCREMENT, serverName VARCHAR(256), address VARCHAR(256), US BOOLEAN NOT NULL DEFAULT 'true', PRIMARY KEY (id));"; + private static String RETRIEVE_AVAILABLE_SERVERS = "SELECT DynamicServers.serverName, DynamicServers.address, ServerStatus.serverGroup, COUNT(*) As serverCount FROM DynamicServers LEFT JOIN ServerStatus ON ServerStatus.address LIKE CONCAT(DynamicServers.address, '%') WHERE DynamicServers.US = 'false' GROUP BY DynamicServers.address, ServerStatus.serverGroup;"; + private static String RETRIEVE_SERVERGROUP_STATUSES = "SELECT ServerStatus.serverName, serverGroup, ServerStatus.address, players, maxPlayers, case when TIME_TO_SEC(TIMEDIFF(now(), ServerStatus.lastTimeWithPlayers)) > 300 then 1 else 0 end as empty FROM ServerStatus INNER JOIN DynamicServers ON ServerStatus.address LIKE CONCAT(DynamicServers.address, '%') WHERE DynamicServers.US = 'false' AND TIME_TO_SEC(TIMEDIFF(now(), ServerStatus.updated)) <= 10"; + private static String RETRIEVE_SERVER_GROUP_DATA = "SELECT groupName, prefix, scriptName, requiredRam, cpuRequired, requiredTotal, requiredJoinable FROM ServerGroups;"; + public void initialize() { @@ -63,6 +71,50 @@ public class Repository } } } + + connection = null; + preparedStatement = null; + + try + { + Class.forName("com.mysql.jdbc.Driver"); + + connection = DriverManager.getConnection(_connectionString, _userName, _password); + + // Create table + preparedStatement = connection.prepareStatement(CREATE_DYNAMIC_TABLE); + preparedStatement.execute(); + } + catch (Exception exception) + { + exception.printStackTrace(); + } + finally + { + if (preparedStatement != null) + { + try + { + preparedStatement.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + } + + if (connection != null) + { + try + { + connection.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + } + } } public List retrieveOldServerStatuses() @@ -141,18 +193,18 @@ public class Repository return serverData; } - public List retrieveGroupStatusData() + public HashMap retrieveGroupStatusData() { Connection connection = null; ResultSet resultSet = null; PreparedStatement preparedStatement = null; - List groupData = new ArrayList(); - + HashMap groupData = new HashMap(); + try { connection = DriverManager.getConnection(_connectionString, _userName, _password); - preparedStatement = connection.prepareStatement(RETRIEVE_SERVER_STATUSES); + preparedStatement = connection.prepareStatement(RETRIEVE_SERVERGROUP_STATUSES); resultSet = preparedStatement.executeQuery(); while (resultSet.next()) @@ -160,15 +212,20 @@ public class Repository ServerStatusData serverStatusData = new ServerStatusData(); serverStatusData.Name = resultSet.getString(1); - - String addressPortString = resultSet.getString(2); + String serverGroup = resultSet.getString(2); + String addressPortString = resultSet.getString(3); serverStatusData.Address = addressPortString.split(":")[0]; serverStatusData.Port = Integer.parseInt(addressPortString.split(":")[1]); - serverStatusData.Motd = resultSet.getString(3); serverStatusData.Players = resultSet.getInt(4); serverStatusData.MaxPlayers = resultSet.getInt(5); + serverStatusData.Empty = resultSet.getBoolean(7); - serverData.add(serverStatusData); + if (!groupData.containsKey(serverGroup)) + { + groupData.put(serverGroup, new GroupStatusData()); + } + + groupData.get(serverGroup).addServer(serverStatusData); } } catch (Exception exception) @@ -214,6 +271,177 @@ public class Repository } } - return serverData; + return groupData; + } + + public Collection retrieveDynamicServers() + { + Connection connection = null; + ResultSet resultSet = null; + PreparedStatement preparedStatement = null; + HashMap serverMap = new HashMap(); + HashMap serverGroupMap = new HashMap(); + + try + { + connection = DriverManager.getConnection(_connectionString, _userName, _password); + + preparedStatement = connection.prepareStatement(RETRIEVE_SERVER_GROUP_DATA); + resultSet = preparedStatement.executeQuery(); + + while (resultSet.next()) + { + ServerGroupData serverGroupData = new ServerGroupData(); + + serverGroupData.Name = resultSet.getString(1); + serverGroupData.Prefix = resultSet.getString(2); + serverGroupData.ScriptName = resultSet.getString(3); + serverGroupData.RequiredRAM = resultSet.getInt(4); + serverGroupData.RequiredCPU = resultSet.getInt(5); + serverGroupData.RequiredTotalServers = resultSet.getInt(6); + serverGroupData.RequiredJoinableServers = resultSet.getInt(7); + + if (!serverGroupMap.containsKey(serverGroupData.Name)) + serverGroupMap.put(serverGroupData.Name, serverGroupData); + } + + preparedStatement = connection.prepareStatement(RETRIEVE_AVAILABLE_SERVERS); + resultSet = preparedStatement.executeQuery(); + + while (resultSet.next()) + { + DynamicServerData dynamicServer = new DynamicServerData(); + + dynamicServer.Name = resultSet.getString(1); + dynamicServer.Address = resultSet.getString(2); + + if (!serverMap.containsKey(dynamicServer.Name)) + serverMap.put(dynamicServer.Name, dynamicServer); + + String serverGroupName = resultSet.getString(3); + if (serverGroupMap.containsKey(serverGroupName)) + serverMap.get(dynamicServer.Name).setServerGroupCount(serverGroupMap.get(serverGroupName), resultSet.getInt(4)); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + finally + { + if (preparedStatement != null) + { + try + { + preparedStatement.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + } + + if (resultSet != null) + { + try + { + resultSet.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + } + + if (connection != null) + { + try + { + connection.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + } + } + + return serverMap.values(); + } + + public Collection retrieveServerGroups() + { + Connection connection = null; + ResultSet resultSet = null; + PreparedStatement preparedStatement = null; + HashMap serverGroupMap = new HashMap(); + + try + { + connection = DriverManager.getConnection(_connectionString, _userName, _password); + + preparedStatement = connection.prepareStatement(RETRIEVE_SERVER_GROUP_DATA); + resultSet = preparedStatement.executeQuery(); + + while (resultSet.next()) + { + ServerGroupData serverGroupData = new ServerGroupData(); + + serverGroupData.Name = resultSet.getString(1); + serverGroupData.Prefix = resultSet.getString(2); + serverGroupData.ScriptName = resultSet.getString(3); + serverGroupData.RequiredRAM = resultSet.getInt(4); + serverGroupData.RequiredCPU = resultSet.getInt(5); + serverGroupData.RequiredTotalServers = resultSet.getInt(6); + serverGroupData.RequiredJoinableServers = resultSet.getInt(7); + + if (!serverGroupMap.containsKey(serverGroupData.Name)) + serverGroupMap.put(serverGroupData.Name, serverGroupData); + } + } + catch (Exception exception) + { + exception.printStackTrace(); + } + finally + { + if (preparedStatement != null) + { + try + { + preparedStatement.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + } + + if (resultSet != null) + { + try + { + resultSet.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + } + + if (connection != null) + { + try + { + connection.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + } + } + + return serverGroupMap.values(); } } diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerGroupData.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerGroupData.java new file mode 100644 index 000000000..e2da2c156 --- /dev/null +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerGroupData.java @@ -0,0 +1,12 @@ +package mineplex.servermonitor; + +public class ServerGroupData +{ + public String Name; + public String Prefix; + public String ScriptName; + public int RequiredRAM; + public int RequiredCPU; + public int RequiredTotalServers; + public int RequiredJoinableServers; +} diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java index e2149ce95..14c212936 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerMonitor.java @@ -2,6 +2,13 @@ package mineplex.servermonitor; import java.io.BufferedReader; import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + public class ServerMonitor { @@ -14,6 +21,7 @@ public class ServerMonitor while (true) { + /* if (_count % 20 == 0) { for (ServerStatusData statusData : _repository.retrieveOldServerStatuses()) @@ -51,43 +59,111 @@ public class ServerMonitor System.out.println("Sent restart command to " + key + ""); } } - + */ if (_count % 10 == 0) { - HashMap - for (ServerStatusData statusData : _repository.retrieveGroupStatusData()) + List dynamicServers = new ArrayList(_repository.retrieveDynamicServers()); + Collection serverGroups = _repository.retrieveServerGroups(); + HashMap groupStatusList = _repository.retrieveGroupStatusData(); + + for (ServerGroupData serverGroup : serverGroups) { - String key = statusData.Address + " " + statusData.Name; + System.out.println("Checking Server Group " + serverGroup.Name); - String cmd = "/home/mineplex/restartServer.sh"; - Process process = null; + if (!groupStatusList.containsKey(serverGroup.Name)) + { + groupStatusList.put(serverGroup.Name, new GroupStatusData()); + } + + GroupStatusData groupStatus = groupStatusList.get(serverGroup.Name); - try - { - process = new ProcessBuilder(new String[] {"/bin/sh", "-x", cmd, statusData.Address, statusData.Name}).start(); - process.waitFor(); - BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream())); - String line = reader.readLine(); - - while(line != null) - { - System.out.println(line); - line=reader.readLine(); - } - } - catch (Exception e) - { - e.printStackTrace(); - } - finally - { - if (process != null) - { - process.destroy(); - } - } - - System.out.println("Sent restart command to " + key + ""); + int serversToAdd = Math.max(serverGroup.RequiredTotalServers - groupStatus.getTotalServers(), serverGroup.RequiredJoinableServers - groupStatus.getJoinableCount()); + int serversToKill = groupStatus.EmptyServers.size() - serverGroup.RequiredJoinableServers; + + if (serversToAdd > 0) + { + while (serversToAdd > 0) + { + Collections.sort(dynamicServers, new DynamicServerSorter()); + DynamicServerData bestServer = getBestDynamicServer(dynamicServers, serverGroup); + + if (bestServer == null) + { + System.out.println("No best dynamic server available for group " + serverGroup.Name); + break; + } + + String cmd = "/home/mineplex/easyRemoteStartServer.sh"; + Process process = null; + + try + { + process = new ProcessBuilder(new String[] {"/bin/sh", "-x", cmd, bestServer.Address, serverGroup.Prefix + "-" + (groupStatus.getTotalServers() + 1)}).start(); + process.waitFor(); + BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream())); + String line = reader.readLine(); + + while(line != null) + { + System.out.println(line); + line=reader.readLine(); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + finally + { + if (process != null) + { + process.destroy(); + } + } + + bestServer.setServerGroupCount(serverGroup, bestServer.ServerGroupCount.containsKey(serverGroup.Name) ? (bestServer.ServerGroupCount.get(serverGroup.Name) + 1) : 1); + System.out.println("Sent start command to " + bestServer.Address + " for " + serverGroup.Prefix + "-" + (groupStatus.getTotalServers() + 1)); + serversToAdd--; + } + } + else if (serversToKill > 0) + { + while (serversToKill > 0) + { + String cmd = "/home/mineplex/easyRemoteKillServer.sh"; + Process process = null; + + ServerStatusData serverToKill = groupStatus.EmptyServers.get(0); + + try + { + process = new ProcessBuilder(new String[] {"/bin/sh", "-x", cmd, serverToKill.Address, serverToKill.Name}).start(); + process.waitFor(); + BufferedReader reader=new BufferedReader(new InputStreamReader(process.getInputStream())); + String line = reader.readLine(); + + while(line != null) + { + System.out.println(line); + line=reader.readLine(); + } + } + catch (Exception e) + { + e.printStackTrace(); + } + finally + { + if (process != null) + { + process.destroy(); + } + } + + System.out.println("Sent start command to " + serverToKill.Address + " for " + serverToKill.Name); + serversToKill--; + } + } } } @@ -104,4 +180,32 @@ public class ServerMonitor _count %= 20; } } + + private static DynamicServerData getBestDynamicServer(Collection dynamicServers, ServerGroupData serverGroup) + { + DynamicServerData bestServer = null; + + for (DynamicServerData serverData : dynamicServers) + { + System.out.println("Checking Dynamic Server " + serverData.Name); + + if (serverData.AvailableRAM > serverGroup.RequiredRAM && serverData.AvailableCPU > serverGroup.RequiredCPU) + { + if (bestServer == null) + { + bestServer = serverData; + + if (!serverData.ServerGroupCount.containsKey(serverGroup.Name)) + break; + } + else if (serverData.ServerGroupCount.containsKey(serverGroup.Name)) + { + if (serverData.ServerGroupCount.get(serverGroup.Name) < bestServer.ServerGroupCount.get(serverGroup.Name)) + bestServer = serverData; + } + } + } + + return bestServer; + } } diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerStatusData.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerStatusData.java index 425525f6a..092498d42 100644 --- a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerStatusData.java +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerStatusData.java @@ -8,4 +8,5 @@ public class ServerStatusData public int MaxPlayers; public String Address; public int Port; + public boolean Empty = false; } diff --git a/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerTargetData.java b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerTargetData.java new file mode 100644 index 000000000..df81111a7 --- /dev/null +++ b/Plugins/Mineplex.ServerMonitor/src/mineplex/servermonitor/ServerTargetData.java @@ -0,0 +1,8 @@ +package mineplex.servermonitor; + +public class ServerTargetData +{ + public DynamicServerData DedicatedServer; + public int ServerNumber; + public String ServerGroup; +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index e7b8c4f1b..d9f9bc8fb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -479,7 +479,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation public ArrayList LoadFiles(String gameName) { - File folder = new File("../../update/maps" + File.separatorChar + gameName); + File folder = new File(".." + File.separatorChar + ".." + File.separatorChar + "update" + File.separatorChar + "maps" + File.separatorChar + gameName); if (!folder.exists()) folder.mkdirs(); ArrayList maps = new ArrayList(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index b7bdf6a5d..1c8a09586 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -63,9 +63,9 @@ public class Paintball extends TeamGame new Kit[] { - new KitRifle(manager), - new KitMachineGun(manager), + new KitRifle(manager), new KitShotgun(manager), + new KitMachineGun(manager), }, new String[] @@ -202,11 +202,6 @@ public class Paintball extends TeamGame if (damagerTeam.equals(damageeTeam)) return; - - //Color - Color color = Color.RED; - if (event.GetProjectile() instanceof Snowball) - color = Color.AQUA; //Count int count = 1; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java index 02c3d1597..62b5d3fb9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java @@ -19,7 +19,7 @@ public class KitMachineGun extends Kit { public KitMachineGun(ArcadeManager manager) { - super(manager, "Machine Gun", KitAvailability.Free, + super(manager, "Machine Gun", KitAvailability.Blue, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java index 2a8fa2660..c7a9cf6e2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitShotgun.java @@ -1,6 +1,5 @@ package nautilus.game.arcade.game.games.paintball.kits; -import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.entity.EntityType; @@ -20,7 +19,7 @@ public class KitShotgun extends Kit { public KitShotgun(ArcadeManager manager) { - super(manager, "Shotgun", KitAvailability.Free, + super(manager, "Shotgun", KitAvailability.Green, new String[] { diff --git a/putty.reg b/putty.reg new file mode 100644 index 000000000..9d398f3e3 Binary files /dev/null and b/putty.reg differ