Removed db call off main thread for ClanServerPage
This commit is contained in:
parent
91ddac9643
commit
781c4bfdbd
@ -27,8 +27,6 @@ import mineplex.serverdata.data.DataRepository;
|
||||
|
||||
public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop>
|
||||
{
|
||||
|
||||
//private DataRepository<PlayerServerInfo> _repository; // Stores the name of the last Clans server a player was on
|
||||
private ClanRepository _repository;
|
||||
private int _accountId;
|
||||
|
||||
@ -46,21 +44,33 @@ public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
_repository.retrievePlayersClan(_accountId, new Callback<SimpleClanToken>()
|
||||
getPlugin().runAsync(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_repository.retrievePlayersClan(_accountId, new Callback<SimpleClanToken>()
|
||||
{
|
||||
@Override
|
||||
public void run(SimpleClanToken data)
|
||||
{
|
||||
if (data != null)
|
||||
getPlugin().runSync(new Runnable()
|
||||
{
|
||||
buildClanPage(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
buildNoClanPage();
|
||||
}
|
||||
public void run()
|
||||
{
|
||||
if (data != null)
|
||||
{
|
||||
buildClanPage(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
buildNoClanPage();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void buildClanPage(SimpleClanToken clan)
|
||||
|
@ -2,24 +2,18 @@ package mineplex.hub.server.ui.clans;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.party.Party;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.game.clans.core.repository.ClanRepository;
|
||||
import mineplex.game.clans.core.repository.tokens.SimpleClanToken;
|
||||
import mineplex.hub.server.ServerManager;
|
||||
|
||||
public class ClansServerShop extends ShopBase<ServerManager>
|
||||
{
|
||||
|
||||
private ClanRepository _repository;
|
||||
|
||||
public ClansServerShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
|
Loading…
Reference in New Issue
Block a user