Merge pull request #50 in MIN/mineplex from clans_custom_gear to clans-beta
* commit 'f47c1b5c144cdc143d1d3750b970edd63373d5d6': Fix bug where generator location per-clan wasn't being reset properly on server transfer. Fix bugs related to multiple server UI and clan server transferring.
This commit is contained in:
commit
7284093786
@ -186,6 +186,9 @@
|
|||||||
<fileset dir="../Mineplex.Core.Common/bin">
|
<fileset dir="../Mineplex.Core.Common/bin">
|
||||||
<include name="**/*.class"/>
|
<include name="**/*.class"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
|
<fileset dir="../Mineplex.Game.Clans.Core/bin">
|
||||||
|
<include name="**/*.class"/>
|
||||||
|
</fileset>
|
||||||
<fileset dir="../Mineplex.Minecraft.Game.ClassCombat/bin">
|
<fileset dir="../Mineplex.Minecraft.Game.ClassCombat/bin">
|
||||||
<include name="**/*.class"/>
|
<include name="**/*.class"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
|
@ -4,19 +4,19 @@ import mineplex.game.clans.core.repository.tokens.SimpleClanToken;
|
|||||||
import mineplex.serverdata.commands.ServerCommand;
|
import mineplex.serverdata.commands.ServerCommand;
|
||||||
|
|
||||||
|
|
||||||
public class ClanServerChangeCommand extends ServerCommand
|
public class ClanDeleteCommand extends ServerCommand
|
||||||
{
|
{
|
||||||
private String _clanName;
|
private String _clanName;
|
||||||
public String getClanName() { return _clanName; }
|
public String getClanName() { return _clanName; }
|
||||||
|
|
||||||
public ClanServerChangeCommand(String serverName, String clanName)
|
public ClanDeleteCommand(String serverName, String clanName)
|
||||||
{
|
{
|
||||||
super(serverName);
|
super(serverName);
|
||||||
|
|
||||||
_clanName = clanName;
|
_clanName = clanName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClanServerChangeCommand(SimpleClanToken clan)
|
public ClanDeleteCommand(SimpleClanToken clan)
|
||||||
{
|
{
|
||||||
this(clan.getHomeServer(), clan.getClanName());
|
this(clan.getHomeServer(), clan.getClanName());
|
||||||
}
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package mineplex.game.clans.core;
|
||||||
|
|
||||||
|
import mineplex.serverdata.commands.ServerCommand;
|
||||||
|
|
||||||
|
|
||||||
|
public class ClanLoadCommand extends ServerCommand
|
||||||
|
{
|
||||||
|
private String _clanName;
|
||||||
|
public String getClanName() { return _clanName; }
|
||||||
|
|
||||||
|
public ClanLoadCommand(String serverName, String clanName)
|
||||||
|
{
|
||||||
|
super(serverName);
|
||||||
|
|
||||||
|
_clanName = clanName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
// Utilitizes a callback functionality to seperate dependencies
|
||||||
|
}
|
||||||
|
}
|
@ -41,11 +41,11 @@ public class ClanRepository extends RepositoryBase
|
|||||||
private static String CREATE_CLAN_TERRITORY_TABLE = "CREATE TABLE IF NOT EXISTS clanTerritory (id INT NOT NULL AUTO_INCREMENT, clanId INT, serverId INT NOT NULL, chunk VARCHAR(100), safe BIT(1), PRIMARY KEY (id), FOREIGN KEY (clanId) REFERENCES clans(id), INDEX clanIdIndex (clanId, serverId));";
|
private static String CREATE_CLAN_TERRITORY_TABLE = "CREATE TABLE IF NOT EXISTS clanTerritory (id INT NOT NULL AUTO_INCREMENT, clanId INT, serverId INT NOT NULL, chunk VARCHAR(100), safe BIT(1), PRIMARY KEY (id), FOREIGN KEY (clanId) REFERENCES clans(id), INDEX clanIdIndex (clanId, serverId));";
|
||||||
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.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.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 = ?;";
|
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_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_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 = ?;";
|
||||||
private static String RETRIEVE_CLAN_ENEMY_INFO = "SELECT c.name, cOther.name, clanScore, otherClanScore, clanKills, otherClanKills, timeFormed FROM clanEnemies AS ce INNER JOIN clans AS c ON c.id = ce.clanId INNER JOIN clans as cOther ON cOther.id = ce.otherClanId WHERE c.serverId = ?;";
|
private static String RETRIEVE_CLAN_ENEMY_INFO = "SELECT c.name, cOther.name, clanScore, otherClanScore, clanKills, otherClanKills, timeFormed FROM clanEnemies AS ce INNER JOIN clans AS c ON c.id = ce.clanId INNER JOIN clans as cOther ON cOther.id = ce.otherClanId WHERE c.serverId = ?;";
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ public class ClanRepository extends RepositoryBase
|
|||||||
private static String UPDATE_CLAN_ALLIANCE = "UPDATE clanAlliances SET trusted = ? WHERE clanId = ? AND otherClanId = ?;";
|
private static String UPDATE_CLAN_ALLIANCE = "UPDATE clanAlliances SET trusted = ? WHERE clanId = ? AND otherClanId = ?;";
|
||||||
private static String UPDATE_CLAN_ENEMY = "UPDATE clanEnemies SET clanScore = ?, otherClanScore = ?, clanKills = ?, otherClanKills = ? WHERE clanId = ? AND otherClanId = ?;";
|
private static String UPDATE_CLAN_ENEMY = "UPDATE clanEnemies SET clanScore = ?, otherClanScore = ?, clanKills = ?, otherClanKills = ? WHERE clanId = ? AND otherClanId = ?;";
|
||||||
private static String UPDATE_CLAN_TERRITORY = "UPDATE clanTerritory SET safe = ? WHERE serverId = ? AND chunk = ?;";
|
private static String UPDATE_CLAN_TERRITORY = "UPDATE clanTerritory SET safe = ? WHERE serverId = ? AND chunk = ?;";
|
||||||
private static String UPDATE_CLAN_SERVER_ID = "UPDATE clans SET serverId = ?, home = '' WHERE id = ?;";
|
private static String UPDATE_CLAN_SERVER_ID = "UPDATE clans SET serverId = ?, home = '', generator = '' WHERE id = ?;";
|
||||||
private static String UPDATE_CLAN_GENERATOR = "UPDATE clans SET generator = ?, generatorStock = ? WHERE id = ?;";
|
private static String UPDATE_CLAN_GENERATOR = "UPDATE clans SET generator = ?, generatorStock = ? WHERE id = ?;";
|
||||||
|
|
||||||
private static String GET_CLAN_SERVER = "SELECT id FROM clanServer WHERE clanServer.serverName = ?";
|
private static String GET_CLAN_SERVER = "SELECT id FROM clanServer WHERE clanServer.serverName = ?";
|
||||||
@ -164,8 +164,10 @@ public class ClanRepository extends RepositoryBase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void retrieveClan(String clanName, final Callback<ClanToken> callback)
|
public ClanToken retrieveClan(String clanName)
|
||||||
{
|
{
|
||||||
|
final ClanToken clan = new ClanToken();
|
||||||
|
|
||||||
executeQuery(RETRIEVE_CLAN_INFO, new ResultSetCallable()
|
executeQuery(RETRIEVE_CLAN_INFO, new ResultSetCallable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -173,25 +175,49 @@ public class ClanRepository extends RepositoryBase
|
|||||||
{
|
{
|
||||||
if (resultSet.next())
|
if (resultSet.next())
|
||||||
{
|
{
|
||||||
ClanToken token = new ClanToken();
|
if (resultSet.next())
|
||||||
token.Id = resultSet.getInt(1);
|
{
|
||||||
token.Name = resultSet.getString(2);
|
clan.Id = resultSet.getInt(1);
|
||||||
token.Description = resultSet.getString(3);
|
clan.Name = resultSet.getString(2);
|
||||||
token.Home = resultSet.getString(4);
|
clan.Description = resultSet.getString(3);
|
||||||
token.Admin = resultSet.getBoolean(5);
|
clan.Home = resultSet.getString(4);
|
||||||
token.Energy = resultSet.getInt(6);
|
clan.Admin = resultSet.getBoolean(5);
|
||||||
token.Kills = resultSet.getInt(7);
|
clan.Energy = resultSet.getInt(6);
|
||||||
token.Murder = resultSet.getInt(8);
|
clan.Kills = resultSet.getInt(7);
|
||||||
token.Deaths = resultSet.getInt(9);
|
clan.Murder = resultSet.getInt(8);
|
||||||
token.WarWins = resultSet.getInt(10);
|
clan.Deaths = resultSet.getInt(9);
|
||||||
token.WarLosses = resultSet.getInt(11);
|
clan.WarWins = resultSet.getInt(10);
|
||||||
token.DateCreated = resultSet.getTimestamp(12);
|
clan.WarLosses = resultSet.getInt(11);
|
||||||
token.LastOnline = resultSet.getTimestamp(13);
|
clan.Generator = resultSet.getString(12);
|
||||||
|
clan.GeneratorStock = resultSet.getInt(13);
|
||||||
callback.run(token);
|
clan.DateCreated = resultSet.getTimestamp(14);
|
||||||
|
clan.LastOnline = resultSet.getTimestamp(15);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, new ColumnVarChar("name", 100, clanName.toLowerCase()));
|
}, new ColumnVarChar("name", 100, clanName.toLowerCase()));
|
||||||
|
|
||||||
|
executeQuery(RETRIEVE_CLAN_MEMBERS, new ResultSetCallable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||||
|
{
|
||||||
|
while (resultSet.next())
|
||||||
|
{
|
||||||
|
String clanName = resultSet.getString(1);
|
||||||
|
|
||||||
|
ClanMemberToken memberToken = new ClanMemberToken();
|
||||||
|
memberToken.Name = resultSet.getString(2);
|
||||||
|
memberToken.PlayerUUID = UUID.fromString(resultSet.getString(3));
|
||||||
|
memberToken.ClanRole = resultSet.getString(4);
|
||||||
|
|
||||||
|
clan.Members.add(memberToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}, new ColumnVarChar("name", 100, clanName.toLowerCase()));
|
||||||
|
|
||||||
|
return clan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clanExists(String clanName, final Callback<Boolean> callback)
|
public void clanExists(String clanName, final Callback<Boolean> callback)
|
||||||
@ -228,7 +254,7 @@ public class ClanRepository extends RepositoryBase
|
|||||||
}
|
}
|
||||||
}, new ColumnInt("accountId", accountId));
|
}, new ColumnInt("accountId", accountId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ClanToken> retrieveClans()
|
public Collection<ClanToken> retrieveClans()
|
||||||
{
|
{
|
||||||
System.out.println("Beginning to load clans from database...");
|
System.out.println("Beginning to load clans from database...");
|
||||||
@ -240,7 +266,7 @@ public class ClanRepository extends RepositoryBase
|
|||||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||||
{
|
{
|
||||||
while (resultSet.next())
|
while (resultSet.next())
|
||||||
{
|
{
|
||||||
ClanToken token = new ClanToken();
|
ClanToken token = new ClanToken();
|
||||||
token.Id = resultSet.getInt(1);
|
token.Id = resultSet.getInt(1);
|
||||||
token.Name = resultSet.getString(2);
|
token.Name = resultSet.getString(2);
|
||||||
|
@ -684,9 +684,17 @@ public class ClansDataAccessLayer
|
|||||||
_manager.log("Safe Zone at [" + claim.Chunk + "] set to [" + claim.Safe + "] by [" + player + "].");
|
_manager.log("Safe Zone at [" + claim.Chunk + "] set to [" + claim.Safe + "] by [" + player + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void retrieveClan(String clanName, Callback<ClanToken> callback)
|
public void retrieveClan(final String clanName, final Callback<ClanToken> callback)
|
||||||
{
|
{
|
||||||
_repository.retrieveClan(clanName, callback);
|
runAsync(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
ClanToken clan = _repository.retrieveClan(clanName);
|
||||||
|
callback.run(clan);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clanExists(String clanName, Callback<Boolean> callback)
|
public void clanExists(String clanName, Callback<Boolean> callback)
|
||||||
|
@ -58,7 +58,7 @@ public class ClansDisplay extends MiniPlugin
|
|||||||
|
|
||||||
//Update Territory
|
//Update Territory
|
||||||
client.setTerritory(UtilWorld.chunkToStr(player.getLocation().getChunk()));
|
client.setTerritory(UtilWorld.chunkToStr(player.getLocation().getChunk()));
|
||||||
|
|
||||||
//AutoClaim
|
//AutoClaim
|
||||||
if (client.isAutoClaim())
|
if (client.isAutoClaim())
|
||||||
Clans.getClanAdmin().claim(player);
|
Clans.getClanAdmin().claim(player);
|
||||||
|
@ -64,14 +64,16 @@ import mineplex.game.clans.clans.commands.ServerTimeCommand;
|
|||||||
import mineplex.game.clans.clans.loot.LootManager;
|
import mineplex.game.clans.clans.loot.LootManager;
|
||||||
import mineplex.game.clans.clans.map.ItemMapManager;
|
import mineplex.game.clans.clans.map.ItemMapManager;
|
||||||
import mineplex.game.clans.clans.murder.MurderManager;
|
import mineplex.game.clans.clans.murder.MurderManager;
|
||||||
import mineplex.game.clans.clans.redis.ClanServerChangeHandler;
|
import mineplex.game.clans.clans.redis.ClanDeleteCommandHandler;
|
||||||
|
import mineplex.game.clans.clans.redis.ClanLoadCommandHandler;
|
||||||
import mineplex.game.clans.clans.regions.ClansRegions;
|
import mineplex.game.clans.clans.regions.ClansRegions;
|
||||||
import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager;
|
import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager;
|
||||||
import mineplex.game.clans.clans.tntGenerator.TntGeneratorManager;
|
import mineplex.game.clans.clans.tntGenerator.TntGeneratorManager;
|
||||||
import mineplex.game.clans.clans.war.WarManager;
|
import mineplex.game.clans.clans.war.WarManager;
|
||||||
import mineplex.game.clans.economy.GoldManager;
|
import mineplex.game.clans.economy.GoldManager;
|
||||||
import mineplex.game.clans.clans.worldevent.WorldEventManager;
|
import mineplex.game.clans.clans.worldevent.WorldEventManager;
|
||||||
import mineplex.game.clans.core.ClanServerChangeCommand;
|
import mineplex.game.clans.core.ClanDeleteCommand;
|
||||||
|
import mineplex.game.clans.core.ClanLoadCommand;
|
||||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||||
import mineplex.game.clans.core.repository.tokens.ClanMemberToken;
|
import mineplex.game.clans.core.repository.tokens.ClanMemberToken;
|
||||||
import mineplex.game.clans.core.repository.tokens.ClanTerritoryToken;
|
import mineplex.game.clans.core.repository.tokens.ClanTerritoryToken;
|
||||||
@ -226,7 +228,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
_classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory, webServerAddress);
|
_classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory, webServerAddress);
|
||||||
|
|
||||||
// Register redis based server commands
|
// Register redis based server commands
|
||||||
ServerCommandManager.getInstance().registerCommandType(ClanServerChangeCommand.class, new ClanServerChangeHandler());
|
ServerCommandManager.getInstance().registerCommandType(ClanDeleteCommand.class, new ClanDeleteCommandHandler());
|
||||||
|
ServerCommandManager.getInstance().registerCommandType(ClanLoadCommand.class, new ClanLoadCommandHandler());
|
||||||
|
|
||||||
StatsManager statsManager = new StatsManager(plugin, _clientManager);
|
StatsManager statsManager = new StatsManager(plugin, _clientManager);
|
||||||
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager);
|
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager);
|
||||||
@ -237,14 +240,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
|
|
||||||
for (ClanToken token : _clanDataAccess.getRepository().retrieveClans())
|
for (ClanToken token : _clanDataAccess.getRepository().retrieveClans())
|
||||||
{
|
{
|
||||||
ClanInfo clan = new ClanInfo(this, token);
|
loadClan(token);
|
||||||
_clanMap.put(token.Name, clan);
|
|
||||||
|
|
||||||
for (ClanMemberToken memberToken : token.Members)
|
|
||||||
_clanMemberMap.put(memberToken.Name, clan);
|
|
||||||
|
|
||||||
for (ClanTerritoryToken territoryToken : token.Territories)
|
|
||||||
_claimMap.put(territoryToken.Chunk, new ClanTerritory(territoryToken));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//RedisDataRepository(ConnectionData writeConn, ConnectionData readConn, Region region, Class<T> elementType, String elementLabel)
|
//RedisDataRepository(ConnectionData writeConn, ConnectionData readConn, Region region, Class<T> elementType, String elementLabel)
|
||||||
@ -265,6 +261,18 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
addCommand(new MapCommand(this));
|
addCommand(new MapCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loadClan(ClanToken clanToken)
|
||||||
|
{
|
||||||
|
ClanInfo clan = new ClanInfo(this, clanToken);
|
||||||
|
_clanMap.put(clanToken.Name, clan);
|
||||||
|
|
||||||
|
for (ClanMemberToken memberToken : clanToken.Members)
|
||||||
|
_clanMemberMap.put(memberToken.Name, clan);
|
||||||
|
|
||||||
|
for (ClanTerritoryToken territoryToken : clanToken.Territories)
|
||||||
|
_claimMap.put(territoryToken.Chunk, new ClanTerritory(territoryToken));
|
||||||
|
}
|
||||||
|
|
||||||
public DisguiseManager getDisguiseManager()
|
public DisguiseManager getDisguiseManager()
|
||||||
{
|
{
|
||||||
return _disguiseManager;
|
return _disguiseManager;
|
||||||
|
@ -3,18 +3,18 @@ package mineplex.game.clans.clans.redis;
|
|||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.game.clans.clans.ClanInfo;
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.core.ClanServerChangeCommand;
|
import mineplex.game.clans.core.ClanDeleteCommand;
|
||||||
import mineplex.serverdata.commands.CommandCallback;
|
import mineplex.serverdata.commands.CommandCallback;
|
||||||
import mineplex.serverdata.commands.ServerCommand;
|
import mineplex.serverdata.commands.ServerCommand;
|
||||||
|
|
||||||
public class ClanServerChangeHandler implements CommandCallback
|
public class ClanDeleteCommandHandler implements CommandCallback
|
||||||
{
|
{
|
||||||
|
|
||||||
public void run(ServerCommand command)
|
public void run(ServerCommand command)
|
||||||
{
|
{
|
||||||
if (command instanceof ClanServerChangeCommand)
|
if (command instanceof ClanDeleteCommand)
|
||||||
{
|
{
|
||||||
ClanServerChangeCommand serverCommand = (ClanServerChangeCommand) command;
|
ClanDeleteCommand serverCommand = (ClanDeleteCommand) command;
|
||||||
String clanName = serverCommand.getClanName();
|
String clanName = serverCommand.getClanName();
|
||||||
ClanInfo clanInfo = ClansManager.getInstance().getClan(clanName);
|
ClanInfo clanInfo = ClansManager.getInstance().getClan(clanName);
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
package mineplex.game.clans.clans.redis;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.Callback;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.core.ClanDeleteCommand;
|
||||||
|
import mineplex.game.clans.core.ClanLoadCommand;
|
||||||
|
import mineplex.game.clans.core.repository.tokens.ClanToken;
|
||||||
|
import mineplex.serverdata.commands.CommandCallback;
|
||||||
|
import mineplex.serverdata.commands.ServerCommand;
|
||||||
|
|
||||||
|
public class ClanLoadCommandHandler implements CommandCallback
|
||||||
|
{
|
||||||
|
|
||||||
|
public void run(ServerCommand command)
|
||||||
|
{
|
||||||
|
if (command instanceof ClanLoadCommand)
|
||||||
|
{
|
||||||
|
ClanLoadCommand serverCommand = (ClanLoadCommand) command;
|
||||||
|
final String clanName = serverCommand.getClanName();
|
||||||
|
|
||||||
|
ClansManager.getInstance().getClanDataAccess().retrieveClan(clanName, new Callback<ClanToken>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run(ClanToken clan)
|
||||||
|
{
|
||||||
|
if (clan != null)
|
||||||
|
{
|
||||||
|
ClansManager.getInstance().loadClan(clan); // Load the clan data locally
|
||||||
|
System.out.println("Successfully finished loading and transferring clan '" + clanName + "'!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println("ERROR: UNABLE TO LOAD CLAN " + clanName + " DURING REMOTE CLAN LOAD COMMAND!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -38,7 +38,7 @@ import mineplex.serverdata.serialization.RuntimeTypeAdapterFactory;
|
|||||||
import mineplex.serverdata.servers.ServerManager;
|
import mineplex.serverdata.servers.ServerManager;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_7_R4.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSetSlot;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutSetSlot;
|
||||||
import net.minecraft.util.com.google.common.collect.Sets;
|
import net.minecraft.util.com.google.common.collect.Sets;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -683,6 +683,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
for (ServerGroup serverGroup : mineplex.serverdata.servers.ServerManager.getServerRepository(region).getServerGroups(null))
|
for (ServerGroup serverGroup : mineplex.serverdata.servers.ServerManager.getServerRepository(region).getServerGroups(null))
|
||||||
{
|
{
|
||||||
|
System.out.println("ADDING SERVER GROUP: " + serverGroup.getName());
|
||||||
addServerGroup(serverGroup);
|
addServerGroup(serverGroup);
|
||||||
|
|
||||||
if (!serverGroup.getServerNpcName().isEmpty())
|
if (!serverGroup.getServerNpcName().isEmpty())
|
||||||
|
@ -32,7 +32,7 @@ public class LobbyMenu extends ShopPageBase<ServerManager, LobbyShop> implements
|
|||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void buildPage()
|
protected void buildPage()
|
||||||
{
|
{
|
||||||
List<ServerInfo> serverList = new ArrayList<ServerInfo>(getPlugin().getServerList(_serverGroup));
|
List<ServerInfo> serverList = new ArrayList<ServerInfo>(getPlugin().getServerList(_serverGroup));
|
||||||
|
@ -31,12 +31,12 @@ public class ServerNpcShop extends ShopBase<ServerManager>
|
|||||||
{
|
{
|
||||||
return new ServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup);
|
return new ServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix());
|
return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canOpenShop(Player player)
|
protected boolean canOpenShop(Player player)
|
||||||
|
@ -5,7 +5,8 @@ import org.bukkit.event.inventory.ClickType;
|
|||||||
|
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.shop.item.IButton;
|
import mineplex.core.shop.item.IButton;
|
||||||
import mineplex.game.clans.core.ClanServerChangeCommand;
|
import mineplex.game.clans.core.ClanDeleteCommand;
|
||||||
|
import mineplex.game.clans.core.ClanLoadCommand;
|
||||||
import mineplex.game.clans.core.repository.ClanRepository;
|
import mineplex.game.clans.core.repository.ClanRepository;
|
||||||
import mineplex.game.clans.core.repository.tokens.SimpleClanToken;
|
import mineplex.game.clans.core.repository.tokens.SimpleClanToken;
|
||||||
|
|
||||||
@ -33,8 +34,12 @@ public class ClanMoveServerButton implements IButton
|
|||||||
{
|
{
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
ClanServerChangeCommand changeCommand = new ClanServerChangeCommand(_clan);
|
ClanDeleteCommand deleteCommand = new ClanDeleteCommand(_clan);
|
||||||
changeCommand.publish();
|
ClanLoadCommand loadCommand = new ClanLoadCommand(_serverName, _clan.getClanName());
|
||||||
|
|
||||||
|
deleteCommand.publish();
|
||||||
|
loadCommand.publish();
|
||||||
|
|
||||||
System.out.println("Successfully finished moving clan to new home server!");
|
System.out.println("Successfully finished moving clan to new home server!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -75,7 +75,7 @@ public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop
|
|||||||
private void buildNoClanPage()
|
private void buildNoClanPage()
|
||||||
{
|
{
|
||||||
Collection<ServerInfo> servers = getPlugin().getServerList("Clans");
|
Collection<ServerInfo> servers = getPlugin().getServerList("Clans");
|
||||||
|
|
||||||
int currentSlot = 9;
|
int currentSlot = 9;
|
||||||
for (ServerInfo server : servers)
|
for (ServerInfo server : servers)
|
||||||
{
|
{
|
||||||
|
@ -311,6 +311,12 @@ public class RedisServerRepository implements ServerRepository
|
|||||||
{
|
{
|
||||||
Map<String, String> data = response.get();
|
Map<String, String> data = response.get();
|
||||||
|
|
||||||
|
if (data.entrySet().size() == 0)
|
||||||
|
{
|
||||||
|
System.out.println("Encountered empty map! Skipping...");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ServerGroup serverGroup = new ServerGroup(data, serverStatuses);
|
ServerGroup serverGroup = new ServerGroup(data, serverStatuses);
|
||||||
|
Loading…
Reference in New Issue
Block a user