Merge branch 'develop' of github.com:Mineplex-LLC/Minecraft-PC into update/clans
This commit is contained in:
commit
031a9575ae
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -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[]
|
||||
|
@ -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);
|
||||
|
@ -6,6 +6,7 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.shop.confirmation.ConfirmationCallback;
|
||||
import mineplex.core.shop.confirmation.ConfirmationProcessor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
@ -21,6 +22,9 @@ public class BoosterProcessor implements ConfirmationProcessor
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Inventory inventory) {}
|
||||
|
||||
@Override
|
||||
public void process(ConfirmationCallback callback)
|
||||
{
|
||||
|
@ -15,11 +15,12 @@ public class BoosterCommand extends MultiCommandBase<BoosterManager>
|
||||
{
|
||||
public BoosterCommand(BoosterManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "amplifier", "booster");
|
||||
super(plugin, Rank.ALL, "amplifier", "booster");
|
||||
|
||||
AddCommand(new AddCommand(plugin));
|
||||
AddCommand(new GuiCommand(plugin));
|
||||
AddCommand(new ReloadCommand(plugin));
|
||||
AddCommand(new ThankCommand(plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -27,5 +28,6 @@ public class BoosterCommand extends MultiCommandBase<BoosterManager>
|
||||
{
|
||||
UtilPlayer.message(caller, F.help("amplifier add <group>", "Add an amplifier to that group", Rank.DEVELOPER));
|
||||
UtilPlayer.message(caller, F.help("amplifier gui", "Open Amplifier GUI", Rank.DEVELOPER));
|
||||
UtilPlayer.message(caller, F.help("amplifier thank <group>", "Thank an Amplifier for a specific Booster Group", Rank.ALL));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
package mineplex.core.boosters.command;
|
||||
|
||||
import mineplex.core.boosters.Booster;
|
||||
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.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;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class ThankCommand extends CommandBase<BoosterManager>
|
||||
{
|
||||
public ThankCommand(BoosterManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ALL, "thank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
// try to thank the current amplifier group
|
||||
String boosterGroup = Plugin.getBoosterGroup();
|
||||
if (boosterGroup == null || boosterGroup.length() <= 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Amplifier", "You must specify an Amplifier Group"));
|
||||
return;
|
||||
}
|
||||
|
||||
attemptToTipGroup(caller, boosterGroup);
|
||||
}
|
||||
else
|
||||
{
|
||||
String boosterGroup = StringUtils.join(args, ' ');
|
||||
attemptToTipGroup(caller, boosterGroup);
|
||||
}
|
||||
}
|
||||
|
||||
private void attemptToTipGroup(Player caller, String boosterGroup)
|
||||
{
|
||||
Booster booster = Plugin.getActiveBooster(boosterGroup);
|
||||
if (booster == null)
|
||||
{
|
||||
// Give a friendly oops message
|
||||
UtilPlayer.message(caller, F.main("Amplifier", "There was an error handling your request. Try again later"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Plugin.getTipManager().addTip(caller, booster, result ->
|
||||
{
|
||||
if (result == TipAddResult.SUCCESS)
|
||||
{
|
||||
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)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Amplifier", result.getFriendlyMessage()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@ import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.boosters.Booster;
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.boosters.BoosterProcessor;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
@ -115,8 +114,7 @@ public class BoosterPage extends ShopPageBase<BoosterManager, BoosterShop>
|
||||
ShopItem booster = new ShopItem(Material.SUGAR, "Game Amplifier", lore.toArray(new String[0]), 0, false, false);
|
||||
|
||||
BoosterProcessor processor = new BoosterProcessor(getPlugin(), getPlayer());
|
||||
ConfirmationPage<BoosterManager, BoosterShop> page = new ConfirmationPage<>(getPlugin(), getShop(),
|
||||
getClientManager(), getDonationManager(), getPlayer(), this, processor, booster);
|
||||
ConfirmationPage<BoosterManager, BoosterShop> page = new ConfirmationPage<>(getPlayer(), this, processor, booster);
|
||||
getShop().openPageForPlayer(getPlayer(), page);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,8 @@ import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.boosters.Booster;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -33,8 +35,9 @@ public class BoosterTipManager extends MiniDbClientPlugin<PlayerTipData>
|
||||
|
||||
public void addTip(Player player, Booster booster, Callback<TipAddResult> callback)
|
||||
{
|
||||
if (!Recharge.Instance.use(player, "Amplifier Thanks", 1000 * 60 * 10, true, false))
|
||||
if (!Recharge.Instance.use(player, "Amplifier Thanks", 1000 * 5, false, false))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Amplifier", "Please wait before trying that again"));
|
||||
callback.run(TipAddResult.ON_COOLDOWN);
|
||||
return;
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -1,13 +1,12 @@
|
||||
package mineplex.core.brawl.fountain.gui.button;
|
||||
|
||||
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.confirmation.ConfirmationPage;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.shop.item.SalesPackageProcessor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
@ -30,13 +29,10 @@ public class FountainAddButton implements IButton
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_page.getShop().openPageForPlayer(player, new ConfirmationPage<FountainManager, FountainShop>(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable()
|
||||
_page.getShop().openPageForPlayer(player, new ConfirmationPage<>(player, _page, new SalesPackageProcessor(player, GlobalCurrency.GEM, _salesPackage, _page.getDonationManager(), () ->
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_page.getPlugin().getGemFountain().increment(player, _gems, null);
|
||||
_page.refresh();
|
||||
}
|
||||
}, _page, _salesPackage, CurrencyType.GEM, player));
|
||||
_page.getPlugin().getGemFountain().increment(player, _gems, null);
|
||||
_page.refresh();
|
||||
}), _salesPackage.buildIcon()));
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -1,15 +1,13 @@
|
||||
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.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.cosmetic.ui.page.MountPage;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.shop.confirmation.ConfirmationPage;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.SalesPackageProcessor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
public class MountButton implements IButton
|
||||
{
|
||||
@ -25,13 +23,10 @@ public class MountButton implements IButton
|
||||
@Override
|
||||
public void onClick(final Player player, ClickType clickType)
|
||||
{
|
||||
_page.getShop().openPageForPlayer(player, new ConfirmationPage<CosmeticManager, CosmeticShop>(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable()
|
||||
_page.getShop().openPageForPlayer(player, new ConfirmationPage<>(player, _page, new SalesPackageProcessor(player, GlobalCurrency.TREASURE_SHARD, _mount, _page.getDonationManager(), () ->
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.getName(), 1);
|
||||
_page.refresh();
|
||||
}
|
||||
}, _page, _mount, CurrencyType.TREASURE_SHARD, player));
|
||||
_page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.getName(), 1);
|
||||
_page.refresh();
|
||||
}), _mount.buildIcon()));
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -1,12 +1,29 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
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.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;
|
||||
import mineplex.core.gadget.types.HatGadget;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
import mineplex.core.shop.confirmation.ConfirmationPage;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.SalesPackageProcessor;
|
||||
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;
|
||||
@ -14,26 +31,9 @@ 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.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
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.gadgets.morph.MorphBlock;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.gadget.types.HatGadget;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
@ -50,7 +50,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 +105,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 +178,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 +239,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 +291,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 +314,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 +329,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 +363,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;
|
||||
}
|
||||
|
||||
@ -372,14 +372,11 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
UtilPlayer.message(player, F.main("Disguise", "You cant buy things while you are disguised!"));
|
||||
return;
|
||||
}
|
||||
getShop().openPageForPlayer(getPlayer(), new ConfirmationPage<CosmeticManager, CosmeticShop>(getPlugin(), getShop(), getClientManager(), getDonationManager(), new Runnable()
|
||||
getShop().openPageForPlayer(getPlayer(), new ConfirmationPage<>(player, this, new SalesPackageProcessor(player, GlobalCurrency.TREASURE_SHARD, gadget, getDonationManager(), () ->
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
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()));
|
||||
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.getName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity()));
|
||||
refresh();
|
||||
}), gadget.buildIcon()));
|
||||
}
|
||||
|
||||
public void activateGadget(Player player, Gadget gadget)
|
||||
|
@ -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(" ");
|
||||
|
@ -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.");
|
||||
|
@ -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++;
|
||||
|
@ -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;
|
||||
@ -15,11 +15,12 @@ import mineplex.core.pet.Pet;
|
||||
import mineplex.core.pet.PetExtra;
|
||||
import mineplex.core.pet.repository.token.PetChangeToken;
|
||||
import mineplex.core.pet.repository.token.PetToken;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.shop.confirmation.ConfirmationPage;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
import mineplex.core.shop.item.SalesPackageProcessor;
|
||||
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;
|
||||
@ -93,44 +94,42 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
}
|
||||
|
||||
PetExtra tag = new PetExtra("Rename " + _pet.getName() + " to " + _tagName, Material.NAME_TAG, 100);
|
||||
final SalesPackageBase salesPackage = _petPurchase ? _pet : tag;
|
||||
|
||||
_pet.setDisplayName(C.cGreen + "Purchase " + _tagName);
|
||||
|
||||
getShop().openPageForPlayer(getPlayer(), new ConfirmationPage<CosmeticManager, CosmeticShop>(getPlugin(), getShop(), getClientManager(), getDonationManager(), new Runnable()
|
||||
|
||||
getShop().openPageForPlayer(getPlayer(), new ConfirmationPage<>(_player, this, new SalesPackageProcessor(_player, GlobalCurrency.TREASURE_SHARD, salesPackage, _donationManager, () ->
|
||||
{
|
||||
public void run()
|
||||
PetChangeToken token = new PetChangeToken();
|
||||
|
||||
if (getClientManager().Get(getPlayer()) != null)
|
||||
token.AccountId = getClientManager().Get(getPlayer()).getAccountId();
|
||||
else
|
||||
token.AccountId = PlayerCache.getInstance().getPlayer(getPlayer().getUniqueId()).getAccountId();
|
||||
|
||||
token.Name = getPlayer().getName();
|
||||
token.PetType = _pet.getPetType().toString();
|
||||
token.PetId = _pet.getPetType().ordinal();
|
||||
token.PetName = _tagName;
|
||||
|
||||
PetToken petToken = new PetToken();
|
||||
petToken.PetType = token.PetType;
|
||||
|
||||
if (_petPurchase)
|
||||
{
|
||||
PetChangeToken token = new PetChangeToken();
|
||||
|
||||
if (getClientManager().Get(getPlayer()) != null)
|
||||
token.AccountId = getClientManager().Get(getPlayer()).getAccountId();
|
||||
else
|
||||
token.AccountId = PlayerCache.getInstance().getPlayer(getPlayer().getUniqueId()).getAccountId();
|
||||
|
||||
token.Name = getPlayer().getName();
|
||||
token.PetType = _pet.getPetType().toString();
|
||||
token.PetId = _pet.getPetType().ordinal();
|
||||
token.PetName = _tagName;
|
||||
|
||||
PetToken petToken = new PetToken();
|
||||
petToken.PetType = token.PetType;
|
||||
|
||||
if (_petPurchase)
|
||||
{
|
||||
getPlugin().getPetManager().getRepository().AddPet(token);
|
||||
getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.getPetType());
|
||||
}
|
||||
else
|
||||
{
|
||||
getPlugin().getPetManager().getRepository().UpdatePet(token);
|
||||
getPlugin().getPetManager().addRenamePetToQueue(getPlayer().getName(), token.PetName);
|
||||
}
|
||||
|
||||
getPlugin().getPetManager().Get(getPlayer()).getPets().put(_pet.getPetType(), token.PetName);
|
||||
|
||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer()));
|
||||
getPlugin().getPetManager().getRepository().AddPet(token);
|
||||
getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.getPetType());
|
||||
}
|
||||
}, null, _petPurchase ? _pet : tag, CurrencyType.TREASURE_SHARD, getPlayer()));
|
||||
else
|
||||
{
|
||||
getPlugin().getPetManager().getRepository().UpdatePet(token);
|
||||
getPlugin().getPetManager().addRenamePetToQueue(getPlayer().getName(), token.PetName);
|
||||
}
|
||||
|
||||
getPlugin().getPetManager().Get(getPlayer()).getPets().put(_pet.getPetType(), token.PetName);
|
||||
|
||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer()));
|
||||
}), salesPackage.buildIcon()));
|
||||
}
|
||||
|
||||
public void SetTagName(String tagName)
|
||||
|
@ -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,8 +111,8 @@ 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)
|
||||
|
||||
public void PurchaseKnownSalesPackage(final Callback<TransactionResponse> callback, final String name, final UUID uuid, final int cost, final int salesPackageId)
|
||||
{
|
||||
_repository.PurchaseKnownSalesPackage(new Callback<TransactionResponse>()
|
||||
{
|
||||
@ -121,20 +120,20 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
|
||||
{
|
||||
if (response == TransactionResponse.Success)
|
||||
{
|
||||
Donor donor = Get(name);
|
||||
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 +153,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
|
||||
|
||||
if (donor != null)
|
||||
{
|
||||
donor.AddGems(amount);
|
||||
donor.addBalance(GlobalCurrency.GEM, amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -181,7 +180,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 +240,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
|
||||
|
||||
if (donor != null)
|
||||
{
|
||||
donor.addCoins(amount);
|
||||
donor.addBalance(GlobalCurrency.TREASURE_SHARD, amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -268,7 +267,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 +294,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 +337,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 +366,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 + "';";
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -36,8 +36,6 @@ public class PartyEventListener implements Listener
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
player.getInventory().setItem(PartyManager.INTERFACE_SLOT, PartyManager.INTERFACE_ITEM);
|
||||
|
||||
String partyName = _plugin.getInviteManager().getPartyWaiting(player.getUniqueId());
|
||||
|
||||
if (partyName == null)
|
||||
|
@ -43,13 +43,6 @@ public class PartyMethodManager
|
||||
return;
|
||||
}
|
||||
|
||||
boolean can = Bukkit.getMaxPlayers() >= _plugin.getPlugin().getServer().getOnlinePlayers().size();
|
||||
if(!can)
|
||||
{
|
||||
Lang.SERVER_FULL.send(caller);
|
||||
return;
|
||||
}
|
||||
|
||||
if(party != null)
|
||||
{
|
||||
if(!party.getOwner().equalsIgnoreCase(caller.getName()))
|
||||
@ -115,6 +108,14 @@ public class PartyMethodManager
|
||||
_plugin.getInviteManager().sendAcceptOrDeny(possible, caller.getName());
|
||||
return;
|
||||
}
|
||||
//Only perform this when I actually need to.
|
||||
boolean can = Bukkit.getMaxPlayers() >= _plugin.getPlugin().getServer().getOnlinePlayers().size();
|
||||
if(!can)
|
||||
{
|
||||
Lang.SERVER_FULL.send(caller);
|
||||
return;
|
||||
}
|
||||
|
||||
//Not on the same server
|
||||
_plugin.getRedisManager().findAndInvite(target, caller.getName());
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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)
|
||||
{
|
||||
|
@ -31,11 +31,21 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
|
||||
private ConfirmationProcessor _processor;
|
||||
private boolean _processing;
|
||||
|
||||
public ConfirmationPage(PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, Player player, ShopPageBase<PluginType, ShopType> returnPage, ConfirmationProcessor processor, ItemStack displayItem)
|
||||
public ConfirmationPage(Player player, ShopPageBase<PluginType, ShopType> returnPage, ConfirmationProcessor processor, ItemStack displayItem)
|
||||
{
|
||||
super(returnPage.getPlugin(), returnPage.getShop(), returnPage.getClientManager(), returnPage.getDonationManager(), "Confirmation", player);
|
||||
|
||||
_returnPage = returnPage;
|
||||
_displayItem = displayItem;
|
||||
_processor = processor;
|
||||
|
||||
buildPage();
|
||||
}
|
||||
|
||||
public ConfirmationPage(Player player, PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, ConfirmationProcessor processor, ItemStack displayItem)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Confirmation", player);
|
||||
|
||||
_returnPage = returnPage;
|
||||
_displayItem = displayItem;
|
||||
_processor = processor;
|
||||
|
||||
@ -49,6 +59,8 @@ 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), this::okClicked);
|
||||
buildSquareAt(_okSquareSlotStart + 6, new ShopItem(Material.REDSTONE_BLOCK, (byte) 0, ChatColor.RED + "CANCEL", null, 1, false, true), this::cancelClicked);
|
||||
|
||||
_processor.init(this);
|
||||
}
|
||||
|
||||
protected void okClicked(Player player, ClickType clickType)
|
||||
|
@ -1,9 +1,12 @@
|
||||
package mineplex.core.shop.confirmation;
|
||||
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public interface ConfirmationProcessor
|
||||
{
|
||||
public void init(Inventory inventory);
|
||||
public void process(ConfirmationCallback callback);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package mineplex.core.shop.item;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.donation.repository.GameSalesPackageToken;
|
||||
|
||||
public interface ICurrencyPackage
|
||||
{
|
||||
int getSalesPackageId();
|
||||
int getCost(CurrencyType currencytype);
|
||||
int getCost(GlobalCurrency currencytype);
|
||||
boolean isFree();
|
||||
void update(GameSalesPackageToken token);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package mineplex.core.shop.item;
|
||||
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.donation.repository.GameSalesPackageToken;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPackage
|
||||
{
|
||||
@ -20,7 +20,7 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack
|
||||
|
||||
protected int SalesPackageId;
|
||||
protected boolean Free;
|
||||
protected NautHashMap<CurrencyType, Integer> CurrencyCostMap;
|
||||
protected NautHashMap<GlobalCurrency, Integer> CurrencyCostMap;
|
||||
protected boolean KnownPackage = true;
|
||||
protected boolean OneTimePurchaseOnly = true;
|
||||
|
||||
@ -41,7 +41,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 +49,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 +66,7 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCost(CurrencyType currencyType)
|
||||
public int getCost(GlobalCurrency currencyType)
|
||||
{
|
||||
return CurrencyCostMap.containsKey(currencyType) ? CurrencyCostMap.get(currencyType) : 0;
|
||||
}
|
||||
@ -105,7 +103,7 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack
|
||||
|
||||
if (token.Gems > 0)
|
||||
{
|
||||
CurrencyCostMap.put(CurrencyType.GEM, token.Gems);
|
||||
CurrencyCostMap.put(GlobalCurrency.GEM, token.Gems);
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,4 +131,9 @@ public abstract class SalesPackageBase implements ICurrencyPackage, IDisplayPack
|
||||
{
|
||||
DisplayName = name;
|
||||
}
|
||||
|
||||
public ItemStack buildIcon()
|
||||
{
|
||||
return new ItemBuilder(_displayMaterial).setData(_displayData).setTitle(DisplayName).addLore(Description).build();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,70 @@
|
||||
package mineplex.core.shop.item;
|
||||
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.server.util.TransactionResponse;
|
||||
import mineplex.core.shop.confirmation.ConfirmationCallback;
|
||||
import mineplex.core.shop.confirmation.ConfirmationProcessor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class SalesPackageProcessor implements ConfirmationProcessor {
|
||||
private final GlobalCurrency _currencyType;
|
||||
private final SalesPackageBase _salesItem;
|
||||
private final DonationManager _donationManager;
|
||||
private final Player _player;
|
||||
private final Runnable _runAfterPurchase;
|
||||
|
||||
public SalesPackageProcessor(Player player, GlobalCurrency currencyType, SalesPackageBase salesItem, DonationManager donationManager, Runnable runAfterPurchase)
|
||||
{
|
||||
_currencyType = currencyType;
|
||||
_salesItem = salesItem;
|
||||
_donationManager = donationManager;
|
||||
_player = player;
|
||||
_runAfterPurchase = runAfterPurchase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Inventory inventory)
|
||||
{
|
||||
inventory.setItem(4, new ItemBuilder(_currencyType.getDisplayMaterial()).setTitle(_currencyType.getPrefix()).addLore(C.cGray + _salesItem.getCost(_currencyType) + " " + _currencyType.getPrefix() + " will be", C.cGray + "deducted from your account balance").build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ConfirmationCallback callback)
|
||||
{
|
||||
if (_salesItem.isKnown())
|
||||
{
|
||||
_donationManager.PurchaseKnownSalesPackage(response -> showResults(callback, response), _player.getName(), _player.getUniqueId(), _salesItem.getCost(_currencyType), _salesItem.getSalesPackageId());
|
||||
}
|
||||
else
|
||||
{
|
||||
_donationManager.PurchaseUnknownSalesPackage(response -> showResults(callback, response), _player.getName(), _donationManager.getClientManager().Get(_player).getAccountId(), _salesItem.getName(), _currencyType, _salesItem.getCost(_currencyType), _salesItem.oneTimePurchase());
|
||||
}
|
||||
}
|
||||
|
||||
private void showResults(ConfirmationCallback callback, TransactionResponse response)
|
||||
{
|
||||
switch (response)
|
||||
{
|
||||
case Failed:
|
||||
callback.reject("There was an error processing your request.");
|
||||
break;
|
||||
case AlreadyOwns:
|
||||
callback.reject("You already own this package.");
|
||||
break;
|
||||
case InsufficientFunds:
|
||||
callback.reject("Your account has insufficient funds.");
|
||||
break;
|
||||
case Success:
|
||||
callback.resolve("Your purchase was successful.");
|
||||
|
||||
if (_runAfterPurchase != null)
|
||||
_runAfterPurchase.run();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,328 +0,0 @@
|
||||
package mineplex.core.shop.page;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
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;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends ShopBase<PluginType>> extends ShopPageBase<PluginType, ShopType> implements Runnable
|
||||
{
|
||||
private Runnable _runnable;
|
||||
private ShopPageBase<PluginType, ShopType> _returnPage;
|
||||
private SalesPackageBase _salesItem;
|
||||
private int _okSquareSlotStart;
|
||||
private boolean _processing;
|
||||
private int _progressCount;
|
||||
private ShopItem _progressItem;
|
||||
private int _taskId;
|
||||
|
||||
public ConfirmationPage(PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, Runnable runnable, ShopPageBase<PluginType, ShopType> returnPage, SalesPackageBase salesItem, CurrencyType 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;
|
||||
|
||||
if (getShop().canPlayerAttemptPurchase(player))
|
||||
{
|
||||
buildPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
buildErrorPage(new String[]{ChatColor.RED + "You have attempted too many invalid transactions.", ChatColor.RED + "Please wait 10 seconds before retrying."});
|
||||
_taskId = plugin.getScheduler().scheduleSyncRepeatingTask(plugin.getPlugin(), this, 2L, 2L);
|
||||
}
|
||||
}
|
||||
|
||||
protected void buildPage()
|
||||
{
|
||||
this.getInventory().setItem(22, new ShopItem(_salesItem.getDisplayMaterial(), (byte)0, _salesItem.getDisplayName(), _salesItem.getDescription(), 1, false, true).getHandle());
|
||||
|
||||
IButton okClicked = new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
okClicked(player);
|
||||
}
|
||||
};
|
||||
|
||||
IButton cancelClicked = new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
cancelClicked(player);
|
||||
}
|
||||
};
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
protected void okClicked(Player player)
|
||||
{
|
||||
processTransaction();
|
||||
}
|
||||
|
||||
protected void cancelClicked(Player player)
|
||||
{
|
||||
getPlugin().getScheduler().cancelTask(_taskId);
|
||||
|
||||
if (_returnPage != null)
|
||||
getShop().openPageForPlayer(player, _returnPage);
|
||||
else
|
||||
{
|
||||
player.closeInventory();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buildSquareAt(int slot, ShopItem item, IButton button)
|
||||
{
|
||||
addButton(slot, item, button);
|
||||
addButton(slot + 1, item, button);
|
||||
addButton(slot + 2, item, button);
|
||||
|
||||
slot += 9;
|
||||
|
||||
addButton(slot, item, button);
|
||||
addButton(slot + 1, item, button);
|
||||
addButton(slot + 2, item, button);
|
||||
|
||||
slot += 9;
|
||||
|
||||
addButton(slot, item, button);
|
||||
addButton(slot + 1, item, button);
|
||||
addButton(slot + 2, item, button);
|
||||
}
|
||||
|
||||
private void processTransaction()
|
||||
{
|
||||
for (int i=_okSquareSlotStart; i < 54; i++)
|
||||
{
|
||||
getButtonMap().remove(i);
|
||||
clear(i);
|
||||
}
|
||||
|
||||
_processing = true;
|
||||
|
||||
if (getCurrencyType() == CurrencyType.GOLD)
|
||||
{
|
||||
int goldCount = getDonationManager().Get(getPlayer()).getGold();
|
||||
int cost = _salesItem.getCost(getCurrencyType());
|
||||
|
||||
if (cost > goldCount)
|
||||
showResultsPage(TransactionResponse.InsufficientFunds);
|
||||
else
|
||||
{
|
||||
getDonationManager().rewardGold(new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
showResultsPage(TransactionResponse.Success);
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
showResultsPage(TransactionResponse.Failed);
|
||||
}
|
||||
}
|
||||
}, "Energy Purchase", getPlayer().getName(), getClientManager().Get(getPlayer()).getAccountId(), -cost);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_salesItem.isKnown())
|
||||
{
|
||||
getDonationManager().PurchaseKnownSalesPackage(new Callback<TransactionResponse>()
|
||||
{
|
||||
public void run(TransactionResponse response)
|
||||
{
|
||||
showResultsPage(response);
|
||||
}
|
||||
}, getPlayer().getName(), getPlayer().getUniqueId(), _salesItem.getCost(getCurrencyType()), _salesItem.getSalesPackageId());
|
||||
}
|
||||
else
|
||||
{
|
||||
getDonationManager().PurchaseUnknownSalesPackage(new Callback<TransactionResponse>()
|
||||
{
|
||||
public void run(TransactionResponse response)
|
||||
{
|
||||
showResultsPage(response);
|
||||
}
|
||||
}, getPlayer().getName(), getClientManager().Get(getPlayer()).getAccountId(), _salesItem.getName(), getCurrencyType(), _salesItem.getCost(getCurrencyType()), _salesItem.oneTimePurchase());
|
||||
}
|
||||
}
|
||||
|
||||
_taskId = getPlugin().getScheduler().scheduleSyncRepeatingTask(getPlugin().getPlugin(), this, 2L, 2L);
|
||||
}
|
||||
|
||||
private void showResultsPage(TransactionResponse response)
|
||||
{
|
||||
_processing = false;
|
||||
|
||||
switch (response)
|
||||
{
|
||||
case Failed:
|
||||
buildErrorPage(ChatColor.RED + "There was an error processing your request.");
|
||||
getShop().addPlayerProcessError(getPlayer());
|
||||
break;
|
||||
case AlreadyOwns:
|
||||
buildErrorPage(ChatColor.RED + "You already own this package.");
|
||||
getShop().addPlayerProcessError(getPlayer());
|
||||
break;
|
||||
case InsufficientFunds:
|
||||
buildErrorPage(ChatColor.RED + "Your account has insufficient funds.");
|
||||
getShop().addPlayerProcessError(getPlayer());
|
||||
break;
|
||||
case Success:
|
||||
_salesItem.sold(getPlayer(), getCurrencyType());
|
||||
|
||||
buildSuccessPage("Your purchase was successful.");
|
||||
|
||||
if (_runnable != null)
|
||||
_runnable.run();
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_progressCount = 0;
|
||||
}
|
||||
|
||||
private void buildErrorPage(String... message)
|
||||
{
|
||||
IButton returnButton = new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
cancelClicked(player);
|
||||
}
|
||||
};
|
||||
|
||||
ShopItem item = new ShopItem(Material.REDSTONE_BLOCK, (byte)0, ChatColor.RED + "" + ChatColor.UNDERLINE + "ERROR", message, 1, false, true);
|
||||
for (int i = 0; i < this.getSize(); i++)
|
||||
{
|
||||
addButton(i, item, returnButton);
|
||||
}
|
||||
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.BLAZE_DEATH, 1, .1f);
|
||||
}
|
||||
|
||||
private void buildSuccessPage(String message)
|
||||
{
|
||||
IButton returnButton = new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
cancelClicked(player);
|
||||
}
|
||||
};
|
||||
|
||||
ShopItem item = new ShopItem(Material.EMERALD_BLOCK, (byte)0, ChatColor.GREEN + message, null, 1, false, true);
|
||||
for (int i = 0; i < this.getSize(); i++)
|
||||
{
|
||||
addButton(i, item, returnButton);
|
||||
}
|
||||
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, .9f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerClosed()
|
||||
{
|
||||
super.playerClosed();
|
||||
|
||||
Bukkit.getScheduler().cancelTask(_taskId);
|
||||
|
||||
if (_returnPage != null && getShop() != null)
|
||||
getShop().setCurrentPageForPlayer(getPlayer(), _returnPage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_processing)
|
||||
{
|
||||
if (_progressCount == 9)
|
||||
{
|
||||
for (int i=45; i < 54; i++)
|
||||
{
|
||||
clear(i);
|
||||
}
|
||||
|
||||
_progressCount = 0;
|
||||
}
|
||||
|
||||
setItem(45 + _progressCount, _progressItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_progressCount >= 20)
|
||||
{
|
||||
try
|
||||
{
|
||||
Bukkit.getScheduler().cancelTask(_taskId);
|
||||
|
||||
if (_returnPage != null && getShop() != null)
|
||||
{
|
||||
getShop().openPageForPlayer(getPlayer(), _returnPage);
|
||||
}
|
||||
else if (getPlayer() != null)
|
||||
{
|
||||
getPlayer().closeInventory();
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_progressCount++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose()
|
||||
{
|
||||
super.dispose();
|
||||
|
||||
Bukkit.getScheduler().cancelTask(_taskId);
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,19 @@
|
||||
package mineplex.core.treasure.gui;
|
||||
|
||||
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.confirmation.ConfirmationPage;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
import mineplex.core.shop.item.SalesPackageProcessor;
|
||||
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;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
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;
|
||||
|
||||
public class BuyChestButton implements IButton
|
||||
{
|
||||
private InventoryManager _inventoryManager;
|
||||
@ -64,10 +65,11 @@ public class BuyChestButton implements IButton
|
||||
UtilPlayer.message(player, F.main("Disguise", "You cant buy things while you are disguised!"));
|
||||
return;
|
||||
}
|
||||
_page.getShop().openPageForPlayer(player, new ConfirmationPage<>(
|
||||
_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));
|
||||
SalesPackageBase salesPackage = new ChestPackage(_chestName, _chestMat, _chestCost);
|
||||
_page.getShop().openPageForPlayer(player, new ConfirmationPage<>(player, _page, new SalesPackageProcessor(player, GlobalCurrency.TREASURE_SHARD, salesPackage, _page.getDonationManager(), () ->
|
||||
{
|
||||
_inventoryManager.addItemToInventory(player, _chestName, 1);
|
||||
_page.refresh();
|
||||
}), salesPackage.buildIcon()));
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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
|
||||
{
|
||||
@ -246,7 +245,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;
|
||||
}
|
||||
|
@ -514,6 +514,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
{
|
||||
return _donationManager;
|
||||
}
|
||||
|
||||
public GoldManager getGoldManager()
|
||||
{
|
||||
return _goldManager;
|
||||
}
|
||||
|
||||
public InventoryManager getInventoryManager()
|
||||
{
|
||||
|
@ -2,7 +2,6 @@ package mineplex.game.clans.clans.scoreboard.elements;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.scoreboard.ScoreboardManager;
|
||||
import mineplex.core.scoreboard.elements.ScoreboardElement;
|
||||
@ -28,7 +27,7 @@ public class ScoreboardElementPlayer implements ScoreboardElement
|
||||
{
|
||||
List<String> output = Lists.newArrayList();
|
||||
output.add(C.cYellowB + "Gold");
|
||||
output.add(C.cGold + manager.getDonation().Get(player).GetBalance(CurrencyType.GOLD));
|
||||
output.add(C.cGold + "Gold " + _clansManager.getGoldManager().Get(player).getBalance());
|
||||
|
||||
output.add(" ");
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
package mineplex.game.clans.economy;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.server.util.TransactionResponse;
|
||||
import mineplex.core.shop.confirmation.ConfirmationCallback;
|
||||
import mineplex.core.shop.confirmation.ConfirmationProcessor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class GoldPurchaseProcessor implements ConfirmationProcessor {
|
||||
private final Player _player;
|
||||
private final int _price;
|
||||
private final GoldManager _goldManager;
|
||||
private final Runnable _runAfterPurchase;
|
||||
|
||||
public GoldPurchaseProcessor(Player player, int price, GoldManager goldManager, Runnable runAfterPurchase)
|
||||
{
|
||||
_player = player;
|
||||
_price = price;
|
||||
_goldManager = goldManager;
|
||||
_runAfterPurchase = runAfterPurchase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Inventory inventory) {
|
||||
inventory.setItem(4, new ItemBuilder(ClansCurrency.GOLD.getDisplayMaterial()).setTitle(ClansCurrency.GOLD.getPrefix()).addLore(C.cGray + _price + " " + ClansCurrency.GOLD.getPrefix() + " will be", C.cGray + "deducted from your account balance").build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ConfirmationCallback callback) {
|
||||
int goldCount = _goldManager.Get(_player).getBalance();
|
||||
|
||||
if (_price > goldCount)
|
||||
showResults(callback, TransactionResponse.InsufficientFunds);
|
||||
else
|
||||
{
|
||||
_goldManager.rewardGold(data ->
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
showResults(callback, TransactionResponse.Success);
|
||||
_player.playSound(_player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
showResults(callback, TransactionResponse.Failed);
|
||||
}
|
||||
}, _player, -_price, true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void showResults(ConfirmationCallback callback, TransactionResponse response)
|
||||
{
|
||||
switch (response)
|
||||
{
|
||||
case Failed:
|
||||
callback.reject("There was an error processing your request.");
|
||||
break;
|
||||
case AlreadyOwns:
|
||||
callback.reject("You already own this package.");
|
||||
break;
|
||||
case InsufficientFunds:
|
||||
callback.reject("Your account has insufficient funds.");
|
||||
break;
|
||||
case Success:
|
||||
callback.resolve("Your purchase was successful.");
|
||||
_runAfterPurchase.run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -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() {}
|
||||
}
|
@ -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");
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package mineplex.game.clans.shop.energy;
|
||||
|
||||
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);
|
||||
KnownPackage = false;
|
||||
OneTimePurchaseOnly = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sold(Player player, CurrencyType currencyType)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,19 +1,24 @@
|
||||
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.itemstack.ItemBuilder;
|
||||
import mineplex.core.shop.confirmation.ConfirmationPage;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
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.GoldPurchaseProcessor;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class EnergyShopButton implements IButton
|
||||
{
|
||||
private static final ItemStack ICON = new ItemBuilder(Material.REDSTONE).setTitle(ChatColor.RESET + "Clan Energy").build();
|
||||
|
||||
private ClanEnergyManager _energyManager;
|
||||
private EnergyPage _page;
|
||||
private int _energyToPurchase;
|
||||
@ -36,30 +41,17 @@ public class EnergyShopButton implements IButton
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_page.getShop().openPageForPlayer(player, new ConfirmationPage<ClanEnergyManager, EnergyShop>(
|
||||
_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable()
|
||||
|
||||
_page.getShop().openPageForPlayer(player, new ConfirmationPage<>(player, _page, new GoldPurchaseProcessor(player, _cost, _energyManager.getClansManager().getGoldManager(), () ->
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_clanInfo.adjustEnergy(_energyToPurchase);
|
||||
_page.refresh();
|
||||
|
||||
_energyManager.runAsync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_energyManager.getClansManager().getClanDataAccess().updateEnergy(_clanInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// 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));
|
||||
_clanInfo.adjustEnergy(_energyToPurchase);
|
||||
_page.refresh();
|
||||
|
||||
_energyManager.runAsync(() -> _energyManager.getClansManager().getClanDataAccess().updateEnergy(_clanInfo));
|
||||
|
||||
// Notify
|
||||
_energyManager.getClansManager().messageClan(_clanInfo, F.main("Energy", F.name(player.getName()) + " purchased " + F.elem(_energyToPurchase + " Energy") + " for the clan"));
|
||||
}), ICON));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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") + "."));
|
||||
|
@ -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;
|
||||
@ -515,6 +517,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
//Add Self to Other
|
||||
otherPlayer.getScoreboard().getTeam(rankName).addPlayer(player);
|
||||
}
|
||||
|
||||
//only give it in the hub
|
||||
player.getInventory().setItem(PartyManager.INTERFACE_SLOT, PartyManager.INTERFACE_ITEM);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -587,7 +592,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
if (rank != Rank.ALL)
|
||||
rankStr = rank.getTag(true, true) + " ";
|
||||
//Party Chat
|
||||
if (event.getMessage().charAt(0) == '#')
|
||||
if (event.getMessage().charAt(0) == '@')
|
||||
{
|
||||
Party party = _partyManager.getParty(player);
|
||||
if (party != null)
|
||||
@ -733,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--);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -1,16 +1,14 @@
|
||||
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;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
import mineplex.core.shop.item.SalesPackageProcessor;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
|
||||
@ -20,20 +18,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;
|
||||
@ -392,13 +388,8 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
|
||||
public void PurchaseSkill(Player player, ISkill skill)
|
||||
{
|
||||
getShop().openPageForPlayer(player, new ConfirmationPage<ClassShopManager, ClassCombatShop>(getPlugin(), getShop(), getClientManager(), getDonationManager(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
buildPage();
|
||||
}
|
||||
}, this, new SkillSalesPackage(skill), CurrencyType.GEM, player));
|
||||
SalesPackageBase salesPackage = new SkillSalesPackage(skill);
|
||||
getShop().openPageForPlayer(player, new mineplex.core.shop.confirmation.ConfirmationPage<>(player, this, new SalesPackageProcessor(player, GlobalCurrency.GEM, salesPackage, getDonationManager(), this::buildPage), salesPackage.buildIcon()));
|
||||
}
|
||||
|
||||
private boolean isSkillLocked(ISkill skill)
|
||||
@ -419,13 +410,8 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
|
||||
public void PurchaseItem(Player player, Item item)
|
||||
{
|
||||
getShop().openPageForPlayer(player, new ConfirmationPage<ClassShopManager, ClassCombatShop>(getPlugin(), getShop(), getClientManager(), getDonationManager(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
buildPage();
|
||||
}
|
||||
}, this, new ItemSalesPackage(item), CurrencyType.GEM, player));
|
||||
SalesPackageBase salesPackage = new ItemSalesPackage(item);
|
||||
getShop().openPageForPlayer(player, new mineplex.core.shop.confirmation.ConfirmationPage<>(player, this, new SalesPackageProcessor(player, GlobalCurrency.GEM, salesPackage, getDonationManager(), this::buildPage), salesPackage.buildIcon()));
|
||||
}
|
||||
|
||||
public void SelectItem(Player player, Item item)
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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!"));
|
||||
}
|
||||
|
@ -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!"));
|
||||
|
@ -4,13 +4,13 @@ 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.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.common.currency.GlobalCurrency;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.HoverEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
@ -62,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
|
||||
{
|
||||
@ -86,5 +86,10 @@ 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(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());
|
||||
}
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
@ -30,18 +30,21 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.block.BlockData;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
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.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTextTop;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.block.BlockData;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -50,7 +53,10 @@ import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerKitGiveEvent;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.*;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.KitDigger;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.KitDisruptor;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.KitLeaper;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.KitWarper;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||
import nautilus.game.arcade.stats.DistanceTraveledStatTracker;
|
||||
@ -94,6 +100,9 @@ public class DragonEscape extends SoloGame
|
||||
private double _speedMult = 1;
|
||||
|
||||
private HashMap<BlockData, Player> _tunneled = new HashMap<BlockData, Player>();
|
||||
|
||||
private long _started;
|
||||
private long _ended;
|
||||
|
||||
public DragonEscape(ArcadeManager manager)
|
||||
{
|
||||
@ -644,4 +653,46 @@ public class DragonEscape extends SoloGame
|
||||
// Stops players using trap doors in game.
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void setTimes(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == GameState.Live)
|
||||
{
|
||||
_started = System.currentTimeMillis();
|
||||
}
|
||||
else if (event.GetState() == GameState.End)
|
||||
{
|
||||
_ended = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateTimer(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
if (GetState() == GameState.Prepare)
|
||||
{
|
||||
UtilTextTop.display(F.game("Game time: ") + F.time("0.0 Seconds"), UtilServer.getPlayers());
|
||||
}
|
||||
else if (GetState() == GameState.Live)
|
||||
{
|
||||
if (_started == 0)
|
||||
return;
|
||||
|
||||
UtilTextTop.display(F.game("Game time: ") + F.time(UtilTime.convertString(System.currentTimeMillis() - _started, 6, TimeUnit.SECONDS)), UtilServer.getPlayers());
|
||||
}
|
||||
else if (GetState() == GameState.End)
|
||||
{
|
||||
if (_started == 0)
|
||||
return;
|
||||
|
||||
if (_ended == 0)
|
||||
return;
|
||||
|
||||
UtilTextBottom.display(F.game("Game time: ") + F.time(UtilTime.convertString(_ended - _started, 6, TimeUnit.SECONDS)), UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,39 @@
|
||||
package nautilus.game.arcade.game.games.draw;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilBlockText;
|
||||
import mineplex.core.common.util.UtilBlockText.TextAlign;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
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.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.GameScore;
|
||||
import nautilus.game.arcade.game.games.draw.kits.KitArtist;
|
||||
import nautilus.game.arcade.game.games.draw.tools.Tool;
|
||||
import nautilus.game.arcade.game.games.draw.tools.ToolCircle;
|
||||
import nautilus.game.arcade.game.games.draw.tools.ToolLine;
|
||||
import nautilus.game.arcade.game.games.draw.tools.ToolSquare;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||
import nautilus.game.arcade.stats.DrawGuessStatTracker;
|
||||
import nautilus.game.arcade.stats.KeenEyeStatTracker;
|
||||
import nautilus.game.arcade.stats.MrSquiggleStatTracker;
|
||||
import nautilus.game.arcade.stats.PureLuckStatTracker;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
@ -26,38 +52,13 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
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.UtilBlockText;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilBlockText.TextAlign;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.GameScore;
|
||||
import nautilus.game.arcade.game.games.draw.kits.*;
|
||||
import nautilus.game.arcade.game.games.draw.tools.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||
import nautilus.game.arcade.stats.DrawGuessStatTracker;
|
||||
import nautilus.game.arcade.stats.KeenEyeStatTracker;
|
||||
import nautilus.game.arcade.stats.MrSquiggleStatTracker;
|
||||
import nautilus.game.arcade.stats.PureLuckStatTracker;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class Draw extends SoloGame
|
||||
{
|
||||
@ -211,7 +212,6 @@ public class Draw extends SoloGame
|
||||
new ChatStatData("PureLuck", "Lucky Guess'", true)
|
||||
);
|
||||
|
||||
Manager.GetChat().setThreeSecondDelay(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,31 +1,5 @@
|
||||
package nautilus.game.arcade.game.games.typewars;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -67,8 +41,32 @@ import nautilus.game.arcade.gametutorial.events.GameTutorialEndEvent;
|
||||
import nautilus.game.arcade.gametutorial.events.GameTutorialStartEvent;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||
import nautilus.game.arcade.stats.TimeInGameStatTracker;
|
||||
import nautilus.game.arcade.world.WorldData;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class TypeWars extends TeamGame
|
||||
{
|
||||
@ -175,7 +173,6 @@ public class TypeWars extends TeamGame
|
||||
);
|
||||
|
||||
manager.GetCreature().SetDisableCustomDrops(true);
|
||||
manager.GetChat().setThreeSecondDelay(false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -993,7 +990,6 @@ public class TypeWars extends TeamGame
|
||||
|
||||
//End
|
||||
Manager.GetCreature().SetDisableCustomDrops(false);
|
||||
Manager.GetChat().setThreeSecondDelay(true);
|
||||
SetState(GameState.End);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
@ -14,7 +14,8 @@ import mineplex.core.progression.data.PlayerKit;
|
||||
import mineplex.core.progression.data.PlayerKitDataManager;
|
||||
import mineplex.core.progression.gui.Menu;
|
||||
import mineplex.core.progression.math.Calculations;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
import mineplex.core.shop.item.SalesPackageProcessor;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
@ -242,7 +243,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,15 +299,16 @@ 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(), () -> {
|
||||
SalesPackageBase salesPackage = new KitPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()), this);
|
||||
Manager.GetShop().openPageForPlayer(player, new mineplex.core.shop.confirmation.ConfirmationPage<>(player, Manager, Manager.GetShop(), Manager.GetClients(), Manager.GetDonation(), new SalesPackageProcessor(player, GlobalCurrency.GEM, salesPackage, Manager.GetDonation(), () ->
|
||||
{
|
||||
if (player.isOnline())
|
||||
{
|
||||
Manager.GetGame().SetKit(player, this, true);
|
||||
}
|
||||
}, null, new KitPackage(Manager.GetGame().GetType().GetKitGameName(Manager.GetGame()), this), CurrencyType.GEM, player));
|
||||
}), salesPackage.buildIcon()));
|
||||
}
|
||||
else if (this.GetAvailability() == KitAvailability.Achievement)
|
||||
{
|
||||
|
@ -1,24 +1,5 @@
|
||||
package nautilus.game.arcade.managers;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
@ -33,6 +14,23 @@ import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GameCreationManager implements Listener
|
||||
{
|
||||
@ -175,7 +173,6 @@ public class GameCreationManager implements Listener
|
||||
// Manager.GetAntiStack().SetEnabled(true);
|
||||
Manager.getCosmeticManager().setHideParticles(false);
|
||||
Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.CustomWeaponName);
|
||||
Manager.GetChat().setThreeSecondDelay(true);
|
||||
ItemStackFactory.Instance.SetUseCustomNames(false);
|
||||
|
||||
HashMap<String, ChatColor> pastTeams = null;
|
||||
|
@ -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--);
|
||||
|
@ -1,7 +1,5 @@
|
||||
package nautilus.game.arcade.managers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -9,6 +7,7 @@ import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTabTitle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.party.PartyManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -23,7 +22,6 @@ import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -41,6 +39,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GamePlayerManager implements Listener
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
@ -154,6 +154,7 @@ public class GamePlayerManager implements Listener
|
||||
player.sendMessage(F.main("Kit", "No default kit found for " + C.cGreenB + Manager.GetGame().GetName()));
|
||||
}
|
||||
}.runTaskLater(Manager.getPlugin(), 10L);
|
||||
player.getInventory().setItem(PartyManager.INTERFACE_SLOT, PartyManager.INTERFACE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ public class GameChatManager implements Listener
|
||||
}
|
||||
|
||||
//Party Chat
|
||||
if (event.getMessage().charAt(0) == '#')
|
||||
if (event.getMessage().charAt(0) == '@')
|
||||
{
|
||||
Party party = _manager.getPartyManager().getParty(sender);
|
||||
if (party != null)
|
||||
@ -186,7 +186,7 @@ public class GameChatManager implements Listener
|
||||
|
||||
if (team != null)
|
||||
{
|
||||
boolean isPriv = event.getMessage().charAt(0) == '@';
|
||||
boolean isPriv = event.getMessage().charAt(0) == '#';
|
||||
|
||||
if(isPriv)
|
||||
event.setMessage(event.getMessage().substring(1, event.getMessage().length()));
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user