Added back buttons for sub menus.
Added Gem booster pack and booster count display. Added reason and admin to mute message Fixed inventory tracking.
This commit is contained in:
parent
e1be732202
commit
bed2545b04
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
<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_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,"/>
|
<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.ATTR_TARGETS_UPDATED" value="true"/>
|
||||||
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
|
<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"/>
|
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
|
<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_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"/>
|
<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}"/>
|
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Mineplex.Core}"/>
|
||||||
</launchConfiguration>
|
</launchConfiguration>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||||
<triggers>full,incremental,</triggers>
|
<triggers>auto,full,incremental,</triggers>
|
||||||
<arguments>
|
<arguments>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>LaunchConfigHandle</key>
|
<key>LaunchConfigHandle</key>
|
||||||
|
@ -1,14 +1,32 @@
|
|||||||
package mineplex.core.inventory;
|
package mineplex.core.inventory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ClientInventory
|
public class ClientInventory
|
||||||
{
|
{
|
||||||
public List<ClientItem> Items = new ArrayList<ClientItem>();
|
public NautHashMap<String, ClientItem> Items = new NautHashMap<String, ClientItem>();
|
||||||
|
|
||||||
public int getChestCount()
|
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 Item Item;
|
||||||
public int Count;
|
public int Count;
|
||||||
|
|
||||||
|
public ClientItem(Item item, int count)
|
||||||
|
{
|
||||||
|
Item = item;
|
||||||
|
Count = count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
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 in game lobbies to boost gems earned for all.",
|
||||||
|
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;
|
package mineplex.core.inventory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
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.common.util.NautHashMap;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
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.Category;
|
||||||
import mineplex.core.inventory.data.InventoryRepository;
|
import mineplex.core.inventory.data.InventoryRepository;
|
||||||
import mineplex.core.inventory.data.Item;
|
import mineplex.core.inventory.data.Item;
|
||||||
@ -27,7 +29,9 @@ import mineplex.core.mount.MountManager;
|
|||||||
import mineplex.core.pet.PetManager;
|
import mineplex.core.pet.PetManager;
|
||||||
|
|
||||||
public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||||
{
|
{
|
||||||
|
private static Object _inventoryLock = new Object();
|
||||||
|
|
||||||
private GadgetManager _gadgetManager;
|
private GadgetManager _gadgetManager;
|
||||||
private MountManager _mountManager;
|
private MountManager _mountManager;
|
||||||
private PetManager _petManager;
|
private PetManager _petManager;
|
||||||
@ -36,8 +40,8 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
|||||||
|
|
||||||
private InventoryRepository _repository;
|
private InventoryRepository _repository;
|
||||||
|
|
||||||
private NautHashMap<String, Item> _items;
|
private NautHashMap<String, Item> _items = new NautHashMap<String, Item>();
|
||||||
private NautHashMap<String, Category> _categories;
|
private NautHashMap<String, Category> _categories = new NautHashMap<String, Category>();
|
||||||
|
|
||||||
public InventoryManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager)
|
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);
|
_repository = new InventoryRepository(plugin);
|
||||||
|
|
||||||
/*
|
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(GetPlugin(), new Runnable()
|
||||||
for (GadgetType gadgetType : GadgetType.values())
|
|
||||||
{
|
{
|
||||||
if (!_categories.containsKey(gadgetType.name()))
|
public void run()
|
||||||
_repository.addCategory(new Category(0, gadgetType.name()));
|
|
||||||
|
|
||||||
for (Gadget gadget : _gadgetManager.getGadgets(gadgetType))
|
|
||||||
{
|
{
|
||||||
if (!_items.containsKey(gadget.GetName()))
|
updateItems();
|
||||||
_repository.addItem(new Item(0, gadget.GetName(), null));
|
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
|
@Override
|
||||||
protected ClientInventory AddPlayer(String player)
|
protected ClientInventory AddPlayer(String player)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineplex.core.inventory.data;
|
package mineplex.core.inventory.data;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -8,7 +7,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.core.common.util.NautHashMap;
|
|
||||||
import mineplex.core.database.RepositoryBase;
|
import mineplex.core.database.RepositoryBase;
|
||||||
import mineplex.core.database.ResultSetCallable;
|
import mineplex.core.database.ResultSetCallable;
|
||||||
import mineplex.core.database.column.ColumnInt;
|
import mineplex.core.database.column.ColumnInt;
|
||||||
@ -18,18 +16,18 @@ import mineplex.core.inventory.ClientItem;
|
|||||||
|
|
||||||
public class InventoryRepository extends RepositoryBase
|
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_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), INDEX nameIndex (name));";
|
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 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 INSERT_ITEM = "INSERT INTO items (name, categoryId) 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 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 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 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.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 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)
|
public InventoryRepository(JavaPlugin plugin)
|
||||||
{
|
{
|
||||||
@ -67,14 +65,14 @@ public class InventoryRepository extends RepositoryBase
|
|||||||
return categories;
|
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()
|
public List<Item> retrieveItems()
|
||||||
@ -87,7 +85,7 @@ public class InventoryRepository extends RepositoryBase
|
|||||||
{
|
{
|
||||||
while (resultSet.next())
|
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;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateClientInventories(NautHashMap<String, List<ClientItem>> clientInventories)
|
public void incrementClientInventoryItem(String uuid, int itemId, int count)
|
||||||
{
|
{
|
||||||
PreparedStatement preparedStatement = null;
|
executeUpdate(INSERT_CLIENT_INVENTORY, new ColumnInt("itemid", itemId), new ColumnInt("count", count), new ColumnVarChar("uuid", 100, uuid));
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClientInventory loadClientInformation(String uuid)
|
public ClientInventory loadClientInformation(String uuid)
|
||||||
@ -147,12 +108,7 @@ public class InventoryRepository extends RepositoryBase
|
|||||||
{
|
{
|
||||||
while (resultSet.next())
|
while (resultSet.next())
|
||||||
{
|
{
|
||||||
ClientItem item = new ClientItem();
|
clientInventory.addItem(new ClientItem(new Item(resultSet.getString(1), resultSet.getString(2)), resultSet.getInt(3)));
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, new ColumnVarChar("uuid", 100, uuid));
|
}, new ColumnVarChar("uuid", 100, uuid));
|
||||||
|
@ -2,21 +2,19 @@ package mineplex.core.inventory.data;
|
|||||||
|
|
||||||
public class Item
|
public class Item
|
||||||
{
|
{
|
||||||
public int Id = -1;
|
public int Id;
|
||||||
public String Name;
|
public String Name;
|
||||||
public Category Category;
|
public String Category;
|
||||||
public int Rarity = 0;
|
|
||||||
|
|
||||||
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;
|
Id = id;
|
||||||
Name = name;
|
Name = name;
|
||||||
Category = category;
|
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()
|
public void run()
|
||||||
{
|
{
|
||||||
|
Plugin.addItemToInventory(Player, gadget.getGadgetType().name(), gadget.GetName(), 1);
|
||||||
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
|
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
|
||||||
}
|
}
|
||||||
}, null, gadget, CurrencyType.Coins, Player));
|
}, null, gadget, CurrencyType.Coins, Player));
|
||||||
|
@ -4,10 +4,13 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
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.F;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.gadget.types.Gadget;
|
import mineplex.core.gadget.types.Gadget;
|
||||||
import mineplex.core.gadget.types.GadgetType;
|
import mineplex.core.gadget.types.GadgetType;
|
||||||
|
import mineplex.core.inventory.GemBooster;
|
||||||
import mineplex.core.inventory.InventoryManager;
|
import mineplex.core.inventory.InventoryManager;
|
||||||
import mineplex.core.inventory.ui.InventoryShop;
|
import mineplex.core.inventory.ui.InventoryShop;
|
||||||
import mineplex.core.inventory.ui.button.DeactivateGadgetButton;
|
import mineplex.core.inventory.ui.button.DeactivateGadgetButton;
|
||||||
@ -20,6 +23,8 @@ import mineplex.core.inventory.ui.button.OpenParticles;
|
|||||||
import mineplex.core.inventory.ui.button.OpenPets;
|
import mineplex.core.inventory.ui.button.OpenPets;
|
||||||
import mineplex.core.mount.Mount;
|
import mineplex.core.mount.Mount;
|
||||||
import mineplex.core.shop.item.ShopItem;
|
import mineplex.core.shop.item.ShopItem;
|
||||||
|
import mineplex.core.shop.item.SingleButton;
|
||||||
|
import mineplex.core.shop.page.ConfirmationPage;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
|
|
||||||
public class Menu extends ShopPageBase<InventoryManager, InventoryShop>
|
public class Menu extends ShopPageBase<InventoryManager, InventoryShop>
|
||||||
@ -36,7 +41,44 @@ public class Menu extends ShopPageBase<InventoryManager, InventoryShop>
|
|||||||
{
|
{
|
||||||
AddItem(11, new ShopItem(175, DonationManager.Get(Player.getName()).getCoins() + " Coins", 1, false));
|
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(13, new ShopItem(Material.CHEST, Plugin.Get(Player).getChestCount() + " Chests", 1, false));
|
||||||
AddItem(15, new ShopItem(Material.EMERALD, DonationManager.Get(Player.getName()).GetGems() + " Gems", 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(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(29, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this));
|
||||||
@ -46,7 +88,6 @@ public class Menu extends ShopPageBase<InventoryManager, InventoryShop>
|
|||||||
|
|
||||||
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Particle) != null)
|
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Particle) != null)
|
||||||
{
|
{
|
||||||
System.out.println("found active particle.");
|
|
||||||
Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Particle);
|
Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Particle);
|
||||||
|
|
||||||
AddButton(36,
|
AddButton(36,
|
||||||
|
@ -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()
|
Shop.OpenPageForPlayer(Player, new ConfirmationPage<InventoryManager, InventoryShop>(Plugin, Shop, ClientManager, DonationManager, new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
Plugin.addItemToInventory(Player, "Mount", mount.GetName(), 1);
|
||||||
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
|
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)
|
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);
|
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));
|
}, null, _petPurchase ? _pet : tag, CurrencyType.Coins, Player));
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ public class Punish extends MiniPlugin
|
|||||||
|
|
||||||
if (client != null && client.IsMuted())
|
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);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ public class Punish extends MiniPlugin
|
|||||||
|
|
||||||
if (client != null && client.IsMuted())
|
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.setMessage(" ");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user