Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
This commit is contained in:
commit
db90bcc958
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="Arcade,Hub,"/>
|
||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="Arcade,Hub,"/>
|
||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="Arcade,Hub,"/>
|
||||
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
|
||||
@ -10,7 +11,7 @@
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${BUILD_FILES}/common.xml"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
|
||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Mineplex.Core}"/>
|
||||
</launchConfiguration>
|
||||
|
@ -12,7 +12,7 @@
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<triggers>auto,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>LaunchConfigHandle</key>
|
||||
|
@ -1,14 +1,32 @@
|
||||
package mineplex.core.inventory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
|
||||
public class ClientInventory
|
||||
{
|
||||
public List<ClientItem> Items = new ArrayList<ClientItem>();
|
||||
|
||||
public NautHashMap<String, ClientItem> Items = new NautHashMap<String, ClientItem>();
|
||||
|
||||
public int getChestCount()
|
||||
{
|
||||
return 0;
|
||||
return Items.containsKey("LootChest") ? Items.get("LootChest").Count : 0;
|
||||
}
|
||||
|
||||
public void addItem(ClientItem item)
|
||||
{
|
||||
if (!Items.containsKey(item.Item.Name))
|
||||
Items.put(item.Item.Name, new ClientItem(item.Item, 0));
|
||||
|
||||
Items.get(item.Item.Name).Count += item.Count;
|
||||
}
|
||||
|
||||
public void removeItem(ClientItem item)
|
||||
{
|
||||
if (!Items.containsKey(item.Item.Name))
|
||||
return;
|
||||
|
||||
Items.get(item.Item.Name).Count -= item.Count;
|
||||
|
||||
if (Items.get(item.Item.Name).Count == 0)
|
||||
Items.remove(item.Item.Name);
|
||||
}
|
||||
}
|
||||
|
@ -6,4 +6,10 @@ public class ClientItem
|
||||
{
|
||||
public Item Item;
|
||||
public int Count;
|
||||
|
||||
public ClientItem(Item item, int count)
|
||||
{
|
||||
Item = item;
|
||||
Count = count;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package mineplex.core.inventory;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
|
||||
public class GemBooster extends SalesPackageBase
|
||||
{
|
||||
public GemBooster(int gemBoosters)
|
||||
{
|
||||
super("20 Gem Booster Pack", Material.EMERALD, (byte)0, new String[]
|
||||
{
|
||||
C.cYellow + "1000 Coins",
|
||||
" ",
|
||||
C.cWhite + "Use these before games start to",
|
||||
C.cWhite + "boost the amount of Gems earned",
|
||||
C.cWhite + "for all players in the game!",
|
||||
" ",
|
||||
C.cWhite + "Your Gem Boosters: " + C.cGreen + gemBoosters
|
||||
}, 1000);
|
||||
|
||||
KnownPackage = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Sold(Player player, CurrencyType currencyType)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,8 +1,11 @@
|
||||
package mineplex.core.inventory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
@ -16,8 +19,7 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
|
||||
import mineplex.core.inventory.data.Category;
|
||||
import mineplex.core.inventory.data.InventoryRepository;
|
||||
import mineplex.core.inventory.data.Item;
|
||||
@ -27,7 +29,9 @@ import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.pet.PetManager;
|
||||
|
||||
public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||
{
|
||||
{
|
||||
private static Object _inventoryLock = new Object();
|
||||
|
||||
private GadgetManager _gadgetManager;
|
||||
private MountManager _mountManager;
|
||||
private PetManager _petManager;
|
||||
@ -36,8 +40,8 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||
|
||||
private InventoryRepository _repository;
|
||||
|
||||
private NautHashMap<String, Item> _items;
|
||||
private NautHashMap<String, Category> _categories;
|
||||
private NautHashMap<String, Item> _items = new NautHashMap<String, Item>();
|
||||
private NautHashMap<String, Category> _categories = new NautHashMap<String, Category>();
|
||||
|
||||
public InventoryManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager)
|
||||
{
|
||||
@ -51,21 +55,79 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||
|
||||
_repository = new InventoryRepository(plugin);
|
||||
|
||||
/*
|
||||
for (GadgetType gadgetType : GadgetType.values())
|
||||
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
if (!_categories.containsKey(gadgetType.name()))
|
||||
_repository.addCategory(new Category(0, gadgetType.name()));
|
||||
|
||||
for (Gadget gadget : _gadgetManager.getGadgets(gadgetType))
|
||||
public void run()
|
||||
{
|
||||
if (!_items.containsKey(gadget.GetName()))
|
||||
_repository.addItem(new Item(0, gadget.GetName(), null));
|
||||
updateItems();
|
||||
updateCategories();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}, 20L);
|
||||
}
|
||||
|
||||
private void updateItems()
|
||||
{
|
||||
List<Item> items = _repository.retrieveItems();
|
||||
|
||||
synchronized (_inventoryLock)
|
||||
{
|
||||
for (Item item : items)
|
||||
{
|
||||
_items.put(item.Name, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCategories()
|
||||
{
|
||||
List<Category> categories = _repository.retrieveCategories();
|
||||
|
||||
synchronized (_inventoryLock)
|
||||
{
|
||||
for (Category category : categories)
|
||||
{
|
||||
_categories.put(category.Name, category);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addItemToInventory(final Player player, final String category, final String item, final int count)
|
||||
{
|
||||
final String uuidString = player.getUniqueId().toString();
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
synchronized (_inventoryLock)
|
||||
{
|
||||
if (!_categories.containsKey(category))
|
||||
{
|
||||
_repository.addCategory(category);
|
||||
}
|
||||
}
|
||||
|
||||
updateCategories();
|
||||
|
||||
synchronized (_inventoryLock)
|
||||
{
|
||||
if (!_items.containsKey(item))
|
||||
{
|
||||
_repository.addItem(item, _categories.get(category).Id);
|
||||
}
|
||||
}
|
||||
|
||||
updateItems();
|
||||
|
||||
synchronized (_inventoryLock)
|
||||
{
|
||||
_repository.incrementClientInventoryItem(uuidString, _items.get(item).Id, count);
|
||||
Get(player).addItem(new ClientItem(_items.get(item), count));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClientInventory AddPlayer(String player)
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
package mineplex.core.inventory.data;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
@ -8,7 +7,6 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.ResultSetCallable;
|
||||
import mineplex.core.database.column.ColumnInt;
|
||||
@ -18,18 +16,18 @@ import mineplex.core.inventory.ClientItem;
|
||||
|
||||
public class InventoryRepository extends RepositoryBase
|
||||
{
|
||||
private static String CREATE_INVENTORY_TABLE = "CREATE TABLE IF NOT EXISTS items (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), categoryId INT, rarity INT, PRIMARY KEY (id), FOREIGN KEY (categoryId) REFERENCES itemCategories(id), INDEX uniqueNameCategoryIndex (name, categoryId));";
|
||||
private static String CREATE_INVENTORY_CATEGORY_TABLE = "CREATE TABLE IF NOT EXISTS itemCategories (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), PRIMARY KEY (id), INDEX nameIndex (name));";
|
||||
private static String CREATE_INVENTORY_TABLE = "CREATE TABLE IF NOT EXISTS items (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), categoryId INT, rarity INT, PRIMARY KEY (id), FOREIGN KEY (categoryId) REFERENCES itemCategories(id), UNIQUE INDEX uniqueNameCategoryIndex (name, categoryId));";
|
||||
private static String CREATE_INVENTORY_CATEGORY_TABLE = "CREATE TABLE IF NOT EXISTS itemCategories (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), PRIMARY KEY (id), UNIQUE INDEX nameIndex (name));";
|
||||
private static String CREATE_INVENTORY_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountInventory (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, itemId INT NOT NULL, count INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (itemId) REFERENCES items(id), UNIQUE INDEX accountItemIndex (accountId, itemId));";
|
||||
|
||||
private static String INSERT_ITEM = "INSERT INTO items (name, categoryId, rarity) VALUES (?, ?, ?);";
|
||||
private static String RETRIEVE_ITEMS = "SELECT items.id, items.name, itemCategories.id, itemCategories.name, rarity FROM items INNER JOIN itemCategories ON itemCategories.id = items.categoryId;";
|
||||
private static String INSERT_ITEM = "INSERT INTO items (name, categoryId) VALUES (?, ?);";
|
||||
private static String RETRIEVE_ITEMS = "SELECT items.id, items.name, itemCategories.name FROM items INNER JOIN itemCategories ON itemCategories.id = items.categoryId;";
|
||||
|
||||
private static String INSERT_CATEGORY = "INSERT INTO category (name) VALUES (?);";
|
||||
private static String INSERT_CATEGORY = "INSERT INTO itemCategories (name) VALUES (?);";
|
||||
private static String RETRIEVE_CATEGORIES = "SELECT id, name FROM itemCategories;";
|
||||
|
||||
private static String INSERT_CLIENT_INVENTORY = "INSERT INTO accountInventory (accountId, itemId, count) SELECT accounts.id, ?, ? FROM accounts WHERE accounts.uuid = ? ON DUPLICATE KEY UPDATE count=VALUES(count);";
|
||||
private static String RETRIEVE_CLIENT_INVENTORY = "SELECT items.id, items.name, ic.id, ic.name as category, count FROM accountInventory AS ai INNER JOIN items ON items.id = ai.itemId INNER JOIN itemCategories AS ic ON ic.id = items.categoryId INNER JOIN accounts ON accounts.id = ai.accountId WHERE accounts.uuid = ?;";
|
||||
private static String INSERT_CLIENT_INVENTORY = "INSERT INTO accountInventory (accountId, itemId, count) SELECT accounts.id, ?, ? FROM accounts WHERE accounts.uuid = ? ON DUPLICATE KEY UPDATE count=count + VALUES(count);";
|
||||
private static String RETRIEVE_CLIENT_INVENTORY = "SELECT items.name, ic.name as category, count FROM accountInventory AS ai INNER JOIN items ON items.id = ai.itemId INNER JOIN itemCategories AS ic ON ic.id = items.categoryId INNER JOIN accounts ON accounts.id = ai.accountId WHERE accounts.uuid = ?;";
|
||||
|
||||
public InventoryRepository(JavaPlugin plugin)
|
||||
{
|
||||
@ -67,14 +65,14 @@ public class InventoryRepository extends RepositoryBase
|
||||
return categories;
|
||||
}
|
||||
|
||||
public void addItem(Item item)
|
||||
public void addItem(String name, int categoryId)
|
||||
{
|
||||
executeUpdate(INSERT_ITEM, new ColumnVarChar("name", 100, item.Name), new ColumnInt("categoryId", item.Category.Id), new ColumnInt("rarity", item.Rarity));
|
||||
executeUpdate(INSERT_ITEM, new ColumnVarChar("name", 100, name), new ColumnInt("categoryId", categoryId));
|
||||
}
|
||||
|
||||
public void addCategory(Category category)
|
||||
public void addCategory(String name)
|
||||
{
|
||||
executeUpdate(INSERT_CATEGORY, new ColumnVarChar("name", 100, category.Name));
|
||||
executeUpdate(INSERT_CATEGORY, new ColumnVarChar("name", 100, name));
|
||||
}
|
||||
|
||||
public List<Item> retrieveItems()
|
||||
@ -87,7 +85,7 @@ public class InventoryRepository extends RepositoryBase
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
items.add(new Item(resultSet.getInt(1), resultSet.getString(2), new Category(resultSet.getInt(3), resultSet.getString(4)), resultSet.getInt(5)));
|
||||
items.add(new Item(resultSet.getInt(1), resultSet.getString(2), resultSet.getString(3)));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -95,46 +93,9 @@ public class InventoryRepository extends RepositoryBase
|
||||
return items;
|
||||
}
|
||||
|
||||
public void updateClientInventories(NautHashMap<String, List<ClientItem>> clientInventories)
|
||||
public void incrementClientInventoryItem(String uuid, int itemId, int count)
|
||||
{
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try
|
||||
{
|
||||
preparedStatement = getConnection().prepareStatement(INSERT_CLIENT_INVENTORY);
|
||||
|
||||
for (String uuid : clientInventories.keySet())
|
||||
{
|
||||
for (ClientItem item : clientInventories.get(uuid))
|
||||
{
|
||||
preparedStatement.setInt(1, item.Item.Id);
|
||||
preparedStatement.setInt(2, item.Count);
|
||||
preparedStatement.setString(3, uuid);
|
||||
|
||||
preparedStatement.addBatch();
|
||||
}
|
||||
}
|
||||
|
||||
preparedStatement.executeBatch();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (preparedStatement != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
preparedStatement.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
executeUpdate(INSERT_CLIENT_INVENTORY, new ColumnInt("itemid", itemId), new ColumnInt("count", count), new ColumnVarChar("uuid", 100, uuid));
|
||||
}
|
||||
|
||||
public ClientInventory loadClientInformation(String uuid)
|
||||
@ -147,12 +108,7 @@ public class InventoryRepository extends RepositoryBase
|
||||
{
|
||||
while (resultSet.next())
|
||||
{
|
||||
ClientItem item = new ClientItem();
|
||||
|
||||
item.Item = new Item(resultSet.getInt(1), resultSet.getString(2), new Category(resultSet.getInt(3), resultSet.getString(4)));
|
||||
item.Count = resultSet.getInt(4);
|
||||
|
||||
clientInventory.Items.add(item);
|
||||
clientInventory.addItem(new ClientItem(new Item(resultSet.getString(1), resultSet.getString(2)), resultSet.getInt(3)));
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("uuid", 100, uuid));
|
||||
|
@ -2,21 +2,19 @@ package mineplex.core.inventory.data;
|
||||
|
||||
public class Item
|
||||
{
|
||||
public int Id = -1;
|
||||
public int Id;
|
||||
public String Name;
|
||||
public Category Category;
|
||||
public int Rarity = 0;
|
||||
public String Category;
|
||||
|
||||
public Item(int id, String name, Category category, int rarity)
|
||||
public Item(String name, String category)
|
||||
{
|
||||
this(-1, name, category);
|
||||
}
|
||||
|
||||
public Item(int id, String name, String category)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
Category = category;
|
||||
Rarity = rarity;
|
||||
}
|
||||
|
||||
public Item(int id, String name, Category category)
|
||||
{
|
||||
this(id, name, category, 0);
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ public class GadgetPage extends ShopPageBase<InventoryManager, InventoryShop>
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Plugin.addItemToInventory(Player, gadget.getGadgetType().name(), gadget.GetName(), 1);
|
||||
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
|
||||
}
|
||||
}, null, gadget, CurrencyType.Coins, Player));
|
||||
|
@ -1,15 +1,16 @@
|
||||
package mineplex.core.inventory.ui.page;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
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.donation.DonationManager;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
import mineplex.core.inventory.GemBooster;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.inventory.ui.InventoryShop;
|
||||
import mineplex.core.inventory.ui.button.DeactivateGadgetButton;
|
||||
@ -22,6 +23,8 @@ import mineplex.core.inventory.ui.button.OpenParticles;
|
||||
import mineplex.core.inventory.ui.button.OpenPets;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
|
||||
public class Menu extends ShopPageBase<InventoryManager, InventoryShop>
|
||||
@ -29,7 +32,7 @@ public class Menu extends ShopPageBase<InventoryManager, InventoryShop>
|
||||
public Menu(InventoryManager plugin, InventoryShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Inventory", player);
|
||||
|
||||
|
||||
BuildPage();
|
||||
}
|
||||
|
||||
@ -38,61 +41,90 @@ public class Menu extends ShopPageBase<InventoryManager, InventoryShop>
|
||||
{
|
||||
AddItem(11, new ShopItem(175, DonationManager.Get(Player.getName()).getCoins() + " Coins", 1, false));
|
||||
AddItem(13, new ShopItem(Material.CHEST, Plugin.Get(Player).getChestCount() + " Chests", 1, false));
|
||||
AddItem(15, new ShopItem(Material.EMERALD, "Gem Booster", new String[]
|
||||
{
|
||||
ChatColor.RESET + "Use these before games start to",
|
||||
ChatColor.RESET + "boost the amount of Gems earned",
|
||||
ChatColor.RESET + "for all players in the game!",
|
||||
ChatColor.RESET + " ",
|
||||
C.cGreen + C.Bold + "Click to Purchase"
|
||||
}, 1, false));
|
||||
|
||||
|
||||
int gemBoosters = Plugin.Get(Player).Items.containsKey("Gem Booster") ? Plugin.Get(Player).Items.get("Gem Booster").Count : 0;
|
||||
final GemBooster gemBoosterItem = new GemBooster(gemBoosters);
|
||||
|
||||
if (DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= gemBoosterItem.GetCost(CurrencyType.Coins))
|
||||
{
|
||||
AddButton(15, new ShopItem(
|
||||
gemBoosterItem.GetDisplayMaterial(),
|
||||
gemBoosterItem.GetDisplayName(),
|
||||
gemBoosterItem.GetDescription(),
|
||||
1,
|
||||
false),
|
||||
new SingleButton()
|
||||
{
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
Shop.OpenPageForPlayer(Player, new ConfirmationPage<InventoryManager, InventoryShop>(Plugin, Shop, ClientManager, DonationManager, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Plugin.addItemToInventory(Player, "Utility", "Gem Booster", 20);
|
||||
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, Player));
|
||||
}
|
||||
}, null, gemBoosterItem, CurrencyType.Coins, Player));
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddItem(15, new ShopItem(
|
||||
gemBoosterItem.GetDisplayMaterial(),
|
||||
gemBoosterItem.GetDisplayName(),
|
||||
gemBoosterItem.GetDescription(),
|
||||
1,
|
||||
false));
|
||||
}
|
||||
|
||||
AddButton(27, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));
|
||||
AddButton(29, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this));
|
||||
AddButton(31, new ShopItem(Material.LEASH, "Pets", 1, false), new OpenPets(this));
|
||||
AddButton(33, new ShopItem(Material.IRON_BARDING, "Mounts", 1, false), new OpenMounts(this));
|
||||
AddButton(35, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this));
|
||||
|
||||
|
||||
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Particle) != null)
|
||||
{
|
||||
System.out.println("found active particle.");
|
||||
Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Particle);
|
||||
|
||||
|
||||
AddButton(36,
|
||||
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), F.item(gadget.GetName()), new String[] {}, 1, false, false),
|
||||
new DeactivateGadgetButton(gadget, this));
|
||||
new DeactivateGadgetButton(gadget, this));
|
||||
}
|
||||
|
||||
|
||||
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Item) != null)
|
||||
{
|
||||
Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Item);
|
||||
|
||||
|
||||
AddButton(38,
|
||||
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), F.item(gadget.GetName()), new String[] {}, 1, false, false),
|
||||
new DeactivateGadgetButton(gadget, this));
|
||||
new DeactivateGadgetButton(gadget, this));
|
||||
}
|
||||
|
||||
|
||||
if (Plugin.getPetManager().hasActivePet(Player.getName()))
|
||||
{
|
||||
AddButton(40, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), F.item(Plugin.getPetManager().getActivePet(Player.getName()).getCustomName()), new String[] {}, 1, false, false), new DeactivatePetButton(this, Plugin.getPetManager()));
|
||||
}
|
||||
|
||||
|
||||
if (Plugin.getMountManager().getActive(Player) != null)
|
||||
{
|
||||
Mount<?> mount = Plugin.getMountManager().getActive(Player);
|
||||
|
||||
|
||||
AddButton(42,
|
||||
new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), F.item(mount.GetName()), new String[] {}, 1, false, false),
|
||||
new DeactivateMountButton(mount, this));
|
||||
new DeactivateMountButton(mount, this));
|
||||
}
|
||||
|
||||
|
||||
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Morph) != null)
|
||||
{
|
||||
Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Morph);
|
||||
|
||||
|
||||
AddButton(44,
|
||||
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), F.item(gadget.GetName()), new String[] {}, 1, false, false),
|
||||
new DeactivateGadgetButton(gadget, this));
|
||||
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), F.item(gadget.GetName()), new String[] {}, 1, false, false),
|
||||
new DeactivateGadgetButton(gadget, this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,15 +86,16 @@ public class MountPage extends ShopPageBase<InventoryManager, InventoryShop>
|
||||
});
|
||||
}
|
||||
|
||||
public void purchaseMount(final Player player, final Mount<?> _mount)
|
||||
public void purchaseMount(final Player player, final Mount<?> mount)
|
||||
{
|
||||
Shop.OpenPageForPlayer(Player, new ConfirmationPage<InventoryManager, InventoryShop>(Plugin, Shop, ClientManager, DonationManager, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Plugin.addItemToInventory(Player, "Mount", mount.GetName(), 1);
|
||||
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
|
||||
}
|
||||
}, null, _mount, CurrencyType.Coins, Player));
|
||||
}, null, mount, CurrencyType.Coins, Player));
|
||||
}
|
||||
|
||||
public void activateMount(Player player, Mount<?> _mount)
|
||||
|
@ -98,7 +98,8 @@ public class PetTagPage extends ShopPageBase<InventoryManager, InventoryShop>
|
||||
|
||||
Plugin.getPetManager().Get(Player).GetPets().put(_pet.GetPetType(), token.PetName);
|
||||
|
||||
Player.closeInventory();
|
||||
Plugin.addItemToInventory(Player, "Pet", _pet.GetPetType().toString(), 1);
|
||||
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, Player));
|
||||
}
|
||||
}, null, _petPurchase ? _pet : tag, CurrencyType.Coins, Player));
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public class Punish extends MiniPlugin
|
||||
|
||||
if (client != null && client.IsMuted())
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main(GetName(), "Shh, you're muted for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + "."));
|
||||
event.getPlayer().sendMessage(F.main(GetName(), "Shh, you're muted because " + client.GetPunishment(PunishmentSentence.Mute).GetReason() + " by " + client.GetPunishment(PunishmentSentence.Mute).GetAdmin() + " for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + "."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -109,7 +109,7 @@ public class Punish extends MiniPlugin
|
||||
|
||||
if (client != null && client.IsMuted())
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main(GetName(), "Shh, you're muted for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + "."));
|
||||
event.getPlayer().sendMessage(F.main(GetName(), "Shh, you're muted because " + client.GetPunishment(PunishmentSentence.Mute).GetReason() + " by " + client.GetPunishment(PunishmentSentence.Mute).GetAdmin() + " for " + C.cGreen + UtilTime.convertString(client.GetPunishment(PunishmentSentence.Mute).GetRemaining(), 1, TimeUnit.FIT) + "."));
|
||||
event.setMessage(" ");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user