Merge diff from krnlyng:

Adjust item spawn, to allow for match native names.
This commit is contained in:
KHobbits 2011-08-10 10:45:24 +01:00
parent db50d455df
commit 47c8217511
3 changed files with 7 additions and 2 deletions

View File

@ -163,6 +163,11 @@ public class ItemDb implements IConf
metaData = durabilities.get(itemname);
}
}
else if(Material.getMaterial(itemname) != null)
{
itemid = Material.getMaterial(itemname).getId();
metaData = 0;
}
else
{
throw new Exception(Util.format("unknownItemName", id));

View File

@ -50,7 +50,7 @@ public class Commandgive extends EssentialsCommand
}
User giveTo = getPlayer(server, args, 0);
String itemName = stack.getType().name().toLowerCase().replace('_', ' ');
String itemName = stack.getType().toString().toLowerCase().replace('_', ' ');
charge(sender);
sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + ".");
giveTo.getInventory().addItem(stack);

View File

@ -46,7 +46,7 @@ public class Commanditem extends EssentialsCommand
return;
}
String itemName = stack.getType().name().toLowerCase().replace('_', ' ');
String itemName = stack.getType().toString().toLowerCase().replace('_', ' ');
charge(user);
user.sendMessage(Util.format("itemSpawn", stack.getAmount(), itemName));
user.getInventory().addItem(stack);