diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrecipe.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrecipe.java index abd91a14d..411a83afe 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrecipe.java +++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandrecipe.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.commands; import com.earth2me.essentials.CommandSource; import com.earth2me.essentials.User; +import com.earth2me.essentials.craftbukkit.Inventories; import com.earth2me.essentials.utils.EnumUtil; import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.VersionUtil; @@ -53,7 +54,18 @@ public class Commandrecipe extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - final ItemStack itemType = ess.getItemDb().get(args[0]); + final ItemStack itemType; + + if (args[0].equalsIgnoreCase("hand")) { + if (!sender.isPlayer()) { + throw new Exception(tl("consoleCannotUseCommand")); + } + + itemType = Inventories.getItemInHand(sender.getPlayer()); + } else { + itemType = ess.getItemDb().get(args[0]); + } + int recipeNo = 0; if (args.length > 1) { diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index 46567df00..3801a8a18 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -157,6 +157,7 @@ commandHelpLine3=\u00a76Usage(s); commandHelpLine4=\u00a76Aliases(s): \u00a7f{0} commandHelpLineUsage={0} \u00a76- {1} commandNotLoaded=\u00a74Command {0} is improperly loaded. +consoleCannotUseCommand=This command cannot be used by Console. compassBearing=\u00a76Bearing\: {0} ({1} degrees). compassCommandDescription=Describes your current bearing. compassCommandUsage=/ @@ -1025,8 +1026,8 @@ recentlyForeverAlone=\u00a74{0} recently went offline. recipe=\u00a76Recipe for \u00a7c{0}\u00a76 (\u00a7c{1}\u00a76 of \u00a7c{2}\u00a76) recipeBadIndex=There is no recipe by that number. recipeCommandDescription=Displays how to craft items. -recipeCommandUsage=/ [number] -recipeCommandUsage1=/ [page] +recipeCommandUsage=/ <|hand> [number] +recipeCommandUsage1=/ <|hand> [page] recipeCommandUsage1Description=Displays how to craft the given item recipeFurnace=\u00a76Smelt\: \u00a7c{0}\u00a76. recipeGrid=\u00a7c{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X