Ability to purchase old chests
This commit is contained in:
parent
af95d3ba4e
commit
6bbf9bd321
@ -0,0 +1,25 @@
|
||||
package mineplex.core.treasure;
|
||||
|
||||
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 OldChest extends SalesPackageBase
|
||||
{
|
||||
public OldChest()
|
||||
{
|
||||
super("Old Chest", Material.CHEST, (byte) 0, new String[] { ChatColor.RESET + "Old Chest" }, 1000);
|
||||
|
||||
KnownPackage = false;
|
||||
OneTimePurchaseOnly = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Sold(Player player, CurrencyType currencyType)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -3,8 +3,14 @@ package mineplex.core.treasure.gui;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.treasure.OldChest;
|
||||
import mineplex.core.treasure.TreasureManager;
|
||||
|
||||
public class BuyBasicChestButton implements IButton
|
||||
{
|
||||
@ -12,26 +18,29 @@ public class BuyBasicChestButton implements IButton
|
||||
|
||||
private InventoryManager _inventoryManager;
|
||||
|
||||
public BuyBasicChestButton(Player player, InventoryManager inventoryManager)
|
||||
private TreasurePage _page;
|
||||
|
||||
public BuyBasicChestButton(Player player, InventoryManager inventoryManager, TreasurePage page)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
_inventoryManager = inventoryManager;
|
||||
|
||||
_page = page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
public void onClick(final Player player, ClickType clickType)
|
||||
{
|
||||
//need to do this :o
|
||||
// Shop.OpenPageForPlayer(player, new ConfirmationPage<CosmeticManager, CosmeticShop>(Plugin, Shop, ClientManager, DonationManager, new Runnable()
|
||||
// {
|
||||
// public void run()
|
||||
// {
|
||||
// _inventoryManager.addItemToInventory(player, "Item", "Old Chest", 1);
|
||||
// Refresh();
|
||||
// }
|
||||
// }, this, new TreasureKey(), CurrencyType.Coins, Player));
|
||||
|
||||
_inventoryManager.addItemToInventory(player, "Item", "Old Chest", 1);
|
||||
_page.getShop().OpenPageForPlayer(player, new ConfirmationPage<TreasureManager, TreasureShop>(
|
||||
_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_inventoryManager.addItemToInventory(player, "Item", "Old Chest", 1);
|
||||
_page.Refresh();
|
||||
}
|
||||
}, _page, new OldChest(), CurrencyType.Coins, player));
|
||||
}
|
||||
}
|
@ -8,12 +8,17 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.core.treasure.TreasureKey;
|
||||
import mineplex.core.treasure.TreasureLocation;
|
||||
import mineplex.core.treasure.TreasureManager;
|
||||
import mineplex.core.treasure.TreasureType;
|
||||
@ -74,7 +79,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
|
||||
if (basicCount > 0)
|
||||
AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.OLD));
|
||||
else
|
||||
AddButton(2, basic, new BuyBasicChestButton(Player, _inventoryManager));
|
||||
AddButton(2, basic, new BuyBasicChestButton(Player, _inventoryManager, this));
|
||||
AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.ANCIENT));
|
||||
AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.MYTHICAL));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user