Fixes for Illuminated chest

Fixes for /check command (Support)
This commit is contained in:
LCastr0 2016-05-20 23:33:58 -03:00
parent 22fb507871
commit 0109e2f2dd
17 changed files with 148 additions and 68 deletions

View File

@ -123,6 +123,11 @@ public class Donor
_unknownSalesPackagesOwned.add(packageName);
}
public void RemoveUnknownSalesPackagesOwned(String packageName)
{
_unknownSalesPackagesOwned.remove(packageName);
}
public List<TransactionToken> getTransactions()
{
return _transactions;

View File

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import mineplex.core.gadget.commands.LockCosmeticsCommand;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -245,6 +246,7 @@ public class GadgetManager extends MiniPlugin
public void addCommands()
{
addCommand(new UnlockCosmeticsCommand(this));
addCommand(new LockCosmeticsCommand(this));
addCommand(new AmmoCommand(this));
}

View File

@ -24,13 +24,6 @@ public class AmmoCommand extends CommandBase<GadgetManager>
@Override
public void Execute(Player caller, String[] args)
{
boolean testServer = _plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
if(!testServer)
{
UtilPlayer.message(caller, F.elem("This command can only be used on test servers!"));
}
if(args.length == 2)
{
String gadgetName = args[0];

View File

@ -0,0 +1,71 @@
package mineplex.core.gadget.commands;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import org.bukkit.entity.Player;
public class LockCosmeticsCommand extends CommandBase<GadgetManager>
{
private GadgetManager _plugin;
public LockCosmeticsCommand(GadgetManager plugin)
{
super(plugin, Rank.JNR_DEV, new Rank[]{Rank.SNR_MODERATOR}, "lockCosmetics");
_plugin = plugin;
}
@Override
public void Execute(Player caller, String[] args)
{
// Adds all cosmetic types
if (args.length == 0)
{
addCosmetics(null, caller);
}
// Adds specific type
else
{
String type = args[0];
if (type.equalsIgnoreCase("all"))
{
addCosmetics(null, caller);
}
else
{
GadgetType gadgetType = GadgetType.valueOf(type);
if (gadgetType == null)
{
UtilPlayer.message(caller, F.main("Cosmetics", "Invalid cosmetic type!"));
}
else
{
addCosmetics(gadgetType, caller);
}
}
}
}
private void addCosmetics(GadgetType gadgetType, Player caller)
{
if (gadgetType == null)
{
for (GadgetType type : GadgetType.values())
{
addCosmetics(type, caller);
}
return;
}
for (Gadget gadget : _plugin.getGadgets(gadgetType))
{
_plugin.getDonationManager().Get(caller.getName()).RemoveUnknownSalesPackagesOwned(gadget.GetName());
}
UtilPlayer.message(caller, F.main("Cosmetics", "Removed all the " + gadgetType.name() + " cosmetics!"));
}
}

View File

@ -16,20 +16,13 @@ public class UnlockCosmeticsCommand extends CommandBase<GadgetManager>
public UnlockCosmeticsCommand(GadgetManager plugin)
{
super(plugin, Rank.JNR_DEV, "unlockCosmetics");
super(plugin, Rank.JNR_DEV, new Rank[]{Rank.SNR_MODERATOR}, "unlockCosmetics");
_plugin = plugin;
}
@Override
public void Execute(Player caller, String[] args)
{
boolean testServer = _plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
if(!testServer)
{
UtilPlayer.message(caller, F.elem("This command can only be used on test servers!"));
}
// Adds all cosmetic types
if (args.length == 0)
{

View File

@ -21,7 +21,7 @@ public class ArrowTrailCupid extends ArrowEffectGadget
{
super(manager, "Cupid's Arrows",
UtilText.splitLineToArray("Thats the power of love!", LineFormat.LORE),
-2, Material.APPLE, (byte)0);
-2, Material.APPLE, (byte)0, "Arrows of Cupid");
}
@Override

View File

@ -20,7 +20,7 @@ public class DeathCupidsBrokenHeart extends DeathEffectGadget
{
super(manager, "Cupid's Broken Heart",
UtilText.splitLineToArray("Cue the weeping violins...", LineFormat.LORE),
-2, Material.APPLE, (byte) 0);
-2, Material.APPLE, (byte) 0, "Broken Hearted");
}
@Override

View File

@ -31,7 +31,7 @@ public class DoubleJumpCupidsWings extends DoubleJumpEffectGadget
{
super(manager, "Cupid's Wings",
UtilText.splitLineToArray("Take flight on the wings of love!", LineFormat.LORE),
-2, Material.APPLE, (byte)0);
-2, Material.APPLE, (byte)0, "Wings of Love");
}
@Override

View File

@ -14,7 +14,7 @@ public class HatCompanionBlock extends HatGadget
{
super(manager, "Companion Block",
UtilText.splitLineToArray(C.cGray + "The Enrichment Center is required to remind you that the Weighted Companion cube cannot talk. In the event that it does talk The Enrichment Center asks you to ignore its advice.", LineFormat.LORE),
-2, SkinData.COMPANION_CUBE.getSkull(), "Companion Block");
-2, SkinData.COMPANION_CUBE.getSkull(), "Companion");
}
}

