Update support packages

This commit is contained in:
AlexTheCoder 2016-09-03 15:16:59 -04:00 committed by cnr
parent 5b80f3b6ac
commit b3478d70e8
15 changed files with 196 additions and 28 deletions

View File

@ -16,6 +16,7 @@ import mineplex.core.monitor.LagMeter;
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.portal.Portal;
import mineplex.core.powerplayclub.PowerPlayClubRepository;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.profileCache.ProfileCacheManager;
import mineplex.core.punish.Punish;
@ -64,14 +65,16 @@ public class StaffServer extends JavaPlugin
Portal portal = new Portal(this, clientManager, serverStatusManager.getCurrentServerName());
EloManager eloManager = new EloManager(this, clientManager);
new Chat(this, null, clientManager, preferenceManager, new AchievementManager(new StatsManager(this, clientManager), clientManager, donationManager, null, eloManager), serverStatusManager.getCurrentServerName());
StatsManager statsManager = new StatsManager(this, clientManager);
new Chat(this, null, clientManager, preferenceManager, new AchievementManager(statsManager, clientManager, donationManager, null, eloManager), serverStatusManager.getCurrentServerName());
new MemoryFix(this);
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
require(PacketHandler.class);
require(DisguiseManager.class);
new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this, clientManager), new StatsManager(this, clientManager)));
PowerPlayClubRepository powerPlayRepo = new PowerPlayClubRepository(this, clientManager);
new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this, clientManager), statsManager, powerPlayRepo), powerPlayRepo);
//new Password(this, serverStatusManager.getCurrentServerName());
//Updates

View File

@ -3,8 +3,10 @@ package mineplex.staffServer.customerSupport;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import mineplex.core.MiniPlugin;
@ -45,7 +47,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
private NautHashMap<Player, HashSet<String>> _agentCacheMap = new NautHashMap<Player, HashSet<String>>();
private NautHashMap<Integer, List<String>> _accountBonusLog = new NautHashMap<>();
public CustomerSupport(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, SalesPackageManager salesPackageManager)
public CustomerSupport(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, SalesPackageManager salesPackageManager, PowerPlayClubRepository powerPlayRepo)
{
super("Customer Support", plugin);
@ -53,7 +55,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
_donationManager = donationManager;
_salesPackageManager = salesPackageManager;
_repository = new CustomerSupportRepository(getPlugin());
_powerPlayRepo = new PowerPlayClubRepository(plugin, clientManager);
_powerPlayRepo = powerPlayRepo;
}
@EventHandler
@ -138,6 +140,7 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
int freedomChestsReceived = 0;
int runeAmplifier20 = 0;
int runeAmplifier60 = 0;
int omegaChestsReceived = 0;
for (CoinTransactionToken transaction : donor.getCoinTransactions())
{
@ -215,6 +218,17 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
freedomChestsReceived += 1;
}
}
if (transaction.SalesPackageName.startsWith("Omega Chest"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
omegaChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
omegaChestsReceived += 1;
}
}
if (transaction.SalesPackageName.startsWith("Valentines Gift"))
{
@ -265,10 +279,10 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
caller.sendMessage(C.cBlue + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived);
caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived);
caller.sendMessage(C.cBlue + "Illuminated Chests Received: " + C.cYellow + illuminatedChestsReceived);
caller.sendMessage(C.cBlue + "Omega Chests Received: " + C.cYellow + omegaChestsReceived);
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);
caller.sendMessage(C.cBlue + "Freedom Chests Received: " + C.cYellow + freedomChestsReceived);
caller.sendMessage(C.cBlue + "Monthly Bonus Log (Last 6 entries):");
if (_accountBonusLog.containsKey(client.getAccountId()))
@ -285,8 +299,8 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Usage"));
caller.sendMessage(C.cBlue + "Clan Banner Editor: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Editor"));
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
caller.sendMessage(C.cBlue + "Power play subscription (September): " + powerPlaySub);
caller.sendMessage(C.cBlue + "Power play claim (September): " + powerPlayClaim);
caller.sendMessage(C.cBlue + "Power Play Subscription (" + Calendar.getInstance().getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "): " + (powerPlaySub ? C.cGreen + "Active" : C.cRed + "Inactive"));
caller.sendMessage(C.cBlue + "Power Play Monthly Reward (" + Calendar.getInstance().getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "): " + (powerPlayClaim ? C.cGreen + "Claimed" : C.cRed + "Unclaimed"));
_accountBonusLog.remove(client.getAccountId());
}

