mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-04 14:31:26 +01:00
Update setworth to allow /setworth <price> ingame
Allow /setworth to be used from console.
This commit is contained in:
parent
a40c936bcf
commit
8dcd591beb
@ -3,6 +3,7 @@ package com.earth2me.essentials.commands;
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
@ -21,8 +22,34 @@ public class Commandsetworth extends EssentialsCommand
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
ItemStack stack = ess.getItemDb().get(args[0]);
|
||||
ess.getWorth().setPrice(stack, Double.parseDouble(args[1]));
|
||||
ItemStack stack;
|
||||
String price;
|
||||
|
||||
if (args.length == 1)
|
||||
{
|
||||
stack = user.getInventory().getItemInHand();
|
||||
price = args[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
stack = ess.getItemDb().get(args[0]);
|
||||
price = args[1];
|
||||
}
|
||||
|
||||
ess.getWorth().setPrice(stack, Double.parseDouble(price));
|
||||
user.sendMessage(_("worthSet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
ItemStack stack = ess.getItemDb().get(args[0]);
|
||||
ess.getWorth().setPrice(stack, Double.parseDouble(args[1]));
|
||||
sender.sendMessage(_("worthSet"));
|
||||
}
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ commands:
|
||||
aliases: [createwarp,esetwarp]
|
||||
setworth:
|
||||
description: Set the sell value of an item.
|
||||
usage: /<command> <itemname|id> <price>
|
||||
usage: /<command> [itemname|id] <price>
|
||||
aliases: [esetworth]
|
||||
socialspy:
|
||||
description: Toggles if you can see msg/mail commands in chat.
|
||||
|
Loading…
Reference in New Issue
Block a user