Enabled snake parkour

Updated servermanager/serverNpcPage to handle free and beta timers.
This commit is contained in:
Jonathan Williams 2014-08-22 22:53:15 -05:00
parent a84468157c
commit 3a47a161c5
4 changed files with 20 additions and 20 deletions

View File

@ -89,7 +89,6 @@ public class ParkourManager extends MiniPlugin
}, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38), }, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38),
new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17))); new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17)));
/*
_parkour.add(new ParkourSnake("Snake Parkour", new String[] _parkour.add(new ParkourSnake("Snake Parkour", new String[]
{ {
"This parkour requires incredible timing", "This parkour requires incredible timing",
@ -97,7 +96,7 @@ public class ParkourManager extends MiniPlugin
"by the devil as a cruel joke!" "by the devil as a cruel joke!"
}, 8000, new Location(Manager.GetSpawn().getWorld(), 22,70,-54), }, 8000, new Location(Manager.GetSpawn().getWorld(), 22,70,-54),
new Location(Manager.GetSpawn().getWorld(), 28,-50,-88), new Location(Manager.GetSpawn().getWorld(), -24,90,-46))); new Location(Manager.GetSpawn().getWorld(), 28,-50,-88), new Location(Manager.GetSpawn().getWorld(), -24,90,-46)));
*/
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5); _lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
_lavaParkourReturn.setYaw(90); _lavaParkourReturn.setYaw(90);

View File

@ -63,6 +63,7 @@ import mineplex.serverdata.MinecraftServer;
public class ServerManager extends MiniPlugin public class ServerManager extends MiniPlugin
{ {
private static final Long FREE_PORTAL_TIMER = 30000L; private static final Long FREE_PORTAL_TIMER = 30000L;
private static final Long BETA_PORTAL_TIMER = 600000L;
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private DonationManager _donationManager; private DonationManager _donationManager;
@ -81,7 +82,7 @@ public class ServerManager extends MiniPlugin
private NautHashMap<Vector, String> _serverPortalLocations = new NautHashMap<Vector, String>(); private NautHashMap<Vector, String> _serverPortalLocations = new NautHashMap<Vector, String>();
// Join Time for Free Players Timer // Join Time for Free Players Timer
private NautHashMap<String, Long> _freeJoinTime = new NautHashMap<String, Long>(); private NautHashMap<String, Long> _joinTime = new NautHashMap<String, Long>();
private QueueShop _domShop; private QueueShop _domShop;
private QuickShop _quickShop; private QuickShop _quickShop;
@ -141,7 +142,7 @@ public class ServerManager extends MiniPlugin
if (!Recharge.Instance.use(player, "Portal Server", 1000, false, false)) if (!Recharge.Instance.use(player, "Portal Server", 1000, false, false))
return; return;
long timeUntilPortal = getMillisecondsUntilPortal(player); long timeUntilPortal = getMillisecondsUntilPortal(player, false);
if (!_hubManager.CanPortal(player) || timeUntilPortal > 0) if (!_hubManager.CanPortal(player) || timeUntilPortal > 0)
{ {
if (timeUntilPortal > 0) if (timeUntilPortal > 0)
@ -240,14 +241,14 @@ public class ServerManager extends MiniPlugin
if (_clientManager.Get(event.getPlayer()).GetRank() == Rank.ALL) if (_clientManager.Get(event.getPlayer()).GetRank() == Rank.ALL)
{ {
_freeJoinTime.put(event.getPlayer().getName(), System.currentTimeMillis()); _joinTime.put(event.getPlayer().getName(), System.currentTimeMillis());
} }
} }
@EventHandler @EventHandler
public void playerQuit(PlayerQuitEvent event) public void playerQuit(PlayerQuitEvent event)
{ {
_freeJoinTime.remove(event.getPlayer().getName()); _joinTime.remove(event.getPlayer().getName());
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
@ -263,20 +264,18 @@ public class ServerManager extends MiniPlugin
} }
} }
public Long getMillisecondsUntilPortal(Player player) public Long getMillisecondsUntilPortal(Player player, boolean beta)
{ {
// Party party = _partyManager.GetParty(player); // Party party = _partyManager.GetParty(player);
long timeLeft = 0; long timeLeft = 0;
if (_freeJoinTime.containsKey(player.getName())) if (_joinTime.containsKey(player.getName()))
{ {
timeLeft = (_freeJoinTime.get(player.getName()) - System.currentTimeMillis()) + FREE_PORTAL_TIMER; timeLeft = (_joinTime.get(player.getName()) - System.currentTimeMillis()) + (beta ? BETA_PORTAL_TIMER : FREE_PORTAL_TIMER);
if (timeLeft <= 0) if (timeLeft <= 0)
{
_freeJoinTime.remove(player.getName());
timeLeft = 0; timeLeft = 0;
} }
}
// if (party != null) // if (party != null)
// { // {

View File

@ -78,18 +78,18 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
} }
} }
private void showClock(long milliseconds) private void showClock(long milliseconds, boolean beta)
{ {
int seconds = (int) (milliseconds / 1000); int seconds = (int) (milliseconds / 1000);
String timeLeft = UtilTime.convertString(milliseconds, 0, UtilTime.TimeUnit.SECONDS); String timeLeft = UtilTime.convertString(milliseconds, 0, UtilTime.TimeUnit.FIT);
byte data = (byte) (milliseconds - (seconds * 1000) > 500 ? 15 : 14); byte data = (byte) (milliseconds - (seconds * 1000) > 500 ? 15 : 14);
ShopItem item = new ShopItem(Material.WOOL, data, ChatColor.RESET + C.Bold + "Free Server Timer", null, new String[] { ShopItem item = new ShopItem(Material.WOOL, data, ChatColor.RESET + C.Bold + (beta ? "Beta" : "Free") + " Server Timer", null, new String[] {
ChatColor.RESET + C.cGreen + timeLeft + " Remaining...", ChatColor.RESET + C.cGreen + timeLeft + " Remaining...",
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + C.cYellow + "Free players must wait a short time", ChatColor.RESET + C.cYellow + "Free players must wait a " + (beta ? "long" : "short") + " time",
ChatColor.RESET + C.cYellow + "to help lighten the load on our servers.", ChatColor.RESET + C.cYellow + "to help lighten the load on our " + (beta ? "Beta" : "") + " servers.",
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + C.cAqua + "Ultra and Hero players have", ChatColor.RESET + C.cAqua + "Ultra and Hero players have",
ChatColor.RESET + C.cAqua + "instant access to our servers!", ChatColor.RESET + C.cAqua + "instant access to our servers!",
@ -186,10 +186,12 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
int greenStartSlot = 18 + ((9 - serversToShow) / 2); int greenStartSlot = 18 + ((9 - serversToShow) / 2);
boolean showGreen = true; boolean showGreen = true;
long portalTime = Plugin.getMillisecondsUntilPortal(Player); boolean beta = serverList.size() > 0 && serverList.get(0).Name.contains("BETA");
long portalTime = Plugin.getMillisecondsUntilPortal(Player, beta);
if (portalTime > 0) if (portalTime > 0)
{ {
showClock(portalTime); showClock(portalTime, beta);
showGreen = false; showGreen = false;
} }

View File

@ -11,6 +11,6 @@ public class HelpDeskManager extends MiniPlugin
{ {
super("Help Desk", plugin); super("Help Desk", plugin);
new ApiGetCall("https://mineplex.jitbit.com/helpdesk/api", "Tickets"); new ApiGetCall("https://mineplex.jitbit.com/helpdesk/api", "Tickets&");
} }
} }