More achievement gui changes
This commit is contained in:
parent
86930de23e
commit
2e0b074053
@ -12,104 +12,129 @@ public enum AchievementCategory
|
||||
{
|
||||
GLOBAL("Global",
|
||||
new String[] { "GemsEarned" },
|
||||
Material.BED, 0),
|
||||
new String[] { "Gems Earned" },
|
||||
Material.BED, 0, GameCategory.GLOBAL),
|
||||
|
||||
//Survival
|
||||
BRIDGES("The Bridges",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.IRON_PICKAXE, 0),
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
|
||||
Material.IRON_PICKAXE, 0, GameCategory.SURVIVAL),
|
||||
|
||||
SURVIVAL_GAMES("Survival Games",
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" },
|
||||
Material.IRON_SWORD, 0),
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
|
||||
Material.IRON_SWORD, 0, GameCategory.SURVIVAL),
|
||||
|
||||
UHC("Ultra Hardcore",
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" },
|
||||
Material.GOLD_INGOT, 0),
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
|
||||
Material.GOLD_INGOT, 0, GameCategory.SURVIVAL),
|
||||
|
||||
//Classics
|
||||
SMASH_MOBS("Super Smash Mobs",
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" },
|
||||
Material.SKULL_ITEM, 4),
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
|
||||
Material.SKULL_ITEM, 0, GameCategory.CLASSICS),
|
||||
|
||||
BLOCK_HUNT("Block Hunt",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.DIRT, 0),
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.DIRT, 0, GameCategory.CLASSICS),
|
||||
|
||||
DRAW_MY_THING("Draw My Thing",
|
||||
new String[] {"Wins", "Losses", "GemsEarned"},
|
||||
Material.BOOK_AND_QUILL, 0),
|
||||
new String[] {"Wins", "Losses", "GemsEarned"},
|
||||
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS),
|
||||
|
||||
CASTLE_SIEGE("Castle Siege",
|
||||
new String[] {"Wins", "Losses", "Kills as Defenders", "Deaths as Defenders", "Kills as Undead", "Deaths as Undead", "GemsEarned"},
|
||||
Material.DIAMOND_CHESTPLATE, 0),
|
||||
new String[] {"Wins", "Losses", "Kills as Defenders", "Deaths as Defenders", "Kills as Undead", "Deaths as Undead", "Gems Earned"},
|
||||
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS),
|
||||
|
||||
//Champions
|
||||
DOMINATE("Dominate",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.BEACON, 0),
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.BEACON, 0, GameCategory.CHAMPIONS),
|
||||
|
||||
TEAM_DEATHMATCH("Team Deathmatch",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.GOLD_SWORD, 0),
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.GOLD_SWORD, 0, GameCategory.CHAMPIONS),
|
||||
|
||||
//Arcade
|
||||
DRAGONS("Dragons",
|
||||
new String[] {"Wins", "Losses", "GemsEarned"},
|
||||
Material.ENDER_STONE, 0),
|
||||
new String[] {"Wins", "Losses", "Gems Earned"},
|
||||
Material.ENDER_STONE, 0, GameCategory.ARCADE),
|
||||
|
||||
DRAGON_ESCAPE("Dragon Escape",
|
||||
new String[] {"Wins", "Losses", "GemsEarned"},
|
||||
Material.DRAGON_EGG, 0),
|
||||
new String[] {"Wins", "Losses", "Gems Earned"},
|
||||
Material.DRAGON_EGG, 0, GameCategory.ARCADE),
|
||||
|
||||
SHEEP_QUEST("Sheep Quest",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.WOOL, 0),
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.WOOL, 0, GameCategory.ARCADE),
|
||||
|
||||
SNEAKY_ASSASSINS("Sneaky Assassins",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.INK_SACK, 0),
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.INK_SACK, 0, GameCategory.ARCADE),
|
||||
|
||||
ONE_IN_THE_QUIVER("One in the Quiver",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.BOW, 0),
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.BOW, 0, GameCategory.ARCADE),
|
||||
|
||||
SUPER_PAINTBALL("Super Paintball",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.ENDER_PEARL, 0),
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.ENDER_PEARL, 0, GameCategory.ARCADE),
|
||||
|
||||
TURF_WARS("Turf Wars",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.HARD_CLAY, 14),
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.HARD_CLAY, 14, GameCategory.ARCADE),
|
||||
|
||||
RUNNER("Runner",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.LEATHER_BOOTS, 0),
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.LEATHER_BOOTS, 0, GameCategory.ARCADE),
|
||||
|
||||
SPLEEF("Super Spleef",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.IRON_SPADE, 0),
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.IRON_SPADE, 0, GameCategory.ARCADE),
|
||||
|
||||
DEATH_TAG("Death Tag",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.SKULL_ITEM, 0),
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.SKULL_ITEM, 0, GameCategory.ARCADE),
|
||||
|
||||
BACON_BRAWL("Bacon Brawl",
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
Material.PORK, 0);
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.PORK, 0, GameCategory.ARCADE);
|
||||
|
||||
|
||||
private String _name;
|
||||
private String[] _statsToDisplay;
|
||||
private String[] _friendlyStatNames;
|
||||
private Material _icon;
|
||||
private GameCategory _gameCategory;
|
||||
private byte _iconData;
|
||||
|
||||
AchievementCategory(String name, String[] statsToDisplay, Material icon, int iconData)
|
||||
AchievementCategory(String name, String[] statsToDisplay, String[] friendlyStatNames, Material icon, int iconData, GameCategory gameCategory)
|
||||
{
|
||||
_name = name;
|
||||
_statsToDisplay = statsToDisplay;
|
||||
_friendlyStatNames = friendlyStatNames;
|
||||
_icon = icon;
|
||||
_iconData = (byte)iconData;
|
||||
_gameCategory = gameCategory;
|
||||
}
|
||||
|
||||
public String getFriendlyName()
|
||||
@ -131,4 +156,19 @@ public enum AchievementCategory
|
||||
{
|
||||
return _iconData;
|
||||
}
|
||||
|
||||
public GameCategory getGameCategory()
|
||||
{
|
||||
return _gameCategory;
|
||||
}
|
||||
|
||||
public String[] getFriendlyStatNames()
|
||||
{
|
||||
return _friendlyStatNames;
|
||||
}
|
||||
|
||||
public static enum GameCategory
|
||||
{
|
||||
GLOBAL, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class AchievementShop extends ShopBase<AchievementManager>
|
||||
|
||||
protected ShopPageBase<AchievementManager, ? extends ShopBase<AchievementManager>> BuildPagesFor(Player player, Player target)
|
||||
{
|
||||
return new AchievementMainPage(Plugin, _statsManager, this, ClientManager, DonationManager, player, target);
|
||||
return new AchievementMainPage(Plugin, _statsManager, this, ClientManager, DonationManager, target.getName() + "'s Stats", player, target);
|
||||
}
|
||||
|
||||
public boolean attemptShopOpen(Player player, Player target)
|
||||
|
@ -0,0 +1,44 @@
|
||||
package mineplex.core.achievement.ui.button;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementCategory;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.achievement.ui.AchievementShop;
|
||||
import mineplex.core.achievement.ui.page.ArcadeMainPage;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/22/2014.
|
||||
*/
|
||||
public class ArcadeButton extends SingleButton
|
||||
{
|
||||
private AchievementShop _shop;
|
||||
private AchievementManager _achievementManager;
|
||||
private StatsManager _statsManager;
|
||||
private DonationManager _donationManager;
|
||||
private CoreClientManager _clientManager;
|
||||
private Player _target;
|
||||
|
||||
public ArcadeButton(AchievementShop shop, AchievementManager achievementManager, StatsManager statsManager, DonationManager donationManager, CoreClientManager clientManager, Player target)
|
||||
{
|
||||
_shop = shop;
|
||||
_achievementManager = achievementManager;
|
||||
_statsManager = statsManager;
|
||||
_donationManager = donationManager;
|
||||
_clientManager = clientManager;
|
||||
_target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
_shop.OpenPageForPlayer(player, new ArcadeMainPage(_achievementManager, _statsManager, _shop, _clientManager, _donationManager, "Arcade Games", player, _target));
|
||||
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.achievement.ui.button;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
@ -39,6 +40,7 @@ public class CategoryButton extends SingleButton
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
_shop.OpenPageForPlayer(player, new AchievementPage(_achievementManager, _statsManager, _category, _shop, _clientManager, _donationManager, player, _target));
|
||||
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
@ -12,6 +13,7 @@ import mineplex.core.achievement.AchievementCategory;
|
||||
import mineplex.core.achievement.AchievementData;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.achievement.ui.AchievementShop;
|
||||
import mineplex.core.achievement.ui.button.ArcadeButton;
|
||||
import mineplex.core.achievement.ui.button.CategoryButton;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
@ -25,12 +27,12 @@ import mineplex.core.stats.StatsManager;
|
||||
*/
|
||||
public class AchievementMainPage extends ShopPageBase<AchievementManager, AchievementShop>
|
||||
{
|
||||
private Player _target;
|
||||
private StatsManager _statsManager;
|
||||
protected Player _target;
|
||||
protected StatsManager _statsManager;
|
||||
|
||||
public AchievementMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, Player target)
|
||||
public AchievementMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, Player target)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, target.getName() + "'s Stats", player);
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
|
||||
_target = target;
|
||||
_statsManager = statsManager;
|
||||
@ -41,10 +43,14 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
@Override
|
||||
protected void BuildPage()
|
||||
{
|
||||
int categoryCount = 0;
|
||||
int slot = 10;
|
||||
int globalSlot = 4;
|
||||
int normalSlot = 18;
|
||||
|
||||
for (AchievementCategory category : AchievementCategory.values())
|
||||
{
|
||||
if (category.getGameCategory() == AchievementCategory.GameCategory.ARCADE)
|
||||
continue;
|
||||
|
||||
CategoryButton button = new CategoryButton(Shop, Plugin, _statsManager, category, DonationManager, ClientManager, _target);
|
||||
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
@ -55,29 +61,48 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + "Click for more details!");
|
||||
|
||||
ShopItem shopItem = new ShopItem(category.getIcon(), category.getIconData(), ChatColor.RESET + C.Bold + category.getFriendlyName(), lore.toArray(new String[0]), 1, false, false);
|
||||
AddButton(slot, shopItem, button);
|
||||
int slot;
|
||||
switch(category.getGameCategory())
|
||||
{
|
||||
case GLOBAL:
|
||||
slot = globalSlot;
|
||||
break;
|
||||
default:
|
||||
slot = normalSlot;
|
||||
normalSlot += 2;
|
||||
}
|
||||
|
||||
slot += 2;
|
||||
categoryCount++;
|
||||
if (categoryCount % 4 == 0)
|
||||
slot += 10;
|
||||
if (normalSlot == 28)
|
||||
normalSlot = 36;
|
||||
|
||||
ShopItem shopItem = new ShopItem(category.getIcon(), category.getIconData(), C.Bold + category.getFriendlyName(), lore.toArray(new String[0]), 1, false, false);
|
||||
AddButton(slot, shopItem, button);
|
||||
}
|
||||
addArcadeButton();
|
||||
}
|
||||
|
||||
private void addStats(AchievementCategory category, List<String> lore, int max)
|
||||
protected void addStats(AchievementCategory category, List<String> lore, int max)
|
||||
{
|
||||
String[] statsToDisplay = category.getStatsToDisplay();
|
||||
String[] friendlyStatNames = category.getFriendlyStatNames();
|
||||
PlayerStats stats = _statsManager.Get(_target);
|
||||
for (int i = 0; i < statsToDisplay.length && i < max; i++)
|
||||
{
|
||||
String statName = statsToDisplay[i];
|
||||
int statNumber = stats.getStat(category.getFriendlyName() + "." + statName);
|
||||
lore.add(C.cYellow + _statsManager.parseFriendlyStatName(statName) + ": " + C.cWhite + statNumber);
|
||||
lore.add(C.cYellow + friendlyStatNames[i] + ": " + C.cWhite + statNumber);
|
||||
}
|
||||
}
|
||||
|
||||
private void addAchievements(AchievementCategory category, List<String> lore, int max)
|
||||
protected void addArcadeButton()
|
||||
{
|
||||
ArcadeButton button = new ArcadeButton(Shop, Plugin, _statsManager, DonationManager, ClientManager, _target);
|
||||
ShopItem shopItem = new ShopItem(Material.SKULL_ITEM, (byte) 4, C.Bold + "Arcade Games", new String[] {" ", ChatColor.RESET + "Click for more!"}, 1, false, false);
|
||||
|
||||
AddButton(44, shopItem, button);
|
||||
}
|
||||
|
||||
protected void addAchievements(AchievementCategory category, List<String> lore, int max)
|
||||
{
|
||||
int achievementCount = 0;
|
||||
for (int i = 0; i < Achievement.values().length && achievementCount < max; i++)
|
||||
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@ -100,7 +101,8 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
||||
{
|
||||
String itemName = ChatColor.RESET + _category.getFriendlyName() + " Master Achievement";
|
||||
masterAchievementLore.add(" ");
|
||||
masterAchievementLore.add(ChatColor.RESET + "Kit Reward Coming Soon!");
|
||||
if (Player.equals(_target))
|
||||
masterAchievementLore.add(ChatColor.RESET + "Kit Reward Coming Soon!");
|
||||
|
||||
AddItem(40, new ShopItem(Material.WOOL, (byte) (hasAllAchievements ? 5 : 14), itemName, masterAchievementLore.toArray(new String[0]), 1, false, true));
|
||||
}
|
||||
@ -116,7 +118,14 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
Shop.OpenPageForPlayer(Player, new AchievementMainPage(Plugin, _statsManager, Shop, ClientManager, DonationManager, player, _target));
|
||||
AchievementMainPage page;
|
||||
if (_category.getGameCategory() == AchievementCategory.GameCategory.ARCADE)
|
||||
page = new ArcadeMainPage(Plugin, _statsManager, Shop, ClientManager, DonationManager, "Arcade Games", player, _target);
|
||||
else
|
||||
page = new AchievementMainPage(Plugin, _statsManager, Shop, ClientManager, DonationManager, _target.getName() + "'s Stats", player, _target);;
|
||||
|
||||
Shop.OpenPageForPlayer(Player, page);
|
||||
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -133,11 +142,12 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
|
||||
lore.add("");
|
||||
|
||||
PlayerStats stats = _statsManager.Get(_target);
|
||||
for (String statName : _category.getStatsToDisplay())
|
||||
String[] statsToDisplay = _category.getStatsToDisplay();
|
||||
String[] friendlyStatNames = _category.getFriendlyStatNames();
|
||||
for (int i = 0; i < statsToDisplay.length; i++)
|
||||
{
|
||||
int statNumber = stats.getStat(_category.getFriendlyName() + "." + statName);
|
||||
String name = statName.substring(statName.lastIndexOf('.') + 1);
|
||||
lore.add(C.cYellow + _statsManager.parseFriendlyStatName(name) + ": " + C.cWhite + statNumber);
|
||||
int statNumber = stats.getStat(_category.getFriendlyName() + "." + statsToDisplay[i]);
|
||||
lore.add(C.cYellow + friendlyStatNames[i] + ": " + C.cWhite + statNumber);
|
||||
}
|
||||
|
||||
ItemStack item = new ItemStack(material);
|
||||
|
@ -0,0 +1,77 @@
|
||||
package mineplex.core.achievement.ui.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementCategory;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.achievement.ui.AchievementShop;
|
||||
import mineplex.core.achievement.ui.button.CategoryButton;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/25/2014.
|
||||
*/
|
||||
public class ArcadeMainPage extends AchievementMainPage
|
||||
{
|
||||
public ArcadeMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, Player target)
|
||||
{
|
||||
super(plugin, statsManager, shop, clientManager, donationManager, name, player, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void BuildPage()
|
||||
{
|
||||
int slot = 10;
|
||||
|
||||
for (AchievementCategory category : AchievementCategory.values())
|
||||
{
|
||||
if (category.getGameCategory() != AchievementCategory.GameCategory.ARCADE)
|
||||
continue;
|
||||
|
||||
CategoryButton button = new CategoryButton(Shop, Plugin, _statsManager, category, DonationManager, ClientManager, _target);
|
||||
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
lore.add(" ");
|
||||
addStats(category, lore, 2);
|
||||
lore.add(" ");
|
||||
addAchievements(category, lore, 9);
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + "Click for more details!");
|
||||
|
||||
if (slot == 18 || slot == 27 || slot == 36)
|
||||
slot++;
|
||||
|
||||
ShopItem shopItem = new ShopItem(category.getIcon(), category.getIconData(), C.Bold + category.getFriendlyName(), lore.toArray(new String[0]), 1, false, false);
|
||||
AddButton(slot, shopItem, button);
|
||||
|
||||
slot += 2;
|
||||
}
|
||||
|
||||
addBackButton();
|
||||
}
|
||||
|
||||
private void addBackButton()
|
||||
{
|
||||
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
|
||||
{
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
Shop.OpenPageForPlayer(Player, new AchievementMainPage(Plugin, _statsManager, Shop, ClientManager, DonationManager, _target.getName() + "'s Stats", player, _target));
|
||||
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -163,29 +163,4 @@ public class StatsManager extends MiniClientPlugin<PlayerStats>
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String parseFriendlyStatName(String statName)
|
||||
{
|
||||
statName = statName.substring(statName.lastIndexOf(".") + 1);
|
||||
|
||||
int lastBreak = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < statName.length(); i++)
|
||||
{
|
||||
char c = statName.charAt(i);
|
||||
if (Character.isUpperCase(c))
|
||||
{
|
||||
sb.append(statName.substring(lastBreak, i) + " ");
|
||||
lastBreak = i;
|
||||
}
|
||||
|
||||
if (i == statName.length() - 1)
|
||||
{
|
||||
sb.append(statName.substring(lastBreak));
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString().trim();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user