Made changes to accommodate for Clan ELO's
This commit is contained in:
parent
97f5b60404
commit
b8f06374cd
@ -19,8 +19,6 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import mineplex.core.vanish.events.PreVanishEvent;
|
|
||||||
|
|
||||||
public class UtilServer
|
public class UtilServer
|
||||||
{
|
{
|
||||||
public static Player[] getPlayers()
|
public static Player[] getPlayers()
|
||||||
@ -118,6 +116,7 @@ public class UtilServer
|
|||||||
public static <T extends Event> T callEvent(T event)
|
public static <T extends Event> T callEvent(T event)
|
||||||
{
|
{
|
||||||
getPluginManager().callEvent(event);
|
getPluginManager().callEvent(event);
|
||||||
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void repeat(BukkitRunnable runnable, long time)
|
public static void repeat(BukkitRunnable runnable, long time)
|
||||||
|
@ -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_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 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_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_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_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 = ?;";
|
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.Deaths = resultSet.getInt(9);
|
||||||
clan.WarWins = resultSet.getInt(10);
|
clan.WarWins = resultSet.getInt(10);
|
||||||
clan.WarLosses = resultSet.getInt(11);
|
clan.WarLosses = resultSet.getInt(11);
|
||||||
clan.Generator = resultSet.getString(12);
|
clan.EloRating = resultSet.getInt(12);
|
||||||
clan.GeneratorStock = resultSet.getInt(13);
|
clan.Generator = resultSet.getString(13);
|
||||||
clan.DateCreated = resultSet.getTimestamp(14);
|
clan.GeneratorStock = resultSet.getInt(14);
|
||||||
clan.LastOnline = resultSet.getTimestamp(15);
|
clan.DateCreated = resultSet.getTimestamp(15);
|
||||||
|
clan.LastOnline = resultSet.getTimestamp(16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, new ColumnVarChar("name", 100, clanName.toLowerCase()));
|
}, new ColumnVarChar("name", 100, clanName.toLowerCase()));
|
||||||
@ -290,15 +291,16 @@ public class ClanRepository extends MinecraftRepository
|
|||||||
token.Deaths = resultSet.getInt(9);
|
token.Deaths = resultSet.getInt(9);
|
||||||
token.WarWins = resultSet.getInt(10);
|
token.WarWins = resultSet.getInt(10);
|
||||||
token.WarLosses = resultSet.getInt(11);
|
token.WarLosses = resultSet.getInt(11);
|
||||||
token.Generator = resultSet.getString(12);
|
token.EloRating = resultSet.getInt(12);
|
||||||
token.GeneratorStock = resultSet.getInt(13);
|
token.Generator = resultSet.getString(13);
|
||||||
token.DateCreated = resultSet.getTimestamp(14);
|
token.GeneratorStock = resultSet.getInt(14);
|
||||||
token.LastOnline = resultSet.getTimestamp(15);
|
token.DateCreated = resultSet.getTimestamp(15);
|
||||||
|
token.LastOnline = resultSet.getTimestamp(16);
|
||||||
|
|
||||||
ClanTerritoryToken territoryToken = new ClanTerritoryToken();
|
ClanTerritoryToken territoryToken = new ClanTerritoryToken();
|
||||||
territoryToken.ClanName = token.Name;
|
territoryToken.ClanName = token.Name;
|
||||||
territoryToken.Chunk = resultSet.getString(16);
|
territoryToken.Chunk = resultSet.getString(17);
|
||||||
territoryToken.Safe = resultSet.getBoolean(17);
|
territoryToken.Safe = resultSet.getBoolean(18);
|
||||||
|
|
||||||
if (!clans.containsKey(token.Name))
|
if (!clans.containsKey(token.Name))
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ public class ClanToken
|
|||||||
public int Deaths;
|
public int Deaths;
|
||||||
public int WarWins;
|
public int WarWins;
|
||||||
public int WarLosses;
|
public int WarLosses;
|
||||||
|
public int EloRating;
|
||||||
public String Generator;
|
public String Generator;
|
||||||
public int GeneratorStock;
|
public int GeneratorStock;
|
||||||
public Timestamp DateCreated;
|
public Timestamp DateCreated;
|
||||||
|
@ -48,6 +48,7 @@ public class ClanInfo
|
|||||||
private int _deaths;
|
private int _deaths;
|
||||||
private int _warWins;
|
private int _warWins;
|
||||||
private int _warLosses;
|
private int _warLosses;
|
||||||
|
private int _eloRating;
|
||||||
|
|
||||||
private boolean _admin = false;
|
private boolean _admin = false;
|
||||||
|
|
||||||
@ -86,6 +87,7 @@ public class ClanInfo
|
|||||||
_id = token.Id;
|
_id = token.Id;
|
||||||
_name = token.Name;
|
_name = token.Name;
|
||||||
_desc = token.Description;
|
_desc = token.Description;
|
||||||
|
_eloRating = token.EloRating;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -594,6 +596,16 @@ public class ClanInfo
|
|||||||
{
|
{
|
||||||
_warLosses += amount;
|
_warLosses += amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getEloRating()
|
||||||
|
{
|
||||||
|
return _eloRating;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEloRating(int amount)
|
||||||
|
{
|
||||||
|
_eloRating += amount;
|
||||||
|
}
|
||||||
|
|
||||||
public ClanWarData getWarData(ClanInfo against)
|
public ClanWarData getWarData(ClanInfo against)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user