From e051c1d62cc6f4cc58b0fd0ccb53914b5aa43360 Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Thu, 7 Aug 2014 21:22:18 -0500 Subject: [PATCH] Work on inventoryManager and Enjin translator. --- .../core/inventory/InventoryManager.java | 22 +++++++++++++++ .../src/mineplex/enjinTranslator/Enjin.java | 26 ++++++++++++------ Website/LOCWebsite.suo | Bin 474624 -> 474624 bytes 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java index 3d8875619..42b7364e3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/inventory/InventoryManager.java @@ -13,9 +13,14 @@ import mineplex.core.MiniClientPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.account.event.RetrieveClientInformationEvent; 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; import mineplex.core.inventory.ui.InventoryShop; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.mount.MountManager; @@ -31,6 +36,9 @@ public class InventoryManager extends MiniClientPlugin private InventoryRepository _repository; + private NautHashMap _items; + private NautHashMap _categories; + public InventoryManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager) { super("Inventory Manager", plugin); @@ -42,6 +50,20 @@ public class InventoryManager extends MiniClientPlugin _inventoryShop = new InventoryShop(this, clientManager, donationManager, _moduleName); _repository = new InventoryRepository(plugin); + + /* + for (GadgetType gadgetType : GadgetType.values()) + { + if (!_categories.containsKey(gadgetType.name())) + _repository.addCategory(new Category(0, gadgetType.name())); + + for (Gadget gadget : _gadgetManager.getGadgets(gadgetType)) + { + if (!_items.containsKey(gadget.GetName())) + _repository.addItem(new Item(0, gadget.GetName(), null)); + } + } + */ } @Override diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index bda582e9f..4ec9bea8f 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -1,5 +1,7 @@ package mineplex.enjinTranslator; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; import org.bukkit.command.Command; @@ -27,6 +29,8 @@ public class Enjin extends MiniPlugin implements CommandExecutor public long _lastPoll = System.currentTimeMillis() - 120000; + private SimpleDateFormat _dateFormat = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss"); + public Enjin(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Punish punish) { super("Enjin", plugin); @@ -58,16 +62,22 @@ public class Enjin extends MiniPlugin implements CommandExecutor if (label.equalsIgnoreCase("enjin_mineplex")) { - System.out.println("enjin command"); - if (args.length == 3 && args[0].equalsIgnoreCase("gem")) { String name = args[1]; int amount = Integer.parseInt(args[2]); _donationManager.RewardGems(null, "purchase", name, amount); - System.out.println("enjin gem"); + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " gems."); } + else if (args.length == 3 && args[0].equalsIgnoreCase("coin")) + { + String name = args[1]; + int amount = Integer.parseInt(args[2]); + + _donationManager.RewardCoins(null, "purchase", name, amount); + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + amount + " coins."); + } else if (args.length == 4 && args[0].equalsIgnoreCase("rank")) { String name = args[1]; @@ -75,7 +85,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor boolean perm = Boolean.parseBoolean(args[3]); _clientManager.SaveRank(name, mineplex.core.common.Rank.valueOf(rank), perm); - System.out.println("enjin rank"); + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + rank + " " + (perm ? "permanently." : "for 1 month.")); } else if (args.length >= 3 && args[0].equalsIgnoreCase("purchase")) { @@ -88,8 +98,8 @@ public class Enjin extends MiniPlugin implements CommandExecutor packageName += " " + args[i]; } - _donationManager.PurchaseUnknownSalesPackage(null, name, packageName, 0, false); - System.out.println("enjin purchase"); + _donationManager.PurchaseUnknownSalesPackage(null, name, packageName, false, 0, false); + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " received " + packageName + "."); } else if (args.length >= 3 && args[0].equalsIgnoreCase("unban")) { @@ -102,7 +112,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor } _punish.RemoveBan(name, reason); - System.out.println("enjin unban"); + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " unbanned for " + reason); } else if (args.length >= 3 && args[0].equalsIgnoreCase("ban")) { @@ -115,7 +125,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor } _punish.AddPunishment(name, Category.Other, reason, null, 3, true, -1); - System.out.println("enjin ban"); + System.out.println("[" + _dateFormat.format(new Date()) + "] " + name + " banned for " + reason); } } diff --git a/Website/LOCWebsite.suo b/Website/LOCWebsite.suo index 9309867d090c94ddd296d3088de3a1fc980acf21..4c04208389ad0e721395dbef0b10411a34c226ef 100644 GIT binary patch delta 971 zcmZuwTS!z<6g}tOd(QRRjHZnCG98~8hA-^Nlua+q!kKImLdqyYBC*$4WFa#W1(BuQ zk6mFk+JoxLx;p14(zHGzsfmd2Bl5!^A*O=cN0Hf{nlV2*u()UMz4l&b?|Y8#XPWP4 zT5qG0;Ja$Sv-;6%DicBmCyW;5MZ89*a3!Jx=sGE1_a?ga4RytanHW-FLkcU=zuBra z8jl3)KT?WIA67~XGsR`qXaf3Y#bSmx+a+oADB4G+eP(W`Hm+PEBnk0H$1qR(7)>{t z+Ya_CHaw3QUrxuI$^y*M-`raw%#-x>3XMb#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