From affc9eeb9c14f41887ea888998bab2ea805631ef Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 22 Nov 2013 14:17:00 -0800 Subject: [PATCH] Added inventory click for creative users in Hub Added Ultra/Survival games beta stuff do servernpcpage --- .../src/mineplex/hub/HubManager.java | 3 +- .../mineplex/hub/server/ui/ServerNpcPage.java | 31 +++++++++++++++---- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index fc3caf2bd..7ce6291ed 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -368,7 +368,8 @@ public class HubManager extends MiniClientPlugin @EventHandler public void InventoryCancel(InventoryClickEvent event) { - event.setCancelled(true); + if (event.getWhoClicked() instanceof Player && ((Player)event.getWhoClicked()).getGameMode() != GameMode.CREATIVE) + event.setCancelled(true); } @EventHandler diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java index 82047ffc7..d0517a119 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java @@ -67,6 +67,7 @@ public class ServerNpcPage extends ShopPageBase im for (ServerInfo serverInfo : serverList) { + boolean ownsUltraPackage = DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA); String inProgress = (serverInfo.Game == null || serverInfo.ServerType.equalsIgnoreCase("Competitive")) ? (ChatColor.RESET + C.Line + "Game in progress.") : (ChatColor.RESET + C.Line + "Click to spectate"); String inProgressLine2 = (serverInfo.Game == null || serverInfo.ServerType.equalsIgnoreCase("Competitive")) ? null : (ChatColor.RESET + C.Line + "and wait for next game!"); @@ -97,13 +98,31 @@ public class ServerNpcPage extends ShopPageBase im if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers) { - if (!Client.GetRank().Has(Rank.ULTRA)) - lore.add(openFull); + if (!serverInfo.Game.equalsIgnoreCase("Survival Games")) + { + lore.add(ChatColor.RESET + C.Line + "Full Survival Games servers"); + lore.add(ChatColor.RESET + C.Line + "cannot be joined."); + } else - lore.add(openFullUltra); + { + if (!ownsUltraPackage) + lore.add(openFull); + else + lore.add(openFullUltra); + } } else - lore.add(ChatColor.RESET + C.Line + "Click to join!"); + { + if (serverInfo.Game.contains("Beta")) + { + if (ownsUltraPackage) + lore.add(ChatColor.RESET + C.Line + "Click to join!"); + else + lore.add(ChatColor.RESET + C.Line + "Only Ultras can play games in Beta!"); + } + else + lore.add(ChatColor.RESET + C.Line + "Click to join!"); + } greenCount++; } @@ -134,7 +153,7 @@ public class ServerNpcPage extends ShopPageBase im } else if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers) { - if (!Client.GetRank().Has(Rank.ULTRA)) + if (!Client.GetRank().Has(Rank.ULTRA) || ownsUltraPackage) lore.add(openFull); else { @@ -183,7 +202,7 @@ public class ServerNpcPage extends ShopPageBase im { int slots = Plugin.GetRequiredSlots(player, serverInfo.ServerType); - if (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots) + if (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA))) { PlayDenySound(player); return;