From ab228fb4923a56998da6f73f093b3faed161bbc6 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Sat, 22 Oct 2016 23:52:33 -0400 Subject: [PATCH] Implement trick or treat chest in customer support server --- .../customerSupport/CustomerSupport.java | 13 +++++++++++++ .../salespackage/SalesPackageManager.java | 4 +++- .../salespackages/TrickOrTreatChest.java | 19 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/TrickOrTreatChest.java diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index b81e2ae90..fa2d4c7bf 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -158,6 +158,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int omegaChestsReceived = 0; int hauntedChestsReceived = 0; int hauntedChestsOpened = 0; + int trickOrTreatChestsReceived = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -257,6 +258,17 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable hauntedChestsReceived += 1; } + } + if (transaction.SalesPackageName.startsWith("Trick or Treat Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + trickOrTreatChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + trickOrTreatChestsReceived += 1; + } + } if (transaction.SalesPackageName.startsWith("Valentines Gift")) { @@ -326,6 +338,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable caller.sendMessage(C.cBlue + "Omega Chests Received: " + C.cYellow + omegaChestsReceived); caller.sendMessage(C.cBlue + "Haunted Chests Received: " + C.cYellow + hauntedChestsReceived); caller.sendMessage(C.cBlue + "Haunted Chests Opened: " + C.cYellow + hauntedChestsOpened); + caller.sendMessage(C.cBlue + "Trick or Treat Chests Received: " + C.cYellow + trickOrTreatChestsReceived); caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived); caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min) Received: " + C.cYellow + runeAmplifier20); caller.sendMessage(C.cBlue + "Rune Amplifiers (60 min) Received: " + C.cYellow + runeAmplifier60); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index 7996621e1..aed398e97 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -35,6 +35,7 @@ import mineplex.staffServer.salespackage.salespackages.Pet; import mineplex.staffServer.salespackage.salespackages.PowerPlayClub; import mineplex.staffServer.salespackage.salespackages.RuneAmplifier; import mineplex.staffServer.salespackage.salespackages.SalesPackageBase; +import mineplex.staffServer.salespackage.salespackages.TrickOrTreatChest; public class SalesPackageManager extends MiniPlugin { @@ -92,6 +93,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new PowerPlayClub(this, true)); AddSalesPackage(new OmegaChest(this)); AddSalesPackage(new HauntedChest(this)); + AddSalesPackage(new TrickOrTreatChest(this)); for (mineplex.core.pet.Pet pet : _petFactory.GetPets()) { @@ -165,7 +167,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 || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest) + else if (salesPackage instanceof MythicalChest || salesPackage instanceof AncientChest || salesPackage instanceof OldChest || salesPackage instanceof IlluminatedChest || salesPackage instanceof FreedomChest || salesPackage instanceof HauntedChest || salesPackage instanceof TrickOrTreatChest) { chestBuilder = chestBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray"); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/TrickOrTreatChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/TrickOrTreatChest.java new file mode 100644 index 000000000..315dd6151 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/TrickOrTreatChest.java @@ -0,0 +1,19 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; +import org.bukkit.entity.Player; + +public class TrickOrTreatChest extends SalesPackageBase +{ + public TrickOrTreatChest(SalesPackageManager manager) + { + super(manager, "1 Trick or Treat Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Trick or Treat Chest", "Give 1 Trick or Treat Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} \ No newline at end of file