Work on inventoryManager and Enjin translator.

This commit is contained in:
Jonathan Williams 2014-08-07 21:22:18 -05:00
parent 5d89d1f728
commit e051c1d62c
3 changed files with 40 additions and 8 deletions

View File

@ -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<ClientInventory>
private InventoryRepository _repository;
private NautHashMap<String, Item> _items;
private NautHashMap<String, Category> _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<ClientInventory>
_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

View File

@ -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,15 +62,21 @@ 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"))
{
@ -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);
}
}

Binary file not shown.