From 47c82175112f3b221d019b06f6049fa8295e622f Mon Sep 17 00:00:00 2001 From: KHobbits Date: Wed, 10 Aug 2011 10:45:24 +0100 Subject: [PATCH] Merge diff from krnlyng: Adjust item spawn, to allow for match native names. --- Essentials/src/com/earth2me/essentials/ItemDb.java | 5 +++++ .../src/com/earth2me/essentials/commands/Commandgive.java | 2 +- .../src/com/earth2me/essentials/commands/Commanditem.java | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java index d7e534341..8e05b17fb 100644 --- a/Essentials/src/com/earth2me/essentials/ItemDb.java +++ b/Essentials/src/com/earth2me/essentials/ItemDb.java @@ -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)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java index b029df098..21eea2c70 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandgive.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandgive.java @@ -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); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java index 4961f714d..79e8344f1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditem.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditem.java @@ -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);