Fixed StaffServer commands for inventory.

This commit is contained in:
Jonathan Williams 2014-11-21 18:34:28 -08:00
parent 390c0dfff3
commit 695ed95b5d
3 changed files with 43 additions and 15 deletions

View File

@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.staffServer.salespackage.SalesPackageManager;
@ -18,18 +19,26 @@ public class BoosterCommand extends CommandBase<SalesPackageManager>
}
@Override
public void Execute(Player caller, String[] args)
public void Execute(final Player caller, String[] args)
{
if (args == null || args.length != 2)
return;
String playerName = args[0];
int amount = Integer.parseInt(args[1]);
final String playerName = args[0];
final int amount = Integer.parseInt(args[1]);
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Gem Booster " + amount, false, 0, false);
Plugin.getInventoryManager().addItemToInventoryForOffline(uuid.toString(), "Utility", "Gem Booster", amount);
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " boosters to " + playerName + "'s account!"));
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
{
public void run(Boolean success)
{
if (success)
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " boosters to " + playerName + "'s account!"));
else
caller.sendMessage(F.main(Plugin.getName(), "There was an error adding " + amount + " boosters to " + playerName + "'s account!"));
}
}, uuid.toString(), "Utility", "Gem Booster", amount);
}
}

View File

@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.staffServer.salespackage.SalesPackageManager;
@ -18,18 +19,27 @@ public class TreasureChestCommand extends CommandBase<SalesPackageManager>
}
@Override
public void Execute(Player caller, String[] args)
public void Execute(final Player caller, String[] args)
{
if (args == null || args.length != 2)
return;
String playerName = args[0];
int amount = Integer.parseInt(args[1]);
final String playerName = args[0];
final int amount = Integer.parseInt(args[1]);
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Treasure Chest " + amount, false, 0, false);
Plugin.getInventoryManager().addItemToInventoryForOffline(uuid.toString(), "Utility", "Treasure Chest", amount);
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure chests to " + playerName + "'s account!"));
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
{
public void run(Boolean success)
{
if (success)
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure chests to " + playerName + "'s account!"));
else
caller.sendMessage(F.main(Plugin.getName(), "There was an error adding " + amount + " treasure chests to " + playerName + "'s account!"));
}
}, uuid.toString(), "Utility", "Treasure Chest", amount);
}
}

View File

@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.staffServer.salespackage.SalesPackageManager;
@ -18,18 +19,26 @@ public class TreasureKeyCommand extends CommandBase<SalesPackageManager>
}
@Override
public void Execute(Player caller, String[] args)
public void Execute(final Player caller, String[] args)
{
if (args == null || args.length != 2)
return;
String playerName = args[0];
int amount = Integer.parseInt(args[1]);
final String playerName = args[0];
final int amount = Integer.parseInt(args[1]);
UUID uuid = UUIDFetcher.getUUIDOf(playerName);
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, uuid, "Treasure Key " + amount, false, 0, false);
Plugin.getInventoryManager().addItemToInventoryForOffline(uuid.toString(), "Treasure", "Treasure Key", amount);
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure Keys to " + playerName + "'s account!"));
Plugin.getInventoryManager().addItemToInventoryForOffline(new Callback<Boolean>()
{
public void run(Boolean success)
{
if (success)
caller.sendMessage(F.main(Plugin.getName(), "Added " + amount + " treasure Keys to " + playerName + "'s account!"));
else
caller.sendMessage(F.main(Plugin.getName(), "There was an error adding " + amount + " treasure Keys to " + playerName + "'s account!"));
}
}, uuid.toString(), "Treasure", "Treasure Key", amount);
}
}