Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
CoderTim 2014-09-22 03:56:16 -04:00
commit acc056d32d
2 changed files with 92 additions and 10 deletions

View File

@ -67,21 +67,25 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
ArrayList<String> lore = new ArrayList<String>(); ArrayList<String> lore = new ArrayList<String>();
lore.add(ChatColor.RESET + "You can find all kinds of rare");
lore.add(ChatColor.RESET + "" + treasureKeyCount + C.cGold + " Treasure Keys"); lore.add(ChatColor.RESET + "and exciting loot inside!");
lore.add(" ");
lore.add(ChatColor.RESET + C.cYellow + "Treasure Chests: " + ChatColor.RESET + treasureChestCount);
lore.add(ChatColor.RESET + C.cYellow + "Treasure Keys: " + ChatColor.RESET + treasureKeyCount);
lore.add(" "); lore.add(" ");
if (treasureChestCount > 0 && treasureKeyCount > 0) if (treasureChestCount > 0 && treasureKeyCount > 0)
{ {
lore.add(ChatColor.RESET + C.cGreen + "Left-Click to open Treasure Chest"); lore.add(ChatColor.RESET + C.cGreen + "Left-Click to open Treasure Chest");
lore.add(ChatColor.RESET + "Uses 1 Treasure Key");
lore.add(ChatColor.RESET + " Uses 1 Treasure Chest"); lore.add(ChatColor.RESET + " Uses 1 Treasure Chest");
lore.add(ChatColor.RESET + " Uses 1 Treasure Key");
} }
else if (treasureChestCount > 0) else if (treasureChestCount > 0)
{ {
lore.add(ChatColor.RESET + C.cRed + "Left-Click to open Treasure Chest"); lore.add(ChatColor.RESET + C.cRed + "Left-Click to open Treasure Chest");
lore.add(ChatColor.RESET + " This requires 1 Treasure Key"); lore.add(ChatColor.RESET + " This requires 1 Treasure Key");
lore.add(ChatColor.RESET + " You do not have any Treasure Keys");
} }
else else
{ {
@ -101,9 +105,10 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
lore.add(ChatColor.RESET + C.cRed + "Right-Click to purchase Treasure Key"); lore.add(ChatColor.RESET + C.cRed + "Right-Click to purchase Treasure Key");
lore.add(ChatColor.RESET + " Costs 1000 Coins"); lore.add(ChatColor.RESET + " Costs 1000 Coins");
lore.add(ChatColor.RESET + " You cannot afford a Treasure Key");
} }
AddButton(4, new ShopItem(Material.CHEST, ChatColor.RESET + "" + treasureChestCount + C.cGold + " Treasure Chests", lore.toArray(new String[0]), 1, false), new TreasureButton(this, treasureChestCount > 0, treasureKeyCount > 0, canPurchaseKey)); AddButton(4, new ShopItem(Material.CHEST, ChatColor.RESET + C.cGreen + C.Bold + "Treasure Chest", lore.toArray(new String[0]), 1, false), new TreasureButton(this, treasureChestCount > 0, treasureKeyCount > 0, canPurchaseKey));
final GemBooster gemBoosterItem = new GemBooster(Shop.getBoosterEnabled(), Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster")); final GemBooster gemBoosterItem = new GemBooster(Shop.getBoosterEnabled(), Plugin.getInventoryManager().Get(Player).getItemCount("Gem Booster"));

View File

@ -0,0 +1,77 @@
package nautilus.game.arcade.managers;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.stats.StatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
public class GameStatManager implements Listener
{
ArcadeManager Manager;
public GameStatManager(ArcadeManager manager)
{
Manager = manager;
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
}
@EventHandler
public void StatEnableDisable(GameStateChangeEvent event)
{
if (!Manager.IsRewardStats())
return;
if (event.GetState() != GameState.Live)
return;
int requirement = (int)((double)event.GetGame().Manager.GetPlayerFull() * 0.75d);
event.GetGame().CanAddStats = (double)event.GetGame().GetPlayers(true).size() >= requirement;
if (!event.GetGame().CanAddStats)
event.GetGame().Announce(C.Bold + "Stats/Achievements Disabled. Requires " + requirement + " Players.");
}
@EventHandler
public void StatRegister(GameStateChangeEvent event)
{
if (!Manager.IsRewardStats())
return;
if (event.GetState() != GameState.Dead)
return;
for (Player player : event.GetGame().GetStats().keySet())
{
for (String stat : event.GetGame().GetStats().get(player).keySet())
{
Manager.GetStatsManager().incrementStat(player, stat, event.GetGame().GetStats().get(player).get(stat));
}
}
}
@EventHandler
public void StatGameRecord(GameStateChangeEvent event)
{
if (event.GetState() == GameState.End)
{
for (StatTracker tracker : event.GetGame().getStatTrackers())
HandlerList.unregisterAll(tracker);
if (event.GetGame().CanAddStats)
{
Manager.saveBasicStats(event.GetGame());
if (Manager.IsTournamentServer())
Manager.saveLeaderboardStats(event.GetGame());
}
}
}
}