Refactor Clans gold dependency out of core

This commit is contained in:
cnr 2016-07-25 19:57:07 -05:00
parent dc96258055
commit 3d0cc2a5fd
77 changed files with 771 additions and 1222 deletions

View File

@ -1,41 +0,0 @@
package mineplex.core.common;
import mineplex.core.common.util.C;
import org.bukkit.Material;
public enum CurrencyType
{
TOKEN("Tokens", "Token", C.cWhite, Material.EMERALD),
TREASURE_SHARD("Treasure Shards", "Treasure Shard", C.cAqua, Material.PRISMARINE_SHARD),
GEM("Gems", "Gem", C.cGreen, Material.EMERALD),
GOLD("Gold", "Gold", C.cGold, Material.GOLD_NUGGET);
private String _plural;
private String _single;
private String _color;
private Material _displayMaterial;
CurrencyType(String plural, String single, String color, Material displayMaterial)
{
_plural = plural;
_single = single;
_color = color;
_displayMaterial = displayMaterial;
}
@Deprecated
public String getPrefix()
{
return _plural;
}
public String getString(int amount)
{
return _color + amount + " " + (amount == 1 ? _single : _plural);
}
public Material getDisplayMaterial()
{
return _displayMaterial;
}
}

View File

@ -0,0 +1,41 @@
package mineplex.core.common.currency;
import org.bukkit.Material;
/**
* Currency is the base class for all currency types in mineplex:
* - Global currencies, found in {@link GlobalCurrency}, e.g., treasure shards
* - Clans gold, found in the Mineplex.Game.Clans project
*/
public class Currency
{
private final String _plural;
private final String _singular;
private final String _color;
private final Material _displayMaterial;
public Currency(String plural, String singular, String color, Material displayMaterial)
{
this._plural = plural;
this._singular = singular;
this._color = color;
this._displayMaterial = displayMaterial;
}
@Deprecated
public String getPrefix()
{
return _plural;
}
public String getString(int amount)
{
return _color + amount + " " + (amount == 1 ? _singular : _plural);
}
public Material getDisplayMaterial()
{
return _displayMaterial;
}
}

View File

@ -0,0 +1,17 @@
package mineplex.core.common.currency;
import mineplex.core.common.util.C;
import org.bukkit.Material;
/**
* A GlobalCurrency is one whose state is shared between all Mineplex servers.
* GlobalCurrencies can be retrieved and modified through DonationManager/Donor in Mineplex.Core
*/
public class GlobalCurrency extends Currency {
public static final GlobalCurrency TREASURE_SHARD = new GlobalCurrency("Treasure Shards", "Treasure Shard", C.cAqua, Material.PRISMARINE_SHARD);
public static final GlobalCurrency GEM = new GlobalCurrency("Gems", "Gem", C.cGreen, Material.EMERALD);
public GlobalCurrency(String plural, String singular, String color, Material displayMaterial) {
super(plural, singular, color, displayMaterial);
}
}

View File

@ -1,10 +1,7 @@
package mineplex.core.common.util;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.Rank;
import java.util.LinkedList;
import mineplex.core.common.currency.Currency;
import org.bukkit.ChatColor;
public class F
@ -201,7 +198,7 @@ public class F
return out;
}
public static String currency(CurrencyType type, int amount)
public static String currency(Currency type, int amount)
{
return type.getString(amount) + ChatColor.RESET + C.mBody;
}

View File

@ -1,5 +1,9 @@
package mineplex.core.common.util;
import org.apache.commons.lang.WordUtils;
import org.bukkit.ChatColor;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
@ -7,13 +11,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import javax.imageio.ImageIO;
import org.apache.commons.lang.WordUtils;
import org.bukkit.ChatColor;
import mineplex.core.common.CurrencyType;
public class UtilText
{
private static HashMap<Character, Integer> _characters = new HashMap<>();
@ -25,7 +22,7 @@ public class UtilText
{
try
{
InputStream inputStream = CurrencyType.class.getResourceAsStream("/ascii.png");
InputStream inputStream = UtilText.class.getResourceAsStream("/ascii.png");
BufferedImage image = ImageIO.read(inputStream);
char[] text = new char[]

View File

@ -1,41 +1,27 @@
package mineplex.core.bonuses.gui.buttons;
import java.util.ArrayList;
import mineplex.core.bonuses.BonusManager;
import mineplex.core.boosters.BoosterManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.gui.GuiItem;
import mineplex.core.gui.ItemRefresher;
import mineplex.core.gui.pages.LoadingWindow;
import mineplex.core.gui.pages.TimedMessageWindow;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.bonuses.BonusAmount;
import mineplex.core.bonuses.BonusClientData;
import mineplex.core.bonuses.BonusManager;
import mineplex.core.bonuses.StreakRecord;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.*;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import java.util.ArrayList;
public class ClaimTipsButton implements GuiItem, Listener
{
private ItemStack _item;
@ -87,7 +73,7 @@ public class ClaimTipsButton implements GuiItem, Listener
new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.LIME.getData(), 1, ChatColor.GREEN + "Amplifier Thanks Collected"), "Thanks Collected", 6*9, 20*3, getGui()).openInventory();
}
UtilPlayer.message(getPlayer(), F.main("Carl", "You collected " + F.currency(CurrencyType.TREASURE_SHARD, claimed) + " from Amplifiers!"));
UtilPlayer.message(getPlayer(), F.main("Carl", "You collected " + F.currency(GlobalCurrency.TREASURE_SHARD, claimed) + " from Amplifiers!"));
// Pending explosions are strange.. Not sure why we are using strings. Either way, lets display a rank reward effect
_bonusManager.addPendingExplosion(getPlayer(), "RANK");
getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f);

View File

@ -5,8 +5,8 @@ import mineplex.core.boosters.BoosterManager;
import mineplex.core.boosters.tips.BoosterTipManager;
import mineplex.core.boosters.tips.TipAddResult;
import mineplex.core.command.CommandBase;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.Rank;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import org.apache.commons.lang3.StringUtils;
@ -60,8 +60,8 @@ public class ThankCommand extends CommandBase<BoosterManager>
{
if (result == TipAddResult.SUCCESS)
{
UtilPlayer.message(caller, F.main("Tip", "You thanked " + F.name(booster.getPlayerName()) + ". They earned " + F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_SPONSOR) + " and you got "
+ F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER)) + " in return!");
UtilPlayer.message(caller, F.main("Tip", "You thanked " + F.name(booster.getPlayerName()) + ". They earned " + F.currency(GlobalCurrency.TREASURE_SHARD, BoosterTipManager.TIP_FOR_SPONSOR) + " and you got "
+ F.currency(GlobalCurrency.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER)) + " in return!");
caller.playSound(caller.getLocation(), Sound.LEVEL_UP, 1f, 1f);
}
else if (result.getFriendlyMessage() != null)

View File

