mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-04 22:41:33 +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 static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
@ -21,8 +22,34 @@ public class Commandsetworth extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stack = ess.getItemDb().get(args[0]);
|
ItemStack stack;
|
||||||
ess.getWorth().setPrice(stack, Double.parseDouble(args[1]));
|
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"));
|
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]
|
aliases: [createwarp,esetwarp]
|
||||||
setworth:
|
setworth:
|
||||||
description: Set the sell value of an item.
|
description: Set the sell value of an item.
|
||||||
usage: /<command> <itemname|id> <price>
|
usage: /<command> [itemname|id] <price>
|
||||||
aliases: [esetworth]
|
aliases: [esetworth]
|
||||||
socialspy:
|
socialspy:
|
||||||
description: Toggles if you can see msg/mail commands in chat.
|
description: Toggles if you can see msg/mail commands in chat.
|
||||||
|
Loading…
Reference in New Issue
Block a user