View File

@ -1,6 +1,5 @@
package mineplex.staffServer.salespackage;
import mineplex.staffServer.salespackage.salespackages.*;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
@ -10,9 +9,28 @@ import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.powerplayclub.PowerPlayClubRepository;
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.ClanBannerEditor;
import mineplex.staffServer.salespackage.salespackages.ClanBannerUsage;
import mineplex.staffServer.salespackage.salespackages.Coins;
import mineplex.staffServer.salespackage.salespackages.DefaultRank;
import mineplex.staffServer.salespackage.salespackages.FreedomChest;
import mineplex.staffServer.salespackage.salespackages.IlluminatedChest;
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.MythicalChest;
import mineplex.staffServer.salespackage.salespackages.OldChest;
import mineplex.staffServer.salespackage.salespackages.OmegaChest;
import mineplex.staffServer.salespackage.salespackages.PowerPlayClub;
import mineplex.staffServer.salespackage.salespackages.RuneAmplifier;
import mineplex.staffServer.salespackage.salespackages.SalesPackageBase;
public class SalesPackageManager extends MiniPlugin
{
@ -20,10 +38,11 @@ public class SalesPackageManager extends MiniPlugin
private DonationManager _donationManager;
private InventoryManager _inventoryManager;
private StatsManager _statsManager;
private PowerPlayClubRepository _powerPlayRepo;
private NautHashMap<String, SalesPackageBase> _salesPackages = new NautHashMap<String, SalesPackageBase>();
public SalesPackageManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, StatsManager statsManager)
public SalesPackageManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, StatsManager statsManager, PowerPlayClubRepository powerPlayRepo)
{
super("SalesPackageManager", plugin);
@ -31,6 +50,7 @@ public class SalesPackageManager extends MiniPlugin
_donationManager = donationManager;
_inventoryManager = inventoryManager;
_statsManager = statsManager;
_powerPlayRepo = powerPlayRepo;
//Strutt20 asked me to remove some of the stuff from the menu
AddSalesPackage(new Coins(this, 5000));
@ -52,12 +72,15 @@ public class SalesPackageManager extends MiniPlugin
AddSalesPackage(new IlluminatedChest(this));
AddSalesPackage(new FreedomChest(this));
//AddSalesPackage(new ValentinesGift(this));
AddSalesPackage(new FrostLord(this));
AddSalesPackage(new EasterBunny(this));
//AddSalesPackage(new FrostLord(this));
//AddSalesPackage(new EasterBunny(this));
AddSalesPackage(new ClanBannerUsage(this));
AddSalesPackage(new ClanBannerEditor(this));
AddSalesPackage(new RuneAmplifier(this, 20));
AddSalesPackage(new RuneAmplifier(this, 60));
AddSalesPackage(new PowerPlayClub(this, false));
AddSalesPackage(new PowerPlayClub(this, true));
AddSalesPackage(new OmegaChest(this));
}
private void AddSalesPackage(SalesPackageBase salesPackage)
@ -86,6 +109,11 @@ public class SalesPackageManager extends MiniPlugin
{
return _inventoryManager;
}
public PowerPlayClubRepository getPowerPlay()
{
return _powerPlayRepo;
}
public void help(Player player)
{
@ -102,6 +130,7 @@ public class SalesPackageManager extends MiniPlugin
JsonMessage packageBuilder = new JsonMessage("Rank Packages : ").color("blue");
JsonMessage chestBuilder = new JsonMessage("Chest Packages : ").color("blue");
JsonMessage clanBuilder = new JsonMessage("Clan Packages : ").color("blue");
JsonMessage powerPlayBuilder = new JsonMessage("Power Play Club Packages : ").color("blue");
for (SalesPackageBase salesPackage : _salesPackages.values())
{
@ -117,6 +146,10 @@ public class SalesPackageManager extends MiniPlugin
{
clanBuilder = clanBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
}
else if (salesPackage instanceof PowerPlayClub || salesPackage instanceof OmegaChest)
{
powerPlayBuilder = powerPlayBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
}
else
{
packageBuilder = packageBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
@ -127,6 +160,7 @@ public class SalesPackageManager extends MiniPlugin
chestBuilder.sendToPlayer(caller);
packageBuilder.sendToPlayer(caller);
clanBuilder.sendToPlayer(caller);
powerPlayBuilder.sendToPlayer(caller);
}
public StatsManager getStatsManager()

View File

@ -22,6 +22,6 @@ public class LifetimeHeroCommand extends CommandBase<SalesPackageManager>
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " HERO true"));
resetCommandCharge(caller);
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales coin " + args[0] + " 30000"));
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales item " + args[0] + " 2 Item Mythical Chest"));
}
}

