package mineplex.clanshub; import mineplex.core.common.Rank; import mineplex.core.shop.item.IButton; import mineplex.core.shop.page.ShopPageBase; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; public class JoinServerButton implements IButton { private ShopPageBase _page; private ClansTransferManager _transferManager; private ServerInfo _serverInfo; public JoinServerButton(ShopPageBase page, ClansTransferManager transferManager, ServerInfo serverInfo) { _page = page; _transferManager = transferManager; _serverInfo = serverInfo; } @Override public void onClick(Player player, ClickType clickType) { selectServer(player, _serverInfo); } public void selectServer(Player player, ServerInfo serverInfo) { if (serverInfo != null) { System.out.println("Selecting server :" + serverInfo.Name); int slots = 1; if (serverInfo.getAvailableSlots() < slots && !_page.getClient().GetRank().has(Rank.ULTRA)) { _page.playDenySound(player); } else { _transferManager.selectServer(player, serverInfo); } } else { _page.playDenySound(player); } } }