diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java index c983848f0..e10af1a64 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/command/ItemCommand.java @@ -51,24 +51,40 @@ public class ItemCommand extends CommandBase if (uuid != null) { - Plugin.getDonationManager().PurchaseUnknownSalesPackage(new Callback() + if (category.equalsIgnoreCase("ITEM")) { - public void run(TransactionResponse data) + Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback() { - Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback() + 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() + { + 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!"));