View File

@ -22,6 +22,6 @@ public class LifetimeLegendCommand extends CommandBase<SalesPackageManager>
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " LEGEND true"));
resetCommandCharge(caller);
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales coin " + args[0] + " 60000"));
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales item " + args[0] + " 3 Item Mythical Chest"));
}
}

View File

@ -0,0 +1,27 @@
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 LifetimeTitanCommand extends CommandBase<SalesPackageManager>
{
public LifetimeTitanCommand(SalesPackageManager plugin)
{
super(plugin, Rank.MODERATOR, "lifetimetitan");
}
@Override
public void Execute(Player caller, String[] args)
{
resetCommandCharge(caller);
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " TITAN true"));
resetCommandCharge(caller);
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales item " + args[0] + " 5 Item Mythical Chest"));
}
}

View File

@ -22,6 +22,6 @@ public class LifetimeUltraCommand extends CommandBase<SalesPackageManager>
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " ULTRA true"));
resetCommandCharge(caller);
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales coin " + args[0] + " 15000"));
Bukkit.getServer().getPluginManager().callEvent(new PlayerCommandPreprocessEvent(caller, "/sales item " + args[0] + " 1 Item Mythical Chest"));
}
}

View File

@ -0,0 +1,45 @@
package mineplex.staffServer.salespackage.command;
import java.time.LocalDate;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.staffServer.salespackage.SalesPackageManager;
public class PowerPlayCommand extends CommandBase<SalesPackageManager>
{
public PowerPlayCommand(SalesPackageManager plugin)
{
super(plugin, Rank.MODERATOR, "powerplay");
}
@Override
public void Execute(final Player caller, String[] args)
{
if (args == null || args.length < 2)
return;
final String playerName = args[0];
final String duration = args[1];
if (!duration.equalsIgnoreCase("month") && !duration.equalsIgnoreCase("year"))
{
return;
}
Plugin.getClientManager().loadClientByName(playerName, client ->
{
if (client != null)
{
Plugin.getPowerPlay().addSubscription(client.getAccountId(), LocalDate.now(), duration.toLowerCase());
}
else
{
caller.sendMessage(F.main(Plugin.getName(), "Couldn't find " + playerName + "'s account!"));
}
});
}
}

View File

@ -22,6 +22,7 @@ public class Sales extends MultiCommandBase<SalesPackageManager>
AddCommand(new LifetimeHeroCommand(plugin));
AddCommand(new LifetimeLegendCommand(plugin));
AddCommand(new KitsCommand(plugin));
AddCommand(new PowerPlayCommand(plugin));
}
@Override

View File