@ -1,9 +1,8 @@
package mineplex.core.brawl.fountain;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.shop.item.SalesPackageBase;
import org.bukkit.Material;
import org.bukkit.entity.Player;
/**
* @author Shaun Bennett
@ -14,14 +13,8 @@ public class GemFountainSalesPackage extends SalesPackageBase
{
super("Add " + gems + " Gems", Material.EMERALD, (byte) 0, new String[] {}, gems, 1);
CurrencyCostMap.put(CurrencyType.GEM, gems);
CurrencyCostMap.put(GlobalCurrency.GEM, gems);
KnownPackage = false;
OneTimePurchaseOnly = false;
}
@Override
public void sold(Player player, CurrencyType currencyType)
{
}
}

View File

@ -2,8 +2,8 @@ package mineplex.core.brawl.fountain.command;
import mineplex.core.brawl.fountain.FountainManager;
import mineplex.core.command.CommandBase;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.Rank;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
@ -53,7 +53,7 @@ public class AddCommand extends CommandBase<FountainManager>
UtilPlayer.message(caller, F.main("Fountain", "There was an error processing your request!"));
}
}
}, caller, "GemFountain.Add", CurrencyType.GEM, amount, false);
}, caller, "GemFountain.Add", GlobalCurrency.GEM, amount, false);
}
catch (NumberFormatException ex)
{

View File

@ -4,8 +4,8 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.brawl.fountain.Fountain;
import mineplex.core.brawl.fountain.FountainManager;
import mineplex.core.brawl.fountain.gui.button.FountainAddButton;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.MaterialData;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.ShopItem;
@ -77,7 +77,7 @@ public class FountainPage extends ShopPageBase<FountainManager, FountainShop>
if (canAdd)
{
int playerGems = getDonationManager().Get(getPlayer()).GetGems();
int playerGems = getDonationManager().Get(getPlayer()).getBalance(GlobalCurrency.GEM);
ShopItem add1 = new ShopItem(Material.EMERALD, "Add 100 Gems", new String[]{}, 1, playerGems < 100, false);
ShopItem add2 = new ShopItem(Material.EMERALD, "Add 1,000 Gems", new String[]{}, 64, playerGems < 1000, false);
ShopItem add3 = new ShopItem(Material.EMERALD_BLOCK, "Add 10,000 Gems", new String[]{}, 1, playerGems < 10000, false);

View File

@ -4,7 +4,7 @@ import mineplex.core.brawl.fountain.FountainManager;
import mineplex.core.brawl.fountain.GemFountainSalesPackage;
import mineplex.core.brawl.fountain.gui.FountainPage;
import mineplex.core.brawl.fountain.gui.FountainShop;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SalesPackageBase;
import mineplex.core.shop.page.ConfirmationPage;
@ -37,6 +37,6 @@ public class FountainAddButton implements IButton
_page.getPlugin().getGemFountain().increment(player, _gems, null);
_page.refresh();
}
}, _page, _salesPackage, CurrencyType.GEM, player));
}, _page, _salesPackage, GlobalCurrency.GEM, player));
}
}

View File

@ -1,25 +1,23 @@
package mineplex.core.cosmetic.ui;
import mineplex.core.cosmetic.ui.page.*;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.messaging.PluginMessageListener;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.PetTagPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.messaging.PluginMessageListener;
public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMessageListener
{
public CosmeticShop(CosmeticManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name)
{
super(plugin, clientManager, donationManager, name, CurrencyType.GEM, CurrencyType.TREASURE_SHARD);
super(plugin, clientManager, donationManager, name);
plugin.getPlugin().getServer().getMessenger().registerIncomingPluginChannel(plugin.getPlugin(), "MC|ItemName", this);
}

View File

@ -1,15 +1,14 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.MountPage;
import mineplex.core.mount.Mount;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ConfirmationPage;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class MountButton implements IButton
{
@ -32,6 +31,6 @@ public class MountButton implements IButton
_page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.getName(), 1);
_page.refresh();
}
}, _page, _mount, CurrencyType.TREASURE_SHARD, player));
}, _page, _mount, GlobalCurrency.TREASURE_SHARD, player));
}
}

View File

@ -1,12 +1,7 @@
package mineplex.core.cosmetic.ui.page;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
@ -19,6 +14,10 @@ import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
/**
* Created by shaun on 14-09-15.
@ -38,7 +37,7 @@ public class CostumePage extends GadgetPage
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.COSTUME))
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -1)
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -1)
continue;
OutfitGadget outfitGadget = ((OutfitGadget) gadget);

View File

@ -1,30 +1,19 @@
package mineplex.core.cosmetic.ui.page;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.banner.CountryFlag;
import mineplex.core.gadget.event.GadgetChangeEvent;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.banner.CountryFlag;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.GadgetButton;
import mineplex.core.cosmetic.ui.button.activate.ActivateGadgetButton;
import mineplex.core.cosmetic.ui.button.deactivate.DeactivateGadgetButton;
import mineplex.core.cosmetic.ui.button.GadgetButton;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetChangeEvent;
import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
@ -34,6 +23,16 @@ import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
@ -50,7 +49,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ITEM))
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -3)
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -3)
continue;
addGadget(gadget, slot);
@ -105,64 +104,64 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
if (!gadget.ownsGadget(getPlayer()))
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -1)
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -1)
{
//Nothing
}
//Chest Unlocks
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -2 || gadget.getCost(CurrencyType.TREASURE_SHARD) > 0)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -2 || gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests");
}
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -3)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -3)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
}
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -4)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -4)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
}
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -5)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -5)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -6)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -6)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Valentines Gifts");
}
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -7)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -7)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Purchased from shop.mineplex.com");
}
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -8)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Freedom Chests");
}
//Rank Unlocks
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -10)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10)
{
itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
}
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -11)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -11)
{
itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
}
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -12)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -12)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
}
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -13)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -13)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank");
@ -178,12 +177,12 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.getName()));
// boolean canAffordAmmo = true;
// if (itemGadget.getAmmo().getCost(CurrencyType.Coins) > 0)
// if (itemGadget.getAmmo().getCost(GlobalCurrency.Coins) > 0)
// {
// itemLore.add(C.cBlack);
// itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().getDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().getCost(CurrencyType.Coins) + " Coins");
// itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().getDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().getCost(GlobalCurrency.Coins) + " Coins");
//
// if (getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= itemGadget.getAmmo().getCost(CurrencyType.Coins))
// if (getDonationManager().Get(getPlayer().getName()).getBalance(GlobalCurrency.Coins) >= itemGadget.getAmmo().getCost(GlobalCurrency.Coins))
// {
// itemLore.add(C.cGreen + "Right-Click To Purchase");
// }
@ -239,26 +238,26 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
}
else
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0)
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards");
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(GlobalCurrency.TREASURE_SHARD) + " Treasure Shards");
}
if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.getCost(CurrencyType.TREASURE_SHARD))
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).getBalance(GlobalCurrency.TREASURE_SHARD) >= gadget.getCost(GlobalCurrency.TREASURE_SHARD))
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards");
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(GlobalCurrency.TREASURE_SHARD) + " Treasure Shards");
}
if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.getCost(CurrencyType.TREASURE_SHARD))
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).getBalance(GlobalCurrency.TREASURE_SHARD) >= gadget.getCost(GlobalCurrency.TREASURE_SHARD))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this));
}
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
@ -291,7 +290,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
if (gadget.getGadgetType() == GadgetType.ARROW_TRAIL || gadget.getGadgetType() == GadgetType.DEATH
|| gadget.getGadgetType() == GadgetType.PARTICLE || gadget.getGadgetType() == GadgetType.DOUBLE_JUMP)
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8)
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -8)
{
gadgetItemStack = CountryFlag.USA.getBanner();
BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta();
@ -314,7 +313,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
if (gadget.getGadgetType() == GadgetType.ARROW_TRAIL || gadget.getGadgetType() == GadgetType.DEATH
|| gadget.getGadgetType() == GadgetType.PARTICLE || gadget.getGadgetType() == GadgetType.DOUBLE_JUMP)
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8)
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -8)
{
gadgetItemStack = CountryFlag.USA.getBanner();
BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta();
@ -329,20 +328,20 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
}
else
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0)
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards");
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(GlobalCurrency.TREASURE_SHARD) + " Treasure Shards");
}
if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.getCost(CurrencyType.TREASURE_SHARD))
if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).getBalance(GlobalCurrency.TREASURE_SHARD) >= gadget.getCost(GlobalCurrency.TREASURE_SHARD))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this));
}
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0)
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
@ -363,7 +362,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
ItemGadget itemGadget = (ItemGadget)gadget;
if (itemGadget.getAmmo().getCost(CurrencyType.TREASURE_SHARD) < 0)
if (itemGadget.getAmmo().getCost(GlobalCurrency.TREASURE_SHARD) < 0)
return;
}
@ -379,7 +378,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.getName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity()));
refresh();
}
}, this, (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo() : gadget), CurrencyType.TREASURE_SHARD, getPlayer()));
}, this, (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo() : gadget), GlobalCurrency.TREASURE_SHARD, getPlayer()));
}
public void activateGadget(Player player, Gadget gadget)

View File

@ -1,24 +1,11 @@
package mineplex.core.cosmetic.ui.page;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import mineplex.core.cosmetic.ui.button.open.*;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.*;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.open.*;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
@ -27,6 +14,15 @@ import mineplex.core.pet.Pet;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import org.bukkit.Material;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
{
@ -41,7 +37,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
protected void buildPage()
{
// Treasure Shards
int treasureShards = getDonationManager().Get(getPlayer()).getCoins();
int treasureShards = getDonationManager().Get(getPlayer()).getBalance(GlobalCurrency.TREASURE_SHARD);
List<String> shardLore = new ArrayList<String>();
shardLore.add(" ");

View File

@ -1,26 +1,25 @@
package mineplex.core.cosmetic.ui.page;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.MountButton;
import mineplex.core.cosmetic.ui.button.activate.ActivateMountButton;
import mineplex.core.cosmetic.ui.button.deactivate.DeactivateMountButton;
import mineplex.core.cosmetic.ui.button.MountButton;
import mineplex.core.donation.DonationManager;
import mineplex.core.mount.Mount;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
@ -62,58 +61,58 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.getName()))
{
if (mount.getCost(CurrencyType.TREASURE_SHARD) == -1)
if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -1)
{
//Nothing
}
//Chest Unlocks
else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -2 || mount.getCost(CurrencyType.TREASURE_SHARD) > 0)
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -2 || mount.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests");
}
else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -3)
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -3)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
}
else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -4)
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -4)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
}
else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -5)
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -5)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -6)
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -6)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Valentines Holiday Treasure");
}
else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -7)
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -7)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Freedom Chests");
}
//Rank Unlocks
else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -10)
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -10)
{
itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
}
else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -11)
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -11)
{
itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
}
else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -12)
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -12)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
}
else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -13)
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -13)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank");
@ -139,20 +138,20 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
}
else
{
if (mount.getCost(CurrencyType.TREASURE_SHARD) > 0)
if (mount.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards");
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.getCost(GlobalCurrency.TREASURE_SHARD) + " Treasure Shards");
}
if (mount.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= mount.getCost(CurrencyType.TREASURE_SHARD))
if (mount.getCost(GlobalCurrency.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).getBalance(GlobalCurrency.TREASURE_SHARD) >= mount.getCost(GlobalCurrency.TREASURE_SHARD))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this));
}
else if (mount.getCost(CurrencyType.TREASURE_SHARD) > 0)
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");

View File

@ -1,33 +1,16 @@
package mineplex.core.cosmetic.ui.page;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.server.v1_8_R3.Blocks;
import net.minecraft.server.v1_8_R3.ChatMessage;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.Items;
import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow;
import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.PetSorter;
import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton;
import mineplex.core.cosmetic.ui.button.deactivate.DeactivatePetButton;
import mineplex.core.cosmetic.ui.button.PetButton;
import mineplex.core.cosmetic.ui.button.RenamePetButton;
import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton;
import mineplex.core.cosmetic.ui.button.deactivate.DeactivatePetButton;
import mineplex.core.donation.DonationManager;
import mineplex.core.pet.Pet;
import mineplex.core.pet.PetExtra;
@ -35,6 +18,16 @@ import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.AnvilContainer;
import mineplex.core.shop.page.ShopPageBase;
import net.minecraft.server.v1_8_R3.*;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
@ -63,49 +56,49 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
//Chest Unlocks
if (!getPlugin().getPetManager().Get(getPlayer()).getPets().containsKey(pet.getPetType()))
{
if (pet.getCost(CurrencyType.TREASURE_SHARD) == -1)
if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -1)
{
//Nothing
}
else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -2 || pet.getCost(CurrencyType.TREASURE_SHARD) > 0)
else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -2 || pet.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests");
}
else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -3)
else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -3)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
}
else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -4)
else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -4)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
}
else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -5)
else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -5)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
//Rank Unlocks
else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -10)
else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -10)
{
itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
}
else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -11)
else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -11)
{
itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank");
}
else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -12)
else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -12)
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank");
}
else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -13)
else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -13)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank");
@ -145,20 +138,20 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
//Not Owned
else
{
if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0)
if (pet.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards");
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.getCost(GlobalCurrency.TREASURE_SHARD) + " Treasure Shards");
}
if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= pet.getCost(CurrencyType.TREASURE_SHARD))
if (pet.getCost(GlobalCurrency.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).getBalance(GlobalCurrency.TREASURE_SHARD) >= pet.getCost(GlobalCurrency.TREASURE_SHARD))
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this));
}
else if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0)
else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
@ -194,7 +187,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|| getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.VILLAGER
|| getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.ZOMBIE)
{
addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.getCost(CurrencyType.TREASURE_SHARD) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this));
addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.getCost(GlobalCurrency.TREASURE_SHARD) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this));
}
slot++;

View File

@ -2,7 +2,7 @@ package mineplex.core.cosmetic.ui.page;
import mineplex.cache.player.PlayerCache;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
@ -19,7 +19,6 @@ import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase;
import net.minecraft.server.v1_8_R3.ItemStack;
import net.minecraft.server.v1_8_R3.Items;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -130,7 +129,7 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer()));
}
}, null, _petPurchase ? _pet : tag, CurrencyType.TREASURE_SHARD, getPlayer()));
}, null, _petPurchase ? _pet : tag, GlobalCurrency.TREASURE_SHARD, getPlayer()));
}
public void SetTagName(String tagName)

View File

@ -1,36 +1,30 @@
package mineplex.core.donation;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.Queue;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import com.google.gson.Gson;
import mineplex.cache.player.PlayerCache;
import mineplex.core.MiniDbClientPlugin;
import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.donation.command.ShardCommand;
import mineplex.core.donation.command.GemCommand;
import mineplex.core.donation.command.GoldCommand;
import mineplex.core.donation.command.SetGoldCommand;
import mineplex.core.donation.command.ShardCommand;
import mineplex.core.donation.repository.DonationRepository;
import mineplex.core.donation.repository.token.DonorTokenWrapper;
import mineplex.core.server.util.TransactionResponse;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
public class DonationManager extends MiniDbClientPlugin<Donor>
import java.util.LinkedList;
import java.util.Queue;
import java.util.UUID;
public class DonationManager extends MiniClientPlugin<Donor>
{
private final int MAX_GIVE_ATTEMPTS = 10;
@ -38,17 +32,24 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
private NautHashMap<Player, NautHashMap<String, Integer>> _gemQueue = new NautHashMap<Player, NautHashMap<String, Integer>>();
private NautHashMap<Player, NautHashMap<String, Integer>> _coinQueue = new NautHashMap<Player, NautHashMap<String, Integer>>();
private NautHashMap<Player, NautHashMap<String, Integer>> _goldQueue = new NautHashMap<Player, NautHashMap<String, Integer>>();
private Queue<GiveDonorData> _coinAttemptQueue;
private final CoreClientManager _clientManager;
public DonationManager(JavaPlugin plugin, CoreClientManager clientManager, String webAddress)
{
super("Donation", plugin, clientManager);
super("Donation", plugin);
_repository = new DonationRepository(plugin, webAddress);
_coinAttemptQueue = new LinkedList<>();
_clientManager = clientManager;
}
public CoreClientManager getClientManager()
{
return _clientManager;
}
@Override
@ -57,8 +58,6 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
// TODO: Re-add commands? Where are command implementations, seen as missing at the moment.
addCommand(new GemCommand(this));
addCommand(new ShardCommand(this));
addCommand(new GoldCommand(this));
addCommand(new SetGoldCommand(this));
}
@EventHandler
@ -74,12 +73,12 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
//_repository.updateGemsAndCoins(uuid, Get(token.Name).GetGems(), Get(token.Name).getCoins());
}
public void purchaseUnknownSalesPackage(Callback<TransactionResponse> callback, Player player, String packageName, CurrencyType currencyType, int cost, boolean oneTimePurchase)
public void purchaseUnknownSalesPackage(Callback<TransactionResponse> callback, Player player, String packageName, GlobalCurrency currencyType, int cost, boolean oneTimePurchase)
{
PurchaseUnknownSalesPackage(callback, player.getName(), getClientManager().getAccountId(player), packageName, currencyType, cost, oneTimePurchase);
PurchaseUnknownSalesPackage(callback, player.getName(), _clientManager.getAccountId(player), packageName, currencyType, cost, oneTimePurchase);
}
public void PurchaseUnknownSalesPackage(final Callback<TransactionResponse> callback, final String name, final int accountId, final String packageName, final CurrencyType currencyType, final int cost, boolean oneTimePurchase)
public void PurchaseUnknownSalesPackage(final Callback<TransactionResponse> callback, final String name, final int accountId, final String packageName, final GlobalCurrency currencyType, final int cost, boolean oneTimePurchase)
{
final Donor donor = Bukkit.getPlayerExact(name) != null ? Get(name) : null;
@ -112,29 +111,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
}
}, name, accountId, packageName, currencyType, cost);
}
public void PurchaseKnownSalesPackage(final Callback<TransactionResponse> callback, final String name, final UUID uuid, final int cost, final int salesPackageId)
{
_repository.PurchaseKnownSalesPackage(new Callback<TransactionResponse>()
{
public void run(TransactionResponse response)
{
if (response == TransactionResponse.Success)
{
Donor donor = Get(name);
if (donor != null)
{
donor.AddSalesPackagesOwned(salesPackageId);
}
}
if (callback != null)
callback.run(response);
}
}, name, uuid.toString(), cost, salesPackageId);
}
public void RewardGems(Callback<Boolean> callback, String caller, String name, UUID uuid, int amount)
{
RewardGems(callback, caller, name, uuid, amount, true);
@ -154,7 +131,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
if (donor != null)
{
donor.AddGems(amount);
donor.addBalance(GlobalCurrency.GEM, amount);
}
}
}
@ -181,7 +158,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
Donor donor = Get(player.getName());
if (donor != null)
donor.AddGems(amount);
donor.addBalance(GlobalCurrency.GEM, amount);
}
@EventHandler
@ -241,7 +218,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
if (donor != null)
{
donor.addCoins(amount);
donor.addBalance(GlobalCurrency.TREASURE_SHARD, amount);
}
}
}
@ -268,7 +245,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
Donor donor = Get(player.getName());
if (donor != null)
donor.addCoins(amount);
donor.addBalance(GlobalCurrency.TREASURE_SHARD, amount);
}
@EventHandler
@ -295,7 +272,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
continue;
if (player.isOnline() && player.isValid())
RewardCoins(null, caller, player.getName(), ClientManager.Get(player).getAccountId(), total, false);
RewardCoins(null, caller, player.getName(), _clientManager.Get(player).getAccountId(), total, false);
else
{
Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
@ -338,7 +315,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
if (donor != null)
{
donor.addCoins(data.getGiveAmount());
donor.addBalance(GlobalCurrency.TREASURE_SHARD, data.getGiveAmount());
}
if (data.getCallback() != null) data.getCallback().run(true);
@ -367,165 +344,15 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
}
}
public void rewardGold(Callback<Boolean> callback, String caller, Player player, int amount)
{
rewardGold(callback, caller, player.getName(), ClientManager.Get(player).getAccountId(), amount);
}
public void rewardGold(Callback<Boolean> callback, String caller, String name, int accountId, int amount)
{
rewardGold(callback, caller, name, accountId, amount, true);
}
public void rewardGold(final Callback<Boolean> callback, final String caller, final String name, final int accountId, final int amount, final boolean updateTotal)
{
_repository.rewardGold(new Callback<Boolean>()
{
public void run(Boolean success)
{
if (success)
{
if (updateTotal)
{
Donor donor = Get(name);
if (donor != null)
{
donor.addGold(amount);
}
}
}
else
{
System.out.println("REWARD GOLD FAILED...");
}
if (callback != null)
callback.run(success);
}
}, caller, name, accountId, amount);
}
public void setGold(final Callback<Boolean> callback, final String caller, final String name, final int accountId, final int amount, final boolean updateTotal)
{
_repository.setGold(new Callback<Boolean>()
{
public void run(Boolean success)
{
if (success)
{
if (updateTotal)
{
Donor donor = Get(name);
if (donor != null)
{
donor.setGold(amount);
}
}
}
else
{
System.out.println("SET GOLD FAILED...");
}
if (callback != null)
callback.run(success);
}
}, caller, name, accountId, amount);
}
public void RewardGoldLater(final String caller, final Player player, final int amount)
{
if (!_goldQueue.containsKey(player))
_goldQueue.put(player, new NautHashMap<String, Integer>());
int totalAmount = amount;
if (_goldQueue.get(player).containsKey(caller))
totalAmount += _goldQueue.get(player).get(caller);
_goldQueue.get(player).put(caller, totalAmount);
//Do Temp Change
Donor donor = Get(player.getName());
if (donor != null)
donor.addGold(amount);
}
@EventHandler
public void updateGoldQueue(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOWER)
return;
for (Player player : _goldQueue.keySet())
{
updateGoldQueue(null, player);
}
//Clean
_goldQueue.clear();
}
public void updateGoldQueue(final Callback<Boolean> callback, final Player player)
{
String tempCaller = null;
int tempTotal = 0;
for (String curCaller : _goldQueue.get(player).keySet())
{
tempCaller = curCaller;
tempTotal += _goldQueue.get(player).get(curCaller);
}
final String caller = tempCaller;
final int total = tempTotal;
if (caller == null)
return;
if (player.isOnline() && player.isValid())
rewardGold(callback, caller, player.getName(), ClientManager.Get(player).getAccountId(), total, false);
else
{
Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
rewardGold(callback, caller, player.getName(), PlayerCache.getInstance().getPlayer(player.getUniqueId()).getAccountId(), total, false);
}
});
}
System.out.println("Queue Added [" + player + "] with Gold [" + total + "] for [" + caller + "]");
//Clean
_goldQueue.get(player).clear();
}
public void applyKits(String playerName)
{
_repository.applyKits(playerName);
}
@Override
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
{
Get(playerName).setGold(_repository.retrieveDonorInfo(resultSet).getGold());
}
@Override
protected Donor addPlayer(String player)
{
return new Donor();
}
@Override
public String getQuery(int accountId, String uuid, String name)
{
return "SELECT gold FROM accounts WHERE id = '" + accountId + "';";
}
}

View File

@ -1,18 +1,18 @@
package mineplex.core.donation;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.donation.repository.token.CoinTransactionToken;
import mineplex.core.donation.repository.token.DonorToken;
import mineplex.core.donation.repository.token.TransactionToken;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Donor
{
private int _gems;
private int _coins;
private int _gold;
private final Map<GlobalCurrency, Integer> _balances = new HashMap<>();
private boolean _donated;
private List<Integer> _salesPackagesOwned = new ArrayList<Integer>();
private List<String> _unknownSalesPackagesOwned = new ArrayList<String>();
@ -25,8 +25,8 @@ public class Donor
public void loadToken(DonorToken token)
{
_gems = token.Gems;
_coins = token.Coins;
_balances.put(GlobalCurrency.GEM, token.Gems);
_balances.put(GlobalCurrency.TREASURE_SHARD, token.Coins);
_donated = token.Donated;
_salesPackagesOwned = token.SalesPackages;
@ -34,12 +34,7 @@ public class Donor
_transactions = token.Transactions;
_coinTransactions = token.CoinRewards;
}
public int GetGems()
{
return _gems;
}
public List<Integer> GetSalesPackagesOwned()
{
return _salesPackagesOwned;
@ -65,49 +60,21 @@ public class Donor
return _donated;
}
public void DeductCost(int cost, CurrencyType currencyType)
public void DeductCost(int cost, GlobalCurrency currencyType)
{
switch (currencyType)
{
case GEM:
_gems -= cost;
_update = true;
break;
case TREASURE_SHARD:
_coins -= cost;
_update = true;
break;
case GOLD:
_gold -= cost;
_update = true;
break;
default:
break;
}
addBalance(currencyType, -cost);
}
public int GetBalance(CurrencyType currencyType)
public int getBalance(GlobalCurrency currencyType)
{
switch (currencyType)
{
case GEM:
return _gems;
case TREASURE_SHARD:
return _coins;
case GOLD:
return _gold;
case TOKEN:
return 0;
default:
return 0;
}
return _balances.getOrDefault(currencyType, 0);
}
public void AddGems(int gems)
public void addBalance(GlobalCurrency currencyType, int amount)
{
_gems += gems;
_balances.merge(currencyType, amount, Integer::sum);
}
public boolean OwnsUnknownPackage(String packageName)
{
return _unknownSalesPackagesOwned.contains(packageName);
@ -144,33 +111,9 @@ public class Donor
return false;
}
public int getCoins()
{
return _coins;
}
public void addCoins(int amount)
{
_coins += amount;
}
public void addGold(int amount)
{
_gold = Math.max(0, _gold + amount);
}
public void setGold(int amount)
{
_gold = Math.max(0, amount);
}
public List<CoinTransactionToken> getCoinTransactions()
{
return _coinTransactions;
}
public int getGold()
{
return _gold;
}
}

View File

@ -1,24 +1,20 @@
package mineplex.core.donation.repository;
import java.sql.ResultSet;
import java.sql.SQLException;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.Currency;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.Callback;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.DatabaseRunnable;
import mineplex.serverdata.database.column.ColumnInt;
import mineplex.core.donation.Donor;
import mineplex.core.database.MinecraftRepository;
import mineplex.core.donation.repository.token.GemRewardToken;
import mineplex.core.donation.repository.token.PurchaseToken;
import mineplex.core.donation.repository.token.UnknownPurchaseToken;
import mineplex.core.server.remotecall.AsyncJsonWebCall;
import mineplex.core.server.remotecall.JsonWebCall;
import mineplex.core.server.util.TransactionResponse;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.DatabaseRunnable;
import mineplex.serverdata.database.column.ColumnInt;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class DonationRepository extends MinecraftRepository
{
@ -26,8 +22,6 @@ public class DonationRepository extends MinecraftRepository
private static String CREATE_GEM_TRANSACTION_TABLE = "CREATE TABLE IF NOT EXISTS accountGemTransactions (id INT NOT NULL AUTO_INCREMENT, accountId INT, reason VARCHAR(100), gems INT, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));";
private static String INSERT_COIN_TRANSACTION = "INSERT INTO accountCoinTransactions(accountId, reason, coins) VALUES(?, ?, ?);";
private static String UPDATE_ACCOUNT_COINS = "UPDATE accounts SET coins = coins + ? WHERE id = ?;";
private static String UPDATE_ACCOUNT_GOLD = "UPDATE accounts SET gold = gold + ? WHERE id = ? && gold >= ?;";
private static String SET_ACCOUNT_GOLD = "UPDATE accounts SET gold = ? WHERE id = ?;";
private static String UPDATE_NULL_ACCOUNT_GEMS_AND_COINS_ = "UPDATE accounts SET gems = ?, coins = ? WHERE id = ? AND gems IS NULL AND coins IS NULL;";
private String _webAddress;
@ -70,12 +64,12 @@ public class DonationRepository extends MinecraftRepository
}), "Error purchasing known sales package in DonationRepository : ");
}
public void PurchaseUnknownSalesPackage(final Callback<TransactionResponse> callback, final String name, final int accountId, final String packageName, final CurrencyType currencyType, final int cost)
public void PurchaseUnknownSalesPackage(final Callback<TransactionResponse> callback, final String name, final int accountId, final String packageName, final Currency currencyType, final int cost)
{
final UnknownPurchaseToken token = new UnknownPurchaseToken();
token.AccountName = name;
token.SalesPackageName = packageName;
token.CoinPurchase = currencyType == CurrencyType.TREASURE_SHARD;
token.CoinPurchase = currencyType == GlobalCurrency.TREASURE_SHARD;
token.Cost = cost;
token.Premium = false;
@ -85,15 +79,11 @@ public class DonationRepository extends MinecraftRepository
{
if (response == TransactionResponse.Success)
{
if (currencyType == CurrencyType.TREASURE_SHARD)
if (currencyType == GlobalCurrency.TREASURE_SHARD)
{
executeUpdate(UPDATE_ACCOUNT_COINS, new ColumnInt("coins", -cost), new ColumnInt("id", accountId));
//executeUpdate(INSERT_COIN_TRANSACTION, new ColumnInt("id", accountId), new ColumnVarChar("reason", 100, "Purchased " + packageName), new ColumnInt("coins", -cost));
}
else if (currencyType == CurrencyType.GOLD)
{
executeUpdate(UPDATE_ACCOUNT_GOLD, new ColumnInt("gold", -cost), new ColumnInt("id", accountId));
}
}
Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
@ -184,35 +174,6 @@ public class DonationRepository extends MinecraftRepository
}), "Error updating player coin amount in DonationRepository : ");
}
public void rewardGold(final Callback<Boolean> callback, final String giver, final String name, final int accountId, final int gold)
{
handleDatabaseCall(new DatabaseRunnable(new Runnable()
{
public void run()
{
ColumnInt min = new ColumnInt("gold", gold < 0 ? -gold : 0);
boolean success = executeUpdate(UPDATE_ACCOUNT_GOLD, new ColumnInt("gold", gold), new ColumnInt("id", accountId), min) > 0;
callback.run(success);
}
}), "Error updating player gold amount in DonationRepository : ");
}
public void setGold(final Callback<Boolean> callback, final String giver, final String name, final int accountId, final int gold)
{
if (gold < 0)
{
throw new IllegalArgumentException("gold cannot be negative");
}
handleDatabaseCall(new DatabaseRunnable(new Runnable()
{
public void run()
{
boolean success = executeUpdate(SET_ACCOUNT_GOLD, new ColumnInt("gold", gold), new ColumnInt("id", accountId)) > 0;
callback.run(success);
}
}), "Error updating player gold amount in DonationRepository : ");
}
@Override
protected void initialize()
{
@ -240,16 +201,4 @@ public class DonationRepository extends MinecraftRepository
{
new AsyncJsonWebCall(_webAddress + "PlayerAccount/ApplyKits").Execute(playerName);
}
public Donor retrieveDonorInfo(ResultSet resultSet) throws SQLException
{
Donor donor = new Donor();
while (resultSet.next())
{
donor.setGold(resultSet.getInt(1));
}
return donor;
}
}

View File

@ -1,10 +1,7 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.shop.item.SalesPackageBase;
import org.bukkit.Material;
public class Ammo extends SalesPackageBase
{
@ -16,9 +13,4 @@ public class Ammo extends SalesPackageBase
KnownPackage = false;
OneTimePurchaseOnly = false;
}
@Override
public void sold(Player player, CurrencyType currencyType)
{
}
}

View File

@ -1,14 +1,18 @@
package mineplex.core.gadget.gadgets.morph;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.Sound;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.disguise.disguises.DisguiseRabbit;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.*;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
@ -21,28 +25,9 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseRabbit;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
public class MorphBunny extends MorphGadget
{
@ -151,7 +136,7 @@ public class MorphBunny extends MorphGadget
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (Manager.getDonationManager().Get(player.getName()).GetBalance(CurrencyType.TREASURE_SHARD) < 500)
if (Manager.getDonationManager().Get(player.getName()).getBalance(GlobalCurrency.TREASURE_SHARD) < 500)
{
UtilPlayer.message(player, F.main("Gadget", "You do not have enough Shards."));
return;

View File

@ -1,8 +1,16 @@
package mineplex.core.gadget.gadgets.morph;
import java.util.HashSet;
import java.util.Iterator;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseVillager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.ChatColor;
import org.bukkit.EntityEffect;
import org.bukkit.Material;
@ -12,27 +20,12 @@ import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseVillager;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
import java.util.HashSet;
import java.util.Iterator;
public class MorphVillager extends MorphGadget implements IThrown
{
@ -81,7 +74,7 @@ public class MorphVillager extends MorphGadget implements IThrown
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (Manager.getDonationManager().Get(player.getName()).GetBalance(CurrencyType.GEM) < 20)
if (Manager.getDonationManager().Get(player.getName()).getBalance(GlobalCurrency.GEM) < 20)
{
UtilPlayer.message(player, F.main("Gadget", "You do not have enough Gems."));
return;

View File

@ -1,17 +1,13 @@
package mineplex.core.gadget.types;
import java.util.HashSet;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetAppliedEvent;
import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.event.GadgetDisableEvent;
import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.shop.item.SalesPackageBase;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -19,6 +15,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.HashSet;
public abstract class Gadget extends SalesPackageBase implements Listener
{
public GadgetManager Manager;
@ -152,12 +150,6 @@ public abstract class Gadget extends SalesPackageBase implements Listener
UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(getName()) + "."));
}
@Override
public void sold(Player player, CurrencyType currencyType)
{
}
public boolean ownsGadget(Player player)
{
if(isFree() || _free) return true;

View File

@ -1,8 +1,10 @@
package mineplex.core.mount;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.shop.item.SalesPackageBase;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
@ -12,12 +14,8 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.shop.item.SalesPackageBase;
import java.util.HashMap;
import java.util.HashSet;
public abstract class Mount<T extends MountData> extends SalesPackageBase implements Listener
{
@ -35,12 +33,6 @@ public abstract class Mount<T extends MountData> extends SalesPackageBase implem
Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin());
}
@Override
public void sold(Player player, CurrencyType currencyType)
{
}
public final void enable(Player player)
{
MountActivateEvent gadgetEvent = new MountActivateEvent(player, this);

View File

@ -1,12 +1,10 @@
package mineplex.core.pet;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.pet.repository.token.PetSalesToken;
import mineplex.core.shop.item.SalesPackageBase;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class Pet extends SalesPackageBase
{
@ -19,7 +17,7 @@ public class Pet extends SalesPackageBase
_name = name;
_petType = petType;
CurrencyCostMap.put(CurrencyType.TREASURE_SHARD, cost);
CurrencyCostMap.put(GlobalCurrency.TREASURE_SHARD, cost);
KnownPackage = false;
}
@ -38,10 +36,4 @@ public class Pet extends SalesPackageBase
{
return _name;
}
@Override
public void sold(Player player, CurrencyType currencyType)
{
}
}

View File

@ -1,11 +1,9 @@
package mineplex.core.pet;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.pet.repository.token.PetExtraToken;
import mineplex.core.shop.item.SalesPackageBase;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public class PetExtra extends SalesPackageBase
{
@ -18,7 +16,7 @@ public class PetExtra extends SalesPackageBase
_name = name;
_material = material;
CurrencyCostMap.put(CurrencyType.TREASURE_SHARD, cost);
CurrencyCostMap.put(GlobalCurrency.TREASURE_SHARD, cost);
KnownPackage = false;
OneTimePurchaseOnly = false;
@ -38,9 +36,4 @@ public class PetExtra extends SalesPackageBase
{
return _material;
}
@Override
public void sold(Player player, CurrencyType currencyType)
{
}
}

View File

@ -1,14 +1,13 @@
package mineplex.core.reward.rewards;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.donation.DonationManager;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
/**
* Created by shaun on 14-09-12.
@ -34,7 +33,7 @@ public class UnknownPackageReward extends Reward
@Override
protected RewardData giveRewardCustom(Player player, RewardType type)
{
_donationManager.PurchaseUnknownSalesPackage(null, player.getName(), _donationManager.getClientManager().Get(player).getAccountId(), _packageName, CurrencyType.TREASURE_SHARD, 0, true);
_donationManager.PurchaseUnknownSalesPackage(null, player.getName(), _donationManager.getClientManager().Get(player).getAccountId(), _packageName, GlobalCurrency.TREASURE_SHARD, 0, true);
return new RewardData(getRarity().getDarkColor() + _header, getRarity().getColor() + _name, _itemStack, getRarity());
}

View File

@ -1,12 +1,11 @@
package mineplex.core.scoreboard;
import java.util.ArrayList;
import mineplex.core.scoreboard.elements.*;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.ArrayList;
public class ScoreboardData
{
private ArrayList<ScoreboardElement> _elements = new ArrayList<ScoreboardElement>();
@ -96,11 +95,6 @@ public class ScoreboardData
_elements.add(new ScoreboardElementText(" "));
}
public void writePlayerGold()
{
_elements.add(new ScoreboardElementGoldCount());
}
public void writePlayerGems()
{
_elements.add(new ScoreboardElementGemCount());

View File

@ -1,20 +1,19 @@
package mineplex.core.scoreboard.elements;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.scoreboard.ScoreboardManager;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.scoreboard.ScoreboardManager;
public class ScoreboardElementCoinCount implements ScoreboardElement
{
@Override
public List<String> getLines(ScoreboardManager manager, Player player, List<String> out)
{
List<String> output = new ArrayList<String>();
output.add(manager.getDonation().Get(player).GetBalance(CurrencyType.TREASURE_SHARD) + "");
output.add(manager.getDonation().Get(player).getBalance(GlobalCurrency.TREASURE_SHARD) + "");
return output;
}
}

View File

@ -1,20 +1,19 @@
package mineplex.core.scoreboard.elements;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.scoreboard.ScoreboardManager;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.scoreboard.ScoreboardManager;
public class ScoreboardElementGemCount implements ScoreboardElement
{
@Override
public List<String> getLines(ScoreboardManager manager, Player player, List<String> out)
{
List<String> output = new ArrayList<String>();
output.add(manager.getDonation().Get(player).GetBalance(CurrencyType.GEM) + "");
output.add(manager.getDonation().Get(player).getBalance(GlobalCurrency.GEM) + "");
return output;
}
}

View File

@ -1,20 +0,0 @@
package mineplex.core.scoreboard.elements;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.scoreboard.ScoreboardManager;
public class ScoreboardElementGoldCount implements ScoreboardElement
{
@Override
public List<String> getLines(ScoreboardManager manager, Player player, List<String> out)
{
List<String> output = new ArrayList<String>();
output.add(manager.getDonation().Get(player).GetBalance(CurrencyType.GOLD) + "");
return output;
}
}

View File

@ -1,12 +1,13 @@
package mineplex.core.shop;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.donation.DonationManager;
import mineplex.core.npc.event.NpcDamageByEntityEvent;
import mineplex.core.npc.event.NpcInteractEntityEvent;
import mineplex.core.shop.page.ShopPageBase;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory;
@ -22,22 +23,13 @@ import org.bukkit.event.inventory.InventoryDragEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.donation.DonationManager;
import mineplex.core.npc.event.NpcDamageByEntityEvent;
import mineplex.core.npc.event.NpcInteractEntityEvent;
import mineplex.core.shop.page.ShopPageBase;
import java.util.HashSet;
public abstract class ShopBase<PluginType extends MiniPlugin> implements Listener
{
private NautHashMap<String, Long> _errorThrottling;
private NautHashMap<String, Long> _purchaseBlock;
private List<CurrencyType> _availableCurrencyTypes = new ArrayList<CurrencyType>();
private PluginType _plugin;
private CoreClientManager _clientManager;
private DonationManager _donationManager;
@ -46,7 +38,7 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
private HashSet<String> _openedShop = new HashSet<String>();
public ShopBase(PluginType plugin, CoreClientManager clientManager, DonationManager donationManager, String name, CurrencyType...currencyTypes)
public ShopBase(PluginType plugin, CoreClientManager clientManager, DonationManager donationManager, String name)
{
_plugin = plugin;
_clientManager = clientManager;
@ -56,18 +48,10 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
_playerPageMap = new NautHashMap<String, ShopPageBase<PluginType, ? extends ShopBase<PluginType>>>();
_errorThrottling = new NautHashMap<String, Long>();
_purchaseBlock = new NautHashMap<String, Long>();
if (currencyTypes != null && currencyTypes.length > 0)
_availableCurrencyTypes.addAll(Arrays.asList(currencyTypes));
_plugin.registerEvents(this);
}
public List<CurrencyType> getAvailableCurrencyTypes()
{
return _availableCurrencyTypes;
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerDamageEntity(NpcDamageByEntityEvent event)
{

View File

@ -1,12 +1,12 @@
package mineplex.core.shop.item;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.Currency;
import mineplex.core.donation.repository.GameSalesPackageToken;
public interface ICurrencyPackage
{
int getSalesPackageId();
int getCost(CurrencyType currencytype);
int getCost(Currency currencytype);
boolean isFree();
void update(GameSalesPackageToken token);
}

View File

@ -1,12 +1,11 @@
package mineplex.core.shop.item;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.Currency;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.donation.repository.GameSalesPackageToken;
import org.bukkit.Material;
public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPackage
{
@ -20,7 +19,7 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack
protected int SalesPackageId;
protected boolean Free;
protected NautHashMap<CurrencyType, Integer> CurrencyCostMap;
protected NautHashMap<Currency, Integer> CurrencyCostMap;
protected boolean KnownPackage = true;
protected boolean OneTimePurchaseOnly = true;
@ -41,7 +40,7 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack
public SalesPackageBase(String name, Material material, byte displayData, String[] description, int coins, int quantity)
{
CurrencyCostMap = new NautHashMap<CurrencyType, Integer>();
CurrencyCostMap = new NautHashMap<>();
Name = name;
DisplayName = name;
@ -49,12 +48,10 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack
_displayMaterial = material;
_displayData = displayData;
CurrencyCostMap.put(CurrencyType.TREASURE_SHARD, coins);
CurrencyCostMap.put(GlobalCurrency.TREASURE_SHARD, coins);
Quantity = quantity;
}
public abstract void sold(Player player, CurrencyType currencyType);
@Override
public String getName()
{
@ -68,7 +65,7 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack
}
@Override
public int getCost(CurrencyType currencyType)
public int getCost(Currency currencyType)
{
return CurrencyCostMap.containsKey(currencyType) ? CurrencyCostMap.get(currencyType) : 0;
}
@ -105,7 +102,7 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack
if (token.Gems > 0)
{
CurrencyCostMap.put(CurrencyType.GEM, token.Gems);
CurrencyCostMap.put(GlobalCurrency.GEM, token.Gems);
}
}

View File

@ -1,19 +1,15 @@
package mineplex.core.shop.page;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.currency.Currency;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.server.util.TransactionResponse;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SalesPackageBase;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -31,17 +27,18 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
private int _progressCount;
private ShopItem _progressItem;
private int _taskId;
private final Currency _currencyType;
public ConfirmationPage(PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, Runnable runnable, ShopPageBase<PluginType, ShopType> returnPage, SalesPackageBase salesItem, CurrencyType currencyType, Player player)
public ConfirmationPage(PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, Runnable runnable, ShopPageBase<PluginType, ShopType> returnPage, SalesPackageBase salesItem, Currency currencyType, Player player)
{
super(plugin, shop, clientManager, donationManager, " Confirmation", player);
_runnable = runnable;
_returnPage = returnPage;
_salesItem = salesItem;
setCurrencyType(currencyType);
_progressItem = new ShopItem(Material.LAPIS_BLOCK, (byte)11, ChatColor.BLUE + "Processing", null, 1, false, true);
_okSquareSlotStart = 27;
_currencyType = currencyType;
if (getShop().canPlayerAttemptPurchase(player))
{
@ -79,7 +76,7 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
buildSquareAt(_okSquareSlotStart, new ShopItem(Material.EMERALD_BLOCK, (byte) 0, ChatColor.GREEN + "OK", null, 1, false, true), okClicked);
buildSquareAt(_okSquareSlotStart + 6, new ShopItem(Material.REDSTONE_BLOCK, (byte) 0, ChatColor.RED + "CANCEL", null, 1, false, true), cancelClicked);
this.getInventory().setItem(4, new ShopItem(getCurrencyType().getDisplayMaterial(), (byte)0, getCurrencyType().getPrefix(), new String[] { C.cGray + _salesItem.getCost(getCurrencyType()) + " " + getCurrencyType().getPrefix() + " will be", C.cGray + "deducted from your account balance." }, 1, false, true).getHandle());
this.getInventory().setItem(4, new ShopItem(_currencyType.getDisplayMaterial(), (byte)0, _currencyType.getPrefix(), new String[] { C.cGray + _salesItem.getCost(_currencyType) + " " + _currencyType.getPrefix() + " will be", C.cGray + "deducted from your account balance." }, 1, false, true).getHandle());
}
protected void okClicked(Player player)
@ -127,12 +124,12 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
clear(i);
}
_processing = true;
/*_processing = true;
if (getCurrencyType() == CurrencyType.GOLD)
if (_currencyType == GlobalCurrency.GOLD)
{
int goldCount = getDonationManager().Get(getPlayer()).getGold();
int cost = _salesItem.getCost(getCurrencyType());
int cost = _salesItem.getCost(_currencyType);
if (cost > goldCount)
showResultsPage(TransactionResponse.InsufficientFunds);
@ -168,7 +165,7 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
{
showResultsPage(response);
}
}, getPlayer().getName(), getPlayer().getUniqueId(), _salesItem.getCost(getCurrencyType()), _salesItem.getSalesPackageId());
}, getPlayer().getName(), getPlayer().getUniqueId(), _salesItem.getCost(_currencyType), _salesItem.getSalesPackageId());
}
else
{
@ -178,11 +175,12 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
{
showResultsPage(response);
}
}, getPlayer().getName(), getClientManager().Get(getPlayer()).getAccountId(), _salesItem.getName(), getCurrencyType(), _salesItem.getCost(getCurrencyType()), _salesItem.oneTimePurchase());
}, getPlayer().getName(), getClientManager().Get(getPlayer()).getAccountId(), _salesItem.getName(), _currencyType, _salesItem.getCost(_currencyType), _salesItem.oneTimePurchase());
}
}
_taskId = getPlugin().getScheduler().scheduleSyncRepeatingTask(getPlugin().getPlugin(), this, 2L, 2L);
_taskId = getPlugin().getScheduler().scheduleSyncRepeatingTask(getPlugin().getPlugin(), this, 2L, 2L);*/
// TODO
}
private void showResultsPage(TransactionResponse response)
@ -204,8 +202,6 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
getShop().addPlayerProcessError(getPlayer());
break;
case Success:
_salesItem.sold(getPlayer(), getCurrencyType());
buildSuccessPage("Your purchase was successful.");
if (_runnable != null)

