diff --git a/Plugins/Mineplex.Core/.externalToolBuilders/asdf.launch b/Plugins/Mineplex.Core/.externalToolBuilders/asdf.launch index 88af961d4..c531d22bb 100644 --- a/Plugins/Mineplex.Core/.externalToolBuilders/asdf.launch +++ b/Plugins/Mineplex.Core/.externalToolBuilders/asdf.launch @@ -1,6 +1,7 @@ + @@ -10,7 +11,7 @@ - + diff --git a/Plugins/Mineplex.Core/.project b/Plugins/Mineplex.Core/.project index 62da8a3cf..83838c414 100644 --- a/Plugins/Mineplex.Core/.project +++ b/Plugins/Mineplex.Core/.project @@ -12,7 +12,7 @@ org.eclipse.ui.externaltools.ExternalToolBuilder - full,incremental, + auto,full,incremental, LaunchConfigHandle diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ClientInventory.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ClientInventory.java index 8f8ff2ecc..501bddf52 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ClientInventory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ClientInventory.java @@ -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 Items = new ArrayList(); - + public NautHashMap Items = new NautHashMap(); + 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); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ClientItem.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ClientItem.java index 1faa80d4f..26a47144b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ClientItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ClientItem.java @@ -6,4 +6,10 @@ public class ClientItem { public Item Item; public int Count; + + public ClientItem(Item item, int count) + { + Item = item; + Count = count; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java new file mode 100644 index 000000000..510e40f0f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/GemBooster.java @@ -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) + { + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java index 42b7364e3..4a23656e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java @@ -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 -{ +{ + private static Object _inventoryLock = new Object(); + private GadgetManager _gadgetManager; private MountManager _mountManager; private PetManager _petManager; @@ -36,8 +40,8 @@ public class InventoryManager extends MiniClientPlugin private InventoryRepository _repository; - private NautHashMap _items; - private NautHashMap _categories; + private NautHashMap _items = new NautHashMap(); + private NautHashMap _categories = new NautHashMap(); public InventoryManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager) { @@ -51,21 +55,79 @@ public class InventoryManager extends MiniClientPlugin _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 items = _repository.retrieveItems(); + + synchronized (_inventoryLock) + { + for (Item item : items) + { + _items.put(item.Name, item); + } + } + } + + private void updateCategories() + { + List 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) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java index 64b290d74..37d1c186e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/InventoryRepository.java @@ -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 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> 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)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/Item.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/Item.java index 71256be94..5f4b3efdb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/Item.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/data/Item.java @@ -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); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/GadgetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/GadgetPage.java index fff32e67d..d36bcf243 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/GadgetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/GadgetPage.java @@ -109,6 +109,7 @@ public class GadgetPage extends ShopPageBase { 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)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/Menu.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/Menu.java index 5cd3edbf5..783147bb9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/Menu.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/Menu.java @@ -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 @@ -29,7 +32,7 @@ public class Menu extends ShopPageBase 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 { 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(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)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/MountPage.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/MountPage.java index 11df3849e..2e3883dd8 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/MountPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/MountPage.java @@ -86,15 +86,16 @@ public class MountPage extends ShopPageBase }); } - public void purchaseMount(final Player player, final Mount _mount) + public void purchaseMount(final Player player, final Mount mount) { Shop.OpenPageForPlayer(Player, new ConfirmationPage(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) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/PetTagPage.java index d0144c045..46091ddb1 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/PetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/ui/page/PetTagPage.java @@ -98,7 +98,8 @@ public class PetTagPage extends ShopPageBase 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)); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java index 324958a50..ae364e196 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/Punish.java @@ -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); } diff --git a/Website/LOCWebsite.suo b/Website/LOCWebsite.suo index cfa74081d..17c33e71f 100644 Binary files a/Website/LOCWebsite.suo and b/Website/LOCWebsite.suo differ