@ -13,9 +13,9 @@ public class LifetimeHero extends SalesPackageBase
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales coin " + playerName + " 30000", " 30,000 Coins");
addButton(agent, "/sales rank " + playerName + " HERO true", " Lifetime Hero.");
addButton(agent, "Apply All", "/sales lifetimehero " + playerName, " Apply all above.");
addButton(agent, "/sales rank " + playerName + " HERO true", "Lifetime Hero.");
addButton(agent, "/sales item " + playerName + " 2 Item Mythical Chest", "2 Mythical Chests.");
addButton(agent, "Apply All", "/sales lifetimehero " + playerName, "Apply all above.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}

View File

@ -13,12 +13,12 @@ public class LifetimeLegend extends SalesPackageBase
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales coin " + playerName + " 60000", " 60,000 Coins");
addButton(agent, "/sales rank " + playerName + " LEGEND true", " Lifetime Legend.");
addButton(agent, "/sales item " + playerName + " 1 Morph Wither Morph", "Gives Wither Morph.");
addButton(agent, "/sales item " + playerName + " 1 Pet Widder", "Gives Wither Pet.");
addButton(agent, "/sales item " + playerName + " 1 Particle Legendary Aura", "Gives Legendary Aura Particle.");
addButton(agent, "Apply All", "/sales lifetimelegend " + playerName, " Apply all above.");
addButton(agent, "/sales rank " + playerName + " LEGEND true", "Lifetime Legend.");
addButton(agent, "/sales item " + playerName + " 3 Item Mythical Chest", "3 Mythical Chests.");
//addButton(agent, "/sales item " + playerName + " 1 Morph Wither Morph", "Gives Wither Morph.");
//addButton(agent, "/sales item " + playerName + " 1 Pet Widder", "Gives Wither Pet.");
//addButton(agent, "/sales item " + playerName + " 1 Particle Legendary Aura", "Gives Legendary Aura Particle.");
addButton(agent, "Apply All", "/sales lifetimelegend " + playerName, "Apply all above.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}

View File

@ -13,10 +13,12 @@ public class LifetimeTitan extends SalesPackageBase
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales rank " + playerName + " TITAN true", " Lifetime Titan.");
addButton(agent, "/sales rank " + playerName + " TITAN true", "Lifetime Titan.");
addButton(agent, "/sales item " + playerName + " 5 Item Mythical Chest", "5 Mythical Chests.");
// addButton(agent, "/sales item " + playerName + " 1 Molten Snake", "Gives Molten Snake Mount.");
// addButton(agent, "/sales item " + playerName + " 1 Elder Guardian Morph", "Gives Elder Guardian Morph.");
// addButton(agent, "/sales item " + playerName + " 1 Flame of the Titans", "Gives Titan Particle.");
addButton(agent, "Apply All", "/sales lifetimetitan " + playerName, "Apply all above.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}

View File

@ -13,9 +13,9 @@ public class LifetimeUltra extends SalesPackageBase
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales coin " + playerName + " 15000", " 15,000 Coins");
addButton(agent, "/sales rank " + playerName + " ULTRA true", " Lifetime Ultra.");
addButton(agent, "Apply All", "/sales lifetimeultra " + playerName, " Apply all above.");
addButton(agent, "/sales rank " + playerName + " ULTRA true", "Lifetime Ultra.");
addButton(agent, "/sales item " + playerName + " 1 Item Mythical Chest", "1 Mythical Chest.");
addButton(agent, "Apply All", "/sales lifetimeultra " + playerName, "Apply all above.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}

View File

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

View File

@ -0,0 +1,22 @@
package mineplex.staffServer.salespackage.salespackages;
import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.entity.Player;
public class PowerPlayClub extends SalesPackageBase
{
private boolean _year;
public PowerPlayClub(SalesPackageManager manager, boolean year)
{
super(manager, "1 " + (year ? "Year" : "Month") + " Power Play Club Membership");
_year = year;
}
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales powerplay " + playerName + " " + (_year ? "year" : "month"), "Give 1 " + (_year ? "Year" : "Month") + " Power Play Club Membership.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}
}