View File

@ -1,5 +1,13 @@
package mineplex.core.shop.page;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilInv;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.item.IButton;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryCustom;
@ -11,16 +19,6 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilInv;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.item.IButton;
public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType extends ShopBase<PluginType>> extends CraftInventoryCustom implements Listener
{
protected PluginType _plugin;
@ -29,7 +27,6 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
protected ShopType _shop;
protected Player _player;
protected CoreClient _client;
protected CurrencyType _currencyType;
protected NautHashMap<Integer, IButton> _buttonMap;
protected boolean _showCurrency = false;
@ -52,27 +49,6 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
_buttonMap = new NautHashMap<Integer, IButton>();
_client = _clientManager.Get(player);
if (shop.getAvailableCurrencyTypes().size() > 0)
{
_currencyType = shop.getAvailableCurrencyTypes().get(0);
}
}
protected void changeCurrency(Player player)
{
playAcceptSound(player);
int currentIndex = _shop.getAvailableCurrencyTypes().indexOf(_currencyType);
if (currentIndex + 1 < _shop.getAvailableCurrencyTypes().size())
{
_currencyType = _shop.getAvailableCurrencyTypes().get(currentIndex + 1);
}
else
{
_currencyType = _shop.getAvailableCurrencyTypes().get(0);
}
}
protected abstract void buildPage();
@ -237,16 +213,6 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
return _client;
}
protected CurrencyType getCurrencyType()
{
return _currencyType;
}
protected void setCurrencyType(CurrencyType type)
{
_currencyType = type;
}
protected NautHashMap<Integer, IButton> getButtonMap()
{
return _buttonMap;

View File

@ -1,20 +1,18 @@
package mineplex.core.tournament.ui;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.tournament.TournamentManager;
import mineplex.core.tournament.ui.page.MainMenu;
import org.bukkit.entity.Player;
public class TournamentShop extends ShopBase<TournamentManager>
{
public TournamentShop(TournamentManager plugin, CoreClientManager clientManager, DonationManager donationManager)
{
super(plugin, clientManager, donationManager, "Tournaments", CurrencyType.GEM);
super(plugin, clientManager, donationManager, "Tournaments");
}
@Override

View File

@ -1,10 +1,7 @@
package mineplex.core.treasure;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.shop.item.SalesPackageBase;
import org.bukkit.Material;
public class ChestPackage extends SalesPackageBase
{
@ -15,10 +12,4 @@ public class ChestPackage extends SalesPackageBase
KnownPackage = false;
OneTimePurchaseOnly = false;
}
@Override
public void sold(Player player, CurrencyType currencyType)
{
}
}

View File

@ -1,11 +1,8 @@
package mineplex.core.treasure;
import mineplex.core.shop.item.SalesPackageBase;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.shop.item.SalesPackageBase;
/**
* Created by shaun on 14-09-18.
@ -19,10 +16,4 @@ public class TreasureKey extends SalesPackageBase
KnownPackage = false;
OneTimePurchaseOnly = false;
}
@Override
public void sold(Player player, CurrencyType currencyType)
{
}
}

View File

@ -1,17 +1,16 @@
package mineplex.core.treasure.gui;
import mineplex.core.treasure.TreasureType;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.treasure.ChestPackage;
import mineplex.core.treasure.TreasureType;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class BuyChestButton implements IButton
{
@ -68,6 +67,6 @@ public class BuyChestButton implements IButton
_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), () -> {
_inventoryManager.addItemToInventory(player, _chestName, 1);
_page.refresh();
}, _page, new ChestPackage(_chestName, _chestMat, _chestCost), CurrencyType.TREASURE_SHARD, player));
}, _page, new ChestPackage(_chestName, _chestMat, _chestCost), GlobalCurrency.TREASURE_SHARD, player));
}
}

View File

@ -1,8 +1,11 @@
package mineplex.core.treasure.gui;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom;
import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom;
@ -11,24 +14,21 @@ import mineplex.core.gadget.gadgets.morph.MorphUncleSam;
import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.mount.Mount;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.TreasureManager;
import mineplex.core.treasure.TreasureType;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.TreasureManager;
import mineplex.core.treasure.TreasureType;
import java.util.ArrayList;
import java.util.List;
public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
{
@ -50,7 +50,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
@Override
protected void buildPage()
{
int treasureShards = getDonationManager().Get(getPlayer()).getCoins();
int treasureShards = getDonationManager().Get(getPlayer()).getBalance(GlobalCurrency.TREASURE_SHARD);
int basicCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.OLD.getItemName());
int heroicCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ANCIENT.getItemName());

View File

@ -1,24 +1,10 @@
package mineplex.enjinTranslator;
import java.text.SimpleDateFormat;
import java.util.AbstractMap;
import java.util.Date;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.UUID;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.Rank;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UUIDFetcher;
@ -28,6 +14,19 @@ import mineplex.core.server.util.TransactionResponse;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.enjinTranslator.purchase.PurchaseManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import java.text.SimpleDateFormat;
import java.util.AbstractMap;
import java.util.Date;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.UUID;
public class Enjin extends MiniPlugin implements CommandExecutor
{
@ -243,7 +242,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor
_purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, amount, data == TransactionResponse.Success);
}
}
}, name, client.getAccountId(), amount == 1 ? packageName : packageName + " " + amount, CurrencyType.GEM, 0, false);
}, name, client.getAccountId(), amount == 1 ? packageName : packageName + " " + amount, GlobalCurrency.GEM, 0, false);
return true;
}

View File

@ -481,6 +481,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
{
return _donationManager;
}
public GoldManager getGoldManager()
{
return _goldManager;
}
public ItemMapManager getItemMapManager()
{

View File

@ -1,17 +1,15 @@
package mineplex.game.clans.clans.scoreboard.elements;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.scoreboard.ScoreboardManager;
import mineplex.core.scoreboard.elements.ScoreboardElement;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ClansUtility;
import mineplex.game.clans.core.repository.ClanTerritory;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
public class ScoreboardElementPlayer implements ScoreboardElement
{
@ -26,7 +24,7 @@ public class ScoreboardElementPlayer implements ScoreboardElement
public List<String> getLines(ScoreboardManager manager, Player player, List<String> out)
{
List<String> output = new ArrayList<String>();
output.add(C.cYellow + "Gold " + C.cWhite + manager.getDonation().Get(player).GetBalance(CurrencyType.GOLD) + "");
output.add(C.cYellow + "Gold " + C.cWhite + _clansManager.getGoldManager().Get(player).getBalance());
String regionString = C.xWilderness + "Wilderness";
output.add(" ");

View File

@ -1,18 +1,14 @@
package mineplex.game.clans.clans.scoreboard.elements;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilServer;
import mineplex.core.scoreboard.ScoreboardManager;
import mineplex.core.scoreboard.elements.ScoreboardElement;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ClansUtility;
import mineplex.game.clans.core.repository.ClanTerritory;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
public class ScoreboardElementPlayerCount implements ScoreboardElement
{

View File

@ -0,0 +1,9 @@
package mineplex.game.clans.economy;
import mineplex.core.common.currency.Currency;
import mineplex.core.common.util.C;
import org.bukkit.Material;
public class ClansCurrency {
public static final Currency GOLD = new Currency("Gold", "Gold", C.cGold, Material.GOLD_NUGGET);
}

View File

@ -1,4 +1,4 @@
package mineplex.core.donation.command;
package mineplex.game.clans.economy;
import mineplex.core.account.CoreClient;
import mineplex.core.command.CommandBase;
@ -6,13 +6,11 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import org.bukkit.entity.Player;
public class GoldCommand extends CommandBase<DonationManager>
public class GoldCommand extends CommandBase<GoldManager>
{
public GoldCommand(DonationManager plugin)
public GoldCommand(GoldManager plugin)
{
super(plugin, Rank.ADMIN, "givegold");
}
@ -22,7 +20,7 @@ public class GoldCommand extends CommandBase<DonationManager>
{
if (args == null || args.length == 0)
{
UtilPlayer.message(caller, F.main("Gold", "Your Gold: " + F.elem("" + Plugin.Get(caller).getGold())));
UtilPlayer.message(caller, F.main("Gold", "Your Gold: " + F.elem("" + Plugin.Get(caller).getBalance())));
return;
}
else if (args.length < 2)
@ -84,6 +82,6 @@ public class GoldCommand extends CommandBase<DonationManager>
UtilPlayer.message(target, F.main("Gold", F.name(caller.getName()) + " gave you " + F.elem(gold + " Gold") + "."));
}
}
}, caller.getName(), targetName, accountId, gold);
}, accountId, targetName, gold, true);
}
}

View File

@ -0,0 +1,18 @@
package mineplex.game.clans.economy;
public class GoldData
{
private int balance;
public void addBalance(int amount) {
balance += amount;
}
public void setBalance(int amount) {
balance = amount;
}
public int getBalance() {
return balance;
}
}

View File

@ -1,14 +1,16 @@
package mineplex.game.clans.economy;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.*;
import mineplex.core.donation.DonationManager;
import mineplex.core.donation.Donor;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.items.economy.GoldToken;
import mineplex.game.clans.shop.bank.BankShop;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -24,22 +26,11 @@ import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.donation.Donor;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.items.economy.GoldToken;
import mineplex.game.clans.shop.bank.BankShop;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
public class GoldManager extends MiniPlugin
public class GoldManager extends MiniDbClientPlugin<GoldData>
{
public static final double GEM_CONVERSION_RATE = 16; // The number of gold coins when converted from a single gem
@ -54,10 +45,12 @@ public class GoldManager extends MiniPlugin
private Set<Item> _itemSet;
private Map<Player, Integer> _playerPickupMap;
private BankShop _bankShop;
private final GoldRepository _repository;
public GoldManager(ClansManager plugin, CoreClientManager clientManager, DonationManager donationManager)
{
super("Clans Gold", plugin.getPlugin());
super("Clans Gold", plugin.getPlugin(), clientManager);
_instance = this;
_donationManager = donationManager;
@ -65,6 +58,14 @@ public class GoldManager extends MiniPlugin
_itemSet = new HashSet<Item>();
_playerPickupMap = new HashMap<Player, Integer>();
_bankShop = new BankShop(plugin, clientManager, donationManager);
_repository = new GoldRepository(plugin.getPlugin());
}
@Override
public void addCommands()
{
addCommand(new GoldCommand(this));
addCommand(new SetGoldCommand(this));
}
@EventHandler
@ -177,12 +178,12 @@ public class GoldManager extends MiniPlugin
public int getGold(Player player)
{
return getDonor(player).getGold();
return Get(player).getBalance();
}
public int getGems(Player player)
{
return getDonor(player).GetGems();
return getDonor(player).getBalance(GlobalCurrency.GEM);
}
public void transferGemsToCoins(Player player, int gemAmount)
@ -192,7 +193,7 @@ public class GoldManager extends MiniPlugin
if (gemCount >= gemAmount)
{
deductGems(player, gemAmount);
_donationManager.RewardGemsLater("GoldManager", player, -gemAmount);
addGold(player, goldCount);
notify(player, String.format("You have transferred %d gems into %d gold coins!", gemAmount, goldCount));
_transferTracker.insertTransfer(player);
@ -208,20 +209,6 @@ public class GoldManager extends MiniPlugin
{
return !_transferTracker.hasTransferredToday(player);
}
public void addGold(Player player, int amount)
{
if (amount >= 0)
_donationManager.rewardGold(null, "GoldManager", player, amount);
}
public void deductGold(Callback<Boolean> resultCallback, Player player, int amount)
{
if (amount == 0)
resultCallback.run(true);
if (amount > 0)
_donationManager.rewardGold(resultCallback, "GoldManager", player, -amount);
}
public void cashIn(Player player, GoldToken token)
{
@ -302,16 +289,7 @@ public class GoldManager extends MiniPlugin
}, player, tokenValue);
}
public void addGems(Player player, int amount)
{
_donationManager.RewardGemsLater("GoldManager", player, amount);
}
public void deductGems(Player player, int amount)
{
addGems(player, -amount);
}
private Donor getDonor(Player player)
{
return _donationManager.Get(player.getName());
@ -330,4 +308,104 @@ public class GoldManager extends MiniPlugin
item.remove();
}
}
public void setGold(final Callback<Boolean> callback, final String caller, final String name, final int accountId, final int amount, final boolean updateTotal)
{
_repository.setGold(new Callback<Boolean>()
{
public void run(Boolean success)
{
if (success)
{
if (updateTotal)
{
GoldData data = Get(name);
if (data != null)
{
data.setBalance(amount);
}
}
}
else
{
System.out.println("SET GOLD FAILED...");
}
if (callback != null)
callback.run(success);
}
}, accountId, amount);
}
public void addGold(Player player, int amount)
{
if (amount >= 0)
rewardGold(null, player, amount, true);
}
public void deductGold(Callback<Boolean> resultCallback, Player player, int amount)
{
if (amount > 0)
rewardGold(resultCallback, player, -amount, true);
}
public void rewardGold(final Callback<Boolean> callback, final Player player, final int amount, final boolean updateTotal)
{
rewardGold(callback, getClientManager().Get(player).getAccountId(), player.getName(), amount, updateTotal);
}
public void rewardGold(final Callback<Boolean> callback, int accountId, String name, final int amount, final boolean updateTotal)
{
if (amount == 0)
{
if (callback != null)
{
callback.run(true);
}
return;
}
_repository.rewardGold(new Callback<Boolean>()
{
public void run(Boolean success)
{
if (success)
{
if (updateTotal)
{
GoldData data = Get(name);
if (data != null)
{
data.addBalance(amount);
}
}
}
else
{
System.out.println("REWARD GOLD FAILED...");
}
if (callback != null)
callback.run(success);
}
}, accountId, amount);
}
@Override
public String getQuery(int accountId, String uuid, String name) {
return "SELECT gold FROM accounts WHERE id = '" + accountId + "';";
}
@Override
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException {
Get(playerName).setBalance(resultSet.getInt(1));
}
@Override
protected GoldData addPlayer(String player) {
return new GoldData();
}
}

View File

@ -0,0 +1,52 @@
package mineplex.game.clans.economy;
import mineplex.core.common.util.Callback;
import mineplex.core.database.MinecraftRepository;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.DatabaseRunnable;
import mineplex.serverdata.database.column.ColumnInt;
import org.bukkit.plugin.java.JavaPlugin;
public class GoldRepository extends MinecraftRepository {
private static final String UPDATE_ACCOUNT_GOLD = "UPDATE accounts SET gold = gold + ? WHERE id = ? && gold >= ?;";
private static final String SET_ACCOUNT_GOLD = "UPDATE accounts SET gold = ? WHERE id = ?;";
public GoldRepository(JavaPlugin plugin) {
super(plugin, DBPool.getAccount());
}
public void rewardGold(final Callback<Boolean> callback, final int accountId, final int gold)
{
handleDatabaseCall(new DatabaseRunnable(new Runnable()
{
public void run()
{
ColumnInt min = new ColumnInt("gold", gold < 0 ? -gold : 0);
boolean success = executeUpdate(UPDATE_ACCOUNT_GOLD, new ColumnInt("gold", gold), new ColumnInt("id", accountId), min) > 0;
callback.run(success);
}
}), "Error updating player gold amount in DonationRepository : ");
}
public void setGold(final Callback<Boolean> callback, final int accountId, final int gold)
{
if (gold < 0)
{
throw new IllegalArgumentException("gold cannot be negative");
}
handleDatabaseCall(new DatabaseRunnable(new Runnable()
{
public void run()
{
boolean success = executeUpdate(SET_ACCOUNT_GOLD, new ColumnInt("gold", gold), new ColumnInt("id", accountId)) > 0;
callback.run(success);
}
}), "Error updating player gold amount in DonationRepository : ");
}
@Override
protected void initialize() {}
@Override
protected void update() {}
}

View File

@ -1,4 +1,4 @@
package mineplex.core.donation.command;
package mineplex.game.clans.economy;
import mineplex.core.account.CoreClient;
import mineplex.core.command.CommandBase;
@ -10,9 +10,9 @@ import mineplex.core.donation.DonationManager;
import org.bukkit.entity.Player;
public class SetGoldCommand extends CommandBase<DonationManager>
public class SetGoldCommand extends CommandBase<GoldManager>
{
public SetGoldCommand(DonationManager plugin)
public SetGoldCommand(GoldManager plugin)
{
super(plugin, Rank.ADMIN, "setgold");
}

View File

@ -1,25 +1,17 @@
package mineplex.game.clans.shop.energy;
import mineplex.core.shop.item.SalesPackageBase;
import mineplex.game.clans.economy.ClansCurrency;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.shop.item.SalesPackageBase;
public class EnergyPackage extends SalesPackageBase
{
public EnergyPackage(String name, int cost)
{
super(name, Material.REDSTONE, " ", ChatColor.RESET + "Clan Energy");
CurrencyCostMap.put(CurrencyType.GOLD, cost);
CurrencyCostMap.put(ClansCurrency.GOLD, cost);
KnownPackage = false;
OneTimePurchaseOnly = false;
}
@Override
public void sold(Player player, CurrencyType currencyType)
{
}
}

View File

@ -1,9 +1,5 @@
package mineplex.game.clans.shop.energy;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilServer;
import mineplex.core.shop.item.IButton;
@ -11,6 +7,9 @@ import mineplex.core.shop.page.ConfirmationPage;
import mineplex.game.clans.clans.ClanEnergyManager;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.event.PreEnergyShopBuyEvent;
import mineplex.game.clans.economy.ClansCurrency;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class EnergyShopButton implements IButton
{
@ -57,7 +56,7 @@ public class EnergyShopButton implements IButton
// Notify
_energyManager.getClansManager().messageClan(_clanInfo, F.main("Energy", F.name(player.getName()) + " purchased " + F.elem(_energyToPurchase + " Energy") + " for the clan"));
}
}, _page, new EnergyPackage(_energyToPurchase + " Energy", _cost), CurrencyType.GOLD, player));
}, _page, new EnergyPackage(_energyToPurchase + " Energy", _cost), ClansCurrency.GOLD, player));
}

View File

@ -1,31 +1,19 @@
package mineplex.game.clans.shop.pvp.tnt;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilUI;
import mineplex.core.common.util.*;
import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.tntGenerator.TntGenerator;
import mineplex.game.clans.clans.tntGenerator.TntGeneratorManager;
import mineplex.game.clans.economy.GoldManager;
import mineplex.game.clans.shop.ClansShopItem;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.inventory.ItemStack;
public class TNTGenPage extends ShopPageBase<ClansManager, TNTGenShop>
{
@ -64,7 +52,7 @@ public class TNTGenPage extends ShopPageBase<ClansManager, TNTGenShop>
return;
}
if (_donationManager.Get(player).getGold() >= ClansShopItem.TNT_GENERATOR.getBuyPrice())
if (getPlugin().getGoldManager().Get(player).getBalance() >= ClansShopItem.TNT_GENERATOR.getBuyPrice())
{
GoldManager.getInstance().deductGold(success -> {
UtilPlayer.message(player, F.main("Clans", "You purchased a " + F.elem("TNT Generator") + " for your Clan. You can now access it from the " + F.elem("PvP Shop") + "."));

View File

@ -1,4 +1,5 @@
package mineplex.hub;
import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
@ -10,6 +11,7 @@ import mineplex.core.bonuses.BonusManager;
import mineplex.core.boosters.BoosterManager;
import mineplex.core.botspam.BotSpamManager;
import mineplex.core.common.Rank;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.*;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.customdata.CustomDataManager;
@ -736,8 +738,8 @@ public class HubManager extends MiniClientPlugin<HubClient>
obj.getScore(C.cGreen + C.Bold + "Gems").setScore(line--);
// Remove Old/Add New
player.getScoreboard().resetScores(Get(player.getName()).GetLastGemCount() + "");
obj.getScore(GetDonation().Get(player.getName()).GetGems() + "").setScore(line--);
Get(player.getName()).SetLastGemCount(GetDonation().Get(player.getName()).GetGems());
obj.getScore(GetDonation().Get(player.getName()).getBalance(GlobalCurrency.GEM) + "").setScore(line--);
Get(player.getName()).SetLastGemCount(GetDonation().Get(player.getName()).getBalance(GlobalCurrency.GEM));
//Space
obj.getScore(" ").setScore(line--);

View File

@ -1,19 +1,9 @@
package mineplex.hub.modules;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.*;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.gadgets.item.ItemLovePotion;
@ -21,6 +11,10 @@ import mineplex.core.server.util.TransactionResponse;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.modules.valentines.Courtship;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
public class ValentinesManager extends MiniPlugin
{
@ -128,6 +122,6 @@ public class ValentinesManager extends MiniPlugin
UtilPlayer.message(player, F.main("Reward", "You recieved " + F.elem(_reward + " Mount") + " from " + F.elem(_prefix) + "!"));
}
}
}, player.getName(), _client.getAccountId(player), _reward, CurrencyType.TREASURE_SHARD, 0, true);
}, player.getName(), _client.getAccountId(player), _reward, GlobalCurrency.TREASURE_SHARD, 0, true);
}
}

View File

@ -1,5 +1,17 @@
package mineplex.minecraft.game.classcombat.shop;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.shop.event.OpenClassShopEvent;
import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
@ -9,20 +21,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.shop.event.OpenClassShopEvent;
import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage;
public class ClassCombatShop extends ShopBase<ClassShopManager>
{
private NautHashMap<String, ItemStack[]> _playerInventoryMap = new NautHashMap<String, ItemStack[]>();
@ -34,14 +32,14 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name)
{
super(plugin, clientManager, donationManager, name, CurrencyType.GEM);
super(plugin, clientManager, donationManager, name);
_skillsOnly = skillsOnly;
}
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name, IPvpClass iPvpClass, boolean hub)
{
super(plugin, clientManager, donationManager, name, CurrencyType.GEM);
super(plugin, clientManager, donationManager, name);
_gameClass = iPvpClass;
_takeAwayStuff = true;
_skillsOnly = skillsOnly;

View File

@ -1,11 +1,8 @@
package mineplex.minecraft.game.classcombat.shop.page;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.Rank;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemStackFactory;
@ -20,20 +17,18 @@ import mineplex.minecraft.game.classcombat.Skill.ISkill;
import mineplex.minecraft.game.classcombat.item.Item;
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
import mineplex.minecraft.game.classcombat.shop.button.DeselectItemButton;
import mineplex.minecraft.game.classcombat.shop.button.PurchaseItemButton;
import mineplex.minecraft.game.classcombat.shop.button.PurchaseSkillButton;
import mineplex.minecraft.game.classcombat.shop.button.SelectItemButton;
import mineplex.minecraft.game.classcombat.shop.button.SelectSkillButton;
import mineplex.minecraft.game.classcombat.shop.button.*;
import mineplex.minecraft.game.classcombat.shop.salespackage.ItemSalesPackage;
import mineplex.minecraft.game.classcombat.shop.salespackage.SkillSalesPackage;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List;
public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
{
private IPvpClass _pvpClass;
@ -398,7 +393,7 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
{
buildPage();
}
}, this, new SkillSalesPackage(skill), CurrencyType.GEM, player));
}, this, new SkillSalesPackage(skill), GlobalCurrency.GEM, player));
}
private boolean isSkillLocked(ISkill skill)
@ -425,7 +420,7 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
{
buildPage();
}
}, this, new ItemSalesPackage(item), CurrencyType.GEM, player));
}, this, new ItemSalesPackage(item), GlobalCurrency.GEM, player));
}
public void SelectItem(Player player, Item item)

View File

@ -1,11 +1,9 @@
package mineplex.minecraft.game.classcombat.shop.salespackage;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.shop.item.SalesPackageBase;
import mineplex.minecraft.game.classcombat.item.Item;
import org.bukkit.Material;
public class ItemSalesPackage extends SalesPackageBase
{
@ -14,12 +12,6 @@ public class ItemSalesPackage extends SalesPackageBase
super("Champions " + item.GetName(), Material.BOOK, (byte)0, item.GetDesc(), item.GetGemCost());
Free = item.isFree();
KnownPackage = false;
CurrencyCostMap.put(CurrencyType.GEM, item.GetGemCost());
}
@Override
public void sold(Player player, CurrencyType currencyType)
{
CurrencyCostMap.put(GlobalCurrency.GEM, item.GetGemCost());
}
}

View File

@ -1,11 +1,9 @@
package mineplex.minecraft.game.classcombat.shop.salespackage;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.shop.item.SalesPackageBase;
import mineplex.minecraft.game.classcombat.Skill.ISkill;
import org.bukkit.Material;
public class SkillSalesPackage extends SalesPackageBase
{
@ -14,12 +12,6 @@ public class SkillSalesPackage extends SalesPackageBase
super("Champions " + skill.GetName(), Material.BOOK, (byte)0, skill.GetDesc(0), skill.GetGemCost());
Free = skill.IsFree();
KnownPackage = false;
CurrencyCostMap.put(CurrencyType.GEM, skill.GetGemCost());
}
@Override
public void sold(Player player, CurrencyType currencyType)
{
CurrencyCostMap.put(GlobalCurrency.GEM, skill.GetGemCost());
}
}

View File

@ -1,15 +1,10 @@
package mineplex.staffServer.customerSupport;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
@ -17,11 +12,8 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.donation.Donor;
import mineplex.core.donation.repository.token.CoinTransactionToken;
import mineplex.core.donation.repository.token.TransactionToken;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.mount.Mount;
import mineplex.serverdata.database.ResultSetCallable;
import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -34,6 +26,12 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
public class CustomerSupport extends MiniPlugin implements ResultSetCallable
{
private CoreClientManager _clientManager;
@ -119,8 +117,8 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
caller.sendMessage(C.cBlue + "Name: " + C.cYellow + playerName);
caller.sendMessage(C.cBlue + "Rank: " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name)));
caller.sendMessage(C.cBlue + "Shards: " + C.cYellow + donor.getCoins());
caller.sendMessage(C.cBlue + "Gems: " + C.cYellow + donor.GetGems());
caller.sendMessage(C.cBlue + "Shards: " + C.cYellow + donor.getBalance(GlobalCurrency.TREASURE_SHARD));
caller.sendMessage(C.cBlue + "Gems: " + C.cYellow + donor.getBalance(GlobalCurrency.GEM));
int enjinCoinsReceived = 0;
int oldChestsReceived = 0;

View File

@ -1,13 +1,12 @@
package mineplex.staffServer.salespackage.command;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClient;
import mineplex.core.command.CommandBase;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.Rank;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.F;
import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.entity.Player;
public class GemHunterCommand extends CommandBase<SalesPackageManager>
{
@ -41,7 +40,7 @@ public class GemHunterCommand extends CommandBase<SalesPackageManager>
if (client != null)
{
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, client.getAccountId(), "Gem Hunter Level " + amount, CurrencyType.GEM, 0, false);
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, client.getAccountId(), "Gem Hunter Level " + amount, GlobalCurrency.GEM, 0, false);
Plugin.getStatsManager().incrementStat(client.getAccountId(), "Global.GemsEarned", experience);
caller.sendMessage(F.main(Plugin.getName(), "Added Level " + amount + " Gem Hunter to " + playerName + "'s account!"));
}

View File

@ -1,18 +1,17 @@
package mineplex.staffServer.salespackage.command;
import java.util.UUID;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClient;
import mineplex.core.command.CommandBase;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.Rank;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.server.util.TransactionResponse;
import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.entity.Player;
import java.util.UUID;
public class ItemCommand extends CommandBase<SalesPackageManager>
{
@ -72,7 +71,7 @@ public class ItemCommand extends CommandBase<SalesPackageManager>
}
}, uuid, itemName, amount);
}
}, playerName, client.getAccountId(), (amount == 1 ? itemName : itemName + " " + amount), CurrencyType.GEM, 0, false);
}, playerName, client.getAccountId(), (amount == 1 ? itemName : itemName + " " + amount), GlobalCurrency.GEM, 0, false);
}
else
caller.sendMessage(F.main(Plugin.getName(), "Couldn't find " + playerName + "'s account!"));

View File

@ -4,10 +4,9 @@ import mineplex.core.MiniPlugin;
import mineplex.core.boosters.Booster;
import mineplex.core.boosters.BoosterManager;
import mineplex.core.boosters.event.BoosterActivateEvent;
import mineplex.core.boosters.event.BoosterExpireEvent;
import mineplex.core.boosters.tips.BoosterTipManager;
import mineplex.core.boosters.tips.TipAddResult;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.jsonchat.ClickEvent;
import mineplex.core.common.jsonchat.HoverEvent;
import mineplex.core.common.jsonchat.JsonMessage;
@ -63,8 +62,8 @@ public class GameBoosterManager extends MiniPlugin
_boosterManager.getTipManager().addTip(player, active, result -> {
if (result == TipAddResult.SUCCESS)
{
UtilPlayer.message(player, F.main("Tip", "You thanked " + F.name(active.getPlayerName()) + ". They earned " + F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_SPONSOR) + " and you got "
+ F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER)) + " in return!");
UtilPlayer.message(player, F.main("Tip", "You thanked " + F.name(active.getPlayerName()) + ". They earned " + F.currency(GlobalCurrency.TREASURE_SHARD, BoosterTipManager.TIP_FOR_SPONSOR) + " and you got "
+ F.currency(GlobalCurrency.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER)) + " in return!");
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1f, 1f);
} else
{
@ -88,7 +87,7 @@ public class GameBoosterManager extends MiniPlugin
Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated a Game Amplifier on " + F.elem(event.getBoosterGroup().replaceAll("_", " ")) + "!"));
}
JsonMessage message = new JsonMessage(F.main("Amplifier", F.elem("Click here") + " to thank them and receive " + F.currency(CurrencyType.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER) + "!"));
JsonMessage message = new JsonMessage(F.main("Amplifier", F.elem("Click here") + " to thank them and receive " + F.currency(GlobalCurrency.TREASURE_SHARD, BoosterTipManager.TIP_FOR_TIPPER) + "!"));
message.click(ClickEvent.RUN_COMMAND, "/amplifier thank " + _boosterGroup);
message.hover(HoverEvent.SHOW_TEXT, C.cGreen + "Click to Thank");
message.send(JsonMessage.MessageType.CHAT_BOX, UtilServer.getPlayers());

View File

@ -1,29 +1,8 @@
package nautilus.game.arcade.game.games.event;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseBat;
import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.disguise.disguises.DisguiseEnderman;
import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.*;
import mineplex.core.disguise.disguises.*;
import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
@ -42,14 +21,7 @@ import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.event.kits.KitPlayer;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.GameHostManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.*;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Sign;
import org.bukkit.entity.Entity;
@ -72,6 +44,8 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.util.*;
public class EventGame extends Game
{
private GameHostManager _mps;
@ -1242,7 +1216,7 @@ public class EventGame extends Game
return;
}
if(Manager.GetDonation().Get(event.getPlayer()).GetGems() < price)
if(Manager.GetDonation().Get(event.getPlayer()).getBalance(GlobalCurrency.GEM) < price)
{
UtilPlayer.message(event.getPlayer(), F.main("Event", "You dont have enough Gems."));
return;

View File

@ -1,19 +1,7 @@
package nautilus.game.arcade.game.games.halloween;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@ -29,37 +17,22 @@ import nautilus.game.arcade.game.games.halloween.creatures.InterfaceMove;
import nautilus.game.arcade.game.games.halloween.kits.KitFinn;
import nautilus.game.arcade.game.games.halloween.kits.KitRobinHood;
import nautilus.game.arcade.game.games.halloween.kits.KitThor;
import nautilus.game.arcade.game.games.halloween.waves.Wave1;
import nautilus.game.arcade.game.games.halloween.waves.Wave2;
import nautilus.game.arcade.game.games.halloween.waves.Wave3;
import nautilus.game.arcade.game.games.halloween.waves.Wave4;
import nautilus.game.arcade.game.games.halloween.waves.Wave5;
import nautilus.game.arcade.game.games.halloween.waves.WaveBase;
import nautilus.game.arcade.game.games.halloween.waves.WaveBoss;
import nautilus.game.arcade.game.games.halloween.waves.WaveVictory;
import nautilus.game.arcade.game.games.halloween.waves.*;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.managers.chat.ChatStatData;
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect;
import org.bukkit.ChatColor;
import org.bukkit.Difficulty;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.Fireball;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.*;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import java.util.*;
public class Halloween extends SoloGame
{
//Wave Data
@ -436,7 +409,7 @@ public class Halloween extends SoloGame
if (!player.isOnline())
continue;
Manager.GetDonation().PurchaseUnknownSalesPackage(null, player.getName(), Manager.GetClients().Get(player).getAccountId(), "Decrepit Warhorse", CurrencyType.TREASURE_SHARD, 0, true);
Manager.GetDonation().PurchaseUnknownSalesPackage(null, player.getName(), Manager.GetClients().Get(player).getAccountId(), "Decrepit Warhorse", GlobalCurrency.TREASURE_SHARD, 0, true);
}
}

View File

@ -1,16 +1,14 @@
package nautilus.game.arcade.game.games.searchanddestroy;
import java.util.ArrayList;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import nautilus.game.arcade.game.games.searchanddestroy.KitManager.UpgradeKit;
import org.bukkit.entity.Player;
import java.util.ArrayList;
public class KitEvolveShop extends ShopBase<KitEvolve>
{
@ -18,9 +16,9 @@ public class KitEvolveShop extends ShopBase<KitEvolve>
private ArrayList<UpgradeKit> _kits;
public KitEvolveShop(KitEvolve plugin, SearchAndDestroy arcadeManager, CoreClientManager clientManager,
DonationManager donationManager, ArrayList<UpgradeKit> kits, CurrencyType... currencyTypes)
DonationManager donationManager, ArrayList<UpgradeKit> kits)
{
super(plugin, clientManager, donationManager, "Kit Evolve Menu", currencyTypes);
super(plugin, clientManager, donationManager, "Kit Evolve Menu");
_arcadeManager = arcadeManager;
_kits = kits;
}

View File

@ -1,11 +1,9 @@
package nautilus.game.arcade.game.games.wizards;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import org.bukkit.entity.Player;
public class WizardSpellMenuShop extends ShopBase<WizardSpellMenu>
@ -13,9 +11,9 @@ public class WizardSpellMenuShop extends ShopBase<WizardSpellMenu>
private Wizards _wizards;
public WizardSpellMenuShop(WizardSpellMenu plugin, CoreClientManager clientManager, DonationManager donationManager,
Wizards wizard, CurrencyType... currencyTypes)
Wizards wizard)
{
super(plugin, clientManager, donationManager, "Kit Evolve Menu", currencyTypes);
super(plugin, clientManager, donationManager, "Kit Evolve Menu");
_wizards = wizard;
}

View File

@ -1,15 +1,13 @@
package nautilus.game.arcade.gui.spectatorMenu;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.addons.compass.CompassAddon;
import nautilus.game.arcade.gui.spectatorMenu.page.SpectatorPage;
import org.bukkit.entity.Player;
/**
* Created by shaun on 14-09-24.
@ -19,9 +17,9 @@ public class SpectatorShop extends ShopBase<CompassAddon>
private ArcadeManager _arcadeManager;
public SpectatorShop(CompassAddon plugin, ArcadeManager arcadeManager, CoreClientManager clientManager, DonationManager donationManager, CurrencyType... currencyTypes)
public SpectatorShop(CompassAddon plugin, ArcadeManager arcadeManager, CoreClientManager clientManager, DonationManager donationManager)
{
super(plugin, clientManager, donationManager, "Spectate Menu", currencyTypes);
super(plugin, clientManager, donationManager, "Spectate Menu");
_arcadeManager = arcadeManager;
}

View File

@ -1,8 +1,8 @@
package nautilus.game.arcade.kit;
import com.google.common.collect.Lists;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.Rank;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
@ -242,7 +242,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
{
PlayerKit playerKit = _dataManager.get(player);
Donor donor = Manager.GetDonation().Get(Bukkit.getPlayer(player));
return Calculations.canUpgrade(playerKit.getLevel(getInternalName()), donor.GetGems());
return Calculations.canUpgrade(playerKit.getLevel(getInternalName()), donor.getBalance(GlobalCurrency.GEM));
}
@Override
@ -298,7 +298,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
{
return true;
}
else if (this.GetAvailability() == KitAvailability.Gem && donor.GetBalance(CurrencyType.GEM) >= this.GetCost())
else if (this.GetAvailability() == KitAvailability.Gem && donor.getBalance(GlobalCurrency.GEM) >= this.GetCost())
{
Manager.GetShop().openPageForPlayer(player, new ConfirmationPage<>(
Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), () -> {
@ -306,7 +306,7 @@ public abstract class ProgressingKit extends Kit implements ProgressiveKit
{
Manager.GetGame().SetKit(player, this, true);
}
}, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()), this), CurrencyType.GEM, player));
}, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()), this), GlobalCurrency.GEM, player));
}
else if (this.GetAvailability() == KitAvailability.Achievement)
{

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.managers;
import mineplex.core.account.CoreClient;
import mineplex.core.common.Rank;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.*;
import mineplex.core.common.util.UtilBlockText.TextAlign;
import mineplex.core.donation.Donor;
@ -1115,9 +1116,9 @@ public class GameLobbyManager implements Listener
// Remove old
entry.getValue().resetScores(_gemMap.get(entry.getKey()) + " ");
// Set new
objective.getScore(Manager.GetDonation().Get(entry.getKey().getName()).GetGems() + " ").setScore(line--);
objective.getScore(Manager.GetDonation().Get(entry.getKey().getName()).getBalance(GlobalCurrency.GEM) + " ").setScore(line--);
_gemMap.put(entry.getKey(), Manager.GetDonation().Get(entry.getKey().getName()).GetGems());
_gemMap.put(entry.getKey(), Manager.GetDonation().Get(entry.getKey().getName()).getBalance(GlobalCurrency.GEM));
//Server
objective.getScore(" ").setScore(line--);

View File

@ -1,28 +1,11 @@
package nautilus.game.arcade.managers;
import java.lang.reflect.Field;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import com.mojang.authlib.GameProfile;
import mineplex.core.achievement.Achievement;
import mineplex.core.boosters.Booster;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.*;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.serverdata.Utility;
@ -37,6 +20,17 @@ import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.GemData;
import net.minecraft.server.v1_8_R3.EntityHuman;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import java.lang.reflect.Field;
import java.util.HashMap;
/**
* This class is used to reward gems and shards at the end of a game, or when players leave the server.
@ -405,8 +399,8 @@ public class GameRewardManager implements Listener
if (give)
{
UtilPlayer.message(player, F.elem(C.cWhite + "§lYou now have " +
C.cGreen + C.Bold + (Manager.GetDonation().Get(player.getName()).GetGems() + totalGems) + " Gems") + C.cWhite + C.Bold + " and " +
F.elem(C.cAqua + C.Bold + (Manager.GetDonation().Get(player.getName()).getCoins() + shards) + " Treasure Shards"));
C.cGreen + C.Bold + (Manager.GetDonation().Get(player.getName()).getBalance(GlobalCurrency.GEM) + totalGems) + " Gems") + C.cWhite + C.Bold + " and " +
F.elem(C.cAqua + C.Bold + (Manager.GetDonation().Get(player.getName()).getBalance(GlobalCurrency.TREASURE_SHARD) + shards) + " Treasure Shards"));
}
else
{

View File

@ -1,19 +1,17 @@
package nautilus.game.arcade.shop;
import org.bukkit.entity.Player;
import nautilus.game.arcade.ArcadeManager;
import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import nautilus.game.arcade.ArcadeManager;
import org.bukkit.entity.Player;
public class ArcadeShop extends ShopBase<ArcadeManager>
{
public ArcadeShop(ArcadeManager plugin, CoreClientManager clientManager, DonationManager donationManager)
{
super(plugin, clientManager, donationManager, "Shop", CurrencyType.GEM);
super(plugin, clientManager, donationManager, "Shop");
}
@Override

View File

@ -1,10 +1,8 @@
package nautilus.game.arcade.shop;
import org.bukkit.entity.Player;
import nautilus.game.arcade.kit.Kit;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.shop.item.SalesPackageBase;
import nautilus.game.arcade.kit.Kit;
public class KitPackage extends SalesPackageBase
{
@ -12,12 +10,6 @@ public class KitPackage extends SalesPackageBase
{
super(gameName + " " + kit.GetName(), kit.getDisplayMaterial(), kit.GetDesc());
KnownPackage = false;
CurrencyCostMap.put(CurrencyType.GEM, kit.GetCost());
}
@Override
public void sold(Player player, CurrencyType currencyType)
{
CurrencyCostMap.put(GlobalCurrency.GEM, kit.GetCost());
}
}