Merge branch 'OldServerSelector'
This commit is contained in:
commit
b2116cc7e8
@ -86,7 +86,6 @@ public class ServerManager extends MiniPlugin
|
|||||||
|
|
||||||
private NautHashMap<String, Long> _queueCooldowns = new NautHashMap<String, Long>();
|
private NautHashMap<String, Long> _queueCooldowns = new NautHashMap<String, Long>();
|
||||||
private NautHashMap<String, HashSet<ServerInfo>> _serverKeyInfoMap = new NautHashMap<String, HashSet<ServerInfo>>();
|
private NautHashMap<String, HashSet<ServerInfo>> _serverKeyInfoMap = new NautHashMap<String, HashSet<ServerInfo>>();
|
||||||
private NautHashMap<String, String> _serverKeyTagMap = new NautHashMap<String, String>();
|
|
||||||
private NautHashMap<String, Integer> _serverPlayerCounts = new NautHashMap<String, Integer>();
|
private NautHashMap<String, Integer> _serverPlayerCounts = new NautHashMap<String, Integer>();
|
||||||
private NautHashMap<String, ServerNpcShop> _serverNpcShopMap = new NautHashMap<String, ServerNpcShop>();
|
private NautHashMap<String, ServerNpcShop> _serverNpcShopMap = new NautHashMap<String, ServerNpcShop>();
|
||||||
private NautHashMap<String, ServerInfo> _serverInfoMap = new NautHashMap<String, ServerInfo>();
|
private NautHashMap<String, ServerInfo> _serverInfoMap = new NautHashMap<String, ServerInfo>();
|
||||||
@ -189,13 +188,13 @@ public class ServerManager extends MiniPlugin
|
|||||||
|
|
||||||
if (serverName != null)
|
if (serverName != null)
|
||||||
{
|
{
|
||||||
List<ServerInfo> serverList = new ArrayList<ServerInfo>(GetServerList(serverName));
|
List<ServerInfo> serverList = new ArrayList<ServerInfo>(getServerList(serverName));
|
||||||
|
|
||||||
int slots = 1;
|
int slots = 1;
|
||||||
|
|
||||||
if (serverList.size() > 0)
|
if (serverList.size() > 0)
|
||||||
{
|
{
|
||||||
slots = GetRequiredSlots(player, serverList.get(0).ServerType);
|
slots = getRequiredSlots(player, serverList.get(0).ServerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -206,7 +205,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
if ((serverInfo.MOTD.contains("Starting") || serverInfo.MOTD.contains("Recruiting") || serverInfo.MOTD.contains("Waiting") || serverInfo.MOTD.contains("Cup")) && (serverInfo.MaxPlayers - serverInfo.CurrentPlayers) >= slots)
|
if ((serverInfo.MOTD.contains("Starting") || serverInfo.MOTD.contains("Recruiting") || serverInfo.MOTD.contains("Waiting") || serverInfo.MOTD.contains("Cup")) && (serverInfo.MaxPlayers - serverInfo.CurrentPlayers) >= slots)
|
||||||
{
|
{
|
||||||
SelectServer(player, serverInfo);
|
selectServer(player, serverInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,7 +291,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
return timeLeft;
|
return timeLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveServer(String serverName)
|
public void removeServer(String serverName)
|
||||||
{
|
{
|
||||||
for (String key : _serverKeyInfoMap.keySet())
|
for (String key : _serverKeyInfoMap.keySet())
|
||||||
{
|
{
|
||||||
@ -304,19 +303,15 @@ public class ServerManager extends MiniPlugin
|
|||||||
|
|
||||||
public void addServerGroup(ServerGroup serverGroup)
|
public void addServerGroup(ServerGroup serverGroup)
|
||||||
{
|
{
|
||||||
_serverKeyInfoMap.put(serverGroup.getName(), new HashSet<ServerInfo>());
|
_serverKeyInfoMap.put(serverGroup.getPrefix(), new HashSet<ServerInfo>());
|
||||||
_serverKeyTagMap.put(serverGroup.getPrefix(), serverGroup.getName());
|
|
||||||
|
|
||||||
if (!serverGroup.getServerNpcName().isEmpty())
|
|
||||||
_serverKeyTagMap.put(serverGroup.getServerNpcName(), serverGroup.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddServerNpc(ServerGroup serverGroup)
|
public void addServerNpc(ServerGroup serverGroup)
|
||||||
{
|
{
|
||||||
_serverNpcShopMap.put(serverGroup.getServerNpcName(), new ServerNpcShop(this, _clientManager, _donationManager, serverGroup));
|
_serverNpcShopMap.put(serverGroup.getServerNpcName(), new ServerNpcShop(this, _clientManager, _donationManager, serverGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveServerNpc(String serverNpcName)
|
public void removeServerNpc(String serverNpcName)
|
||||||
{
|
{
|
||||||
Set<ServerInfo> mappedServers = _serverKeyInfoMap.remove(serverNpcName);
|
Set<ServerInfo> mappedServers = _serverKeyInfoMap.remove(serverNpcName);
|
||||||
_serverNpcShopMap.remove(serverNpcName);
|
_serverNpcShopMap.remove(serverNpcName);
|
||||||
@ -348,22 +343,23 @@ public class ServerManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ServerInfo> GetServerList(String serverNpcName)
|
public Collection<ServerInfo> getServerList(String serverNpcName)
|
||||||
{
|
{
|
||||||
|
System.out.println("contains?" + _serverKeyInfoMap.containsKey(serverNpcName));
|
||||||
return _serverKeyInfoMap.get(serverNpcName);
|
return _serverKeyInfoMap.get(serverNpcName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> GetAllServers()
|
public Set<String> getAllServers()
|
||||||
{
|
{
|
||||||
return _serverInfoMap.keySet();
|
return _serverInfoMap.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServerInfo GetServerInfo(String serverName)
|
public ServerInfo getServerInfo(String serverName)
|
||||||
{
|
{
|
||||||
return _serverInfoMap.get(serverName);
|
return _serverInfoMap.get(serverName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean HasServerNpc(String serverNpcName)
|
public boolean hasServerNpc(String serverNpcName)
|
||||||
{
|
{
|
||||||
return _serverKeyInfoMap.containsKey(serverNpcName);
|
return _serverKeyInfoMap.containsKey(serverNpcName);
|
||||||
}
|
}
|
||||||
@ -449,9 +445,9 @@ public class ServerManager extends MiniPlugin
|
|||||||
|
|
||||||
_serverUpdate.put(serverStatus.getName(), System.currentTimeMillis());
|
_serverUpdate.put(serverStatus.getName(), System.currentTimeMillis());
|
||||||
|
|
||||||
if (_serverKeyTagMap.containsKey(tag))
|
if (_serverKeyInfoMap.containsKey(tag))
|
||||||
{
|
{
|
||||||
_serverKeyInfoMap.get(_serverKeyTagMap.get(tag)).add(serverInfo);
|
_serverKeyInfoMap.get(tag).add(serverInfo);
|
||||||
|
|
||||||
if (!_serverPlayerCounts.containsKey(tag))
|
if (!_serverPlayerCounts.containsKey(tag))
|
||||||
_serverPlayerCounts.put(tag, 0);
|
_serverPlayerCounts.put(tag, 0);
|
||||||
@ -484,7 +480,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
updateCooldowns();
|
updateCooldowns();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Help(Player caller, String message)
|
public void help(Player caller, String message)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main(_moduleName, "Commands List:"));
|
UtilPlayer.message(caller, F.main(_moduleName, "Commands List:"));
|
||||||
UtilPlayer.message(caller, F.help("/servernpc create <name>", "<name> is name of npc.", Rank.OWNER));
|
UtilPlayer.message(caller, F.help("/servernpc create <name>", "<name> is name of npc.", Rank.OWNER));
|
||||||
@ -499,9 +495,9 @@ public class ServerManager extends MiniPlugin
|
|||||||
UtilPlayer.message(caller, F.main(_moduleName, ChatColor.RED + message));
|
UtilPlayer.message(caller, F.main(_moduleName, ChatColor.RED + message));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Help(Player caller)
|
public void help(Player caller)
|
||||||
{
|
{
|
||||||
Help(caller, null);
|
help(caller, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PartyManager getPartyManager()
|
public PartyManager getPartyManager()
|
||||||
@ -509,7 +505,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
return _partyManager;
|
return _partyManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectServer(org.bukkit.entity.Player player, ServerInfo serverInfo)
|
public void selectServer(org.bukkit.entity.Player player, ServerInfo serverInfo)
|
||||||
{
|
{
|
||||||
Party party = _partyManager.GetParty(player);
|
Party party = _partyManager.GetParty(player);
|
||||||
|
|
||||||
@ -539,7 +535,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
|
|
||||||
if (bestServer != null)
|
if (bestServer != null)
|
||||||
{
|
{
|
||||||
SelectServer(player, bestServer);
|
selectServer(player, bestServer);
|
||||||
addCooldown(player);
|
addCooldown(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -580,12 +576,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
*/
|
*/
|
||||||
public ServerInfo getBestServer(Player player, String serverKey)
|
public ServerInfo getBestServer(Player player, String serverKey)
|
||||||
{
|
{
|
||||||
if (_serverKeyTagMap.containsKey(serverKey)) // Update key to full-name if a tag pair exists
|
Collection<ServerInfo> serverList = getServerList(serverKey);
|
||||||
{
|
|
||||||
serverKey = _serverKeyTagMap.get(serverKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
Collection<ServerInfo> serverList = GetServerList(serverKey);
|
|
||||||
if (serverList == null) return null;
|
if (serverList == null) return null;
|
||||||
|
|
||||||
List<ServerInfo> servers = new ArrayList<ServerInfo>(serverList);
|
List<ServerInfo> servers = new ArrayList<ServerInfo>(serverList);
|
||||||
@ -616,7 +607,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
public List<ServerInfo> fetchOpenServers(Player player, List<ServerInfo> servers, int count)
|
public List<ServerInfo> fetchOpenServers(Player player, List<ServerInfo> servers, int count)
|
||||||
{
|
{
|
||||||
List<ServerInfo> results = new ArrayList<ServerInfo>();
|
List<ServerInfo> results = new ArrayList<ServerInfo>();
|
||||||
int requiredSlots = (servers.size() > 0) ? GetRequiredSlots(player, servers.get(0).ServerType) : 0;
|
int requiredSlots = (servers.size() > 0) ? getRequiredSlots(player, servers.get(0).ServerType) : 0;
|
||||||
|
|
||||||
for (ServerInfo server : servers)
|
for (ServerInfo server : servers)
|
||||||
{
|
{
|
||||||
@ -639,7 +630,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
return serverInfo.MOTD.contains("Progress") || serverInfo.MOTD.contains("Restarting");
|
return serverInfo.MOTD.contains("Progress") || serverInfo.MOTD.contains("Restarting");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ListServerNpcs(Player caller)
|
public void listServerNpcs(Player caller)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main(getName(), "Listing Server Npcs:"));
|
UtilPlayer.message(caller, F.main(getName(), "Listing Server Npcs:"));
|
||||||
|
|
||||||
@ -649,7 +640,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ListServers(Player caller, String serverNpcName)
|
public void listServers(Player caller, String serverNpcName)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main(getName(), "Listing Servers for '" + serverNpcName + "':"));
|
UtilPlayer.message(caller, F.main(getName(), "Listing Servers for '" + serverNpcName + "':"));
|
||||||
|
|
||||||
@ -659,7 +650,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ListOfflineServers(Player caller)
|
public void listOfflineServers(Player caller)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main(getName(), "Listing Offline Servers:"));
|
UtilPlayer.message(caller, F.main(getName(), "Listing Offline Servers:"));
|
||||||
|
|
||||||
@ -681,8 +672,6 @@ public class ServerManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
_serverKeyInfoMap.get(npcName).clear();
|
_serverKeyInfoMap.get(npcName).clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
_serverKeyTagMap.clear();
|
|
||||||
|
|
||||||
Region region = getPlugin().getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU;
|
Region region = getPlugin().getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU;
|
||||||
|
|
||||||
@ -693,7 +682,7 @@ public class ServerManager extends MiniPlugin
|
|||||||
addServerGroup(serverGroup);
|
addServerGroup(serverGroup);
|
||||||
|
|
||||||
if (!serverGroup.getServerNpcName().isEmpty())
|
if (!serverGroup.getServerNpcName().isEmpty())
|
||||||
AddServerNpc(serverGroup);
|
addServerNpc(serverGroup);
|
||||||
|
|
||||||
if (!serverGroup.getPortalBottomCornerLocation().isEmpty() && !serverGroup.getPortalTopCornerLocation().isEmpty())
|
if (!serverGroup.getPortalBottomCornerLocation().isEmpty() && !serverGroup.getPortalTopCornerLocation().isEmpty())
|
||||||
{
|
{
|
||||||
@ -729,13 +718,13 @@ public class ServerManager extends MiniPlugin
|
|||||||
ServerGroup eventGroup = new ServerGroup("Event", "Event Servers", "EVENT");
|
ServerGroup eventGroup = new ServerGroup("Event", "Event Servers", "EVENT");
|
||||||
ServerGroup mpsGroup = new ServerGroup("MPS", "Mineplex Player Servers", "MPS");
|
ServerGroup mpsGroup = new ServerGroup("MPS", "Mineplex Player Servers", "MPS");
|
||||||
|
|
||||||
AddServerNpc(eventGroup);
|
addServerNpc(eventGroup);
|
||||||
addServerGroup(eventGroup);
|
addServerGroup(eventGroup);
|
||||||
AddServerNpc(mpsGroup);
|
addServerNpc(mpsGroup);
|
||||||
addServerGroup(mpsGroup);
|
addServerGroup(mpsGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetRequiredSlots(Player player, String serverType)
|
public int getRequiredSlots(Player player, String serverType)
|
||||||
{
|
{
|
||||||
int slots = 0;
|
int slots = 0;
|
||||||
|
|
||||||
@ -772,6 +761,18 @@ public class ServerManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
return _serverNpcShopMap.get("Mixed Arcade");
|
return _serverNpcShopMap.get("Mixed Arcade");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ServerNpcShop getServerNPCShopByName(String name)
|
||||||
|
{
|
||||||
|
for(String shop : _serverNpcShopMap.keySet())
|
||||||
|
{
|
||||||
|
if(shop.equalsIgnoreCase(name))
|
||||||
|
{
|
||||||
|
return _serverNpcShopMap.get(shop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public ServerNpcShop getSuperSmashMobsShop()
|
public ServerNpcShop getSuperSmashMobsShop()
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ public class LobbyMenu extends ShopPageBase<ServerManager, LobbyShop> implements
|
|||||||
@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));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ public class LobbyMenu extends ShopPageBase<ServerManager, LobbyShop> implements
|
|||||||
@Override
|
@Override
|
||||||
public void SelectServer(org.bukkit.entity.Player player, ServerInfo serverInfo)
|
public void SelectServer(org.bukkit.entity.Player player, ServerInfo serverInfo)
|
||||||
{
|
{
|
||||||
int slots = getPlugin().GetRequiredSlots(player, serverInfo.ServerType);
|
int slots = getPlugin().getRequiredSlots(player, serverInfo.ServerType);
|
||||||
|
|
||||||
if (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots)
|
if (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots)
|
||||||
{
|
{
|
||||||
@ -107,6 +107,6 @@ public class LobbyMenu extends ShopPageBase<ServerManager, LobbyShop> implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlugin().SelectServer(player, serverInfo);
|
getPlugin().selectServer(player, serverInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
|||||||
ChatColor.RESET + "fight others to be the last man standing. ",
|
ChatColor.RESET + "fight others to be the last man standing. ",
|
||||||
ChatColor.RESET + "Stay away from the borders!",
|
ChatColor.RESET + "Stay away from the borders!",
|
||||||
ChatColor.RESET + "",
|
ChatColor.RESET + "",
|
||||||
ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("HG") + ChatColor.RESET + " other players!",
|
ChatColor.RESET + "Join " + ChatColor.GREEN + (getPlugin().getGroupTagPlayerCount("HG") + getPlugin().getGroupTagPlayerCount("SG2")) + ChatColor.RESET + " other players!",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
setItem(4, ItemStackFactory.Instance.CreateStack(Material.FEATHER.getId(), (byte) 0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Skywars " + C.cGray + "Solo/Team Survival", new String[]
|
setItem(4, ItemStackFactory.Instance.CreateStack(Material.FEATHER.getId(), (byte) 0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Skywars " + C.cGray + "Solo/Team Survival", new String[]
|
||||||
@ -83,7 +83,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
|||||||
ChatColor.RESET + "Way up there, death ever looming if you fall..",
|
ChatColor.RESET + "Way up there, death ever looming if you fall..",
|
||||||
ChatColor.RESET + "Can you fight? Can you live? Can you win Skywars?",
|
ChatColor.RESET + "Can you fight? Can you live? Can you win Skywars?",
|
||||||
ChatColor.RESET + "",
|
ChatColor.RESET + "",
|
||||||
ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("SKY") + ChatColor.RESET + " other players!",
|
ChatColor.RESET + "Join " + ChatColor.GREEN + (getPlugin().getGroupTagPlayerCount("SKY") + getPlugin().getGroupTagPlayerCount("SKY2")) + ChatColor.RESET + " other players!",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
setItem(6, ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "UHC " + C.cGray + "Ultra Hardcore Mode", new String[]
|
setItem(6, ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE.getId(), (byte)0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "UHC " + C.cGray + "Ultra Hardcore Mode", new String[]
|
||||||
@ -453,7 +453,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
|||||||
ChatColor.RESET + "then battle other players to the ",
|
ChatColor.RESET + "then battle other players to the ",
|
||||||
ChatColor.RESET + "death with your monsters skills!",
|
ChatColor.RESET + "death with your monsters skills!",
|
||||||
ChatColor.RESET + "",
|
ChatColor.RESET + "",
|
||||||
ChatColor.RESET + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("SSM") + ChatColor.RESET + " other players!",
|
ChatColor.RESET + "Join " + ChatColor.GREEN + (getPlugin().getGroupTagPlayerCount("SSM") + getPlugin().getGroupTagPlayerCount("SSM2")) + ChatColor.RESET + " other players!",
|
||||||
};
|
};
|
||||||
|
|
||||||
_superSmashCycle.add(ItemStackFactory.Instance.CreateStack(397, (byte)4, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch", desc));
|
_superSmashCycle.add(ItemStackFactory.Instance.CreateStack(397, (byte)4, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Super Smash Mobs " + C.cGray + "Solo/Team Deathmatch", desc));
|
||||||
|
@ -37,14 +37,14 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
|||||||
private static final String MESSAGE_FULL_GET_ULTRA = ChatColor.RESET + C.Line + "Get Ultra to join full servers!";
|
private static final String MESSAGE_FULL_GET_ULTRA = ChatColor.RESET + C.Line + "Get Ultra to join full servers!";
|
||||||
private static final String MESSAGE_RESTARTING = ChatColor.RESET + C.Line + "This server will be open shortly!";
|
private static final String MESSAGE_RESTARTING = ChatColor.RESET + C.Line + "This server will be open shortly!";
|
||||||
|
|
||||||
private String _serverNpcKey;
|
private String _serverGroupName;
|
||||||
private boolean _onMainPage = true;
|
private boolean _onMainPage = true;
|
||||||
|
|
||||||
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 serverGroupName)
|
||||||
{
|
{
|
||||||
super(plugin, shop, clientManager, donationManager, name, player, 54);
|
super(plugin, shop, clientManager, donationManager, name, player, 54);
|
||||||
|
|
||||||
_serverNpcKey = serverNpcKey;
|
_serverGroupName = serverGroupName;
|
||||||
|
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
@ -52,13 +52,16 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
|||||||
@Override
|
@Override
|
||||||
protected void buildPage()
|
protected void buildPage()
|
||||||
{
|
{
|
||||||
List<ServerInfo> serverList = new ArrayList<ServerInfo>(getPlugin().GetServerList(_serverNpcKey));
|
System.out.println(_serverGroupName);
|
||||||
|
System.out.println("getPlugin() null?" + (getPlugin() == null));
|
||||||
|
List<ServerInfo> serverList = new ArrayList<ServerInfo>(getPlugin().getServerList(_serverGroupName));
|
||||||
|
|
||||||
int slotsNeeded = 1;
|
int slotsNeeded = 1;
|
||||||
|
|
||||||
|
|
||||||
if (serverList.size() > 0)
|
if (serverList.size() > 0)
|
||||||
{
|
{
|
||||||
slotsNeeded = getPlugin().GetRequiredSlots(getPlayer(), serverList.get(0).ServerType);
|
slotsNeeded = getPlugin().getRequiredSlots(getPlayer(), serverList.get(0).ServerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -73,6 +76,13 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
|||||||
|
|
||||||
if (_onMainPage)
|
if (_onMainPage)
|
||||||
{
|
{
|
||||||
|
addButton(4, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BLOCK, (byte) 0, 1, C.cGreen + "Click to Join instantly!"), new IButton() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(Player player, ClickType clickType) {
|
||||||
|
getPlugin().selectServer(player, _serverGroupName);
|
||||||
|
}
|
||||||
|
});
|
||||||
buildAvailableServerPage(serverList, slotsNeeded);
|
buildAvailableServerPage(serverList, slotsNeeded);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -401,7 +411,7 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
|||||||
|
|
||||||
public void SelectServer(Player player, ServerInfo serverInfo)
|
public void SelectServer(Player player, ServerInfo serverInfo)
|
||||||
{
|
{
|
||||||
int slots = getPlugin().GetRequiredSlots(player, serverInfo.ServerType);
|
int slots = getPlugin().getRequiredSlots(player, serverInfo.ServerType);
|
||||||
|
|
||||||
if (serverInfo.getAvailableSlots() < slots && !(getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || getClient().GetRank().Has(Rank.ULTRA)))
|
if (serverInfo.getAvailableSlots() < slots && !(getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || getClient().GetRank().Has(Rank.ULTRA)))
|
||||||
{
|
{
|
||||||
@ -409,6 +419,6 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlugin().SelectServer(player, serverInfo);
|
getPlugin().selectServer(player, serverInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,13 +27,13 @@ public class ServerNpcShop extends ShopBase<ServerManager>
|
|||||||
@Override
|
@Override
|
||||||
protected ShopPageBase<ServerManager, ? extends ShopBase<ServerManager>> buildPagesFor(Player player)
|
protected ShopPageBase<ServerManager, ? extends ShopBase<ServerManager>> buildPagesFor(Player player)
|
||||||
{
|
{
|
||||||
if (_serverGroup.getPrefix().equalsIgnoreCase("MPS") || _serverGroup.getPrefix().equalsIgnoreCase("EVENT"))
|
if (_serverGroup.getPrefix().equalsIgnoreCase("SSM") || _serverGroup.getPrefix().equalsIgnoreCase("SKY") || _serverGroup.getPrefix().equalsIgnoreCase("HG"))
|
||||||
{
|
{
|
||||||
return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix());
|
return new ServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return new ServerTypePage(getPlugin(), this, getClientManager(), getDonationManager(), player, _serverGroup);
|
return new ServerNpcPage(getPlugin(), this, getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ public class ServerNpcShop extends ShopBase<ServerManager>
|
|||||||
getPlugin().getHubManager().GetVisibility().removeHiddenPlayer(player);
|
getPlugin().getHubManager().GetVisibility().removeHiddenPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/*@Override
|
||||||
public boolean attemptShopOpen(Player player)
|
public boolean attemptShopOpen(Player player)
|
||||||
{
|
{
|
||||||
if (_serverGroup.getTeamServerKey().isEmpty() && !_serverGroup.getPrefix().equalsIgnoreCase("EVENT") && !_serverGroup.getPrefix().equalsIgnoreCase("MPS")) // Has no team server key, so auto-join
|
if (_serverGroup.getTeamServerKey().isEmpty() && !_serverGroup.getPrefix().equalsIgnoreCase("EVENT") && !_serverGroup.getPrefix().equalsIgnoreCase("MPS")) // Has no team server key, so auto-join
|
||||||
@ -89,5 +89,5 @@ public class ServerNpcShop extends ShopBase<ServerManager>
|
|||||||
}
|
}
|
||||||
|
|
||||||
return super.attemptShopOpen(player);
|
return super.attemptShopOpen(player);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
@ -80,11 +80,14 @@ public class ServerTypePage extends ShopPageBase<ServerManager, ServerNpcShop>
|
|||||||
{
|
{
|
||||||
if (team)
|
if (team)
|
||||||
{
|
{
|
||||||
getPlugin().selectServer(player, _serverGroup.getTeamServerKey()); // TODO: Grab the team-key instead of regular game key
|
//getPlugin().selectServer(player, _serverGroup.getTeamServerKey()); // TODO: Grab the team-key instead of regular game key
|
||||||
|
//getPlugin().getServerNPCShopByName(_serverGroup.getServerNpcName() + " 2").attemptShopOpen(player);
|
||||||
|
getShop().openPageForPlayer(player, new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getTeamServerKey()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getPlugin().selectServer(player, _serverGroup.getPrefix());
|
//getPlugin().selectServer(player, _serverGroup.getPrefix());
|
||||||
|
getShop().openPageForPlayer(player, new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), _serverGroup.getServerNpcName(), player, _serverGroup.getPrefix()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user