mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Add ability to get recipe of item in hand (#5346)
Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com> Co-authored-by: pop4959 <pop4959@gmail.com>
This commit is contained in:
parent
357cd6b246
commit
646b60a90b
@ -2,6 +2,7 @@ package com.earth2me.essentials.commands;
|
|||||||
|
|
||||||
import com.earth2me.essentials.CommandSource;
|
import com.earth2me.essentials.CommandSource;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
import com.earth2me.essentials.craftbukkit.Inventories;
|
||||||
import com.earth2me.essentials.utils.EnumUtil;
|
import com.earth2me.essentials.utils.EnumUtil;
|
||||||
import com.earth2me.essentials.utils.NumberUtil;
|
import com.earth2me.essentials.utils.NumberUtil;
|
||||||
import com.earth2me.essentials.utils.VersionUtil;
|
import com.earth2me.essentials.utils.VersionUtil;
|
||||||
@ -53,7 +54,18 @@ public class Commandrecipe extends EssentialsCommand {
|
|||||||
throw new NotEnoughArgumentsException();
|
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;
|
int recipeNo = 0;
|
||||||
|
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
|
@ -157,6 +157,7 @@ commandHelpLine3=\u00a76Usage(s);
|
|||||||
commandHelpLine4=\u00a76Aliases(s): \u00a7f{0}
|
commandHelpLine4=\u00a76Aliases(s): \u00a7f{0}
|
||||||
commandHelpLineUsage={0} \u00a76- {1}
|
commandHelpLineUsage={0} \u00a76- {1}
|
||||||
commandNotLoaded=\u00a74Command {0} is improperly loaded.
|
commandNotLoaded=\u00a74Command {0} is improperly loaded.
|
||||||
|
consoleCannotUseCommand=This command cannot be used by Console.
|
||||||
compassBearing=\u00a76Bearing\: {0} ({1} degrees).
|
compassBearing=\u00a76Bearing\: {0} ({1} degrees).
|
||||||
compassCommandDescription=Describes your current bearing.
|
compassCommandDescription=Describes your current bearing.
|
||||||
compassCommandUsage=/<command>
|
compassCommandUsage=/<command>
|
||||||
@ -1025,8 +1026,8 @@ recentlyForeverAlone=\u00a74{0} recently went offline.
|
|||||||
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 (\u00a7c{1}\u00a76 of \u00a7c{2}\u00a76)
|
recipe=\u00a76Recipe for \u00a7c{0}\u00a76 (\u00a7c{1}\u00a76 of \u00a7c{2}\u00a76)
|
||||||
recipeBadIndex=There is no recipe by that number.
|
recipeBadIndex=There is no recipe by that number.
|
||||||
recipeCommandDescription=Displays how to craft items.
|
recipeCommandDescription=Displays how to craft items.
|
||||||
recipeCommandUsage=/<command> <item> [number]
|
recipeCommandUsage=/<command> <<item>|hand> [number]
|
||||||
recipeCommandUsage1=/<command> <item> [page]
|
recipeCommandUsage1=/<command> <<item>|hand> [page]
|
||||||
recipeCommandUsage1Description=Displays how to craft the given item
|
recipeCommandUsage1Description=Displays how to craft the given item
|
||||||
recipeFurnace=\u00a76Smelt\: \u00a7c{0}\u00a76.
|
recipeFurnace=\u00a76Smelt\: \u00a7c{0}\u00a76.
|
||||||
recipeGrid=\u00a7c{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
|
recipeGrid=\u00a7c{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X
|
||||||
|
Loading…
Reference in New Issue
Block a user