diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java index 0d6555bec..5e4c2bbec 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilServer.java @@ -19,8 +19,6 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; import org.bukkit.scheduler.BukkitRunnable; -import mineplex.core.vanish.events.PreVanishEvent; - public class UtilServer { public static Player[] getPlayers() @@ -118,6 +116,7 @@ public class UtilServer public static T callEvent(T event) { getPluginManager().callEvent(event); + return event; } public static void repeat(BukkitRunnable runnable, long time) diff --git a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java index dd7270e81..7308f637c 100644 --- a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java +++ b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/ClanRepository.java @@ -44,9 +44,9 @@ public class ClanRepository extends MinecraftRepository private static String CREATE_CLAN_TERRITORY_TABLE = "CREATE TABLE IF NOT EXISTS clanTerritory (id INT NOT NULL AUTO_INCREMENT, clanId INT, chunk VARCHAR(100), safe BIT(1), PRIMARY KEY (id), FOREIGN KEY (clanId) REFERENCES clans(id));"; private static String CREATE_CLAN_ALLIANCE_TABLE = "CREATE TABLE IF NOT EXISTS clanAlliances (id INT NOT NULL AUTO_INCREMENT, clanId INT, otherClanId INT, trusted BIT(1), PRIMARY KEY (id), FOREIGN KEY (otherClanId) REFERENCES clans(id), FOREIGN KEY (clanId) REFERENCES clans(id), INDEX clanIdIndex (clanId));"; - private static String RETRIEVE_CLAN_INFO = "SELECT c.id, c.name, c.description, c.home, c.admin, c.energy, c.kills, c.murder, c.deaths, c.warWins, c.warLosses, c.generator, c.generatorStock, c.dateCreated, c.lastOnline FROM clans AS c WHERE lower(c.name) = ?;"; + private static String RETRIEVE_CLAN_INFO = "SELECT c.id, c.name, c.description, c.home, c.admin, c.energy, c.kills, c.murder, c.deaths, c.warWins, c.warLosses, c.eloRating, c.generator, c.generatorStock, c.dateCreated, c.lastOnline FROM clans AS c WHERE lower(c.name) = ?;"; private static String RETRIEVE_PLAYER_CLAN_INFO = "SELECT clans.name, accountClan.clanRole, clanServer.serverName, clans.id FROM accountClan INNER JOIN clans ON clans.id = accountClan.clanId INNER JOIN clanServer ON clans.serverId = clanServer.id WHERE accountClan.accountId = ?;"; - private static String RETRIEVE_START_CLAN_INFO = "SELECT c.id, c.name, c.description, c.home, c.admin, c.energy, c.kills, c.murder, c.deaths, c.warWins, c.warLosses, c.generator, c.generatorStock, c.dateCreated, c.lastOnline, ct.chunk, ct.safe FROM clans AS c LEFT JOIN clanTerritory AS ct ON ct.clanId = c.id WHERE c.serverId = ? OR c.admin = 1;"; + private static String RETRIEVE_START_CLAN_INFO = "SELECT c.id, c.name, c.description, c.home, c.admin, c.energy, c.kills, c.murder, c.deaths, c.warWins, c.warLosses, c.eloRating, c.generator, c.generatorStock, c.dateCreated, c.lastOnline, ct.chunk, ct.safe FROM clans AS c LEFT JOIN clanTerritory AS ct ON ct.clanId = c.id WHERE c.serverId = ? OR c.admin = 1;"; private static String RETRIEVE_CLAN_MEMBER_INFO = "SELECT c.name, a.name, a.uuid, clanRole FROM accountClan AS ac INNER JOIN accounts AS a ON a.id = ac.accountId INNER JOIN clans AS c on c.id = ac.clanId WHERE c.serverId = ?;"; private static String RETRIEVE_CLAN_MEMBERS = "SELECT c.name, a.name, a.uuid, clanRole FROM accountClan AS ac INNER JOIN accounts AS a ON a.id = ac.accountId INNER JOIN clans AS c on c.id = ac.clanId WHERE lower(c.name) = ?;"; private static String RETRIEVE_CLAN_ALLIANCE_INFO = "SELECT c.name, cOther.name, ca.trusted FROM clanAlliances AS ca INNER JOIN clans AS c ON c.id = ca.clanId INNER JOIN clans as cOther ON cOther.id = ca.otherClanId WHERE c.serverId = ?;"; @@ -200,10 +200,11 @@ public class ClanRepository extends MinecraftRepository clan.Deaths = resultSet.getInt(9); clan.WarWins = resultSet.getInt(10); clan.WarLosses = resultSet.getInt(11); - clan.Generator = resultSet.getString(12); - clan.GeneratorStock = resultSet.getInt(13); - clan.DateCreated = resultSet.getTimestamp(14); - clan.LastOnline = resultSet.getTimestamp(15); + clan.EloRating = resultSet.getInt(12); + clan.Generator = resultSet.getString(13); + clan.GeneratorStock = resultSet.getInt(14); + clan.DateCreated = resultSet.getTimestamp(15); + clan.LastOnline = resultSet.getTimestamp(16); } } }, new ColumnVarChar("name", 100, clanName.toLowerCase())); @@ -290,15 +291,16 @@ public class ClanRepository extends MinecraftRepository token.Deaths = resultSet.getInt(9); token.WarWins = resultSet.getInt(10); token.WarLosses = resultSet.getInt(11); - token.Generator = resultSet.getString(12); - token.GeneratorStock = resultSet.getInt(13); - token.DateCreated = resultSet.getTimestamp(14); - token.LastOnline = resultSet.getTimestamp(15); + token.EloRating = resultSet.getInt(12); + token.Generator = resultSet.getString(13); + token.GeneratorStock = resultSet.getInt(14); + token.DateCreated = resultSet.getTimestamp(15); + token.LastOnline = resultSet.getTimestamp(16); ClanTerritoryToken territoryToken = new ClanTerritoryToken(); territoryToken.ClanName = token.Name; - territoryToken.Chunk = resultSet.getString(16); - territoryToken.Safe = resultSet.getBoolean(17); + territoryToken.Chunk = resultSet.getString(17); + territoryToken.Safe = resultSet.getBoolean(18); if (!clans.containsKey(token.Name)) { diff --git a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/tokens/ClanToken.java b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/tokens/ClanToken.java index 1d49a9d62..0df6165d1 100644 --- a/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/tokens/ClanToken.java +++ b/Plugins/Mineplex.Game.Clans.Core/src/mineplex/game/clans/core/repository/tokens/ClanToken.java @@ -17,6 +17,7 @@ public class ClanToken public int Deaths; public int WarWins; public int WarLosses; + public int EloRating; public String Generator; public int GeneratorStock; public Timestamp DateCreated; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java index 29151277b..a33523f0e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java @@ -48,6 +48,7 @@ public class ClanInfo private int _deaths; private int _warWins; private int _warLosses; + private int _eloRating; private boolean _admin = false; @@ -86,6 +87,7 @@ public class ClanInfo _id = token.Id; _name = token.Name; _desc = token.Description; + _eloRating = token.EloRating; try { @@ -594,6 +596,16 @@ public class ClanInfo { _warLosses += amount; } + + public int getEloRating() + { + return _eloRating; + } + + public void addEloRating(int amount) + { + _eloRating += amount; + } public ClanWarData getWarData(ClanInfo against) {