mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-07-02 18:53:43 +00:00
[trunk] Updated /item and /give to support the new ItemDb.get()
Heal sign supports data items too. git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1384 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
ed47df93e9
commit
e9927519c4
|
@ -85,7 +85,7 @@ public class EssentialsBlockListener extends BlockListener
|
|||
{
|
||||
if (!event.getLine(1).isEmpty())
|
||||
{
|
||||
String[] l1 = event.getLine(1).split("[ :-]+");
|
||||
String[] l1 = event.getLine(1).split("[ :-]+", 2);
|
||||
boolean m1 = l1[0].matches("\\$[0-9]+");
|
||||
int q1 = Integer.parseInt(m1 ? l1[0].substring(1) : l1[0]);
|
||||
if (q1 < 1) throw new Exception("Quantities must be greater than 0.");
|
||||
|
@ -126,7 +126,7 @@ public class EssentialsBlockListener extends BlockListener
|
|||
if (user.isAuthorized("essentials.signs.warp.create")) {
|
||||
if (!event.getLine(3).isEmpty())
|
||||
{
|
||||
String[] l1 = event.getLine(3).split("[ :-]+");
|
||||
String[] l1 = event.getLine(3).split("[ :-]+", 2);
|
||||
boolean m1 = l1[0].matches("\\$[0-9]+");
|
||||
int q1 = Integer.parseInt(m1 ? l1[0].substring(1) : l1[0]);
|
||||
if (q1 < 1) throw new Exception("Quantities must be greater than 0.");
|
||||
|
|
|
@ -25,8 +25,7 @@ public class Commandgive extends EssentialsCommand
|
|||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
String[] itemArgs = args[1].split("[^a-zA-Z0-9]");
|
||||
ItemStack stack = ItemDb.get(itemArgs[0]);
|
||||
ItemStack stack = ItemDb.get(args[0]);
|
||||
|
||||
String itemname = stack.getType().toString().toLowerCase().replace("_", "");
|
||||
if (sender instanceof Player
|
||||
|
@ -40,10 +39,6 @@ public class Commandgive extends EssentialsCommand
|
|||
sender.sendMessage(ChatColor.RED + "You are not allowed to spawn the item " + itemname);
|
||||
return;
|
||||
}
|
||||
if (itemArgs.length > 1)
|
||||
{
|
||||
stack.setDurability(Short.parseShort(itemArgs[1]));
|
||||
}
|
||||
if (args.length > 2 && Integer.parseInt(args[2]) > 0)
|
||||
{
|
||||
stack.setAmount(Integer.parseInt(args[2]));
|
||||
|
|
|
@ -22,8 +22,7 @@ public class Commanditem extends EssentialsCommand
|
|||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
String[] itemArgs = args[0].split("[^a-zA-Z0-9]");
|
||||
ItemStack stack = ItemDb.get(itemArgs[0]);
|
||||
ItemStack stack = ItemDb.get(args[0]);
|
||||
|
||||
String itemname = stack.getType().toString().toLowerCase().replace("_", "");
|
||||
if (ess.getSettings().permissionBasedItemSpawn()
|
||||
|
@ -36,10 +35,6 @@ public class Commanditem extends EssentialsCommand
|
|||
user.sendMessage(ChatColor.RED + "You are not allowed to spawn the item " + itemname);
|
||||
return;
|
||||
}
|
||||
if (itemArgs.length > 1)
|
||||
{
|
||||
stack.setDurability(Short.parseShort(itemArgs[1]));
|
||||
}
|
||||
|
||||
if (args.length > 1 && Integer.parseInt(args[1]) > 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue