Finished first release of Customer Support plugin.
This commit is contained in:
parent
5e47a12531
commit
70217fe957
@ -0,0 +1,67 @@
|
||||
package mineplex.core.common.jsonchat;
|
||||
|
||||
public class ChildJsonMessage extends JsonMessage
|
||||
{
|
||||
private JsonMessage _parent;
|
||||
|
||||
public ChildJsonMessage(String text)
|
||||
{
|
||||
this(new StringBuilder(), text);
|
||||
}
|
||||
|
||||
public ChildJsonMessage(StringBuilder builder, String text)
|
||||
{
|
||||
this(null, builder, text);
|
||||
}
|
||||
|
||||
public ChildJsonMessage(JsonMessage parent, StringBuilder builder, String text)
|
||||
{
|
||||
super(builder, text);
|
||||
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public ChildJsonMessage add(String text)
|
||||
{
|
||||
Builder.append("}, ");
|
||||
return new ChildJsonMessage(_parent, Builder, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChildJsonMessage color(String color)
|
||||
{
|
||||
super.color(color);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChildJsonMessage click(String action, String value)
|
||||
{
|
||||
super.click(action, value);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChildJsonMessage hover(String action, String value)
|
||||
{
|
||||
super.hover(action, value);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
Builder.append("}");
|
||||
|
||||
if (_parent != null)
|
||||
{
|
||||
Builder.append("]");
|
||||
return _parent instanceof ChildJsonMessage ? ((ChildJsonMessage)_parent).toString() : _parent.toString();
|
||||
}
|
||||
else
|
||||
return Builder.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package mineplex.core.common.jsonchat;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
|
||||
public class JsonMessage
|
||||
{
|
||||
protected StringBuilder Builder;
|
||||
|
||||
public JsonMessage(String text)
|
||||
{
|
||||
this(new StringBuilder(), text);
|
||||
}
|
||||
|
||||
public JsonMessage(StringBuilder builder, String text)
|
||||
{
|
||||
Builder = builder;
|
||||
Builder.append("{\"text\":\"" + text + "\"");
|
||||
}
|
||||
|
||||
public JsonMessage color(String color)
|
||||
{
|
||||
Builder.append(", color:" + color);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChildJsonMessage extra(String text)
|
||||
{
|
||||
Builder.append(", \"extra\":[");
|
||||
return new ChildJsonMessage(this, Builder, text);
|
||||
}
|
||||
|
||||
public JsonMessage click(String action, String value)
|
||||
{
|
||||
Builder.append(", \"clickEvent\":{\"action\":\"" + action + "\",\"value\":\"" + value + "\"}");
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public JsonMessage hover(String action, String value)
|
||||
{
|
||||
Builder.append(", \"hoverEvent\":{\"action\":\"" + action + "\",\"value\":\"" + value + "\"}");
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
Builder.append("}");
|
||||
|
||||
return Builder.toString();
|
||||
}
|
||||
|
||||
public void sendToPlayer(Player player)
|
||||
{
|
||||
UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + player.getName() + " " + toString());
|
||||
}
|
||||
}
|
@ -4,8 +4,11 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
|
||||
public abstract class CommandBase<PluginType extends MiniPlugin> implements ICommand
|
||||
{
|
||||
@ -42,4 +45,9 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
|
||||
{
|
||||
CommandCenter = commandCenter;
|
||||
}
|
||||
|
||||
protected void resetCommandCharge(Player caller)
|
||||
{
|
||||
Recharge.Instance.recharge(caller, "Command");
|
||||
}
|
||||
}
|
||||
|
@ -63,16 +63,19 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addItemToInventory(final Player player, final String category, final String item, final int count)
|
||||
|
||||
public void addItemToInventory(Player player, String category, String item, int count)
|
||||
{
|
||||
final String uuidString = player.getUniqueId().toString();
|
||||
|
||||
if (_items.containsKey(item))
|
||||
{
|
||||
Get(player).addItem(new ClientItem(_items.get(item), count));
|
||||
}
|
||||
|
||||
addItemToInventoryForOffline(player.getUniqueId().toString(), category, item, count);
|
||||
}
|
||||
|
||||
public void addItemToInventoryForOffline(final String uuidString, final String category, final String item, final int count)
|
||||
{
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
|
@ -62,7 +62,7 @@ import mineplex.serverdata.MinecraftServer;
|
||||
|
||||
public class ServerManager extends MiniPlugin
|
||||
{
|
||||
private static final Long FREE_PORTAL_TIMER = 1000L;
|
||||
private static final Long FREE_PORTAL_TIMER = 30000L;
|
||||
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
|
@ -5,6 +5,7 @@ import mineplex.core.chat.Chat;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.memory.MemoryFix;
|
||||
import mineplex.core.monitor.LagMeter;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
@ -16,6 +17,7 @@ import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.updater.FileUpdater;
|
||||
import mineplex.staffServer.customerSupport.CustomerSupport;
|
||||
import mineplex.staffServer.password.Password;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -51,7 +53,7 @@ public class StaffServer extends JavaPlugin
|
||||
new MemoryFix(this);
|
||||
new FileUpdater(this, portal);
|
||||
|
||||
new CustomerSupport(this, clientManager, donationManager);
|
||||
new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this)));
|
||||
new Password(this);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,10 @@ import java.util.HashSet;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -18,21 +22,24 @@ import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.donation.Donor;
|
||||
import mineplex.core.donation.repository.token.CoinTransactionToken;
|
||||
import mineplex.core.donation.repository.token.TransactionToken;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
public class CustomerSupport extends MiniPlugin
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
|
||||
private SalesPackageManager _salesPackageManager;
|
||||
|
||||
private NautHashMap<Player, HashSet<String>> _agentCacheMap = new NautHashMap<Player, HashSet<String>>();
|
||||
private SimpleDateFormat _date = new SimpleDateFormat("MM/dd/yy HH:mm");
|
||||
|
||||
public CustomerSupport(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
public CustomerSupport(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, SalesPackageManager salesPackageManager)
|
||||
{
|
||||
super("Customer Support", plugin);
|
||||
|
||||
_clientManager = clientManager;
|
||||
_donationManager = donationManager;
|
||||
_salesPackageManager = salesPackageManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,7 +50,7 @@ public class CustomerSupport extends MiniPlugin
|
||||
|
||||
public void Help(Player caller)
|
||||
{
|
||||
caller.sendMessage(F.main(GetName(), "Usage : /check jRayx"));
|
||||
caller.sendMessage(F.main(GetName(), "Usage : /check defek7"));
|
||||
}
|
||||
|
||||
public void addAgentMapping(Player caller, String playerName)
|
||||
@ -59,23 +66,24 @@ public class CustomerSupport extends MiniPlugin
|
||||
CoreClient client = _clientManager.Get(playerName);
|
||||
Donor donor = _donationManager.Get(playerName);
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
caller.sendMessage(F.main(GetName(), "Name : " + F.elem(playerName)));
|
||||
caller.sendMessage(F.main(GetName(),
|
||||
"Rank : " + F.elem(client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name)));
|
||||
caller.sendMessage(C.cBlue + "Name : " + C.cYellow + playerName);
|
||||
caller.sendMessage(C.cBlue + "Rank : " + C.cYellow + (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name));
|
||||
caller.sendMessage(C.cBlue + "Transactions : ");
|
||||
|
||||
for (CoinTransactionToken transaction : donor.getCoinTransactions())
|
||||
{
|
||||
if (transaction.Source.equalsIgnoreCase("purchase"))
|
||||
caller.sendMessage("[" + _date.format(transaction.Date) + "] " + C.cYellow + transaction.Amount + " Coins");
|
||||
caller.sendMessage(C.cYellow + _date.format(transaction.Date) + C.cGray + " - " + C.cYellow + transaction.Amount + " Coins");
|
||||
}
|
||||
|
||||
for (TransactionToken transaction : donor.getTransactions())
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0 && transaction.SalesPackageName.contains("Gem Booster"))
|
||||
caller.sendMessage("[" + _date.format(transaction.Date) + "] " + C.cGreen
|
||||
+ transaction.SalesPackageName);
|
||||
caller.sendMessage(C.cYellow + _date.format(transaction.Date) + C.cGray + " - " + C.cYellow + transaction.SalesPackageName);
|
||||
}
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
_salesPackageManager.displaySalesPackages(caller, playerName);
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -83,4 +91,19 @@ public class CustomerSupport extends MiniPlugin
|
||||
{
|
||||
_agentCacheMap.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void foodLevelChange(FoodLevelChangeEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void entityDeath(EntityDamageEvent event)
|
||||
{
|
||||
if (event.getCause() == DamageCause.VOID)
|
||||
event.getEntity().teleport(event.getEntity().getWorld().getSpawnLocation());
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,104 @@
|
||||
package mineplex.staffServer.salespackage;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.staffServer.salespackage.command.DisplayPackageCommand;
|
||||
import mineplex.staffServer.salespackage.command.Sales;
|
||||
import mineplex.staffServer.salespackage.salespackages.Coins;
|
||||
import mineplex.staffServer.salespackage.salespackages.LifetimeHero;
|
||||
import mineplex.staffServer.salespackage.salespackages.LifetimeUltra;
|
||||
import mineplex.staffServer.salespackage.salespackages.MonthlyHero;
|
||||
import mineplex.staffServer.salespackage.salespackages.MonthlyUltra;
|
||||
import mineplex.staffServer.salespackage.salespackages.SalesPackageBase;
|
||||
|
||||
public class SalesPackageManager extends MiniPlugin
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
|
||||
private NautHashMap<String, SalesPackageBase> _salesPackages = new NautHashMap<String, SalesPackageBase>();
|
||||
|
||||
public SalesPackageManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager)
|
||||
{
|
||||
super("SalesPackageManager", plugin);
|
||||
|
||||
_clientManager = clientManager;
|
||||
_donationManager = donationManager;
|
||||
_inventoryManager = inventoryManager;
|
||||
|
||||
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 LifetimeUltra(this));
|
||||
AddSalesPackage(new LifetimeHero(this));
|
||||
}
|
||||
|
||||
private void AddSalesPackage(SalesPackageBase salesPackage)
|
||||
{
|
||||
_salesPackages.put(salesPackage.getName(), salesPackage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
AddCommand(new DisplayPackageCommand(this));
|
||||
AddCommand(new Sales(this));
|
||||
}
|
||||
|
||||
public DonationManager getDonationManager()
|
||||
{
|
||||
return _donationManager;
|
||||
}
|
||||
|
||||
public CoreClientManager getClientManager()
|
||||
{
|
||||
return _clientManager;
|
||||
}
|
||||
|
||||
public InventoryManager getInventoryManager()
|
||||
{
|
||||
return _inventoryManager;
|
||||
}
|
||||
|
||||
public void help(Player player)
|
||||
{
|
||||
}
|
||||
|
||||
public void displayPackage(Player caller, String playerName, String packageName)
|
||||
{
|
||||
_salesPackages.get(packageName).displayToAgent(caller, playerName);
|
||||
}
|
||||
|
||||
public void displaySalesPackages(Player caller, String playerName)
|
||||
{
|
||||
JsonMessage coinBuilder = new JsonMessage("Coins : ").color("blue");
|
||||
JsonMessage packageBuilder = new JsonMessage("Rank Packages : ").color("blue");
|
||||
|
||||
for (SalesPackageBase salesPackage : _salesPackages.values())
|
||||
{
|
||||
if (salesPackage instanceof Coins)
|
||||
{
|
||||
coinBuilder = coinBuilder.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");
|
||||
}
|
||||
}
|
||||
|
||||
coinBuilder.sendToPlayer(caller);
|
||||
packageBuilder.sendToPlayer(caller);
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package mineplex.staffServer.salespackage.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
public class BoosterCommand extends CommandBase<SalesPackageManager>
|
||||
{
|
||||
public BoosterCommand(SalesPackageManager plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "booster");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length != 2)
|
||||
return;
|
||||
|
||||
String playerName = args[0];
|
||||
int amount = Integer.parseInt(args[1]);
|
||||
|
||||
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, "Gem Booster " + amount, false, 0, false);
|
||||
Plugin.getInventoryManager().addItemToInventoryForOffline(UUIDFetcher.getUUIDOf(playerName).toString(), "Utility", "Gem Booster", amount);
|
||||
caller.sendMessage(F.main(Plugin.GetName(), "Added " + amount + " boosters to " + playerName + "'s account!"));
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package mineplex.staffServer.salespackage.command;
|
||||
|
||||
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 CoinCommand extends CommandBase<SalesPackageManager>
|
||||
{
|
||||
public CoinCommand(SalesPackageManager plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "coin");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length != 2)
|
||||
return;
|
||||
|
||||
String playerName = args[0];
|
||||
int amount = Integer.parseInt(args[1]);
|
||||
|
||||
Plugin.getDonationManager().RewardCoins(null, "purchase", playerName, amount);
|
||||
caller.sendMessage(F.main(Plugin.GetName(), "Added " + amount + " coins to " + playerName + "'s account!"));
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package mineplex.staffServer.salespackage.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
public class DisplayPackageCommand extends CommandBase<SalesPackageManager>
|
||||
{
|
||||
public DisplayPackageCommand(SalesPackageManager plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "display");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length < 2)
|
||||
return;
|
||||
|
||||
String playerName = args[0];
|
||||
String packageName = args[1];
|
||||
|
||||
if (args.length > 2)
|
||||
{
|
||||
for (int i = 2; i < args.length; i++)
|
||||
{
|
||||
packageName += " " + args[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (packageName.equalsIgnoreCase("ALL"))
|
||||
Plugin.displaySalesPackages(caller, playerName);
|
||||
else
|
||||
Plugin.displayPackage(caller, playerName, packageName);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
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.core.recharge.Recharge;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
public class HeroCommand extends CommandBase<SalesPackageManager>
|
||||
{
|
||||
public HeroCommand(SalesPackageManager plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "hero");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
resetCommandCharge(caller);
|
||||
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " HERO false");
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
resetCommandCharge(caller);
|
||||
event = new PlayerCommandPreprocessEvent(caller, "/sales coin " + args[0] + " 15000");
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
resetCommandCharge(caller);
|
||||
event = new PlayerCommandPreprocessEvent(caller, "/sales booster " + args[0] + " 60");
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package mineplex.staffServer.salespackage.command;
|
||||
|
||||
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 RankCommand extends CommandBase<SalesPackageManager>
|
||||
{
|
||||
public RankCommand(SalesPackageManager plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "rank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length != 3)
|
||||
return;
|
||||
|
||||
String playerName = args[0];
|
||||
String rank = args[1];
|
||||
boolean perm = Boolean.parseBoolean(args[2]);
|
||||
|
||||
Plugin.getClientManager().SaveRank(playerName, mineplex.core.common.Rank.valueOf(rank), perm);
|
||||
caller.sendMessage(F.main(Plugin.GetName(), playerName + "'s rank has been updated to " + rank + "!"));
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package mineplex.staffServer.salespackage.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.MultiCommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
public class Sales extends MultiCommandBase<SalesPackageManager>
|
||||
{
|
||||
public Sales(SalesPackageManager plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "sales");
|
||||
|
||||
AddCommand(new RankCommand(plugin));
|
||||
AddCommand(new CoinCommand(plugin));
|
||||
AddCommand(new BoosterCommand(plugin));
|
||||
AddCommand(new UltraCommand(plugin));
|
||||
AddCommand(new HeroCommand(plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void Help(Player caller, String[] args)
|
||||
{
|
||||
Plugin.help(caller);
|
||||
}
|
||||
}
|
@ -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 UltraCommand extends CommandBase<SalesPackageManager>
|
||||
{
|
||||
public UltraCommand(SalesPackageManager plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "ultra");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
resetCommandCharge(caller);
|
||||
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " ULTRA false");
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
resetCommandCharge(caller);
|
||||
event = new PlayerCommandPreprocessEvent(caller, "/sales coin " + args[0] + " 7500");
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
resetCommandCharge(caller);
|
||||
event = new PlayerCommandPreprocessEvent(caller, "/sales booster " + args[0] + " 30");
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package mineplex.staffServer.salespackage.salespackages;
|
||||
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Coins extends SalesPackageBase
|
||||
{
|
||||
private int _amount;
|
||||
|
||||
public Coins(SalesPackageManager manager, int amount)
|
||||
{
|
||||
super(manager, amount + " Coins");
|
||||
|
||||
_amount = amount;
|
||||
}
|
||||
public void displayToAgent(Player agent, String playerName)
|
||||
{
|
||||
addButton(agent, "/sales coin " + playerName + " " + _amount, _amount + " Coins.");
|
||||
agent.sendMessage(" ");
|
||||
addBackButton(agent, playerName);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package mineplex.staffServer.salespackage.salespackages;
|
||||
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class LifetimeHero extends SalesPackageBase
|
||||
{
|
||||
public LifetimeHero(SalesPackageManager manager)
|
||||
{
|
||||
super(manager, "Lifetime Hero");
|
||||
}
|
||||
|
||||
public void displayToAgent(Player agent, String playerName)
|
||||
{
|
||||
addButton(agent, "/sales rank " + playerName + " HERO true", " Lifetime Hero Rank.");
|
||||
agent.sendMessage(" ");
|
||||
addBackButton(agent, playerName);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package mineplex.staffServer.salespackage.salespackages;
|
||||
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class LifetimeUltra extends SalesPackageBase
|
||||
{
|
||||
public LifetimeUltra(SalesPackageManager manager)
|
||||
{
|
||||
super(manager, "Lifetime Ultra");
|
||||
}
|
||||
|
||||
public void displayToAgent(Player agent, String playerName)
|
||||
{
|
||||
addButton(agent, "/sales rank " + playerName + " ULTRA true", " Lifetime Ultra Rank.");
|
||||
agent.sendMessage(" ");
|
||||
addBackButton(agent, playerName);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package mineplex.staffServer.salespackage.salespackages;
|
||||
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MonthlyHero extends SalesPackageBase
|
||||
{
|
||||
public MonthlyHero(SalesPackageManager manager)
|
||||
{
|
||||
super(manager, "Monthly Hero");
|
||||
}
|
||||
|
||||
public void displayToAgent(Player agent, String playerName)
|
||||
{
|
||||
addButton(agent, "/sales coin " + playerName + " 15000", " 15,000 Coins");
|
||||
addButton(agent, "/sales booster " + playerName + " 60", " 60 Gem Boosters");
|
||||
addButton(agent, "/sales rank " + playerName + " HERO false", " Monthly Hero.");
|
||||
addButton(agent, "Apply All", "/sales hero " + playerName, " Apply all above.");
|
||||
agent.sendMessage(" ");
|
||||
addBackButton(agent, playerName);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package mineplex.staffServer.salespackage.salespackages;
|
||||
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MonthlyUltra extends SalesPackageBase
|
||||
{
|
||||
public MonthlyUltra(SalesPackageManager manager)
|
||||
{
|
||||
super(manager, "Monthly Ultra");
|
||||
}
|
||||
|
||||
public void displayToAgent(Player agent, String playerName)
|
||||
{
|
||||
addButton(agent, "/sales coin " + playerName + " 7500", " 7,500 Coins");
|
||||
addButton(agent, "/sales booster " + playerName + " 30", " 30 Gem Boosters");
|
||||
addButton(agent, "/sales rank " + playerName + " ULTRA false", " Monthly Ultra.");
|
||||
addButton(agent, "Apply All", "/sales ultra " + playerName, " Apply all above.");
|
||||
agent.sendMessage(" ");
|
||||
addBackButton(agent, playerName);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package mineplex.staffServer.salespackage.salespackages;
|
||||
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class SalesPackageBase
|
||||
{
|
||||
private String _name;
|
||||
|
||||
protected SalesPackageManager Manager;
|
||||
|
||||
protected SalesPackageBase(SalesPackageManager manager, String name)
|
||||
{
|
||||
Manager = manager;
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public abstract void displayToAgent(Player agent, String playerName);
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
protected void addButton(Player agent, String command, String itemText)
|
||||
{
|
||||
addButton(agent, "Apply", command, itemText);
|
||||
}
|
||||
|
||||
protected void addButton(Player agent, String buttonText, String command, String itemText)
|
||||
{
|
||||
new JsonMessage("[").color("blue").extra(buttonText).color("green").click("run_command", command)
|
||||
.add("] ").color("blue").add(itemText).color("yellow").sendToPlayer(agent);
|
||||
}
|
||||
|
||||
protected void addBackButton(Player agent, String playerName)
|
||||
{
|
||||
new JsonMessage("[").color("blue").extra("Back").color("green").click("run_command", "/display " + playerName + " ALL")
|
||||
.add("] ").color("blue").sendToPlayer(agent);
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package mineplex.staffServer.salespackages;
|
||||
|
||||
public class MonthlyUltra
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user