From e85ee39ac5724170bfcf7c233751576615083c73 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Tue, 22 Nov 2016 22:32:29 -0500 Subject: [PATCH] Set up support server with Thankful Chest tracking and Eternal Rank --- .../customerSupport/CustomerSupport.java | 13 ++++++++ .../salespackage/SalesPackageManager.java | 4 +++ .../command/LifetimeEternalCommand.java | 33 +++++++++++++++++++ .../salespackage/command/Sales.java | 1 + .../salespackages/LifetimeEternal.java | 24 ++++++++++++++ .../salespackages/ThankfulChest.java | 19 +++++++++++ 6 files changed, 94 insertions(+) create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeEternalCommand.java create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeEternal.java create mode 100644 Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ThankfulChest.java diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java index 8c5ee0d7c..d5018baf1 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/customerSupport/CustomerSupport.java @@ -159,6 +159,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable int hauntedChestsReceived = 0; int hauntedChestsOpened = 0; int trickOrTreatChestsReceived = 0; + int thankfulChestsReceived = 0; for (CoinTransactionToken transaction : donor.getCoinTransactions()) { @@ -269,6 +270,17 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable trickOrTreatChestsReceived += 1; } + } + if (transaction.SalesPackageName.startsWith("Thankful Chest")) + { + if (transaction.Coins == 0 && transaction.Gems == 0) + { + if (transaction.SalesPackageName.split(" ").length == 3) + thankfulChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]); + else if (transaction.SalesPackageName.split(" ").length == 2) + thankfulChestsReceived += 1; + } + } if (transaction.SalesPackageName.startsWith("Valentines Gift")) { @@ -339,6 +351,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable 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 + "Thankful Chests Received: " + C.cYellow + thankfulChestsReceived); 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 1edf932ea..134a38599 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -24,6 +24,7 @@ import mineplex.staffServer.salespackage.salespackages.DefaultRank; import mineplex.staffServer.salespackage.salespackages.FreedomChest; import mineplex.staffServer.salespackage.salespackages.HauntedChest; import mineplex.staffServer.salespackage.salespackages.IlluminatedChest; +import mineplex.staffServer.salespackage.salespackages.LifetimeEternal; import mineplex.staffServer.salespackage.salespackages.LifetimeHero; import mineplex.staffServer.salespackage.salespackages.LifetimeLegend; import mineplex.staffServer.salespackage.salespackages.LifetimeTitan; @@ -35,6 +36,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.ThankfulChest; import mineplex.staffServer.salespackage.salespackages.TrickOrTreatChest; public class SalesPackageManager extends MiniPlugin @@ -72,6 +74,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new LifetimeHero(this)); AddSalesPackage(new LifetimeLegend(this)); AddSalesPackage(new LifetimeTitan(this)); + AddSalesPackage(new LifetimeEternal(this)); //AddSalesPackage(new GemHunter(this, 4)); //AddSalesPackage(new GemHunter(this, 8)); AddSalesPackage(new ApplyKits(this)); @@ -92,6 +95,7 @@ public class SalesPackageManager extends MiniPlugin AddSalesPackage(new OmegaChest(this)); AddSalesPackage(new HauntedChest(this)); AddSalesPackage(new TrickOrTreatChest(this)); + AddSalesPackage(new ThankfulChest(this)); for (PetType petType : PetType.values()) { diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeEternalCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeEternalCommand.java new file mode 100644 index 000000000..9f2437ddc --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/LifetimeEternalCommand.java @@ -0,0 +1,33 @@ +package mineplex.staffServer.salespackage.command; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; + +import mineplex.core.command.CommandBase; +import mineplex.core.common.Rank; +import mineplex.staffServer.salespackage.SalesPackageManager; + +public class LifetimeEternalCommand extends CommandBase +{ + public LifetimeEternalCommand(SalesPackageManager plugin) + { + super(plugin, Rank.MODERATOR, "lifetimeeternal"); + } + + @Override + public void Execute(Player caller, String[] args) + { + resetCommandCharge(caller); + Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " ETERNAL true")); + + resetCommandCharge(caller); + Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales item " + args[0] + " 2 Item Mythical Chest")); + + resetCommandCharge(caller); + Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales item " + args[0] + " 2 Item Illuminated Chest")); + + resetCommandCharge(caller); + Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales item " + args[0] + " 1 Item Omega Chest")); + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java index 40040e1d0..565f61ced 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/Sales.java @@ -22,6 +22,7 @@ public class Sales extends MultiCommandBase AddCommand(new LifetimeHeroCommand(plugin)); AddCommand(new LifetimeLegendCommand(plugin)); AddCommand(new LifetimeTitanCommand(plugin)); + AddCommand(new LifetimeEternalCommand(plugin)); AddCommand(new KitsCommand(plugin)); AddCommand(new PowerPlayCommand(plugin)); AddCommand(new PetCommand(plugin)); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeEternal.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeEternal.java new file mode 100644 index 000000000..a8148e67b --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/LifetimeEternal.java @@ -0,0 +1,24 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; + +import org.bukkit.entity.Player; + +public class LifetimeEternal extends SalesPackageBase +{ + public LifetimeEternal(SalesPackageManager manager) + { + super(manager, "Lifetime Eternal"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales rank " + playerName + " ETERNAL true", "Lifetime Eternal."); + addButton(agent, "/sales item " + playerName + " 2 Item Mythical Chest", "2 Mythical Chests."); + addButton(agent, "/sales item " + playerName + " 2 Item Illuminated Chest", "2 Illuminated Chests."); + addButton(agent, "/sales item " + playerName + " 1 Item Omega Chest", "1 Omega Chest."); + addButton(agent, "Apply All", "/sales lifetimeeternal " + playerName, "Apply all above."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ThankfulChest.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ThankfulChest.java new file mode 100644 index 000000000..037605455 --- /dev/null +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/salespackages/ThankfulChest.java @@ -0,0 +1,19 @@ +package mineplex.staffServer.salespackage.salespackages; + +import mineplex.staffServer.salespackage.SalesPackageManager; +import org.bukkit.entity.Player; + +public class ThankfulChest extends SalesPackageBase +{ + public ThankfulChest(SalesPackageManager manager) + { + super(manager, "1 Thankful Chest"); + } + + public void displayToAgent(Player agent, String playerName) + { + addButton(agent, "/sales item " + playerName + " 1 Item Thankful Chest", "Give 1 Thankful Chest."); + agent.sendMessage(" "); + addBackButton(agent, playerName); + } +} \ No newline at end of file