View File

@ -23,9 +23,9 @@ public class ParticleHeart extends ParticleGadget
public ParticleHeart(GadgetManager manager)
{
super(manager, "Cupids Love",
super(manager, "Cupid's Love",
UtilText.splitLineToArray(C.cGray + "Share the love you feel in your heart with everybody near you!", LineFormat.LORE), -2,
Material.APPLE, (byte) 0, "I Heart You");
Material.APPLE, (byte) 0, "I Heart You", "Cupids Love", "Heartfelt Halo");
}
@Override

View File

@ -201,6 +201,7 @@ public class TreasureLocation implements Listener
private void chargeAccount(Player player, TreasureType treasureType, Callback<Boolean> callback)
{
int itemCount = _inventoryManager.Get(player).getItemCount(treasureType.getItemName());
player.sendMessage("COUNT: " + itemCount);
if (itemCount > 0)
{
// Should always handle the callback for us

View File

@ -5,7 +5,6 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.event.GetClientEvent;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
@ -13,9 +12,6 @@ import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.treasure.ChestPackage;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class BuyChestButton implements IButton
{

View File

@ -46,12 +46,12 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
int christmasCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.CHRISTMAS.getItemName());
int illuminatedCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ILLUMINATED.getItemName());
List<String> shardLore = new ArrayList<String>();
List<String> shardLore = new ArrayList<>();
shardLore.add(" ");
shardLore.add(C.cGray + "This seems like it might come in");
shardLore.add(C.cGray + "handy. Maybe I can collect more!");
List<String> basicLore = new ArrayList<String>();
List<String> basicLore = new ArrayList<>();
basicLore.add(" ");
basicLore.add(F.value("Old Chests Owned", "" + basicCount));
basicLore.add(" ");
@ -71,7 +71,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
basicLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
}
List<String> heroicLore = new ArrayList<String>();
List<String> heroicLore = new ArrayList<>();
heroicLore.add(" ");
heroicLore.add(F.value("Ancient Chests Owned", "" + heroicCount));
heroicLore.add(" ");
@ -88,7 +88,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
heroicLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
}
List<String> legendaryLore = new ArrayList<String>();
List<String> legendaryLore = new ArrayList<>();
legendaryLore.add(" ");
legendaryLore.add(F.value("Mythical Chests Owned", "" + legendaryCount));
legendaryLore.add(" ");
@ -108,7 +108,7 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
legendaryLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
}
List<String> christmasLore = new ArrayList<String>();
List<String> christmasLore = new ArrayList<>();
christmasLore.add(" ");
christmasLore.add(F.value("Winter Holiday Chests Owned", "" + christmasCount));
christmasLore.add(" ");
@ -155,11 +155,11 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
addItem(40, shards);
addChest(12, christmas, TreasureType.CHRISTMAS, christmasCount);
addChest(14, illuminated, TreasureType.ILLUMINATED, illuminatedCount);
addChest(20, basic, TreasureType.OLD, basicCount);
addChest(22, heroic, TreasureType.ANCIENT, heroicCount);
addChest(24, legendary, TreasureType.MYTHICAL, legendaryCount);
addChest(12, christmas, TreasureType.CHRISTMAS, christmasCount);
addChest(14, illuminated, TreasureType.ILLUMINATED, illuminatedCount);
}
private void addChest(int slot, ItemStack item, TreasureType treasureType, int owned)

View File

