Fix unnecessary calls to mysql/mssql databases in support server

This commit is contained in:
AlexTheCoder 2016-09-04 23:44:54 -04:00
parent b5771550ad
commit ffb6073532

View File

@ -51,24 +51,40 @@ public class ItemCommand extends CommandBase<SalesPackageManager>
if (uuid != null)
{
Plugin.getDonationManager().PurchaseUnknownSalesPackage(new Callback<TransactionResponse>()
if (category.equalsIgnoreCase("ITEM"))
{
public void run(TransactionResponse data)
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
{
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
public void run(Boolean success)
{
public void run(Boolean success)
if (success)
{
if (success)
UtilPlayer.message(caller, F.main(Plugin.getName(), playerName + " received " + amount + " " + itemName + "."));
else
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " " + itemName + "."));
}
UtilPlayer.message(caller, F.main(Plugin.getName(), playerName + " received " + amount + " " + itemName + "."));
}
}, uuid, itemName, amount);
}
}, playerName, client.getAccountId(), (amount == 1 ? itemName : itemName + " " + amount), GlobalCurrency.GEM, 0, false);
else
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " " + itemName + "."));
}
}
}, uuid, itemName, amount);
}
else
{
Plugin.getDonationManager().PurchaseUnknownSalesPackage(new Callback<TransactionResponse>()
{
public void run(TransactionResponse data)
{
if (data == TransactionResponse.Success || data == TransactionResponse.AlreadyOwns)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), playerName + " received " + amount + " " + itemName + "."));
}
else if (data == TransactionResponse.Failed || data == TransactionResponse.InsufficientFunds)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " " + itemName + "."));
}
}
}, playerName, client.getAccountId(), (amount == 1 ? itemName : itemName + " " + amount), GlobalCurrency.GEM, 0, false);
}
}
else
caller.sendMessage(F.main(Plugin.getName(), "Couldn't find " + playerName + "'s account!"));