Added Chest packages to support server.

Fixed Punish not loading.
This commit is contained in:
Jonathan Williams 2015-02-14 15:09:42 -08:00
parent c50e79355f
commit 17543910b5
9 changed files with 81 additions and 31 deletions

View File

@ -2,11 +2,19 @@ package mineplex.core.common.util;
public class UtilSystem
{
public static void PrintStackTrace()
public static void printStackTrace()
{
for (StackTraceElement trace : Thread.currentThread().getStackTrace())
{
System.out.println(trace.toString());
}
}
public static void printStackTrace(StackTraceElement[] stackTrace)
{
for (StackTraceElement trace : stackTrace)
{
System.out.println(trace.toString());
}
}
}

View File

@ -7,6 +7,7 @@ import java.io.InputStreamReader;
import java.lang.reflect.Type;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilSystem;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
@ -312,6 +313,7 @@ public class JsonWebCall
catch (Exception ex)
{
System.out.println("Error executing JsonWebCall: \n" + ex.getMessage());
UtilSystem.printStackTrace(ex.getStackTrace());
System.out.println("Result: \n" + result);
}
finally

View File

@ -1,6 +1,7 @@
package mineplex.staffServer;
import mineplex.core.account.CoreClientManager;
import mineplex.core.antihack.AntiHack;
import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.util.ProfileLoader;
@ -50,7 +51,7 @@ public class StaffServer extends JavaPlugin
DonationManager donationManager = new DonationManager(this, clientManager, webServerAddress);
new Punish(this, webServerAddress, clientManager);
Punish punish = new Punish(this, webServerAddress, clientManager);
new NpcManager(this, new Creature(this));
ServerStatusManager serverStatusManager = new ServerStatusManager(this, clientManager, new LagMeter(this, clientManager));
PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager);
@ -60,6 +61,7 @@ public class StaffServer extends JavaPlugin
new Chat(this, clientManager, preferenceManager, serverStatusManager.getCurrentServerName());
new MemoryFix(this);
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager);
new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this, clientManager), new StatsManager(this, clientManager)));
//new Password(this, serverStatusManager.getCurrentServerName());

View File

@ -106,8 +106,9 @@ public class CustomerSupport extends MiniPlugin
int coinTransactionTotal = 0;
int enjinCoinsReceived = 0;
int coinSpentTotal = 0;
int chestsReceived = 0;
int keysReceived = 0;
int oldChestsReceived = 0;
int ancientChestsReceived = 0;
int mythicalChestsReceived = 0;
for (CoinTransactionToken transaction : donor.getCoinTransactions())
{
@ -124,35 +125,45 @@ public class CustomerSupport extends MiniPlugin
{
coinSpentTotal += transaction.Coins;
if (transaction.SalesPackageName.startsWith("Treasure Chest"))
if (transaction.SalesPackageName.startsWith("Old Chest"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
chestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
oldChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
chestsReceived += Integer.parseInt(transaction.SalesPackageName.replace("Treasure Chest", ""));
oldChestsReceived += 1;
}
}
else if (transaction.SalesPackageName.startsWith("Treasure Key"))
if (transaction.SalesPackageName.startsWith("Ancient Chest"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
keysReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
ancientChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
{
String modifiedString = transaction.SalesPackageName.replace("Treasure Key", "");
ancientChestsReceived += 1;
}
if (modifiedString.length() > 0)
keysReceived += Integer.parseInt(modifiedString);
}
if (transaction.SalesPackageName.startsWith("Mythical Chest"))
{
if (transaction.Coins == 0 && transaction.Gems == 0)
{
if (transaction.SalesPackageName.split(" ").length == 3)
mythicalChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
else if (transaction.SalesPackageName.split(" ").length == 2)
mythicalChestsReceived += 1;
}
}
}
caller.sendMessage(C.cBlue + "Enjin Coin Total Received : " + C.cYellow + enjinCoinsReceived);
caller.sendMessage(C.cBlue + "Treasure Chests Received : " + C.cYellow + chestsReceived);
caller.sendMessage(C.cBlue + "Treasure Keys Received : " + C.cYellow + keysReceived);
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);
int coinsMissing = coinTransactionTotal - (donor.getCoins() + coinSpentTotal);

View File

@ -12,6 +12,7 @@ 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.FrostLord;
@ -21,9 +22,9 @@ import mineplex.staffServer.salespackage.salespackages.LifetimeLegend;
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.TreasureChests;
import mineplex.staffServer.salespackage.salespackages.TreasureKeys;
import mineplex.staffServer.salespackage.salespackages.OldChest;
public class SalesPackageManager extends MiniPlugin
{
@ -54,8 +55,9 @@ public class SalesPackageManager extends MiniPlugin
AddSalesPackage(new GemHunter(this, 4));
AddSalesPackage(new GemHunter(this, 8));
AddSalesPackage(new ApplyKits(this));
AddSalesPackage(new TreasureChests(this));
AddSalesPackage(new TreasureKeys(this));
AddSalesPackage(new OldChest(this));
AddSalesPackage(new AncientChest(this));
AddSalesPackage(new MythicalChest(this));
AddSalesPackage(new FrostLord(this));
}
@ -99,6 +101,7 @@ public class SalesPackageManager extends MiniPlugin
{
JsonMessage coinBuilder = new JsonMessage("Coins : ").color("blue");
JsonMessage packageBuilder = new JsonMessage("Rank Packages : ").color("blue");
JsonMessage chestBuilder = new JsonMessage("Chest Packages : ").color("blue");
for (SalesPackageBase salesPackage : _salesPackages.values())
{
@ -106,6 +109,10 @@ 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)
{
chestBuilder = chestBuilder.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");
@ -113,6 +120,7 @@ public class SalesPackageManager extends MiniPlugin
}
coinBuilder.sendToPlayer(caller);
chestBuilder.sendToPlayer(caller);
packageBuilder.sendToPlayer(caller);
}

View File

@ -4,16 +4,16 @@ import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.entity.Player;
public class TreasureKeys extends SalesPackageBase
public class AncientChest extends SalesPackageBase
{
public TreasureKeys(SalesPackageManager manager)
public AncientChest(SalesPackageManager manager)
{
super(manager, "5 Treasure Keys");
super(manager, "1 Ancient Chest");
}
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales item " + playerName + " 5 Treasure Treasure Key", "Give 5 Treasure Keys.");
addButton(agent, "/sales item " + playerName + " 1 Item Ancient Chest", "Give 1 Ancient Chest.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}

View File

@ -4,16 +4,16 @@ import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.entity.Player;
public class TreasureChests extends SalesPackageBase
public class MythicalChest extends SalesPackageBase
{
public TreasureChests(SalesPackageManager manager)
public MythicalChest(SalesPackageManager manager)
{
super(manager, "10 Treasure Chests");
super(manager, "1 Mythical Chest");
}
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales item " + playerName + " 10 Utility Treasure Chest", "Give 10 Treasure Chests.");
addButton(agent, "/sales item " + playerName + " 1 Item Mythical Chest", "Give 1 Mythical Chest.");
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 OldChest extends SalesPackageBase
{
public OldChest(SalesPackageManager manager)
{
super(manager, "1 Old Chest");
}
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales item " + playerName + " 1 Item Old Chest", "Give 1 Old Chest.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}
}

View File

@ -1,7 +1,6 @@
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;