@ -125,6 +125,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
int ancientChestsReceived = 0;
int mythicalChestsReceived = 0;
int winterChestsReceived = 0;
int illuminatedChestsReceived = 0;
int valentinesGiftsReceived = 0;
for (CoinTransactionToken transaction : donor.getCoinTransactions())
@ -181,6 +182,17 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
winterChestsReceived += 1;
}
}
if (transaction.SalesPackageName.startsWith("Illuminated Chest"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
illuminatedChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
illuminatedChestsReceived += 1;
}
}
if (transaction.SalesPackageName.startsWith("Valentines Gift"))
{
@ -195,12 +207,12 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
}
}
// Strutt20 asked me to remove some stuff from the menu
caller.sendMessage(C.cBlue + "Enjin Coin Total Received: " + C.cYellow + enjinCoinsReceived);
caller.sendMessage(C.cBlue + "Old Chests Received: " + C.cYellow + oldChestsReceived);
caller.sendMessage(C.cBlue + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived);
caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived);
caller.sendMessage(C.cBlue + "Winter Chests Received : " + C.cYellow + winterChestsReceived);
caller.sendMessage(C.cBlue + "Valentines Gifts Received : " + C.cYellow + valentinesGiftsReceived);
caller.sendMessage(C.cBlue + "Illuminated Chests Received: " + C.cYellow + illuminatedChestsReceived);
caller.sendMessage(C.cBlue + "Monthly Bonus Log (Last 6 entries):");
if (_accountBonusLog.containsKey(client.getAccountId()))

View File

@ -1,5 +1,6 @@
package mineplex.staffServer.salespackage;
import mineplex.staffServer.salespackage.salespackages.*;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
@ -12,23 +13,6 @@ import mineplex.core.inventory.InventoryManager;
import mineplex.core.stats.StatsManager;
import mineplex.staffServer.salespackage.command.DisplayPackageCommand;
import mineplex.staffServer.salespackage.command.Sales;
import mineplex.staffServer.salespackage.salespackages.AncientChest;
import mineplex.staffServer.salespackage.salespackages.ApplyKits;
import mineplex.staffServer.salespackage.salespackages.Coins;
import mineplex.staffServer.salespackage.salespackages.DefaultRank;
import mineplex.staffServer.salespackage.salespackages.EasterBunny;
import mineplex.staffServer.salespackage.salespackages.FrostLord;
import mineplex.staffServer.salespackage.salespackages.GemHunter;
import mineplex.staffServer.salespackage.salespackages.LifetimeHero;
import mineplex.staffServer.salespackage.salespackages.LifetimeLegend;
import mineplex.staffServer.salespackage.salespackages.LifetimeTitan;
import mineplex.staffServer.salespackage.salespackages.LifetimeUltra;
import mineplex.staffServer.salespackage.salespackages.MonthlyHero;
import mineplex.staffServer.salespackage.salespackages.MonthlyUltra;
import mineplex.staffServer.salespackage.salespackages.MythicalChest;
import mineplex.staffServer.salespackage.salespackages.SalesPackageBase;
import mineplex.staffServer.salespackage.salespackages.OldChest;
import mineplex.staffServer.salespackage.salespackages.ValentinesGift;
public class SalesPackageManager extends MiniPlugin
{
@ -48,23 +32,25 @@ public class SalesPackageManager extends MiniPlugin
_inventoryManager = inventoryManager;
_statsManager = statsManager;
//Strutt20 asked me to remove some of the stuff from the menu
AddSalesPackage(new Coins(this, 5000));
AddSalesPackage(new Coins(this, 25000));
AddSalesPackage(new Coins(this, 75000));
AddSalesPackage(new MonthlyUltra(this));
AddSalesPackage(new MonthlyHero(this));
//AddSalesPackage(new MonthlyUltra(this));
//AddSalesPackage(new MonthlyHero(this));
AddSalesPackage(new DefaultRank(this));
AddSalesPackage(new LifetimeUltra(this));
AddSalesPackage(new LifetimeHero(this));
AddSalesPackage(new LifetimeLegend(this));
AddSalesPackage(new LifetimeTitan(this));
AddSalesPackage(new GemHunter(this, 4));
AddSalesPackage(new GemHunter(this, 8));
//AddSalesPackage(new GemHunter(this, 4));
//AddSalesPackage(new GemHunter(this, 8));
AddSalesPackage(new ApplyKits(this));
AddSalesPackage(new OldChest(this));
AddSalesPackage(new AncientChest(this));
AddSalesPackage(new MythicalChest(this));
AddSalesPackage(new ValentinesGift(this));
AddSalesPackage(new IlluminatedChest(this));
//AddSalesPackage(new ValentinesGift(this));
AddSalesPackage(new FrostLord(this));
AddSalesPackage(new EasterBunny(this));
}
@ -117,7 +103,7 @@ public class SalesPackageManager extends MiniPlugin
{
coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
}
else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest)
else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest)
{
chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
}

View File

@ -0,0 +1,21 @@
package mineplex.staffServer.salespackage.salespackages;
import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.entity.Player;
public class IlluminatedChest extends SalesPackageBase
{
public IlluminatedChest(SalesPackageManager manager)
{
super(manager, "1 Illuminated Chest");
}
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales item " + playerName + " 1 Item Illuminated Chest", "Give 1 Illuminated Chest.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}
}