Add Server Menu for Premium Servers. Item lore still needs some work
This commit is contained in:
parent
78b3d3b35c
commit
dcc8eaaa21
@ -0,0 +1,19 @@
|
|||||||
|
package mineplex.core.shop.item;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public abstract class SingleButton implements IButton
|
||||||
|
{
|
||||||
|
public abstract void Clicked(Player player);
|
||||||
|
|
||||||
|
public void ClickedLeft(Player player)
|
||||||
|
{
|
||||||
|
Clicked(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClickedRight(Player player)
|
||||||
|
{
|
||||||
|
Clicked(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,4 +9,9 @@ public class ServerInfo
|
|||||||
public String Map;
|
public String Map;
|
||||||
public String ServerType;
|
public String ServerType;
|
||||||
public String Game;
|
public String Game;
|
||||||
|
|
||||||
|
public boolean isFree()
|
||||||
|
{
|
||||||
|
return Integer.parseInt(Name.split("-")[1]) % 2 == 0;
|
||||||
|
}
|
||||||
}
|
}
|
@ -4,189 +4,266 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.logger.Logger;
|
import mineplex.core.logger.Logger;
|
||||||
import mineplex.core.shop.item.ShopItem;
|
import mineplex.core.shop.item.ShopItem;
|
||||||
|
import mineplex.core.shop.item.SingleButton;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import mineplex.hub.server.ServerInfo;
|
import mineplex.hub.server.ServerInfo;
|
||||||
import mineplex.hub.server.ServerManager;
|
import mineplex.hub.server.ServerManager;
|
||||||
import mineplex.hub.server.ServerSorter;
|
import mineplex.hub.server.ServerSorter;
|
||||||
import mineplex.hub.server.ui.button.JoinServerButton;
|
import mineplex.hub.server.ui.button.JoinServerButton;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> implements IServerPage
|
public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> implements IServerPage
|
||||||
{
|
{
|
||||||
private String _serverNpcKey;
|
private String _serverNpcKey;
|
||||||
|
private boolean _onMainPage = true;
|
||||||
|
private boolean _freeOnly;
|
||||||
|
|
||||||
public ServerNpcPage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, String serverNpcKey)
|
public ServerNpcPage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, String serverNpcKey)
|
||||||
{
|
{
|
||||||
super(plugin, shop, clientManager, donationManager, name, player, 54);
|
super(plugin, shop, clientManager, donationManager, name, player, 54);
|
||||||
|
|
||||||
_serverNpcKey = serverNpcKey;
|
_serverNpcKey = serverNpcKey;
|
||||||
|
|
||||||
BuildPage();
|
BuildPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void BuildPage()
|
protected void BuildPage()
|
||||||
{
|
{
|
||||||
List<ServerInfo> serverList = new ArrayList<ServerInfo>(Plugin.GetServerList(_serverNpcKey));
|
List<ServerInfo> serverList = new ArrayList<ServerInfo>(Plugin.GetServerList(_serverNpcKey));
|
||||||
|
int slotsNeeded = 1;
|
||||||
int slots = 1;
|
|
||||||
|
|
||||||
if (serverList.size() > 0)
|
if (serverList.size() > 0)
|
||||||
{
|
{
|
||||||
slots = Plugin.GetRequiredSlots(Player, serverList.get(0).ServerType);
|
slotsNeeded = Plugin.GetRequiredSlots(Player, serverList.get(0).ServerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Collections.sort(serverList, new ServerSorter(slots));
|
Collections.sort(serverList, new ServerSorter(slotsNeeded));
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
Logger.Instance.log(exception);
|
Logger.Instance.log(exception);
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
int slot = 10;
|
|
||||||
int greenCount = 0;
|
if (_onMainPage)
|
||||||
int yellowCount = 0;
|
|
||||||
String openFull = ChatColor.RESET + C.Line + "Get Ultra to join full servers!";
|
|
||||||
String beta = ChatColor.RESET + C.Line + "Get Ultra to join Beta servers!";
|
|
||||||
String openFullUltra = ChatColor.RESET + C.Line + "Click to join!";
|
|
||||||
|
|
||||||
for (ServerInfo serverInfo : serverList)
|
|
||||||
{
|
{
|
||||||
boolean ownsUltraPackage = DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA);
|
buildAvailableServerPage(serverList, slotsNeeded);
|
||||||
|
}
|
||||||
String inProgress = (serverInfo.Game == null || serverInfo.ServerType.equalsIgnoreCase("Competitive")) ? (ChatColor.RESET + C.Line + "Game in progress.") : (ChatColor.RESET + C.Line + "Click to spectate");
|
else
|
||||||
String inProgressLine2 = (serverInfo.Game == null || serverInfo.ServerType.equalsIgnoreCase("Competitive")) ? null : (ChatColor.RESET + C.Line + "and wait for next game!");
|
{
|
||||||
|
buildInProgressServerPage(serverList, _freeOnly, slotsNeeded);
|
||||||
Material status = Material.REDSTONE_BLOCK;
|
}
|
||||||
List<String> lore = new ArrayList<String>();
|
}
|
||||||
|
|
||||||
if (slot >= 53)
|
private void clearPage()
|
||||||
break;
|
{
|
||||||
|
for (int i = 0; i < getSize(); i++)
|
||||||
if ((serverInfo.MOTD.contains("Starting") || serverInfo.MOTD.contains("Recruiting") || serverInfo.MOTD.contains("Waiting") || serverInfo.MOTD.contains("Cup")) && slot < 15 && (serverInfo.MaxPlayers - serverInfo.CurrentPlayers) >= slots)
|
{
|
||||||
|
setItem(i, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ShopItem buildShopItem(ServerInfo serverInfo, int slotsNeeded)
|
||||||
|
{
|
||||||
|
boolean ownsUltraPackage = DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA);
|
||||||
|
Material status = Material.REDSTONE_BLOCK;
|
||||||
|
boolean free = serverInfo.isFree();
|
||||||
|
List<String> lore = new ArrayList<String>();
|
||||||
|
|
||||||
|
String shop = ChatColor.RESET + "www.mineplex.com/shop";
|
||||||
|
String openFull = ChatColor.RESET + C.Line + "Get Ultra to join full servers!";
|
||||||
|
String openPremium = ChatColor.RESET + C.cRed + "Premium requires " + Rank.ULTRA.GetTag(false, false) + C.cRed + " or " + Rank.HERO.GetTag(false, false);
|
||||||
|
String beta = ChatColor.RESET + C.Line + "Get Ultra to join Beta servers!";
|
||||||
|
String clickJoin = ChatColor.RESET + C.Line + "Click to Join";
|
||||||
|
String inProgress = (serverInfo.Game == null || serverInfo.ServerType.equalsIgnoreCase("Competitive")) ? (ChatColor.RESET + C.Line + "Game in Progress.") : C.Line + "Click to Spectate";
|
||||||
|
String inProgressLine2 = (serverInfo.Game == null || serverInfo.ServerType.equalsIgnoreCase("Competitive")) ? null : (ChatColor.RESET + C.Line + "and wait for next game!");
|
||||||
|
|
||||||
|
if (isStarting(serverInfo) && (serverInfo.MaxPlayers - serverInfo.CurrentPlayers) >= slotsNeeded)
|
||||||
|
status = free ? Material.EMERALD_BLOCK : Material.DIAMOND_BLOCK;
|
||||||
|
else if (isInProgress(serverInfo))
|
||||||
|
status = Material.GOLD_BLOCK;
|
||||||
|
|
||||||
|
lore.add(ChatColor.RESET + "");
|
||||||
|
|
||||||
|
if (serverInfo.Game != null)
|
||||||
|
lore.add(ChatColor.RESET + C.cYellow + "Game: " + C.cWhite + serverInfo.Game);
|
||||||
|
|
||||||
|
if (serverInfo.Map != null && !serverInfo.ServerType.equalsIgnoreCase("Competitive"))
|
||||||
|
lore.add(ChatColor.RESET + C.cYellow + "Map: " + C.cWhite + serverInfo.Map);
|
||||||
|
|
||||||
|
lore.add(ChatColor.RESET + C.cYellow + "Players: " + C.cWhite + serverInfo.CurrentPlayers + "/" + serverInfo.MaxPlayers);
|
||||||
|
lore.add(ChatColor.RESET + "");
|
||||||
|
|
||||||
|
// Only show motd if the player has access
|
||||||
|
if (free || ownsUltraPackage)
|
||||||
|
lore.add(ChatColor.RESET + serverInfo.MOTD);
|
||||||
|
|
||||||
|
if (serverInfo.Name.contains("BETA") && !ownsUltraPackage)
|
||||||
|
{
|
||||||
|
lore.add(beta);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers)
|
||||||
{
|
{
|
||||||
if (greenCount > 0 && serverInfo.MaxPlayers == serverInfo.CurrentPlayers)
|
if (serverInfo.Game.equalsIgnoreCase("Survival Games"))
|
||||||
continue;
|
|
||||||
|
|
||||||
slot += 1;
|
|
||||||
status = Material.EMERALD_BLOCK;
|
|
||||||
lore.add(ChatColor.RESET + "");
|
|
||||||
|
|
||||||
if (serverInfo.Game != null)
|
|
||||||
lore.add(ChatColor.RESET + "" + ChatColor.YELLOW + "Game: " + ChatColor.WHITE + serverInfo.Game);
|
|
||||||
|
|
||||||
if (serverInfo.Map != null && !serverInfo.ServerType.equalsIgnoreCase("Competitive"))
|
|
||||||
lore.add(ChatColor.RESET + "" + ChatColor.YELLOW + "Map: " + ChatColor.WHITE + serverInfo.Map);
|
|
||||||
|
|
||||||
lore.add(ChatColor.RESET + "" + ChatColor.YELLOW + "Players: " + ChatColor.WHITE + serverInfo.CurrentPlayers + "/" + serverInfo.MaxPlayers);
|
|
||||||
lore.add(ChatColor.RESET + "");
|
|
||||||
lore.add(ChatColor.RESET + serverInfo.MOTD);
|
|
||||||
|
|
||||||
if (serverInfo.Name.contains("BETA") && !ownsUltraPackage)
|
|
||||||
{
|
{
|
||||||
lore.add(beta);
|
lore.add(ChatColor.RESET + C.Line + "Full Survival Games servers");
|
||||||
|
lore.add(ChatColor.RESET + C.Line + "cannot be joined.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers)
|
if (!ownsUltraPackage)
|
||||||
{
|
{
|
||||||
if (serverInfo.Game.equalsIgnoreCase("Survival Games"))
|
lore.add(free ? openFull : openPremium);
|
||||||
{
|
|
||||||
lore.add(ChatColor.RESET + C.Line + "Full Survival Games servers");
|
|
||||||
lore.add(ChatColor.RESET + C.Line + "cannot be joined.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!ownsUltraPackage)
|
|
||||||
lore.add(openFull);
|
|
||||||
else
|
|
||||||
lore.add(openFullUltra);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
lore.add(ChatColor.RESET + C.Line + "Click to join!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
greenCount++;
|
|
||||||
}
|
|
||||||
else if (serverInfo.MOTD.contains("In") || serverInfo.MOTD.contains("Restarting"))
|
|
||||||
{
|
|
||||||
if (slot <= 15)
|
|
||||||
slot = 27;
|
|
||||||
else
|
|
||||||
slot++;
|
|
||||||
|
|
||||||
status = Material.GOLD_BLOCK;
|
|
||||||
lore.add(ChatColor.RESET + "");
|
|
||||||
|
|
||||||
if (serverInfo.Game != null)
|
|
||||||
lore.add(ChatColor.RESET + "" + ChatColor.YELLOW + "Game: " + ChatColor.WHITE + serverInfo.Game);
|
|
||||||
|
|
||||||
if (serverInfo.Map != null && !serverInfo.ServerType.equalsIgnoreCase("Competitive"))
|
|
||||||
lore.add(ChatColor.RESET + "" + ChatColor.YELLOW + "Map: " + ChatColor.WHITE + serverInfo.Map);
|
|
||||||
|
|
||||||
lore.add(ChatColor.RESET + "" + ChatColor.YELLOW + "Players: " + ChatColor.WHITE + serverInfo.CurrentPlayers + "/" + serverInfo.MaxPlayers);
|
|
||||||
lore.add(ChatColor.RESET + "");
|
|
||||||
lore.add(ChatColor.RESET + serverInfo.MOTD);
|
|
||||||
|
|
||||||
if (serverInfo.MOTD.contains("Restarting"))
|
|
||||||
{
|
|
||||||
lore.add(ChatColor.RESET + C.Line + "This server will be open shortly!");
|
|
||||||
status = Material.IRON_BLOCK;
|
|
||||||
}
|
|
||||||
else if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers)
|
|
||||||
{
|
|
||||||
if (!Client.GetRank().Has(Rank.ULTRA) || ownsUltraPackage)
|
|
||||||
lore.add(openFull);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
lore.add(inProgress);
|
lore.add(inProgress);
|
||||||
|
|
||||||
if (inProgressLine2 != null)
|
if (inProgressLine2 != null)
|
||||||
lore.add(inProgressLine2);
|
lore.add(inProgressLine2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
lore.add(inProgress);
|
|
||||||
|
|
||||||
if (inProgressLine2 != null)
|
|
||||||
lore.add(inProgressLine2);
|
|
||||||
}
|
|
||||||
|
|
||||||
yellowCount++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
continue;
|
{
|
||||||
|
if (free || ownsUltraPackage)
|
||||||
AddButton(slot, new ShopItem(status, ChatColor.UNDERLINE + "" + ChatColor.BOLD + "" + ChatColor.WHITE + "Server " + serverInfo.Name.substring(serverInfo.Name.indexOf('-') + 1), lore.toArray(new String[lore.size()]), Math.max(1, serverInfo.CurrentPlayers), false), new JoinServerButton(this, serverInfo));
|
lore.add(ChatColor.RESET + C.Line + "Click to Join");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lore.add(openPremium);
|
||||||
|
lore.add(shop);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (greenCount < 3)
|
return new ShopItem(status, ChatColor.RESET + C.Line + C.Bold + (free ? C.cGreen + "Free Server " : C.cAqua + "Premium Server ") + serverInfo.Name.split("-")[1], lore.toArray(new String[lore.size()]), serverInfo.CurrentPlayers, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildAvailableServerPage(List<ServerInfo> serverList, int slotsNeeded)
|
||||||
|
{
|
||||||
|
int greenCount = 0;
|
||||||
|
int blueCount = 0;
|
||||||
|
int yellowFreeCount = 0;
|
||||||
|
int yellowUltraCount = 0;
|
||||||
|
int greenStartSlot = 19;
|
||||||
|
int blueStartSlot = 23;
|
||||||
|
|
||||||
|
for (ServerInfo serverInfo : serverList)
|
||||||
{
|
{
|
||||||
setItem(9 + ((greenCount + 1) * 2), null);
|
boolean free = serverInfo.isFree();
|
||||||
greenCount++;
|
int slot = (free ? greenCount + greenStartSlot : blueCount + blueStartSlot);
|
||||||
|
|
||||||
|
if (isStarting(serverInfo) && hasEnoughSlots(serverInfo, slotsNeeded) && (free ? greenCount : blueCount) < 3)
|
||||||
|
{
|
||||||
|
ShopItem shopItem = buildShopItem(serverInfo, slotsNeeded);
|
||||||
|
|
||||||
|
if (free)
|
||||||
|
greenCount++;
|
||||||
|
else
|
||||||
|
blueCount++;
|
||||||
|
|
||||||
|
AddButton(slot, shopItem, new JoinServerButton(this, serverInfo));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (free)
|
||||||
|
yellowFreeCount++;
|
||||||
|
else
|
||||||
|
yellowUltraCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// AddItem(11, new ShopItem(Material.IRON_BLOCK, C.cGreen + "Free Servers", new String[] {C.cGray + "Anyone can play!" }, 1, false));
|
||||||
while (yellowCount < 18)
|
// AddItem(15, new ShopItem(Material.IRON_BLOCK, C.cBlue + "Premium Servers", new String[] {C.cGray + "Available to " + Rank.ULTRA.GetTag(true, true) + ChatColor.RESET + C.cGray + " and " + Rank.HERO.GetTag(true, true) + ChatColor.RESET + C.cGray + "!" }, 1, false));
|
||||||
|
|
||||||
|
AddButton(38, new ShopItem(Material.GOLD_BLOCK, C.cGreen + yellowFreeCount + " Games In Progress", new String[]{ChatColor.RESET + C.Line + "Click to Spectate"}, yellowFreeCount > 64 ? 1 : yellowFreeCount, false), new SingleButton()
|
||||||
{
|
{
|
||||||
setItem(yellowCount + 27, null);
|
@Override
|
||||||
yellowCount++;
|
public void Clicked(Player player)
|
||||||
|
{
|
||||||
|
_onMainPage = false;
|
||||||
|
_freeOnly = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AddButton(42, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowUltraCount + " Games In Progress", new String[]{ChatColor.RESET + C.Line + "Click to Spectate"}, yellowUltraCount > 64 ? 1 : yellowUltraCount, false), new SingleButton()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void Clicked(Player player)
|
||||||
|
{
|
||||||
|
_onMainPage = false;
|
||||||
|
_freeOnly = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Clear empty slots
|
||||||
|
for (int i = greenCount + greenStartSlot; i < greenStartSlot + 3; i++)
|
||||||
|
{
|
||||||
|
setItem(i, null);
|
||||||
|
}
|
||||||
|
for (int i = blueCount + blueStartSlot; i < blueStartSlot + 3; i++)
|
||||||
|
{
|
||||||
|
setItem(i, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isStarting(ServerInfo serverInfo)
|
||||||
|
{
|
||||||
|
return (serverInfo.MOTD.contains("Starting") || serverInfo.MOTD.contains("Recruiting") || serverInfo.MOTD.contains("Waiting") || serverInfo.MOTD.contains("Cup"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isInProgress(ServerInfo serverInfo)
|
||||||
|
{
|
||||||
|
return serverInfo.MOTD.contains("In") || serverInfo.MOTD.contains("Restarting");
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasEnoughSlots(ServerInfo serverInfo, int slotsNeeded)
|
||||||
|
{
|
||||||
|
return (serverInfo.MaxPlayers - serverInfo.CurrentPlayers) >= slotsNeeded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildInProgressServerPage(List<ServerInfo> serverList, boolean freeOnly, int slotsNeeded)
|
||||||
|
{
|
||||||
|
int slot = 9;
|
||||||
|
|
||||||
|
for (ServerInfo serverInfo : serverList)
|
||||||
|
{
|
||||||
|
if (isInProgress(serverInfo) && serverInfo.isFree() == freeOnly && slot < getSize())
|
||||||
|
{
|
||||||
|
ShopItem shopItem = buildShopItem(serverInfo, slotsNeeded);
|
||||||
|
|
||||||
|
AddButton(slot, shopItem, new JoinServerButton(this, serverInfo));
|
||||||
|
|
||||||
|
slot++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void Clicked(Player player)
|
||||||
|
{
|
||||||
|
clearPage();
|
||||||
|
_onMainPage = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
while (slot < getSize())
|
||||||
|
{
|
||||||
|
setItem(slot, null);
|
||||||
|
slot++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +277,7 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
|||||||
{
|
{
|
||||||
int slots = Plugin.GetRequiredSlots(player, serverInfo.ServerType);
|
int slots = Plugin.GetRequiredSlots(player, serverInfo.ServerType);
|
||||||
|
|
||||||
if ((serverInfo.Name.contains("BETA") && !Client.GetRank().Has(Rank.ULTRA)) || (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA))))
|
if ((serverInfo.Name.contains("BETA") && !Client.GetRank().Has(Rank.ULTRA)) || (!serverInfo.isFree() && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA))) || (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA))))
|
||||||
{
|
{
|
||||||
PlayDenySound(player);
|
PlayDenySound(player);
|
||||||
return;
|
return;
|
||||||
|
@ -2,12 +2,11 @@ package mineplex.hub.server.ui.button;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import mineplex.core.shop.item.IButton;
|
import mineplex.core.shop.item.SingleButton;
|
||||||
import mineplex.hub.server.ServerInfo;
|
import mineplex.hub.server.ServerInfo;
|
||||||
import mineplex.hub.server.ui.IServerPage;
|
import mineplex.hub.server.ui.IServerPage;
|
||||||
import mineplex.hub.server.ui.ServerNpcPage;
|
|
||||||
|
|
||||||
public class JoinServerButton implements IButton
|
public class JoinServerButton extends SingleButton
|
||||||
{
|
{
|
||||||
private IServerPage _page;
|
private IServerPage _page;
|
||||||
private ServerInfo _serverInfo;
|
private ServerInfo _serverInfo;
|
||||||
@ -17,15 +16,9 @@ public class JoinServerButton implements IButton
|
|||||||
_page = page;
|
_page = page;
|
||||||
_serverInfo = serverInfo;
|
_serverInfo = serverInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void ClickedLeft(Player player)
|
|
||||||
{
|
|
||||||
_page.SelectServer(player, _serverInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ClickedRight(Player player)
|
public void Clicked(Player player)
|
||||||
{
|
{
|
||||||
_page.SelectServer(player, _serverInfo);
|
_page.SelectServer(player, _serverInfo);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user