Fix bug where any server initializing the ClanRepository was marked as a clans server in the database. Fix bug where administrative clans were being duplicated across different clans servers.
This commit is contained in:
parent
138a4cf638
commit
da3810e5a3
@ -43,7 +43,7 @@ public class ClanRepository extends RepositoryBase
|
||||
|
||||
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_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 = ?;";
|
||||
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_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 = ?;";
|
||||
@ -79,14 +79,22 @@ public class ClanRepository extends RepositoryBase
|
||||
private String _serverName;
|
||||
private int _serverId;
|
||||
|
||||
public ClanRepository(JavaPlugin plugin, String serverName)
|
||||
public ClanRepository(JavaPlugin plugin, String serverName, boolean isClansServer)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
|
||||
_serverName = serverName;
|
||||
_serverId = -1;
|
||||
|
||||
loadServerId();
|
||||
if (isClansServer)
|
||||
{
|
||||
loadServerId();
|
||||
}
|
||||
}
|
||||
|
||||
public ClanRepository(JavaPlugin plugin, String serverName)
|
||||
{
|
||||
this(plugin, serverName, false);
|
||||
}
|
||||
|
||||
private void loadServerId()
|
||||
|
@ -35,7 +35,7 @@ public class ClansDataAccessLayer
|
||||
{
|
||||
_manager = clans;
|
||||
_scoreboard = scoreboard;
|
||||
_repository = new ClanRepository(clans.getPlugin(), clans.getServerName());
|
||||
_repository = new ClanRepository(clans.getPlugin(), clans.getServerName(), true);
|
||||
}
|
||||
|
||||
public void delete(final ClanInfo clan, final Callback<Boolean> callback)
|
||||
|
@ -25,7 +25,7 @@ public class ClansServerShop extends ShopBase<ServerManager>
|
||||
public ClansServerShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, "Clans");
|
||||
System.out.println("initiateddd-----------------------------------");
|
||||
|
||||
_repository = new ClanRepository(plugin.getPlugin(), plugin.getStatusManager().getCurrentServerName());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user