diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java index 3100c97082..e7c937b12f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandexp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandexp.java @@ -1,205 +1,205 @@ -package com.earth2me.essentials.commands; - -import com.earth2me.essentials.CommandSource; -import static com.earth2me.essentials.I18n.tl; -import com.earth2me.essentials.User; -import com.earth2me.essentials.craftbukkit.SetExpFix; -import com.earth2me.essentials.utils.NumberUtil; -import java.util.List; -import java.util.Locale; -import org.bukkit.Server; -import org.bukkit.entity.Player; - - -public class Commandexp extends EssentialsCommand -{ - public Commandexp() - { - super("exp"); - } - - @Override - public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception - { - if (args.length == 0) - { - showExp(user.getSource(), user); - } - else if (args.length > 1 && args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set")) - { - if (args.length == 3 && user.isAuthorized("essentials.exp.set.others")) - { - expMatch(server, user.getSource(), args[1], args[2], false); - } - else - { - setExp(user.getSource(), user, args[1], false); - } - } - else if (args.length > 1 && args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give")) - { - if (args.length == 3 && user.isAuthorized("essentials.exp.give.others")) - { - expMatch(server, user.getSource(), args[1], args[2], true); - } - else - { - setExp(user.getSource(), user, args[1], true); - } - } - else if (args[0].equalsIgnoreCase("show")) - { - if (args.length >= 2 && user.isAuthorized("essentials.exp.others")) - { - String match = args[1].trim(); - showMatch(server, user.getSource(), match); - } - else - { - showExp(user.getSource(), user); - } - } - else - { - if (args.length >= 1 && NumberUtil.isInt(args[0].toLowerCase(Locale.ENGLISH).replace("l", "")) && user.isAuthorized("essentials.exp.give")) - { - if (args.length >= 2 && user.isAuthorized("essentials.exp.give.others")) - { - expMatch(server, user.getSource(), args[1], args[0], true); - } - else - { - setExp(user.getSource(), user, args[0], true); - } - } - else if (args.length >= 1 && user.isAuthorized("essentials.exp.others")) - { - String match = args[0].trim(); - showMatch(server, user.getSource(), match); - } - else - { - showExp(user.getSource(), user); - } - } - } - - @Override - public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception - { - if (args.length < 1) - { - throw new NotEnoughArgumentsException(); - } - else if (args.length > 2 && args[0].equalsIgnoreCase("set")) - { - expMatch(server, sender, args[1], args[2], false); - } - else if (args.length > 2 && args[0].equalsIgnoreCase("give")) - { - expMatch(server, sender, args[1], args[2], true); - } - else - { - String match = args[0].trim(); - if (args.length >= 2 && NumberUtil.isInt(args[0].toLowerCase(Locale.ENGLISH).replace("l", ""))) - { - match = args[1].trim(); - expMatch(server, sender, match, args[0], true); - } - else if (args.length == 1) - { - match = args[0].trim(); - } - showMatch(server, sender, match); - } - } - - private void showMatch(final Server server, final CommandSource sender, final String match) throws PlayerNotFoundException - { - boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).canInteractVanished(); - boolean foundUser = false; - final List matchedPlayers = server.matchPlayer(match); - for (Player matchPlayer : matchedPlayers) - { - final User player = ess.getUser(matchPlayer); - if (skipHidden && player.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(matchPlayer)) - { - continue; - } - foundUser = true; - showExp(sender, player); - } - if (!foundUser) - { - throw new PlayerNotFoundException(); - } - } - - private void expMatch(final Server server, final CommandSource sender, final String match, String amount, final boolean give) throws NotEnoughArgumentsException, PlayerNotFoundException - { - boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).canInteractVanished(); - boolean foundUser = false; - final List matchedPlayers = server.matchPlayer(match); - for (Player matchPlayer : matchedPlayers) - { - final User player = ess.getUser(matchPlayer); - if (skipHidden && player.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(matchPlayer)) - { - continue; - } - foundUser = true; - setExp(sender, player, amount, give); - } - if (!foundUser) - { - throw new PlayerNotFoundException(); - } - } - - private void showExp(final CommandSource sender, final User target) - { - sender.sendMessage(tl("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target.getBase()), target.getBase().getLevel(), SetExpFix.getExpUntilNextLevel(target.getBase()))); - } - - //TODO: Limit who can give negative exp? - private void setExp(final CommandSource sender, final User target, String strAmount, final boolean give) throws NotEnoughArgumentsException - { - long amount; - strAmount = strAmount.toLowerCase(Locale.ENGLISH); - if (strAmount.contains("l")) - { - strAmount = strAmount.replaceAll("l", ""); - int neededLevel = Integer.parseInt(strAmount); - if (give) - { - neededLevel += target.getBase().getLevel(); - } - amount = (long)SetExpFix.getExpToLevel(neededLevel); - SetExpFix.setTotalExperience(target.getBase(), 0); - } - else - { - amount = Long.parseLong(strAmount); - if (amount > Integer.MAX_VALUE || amount < Integer.MIN_VALUE) - { - throw new NotEnoughArgumentsException(); - } - } - - if (give) - { - amount += SetExpFix.getTotalExperience(target.getBase()); - } - if (amount > Integer.MAX_VALUE) - { - amount = (long)Integer.MAX_VALUE; - } - if (amount < 0l) - { - amount = 0l; - } - SetExpFix.setTotalExperience(target.getBase(), (int)amount); - sender.sendMessage(tl("expSet", target.getDisplayName(), amount)); - } -} +package com.earth2me.essentials.commands; + +import com.earth2me.essentials.CommandSource; +import static com.earth2me.essentials.I18n.tl; +import com.earth2me.essentials.User; +import com.earth2me.essentials.craftbukkit.SetExpFix; +import com.earth2me.essentials.utils.NumberUtil; +import java.util.List; +import java.util.Locale; +import org.bukkit.Server; +import org.bukkit.entity.Player; + + +public class Commandexp extends EssentialsCommand +{ + public Commandexp() + { + super("exp"); + } + + @Override + public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { + if (args.length == 0) + { + showExp(user.getSource(), user); + } + else if (args.length > 1 && args[0].equalsIgnoreCase("set") && user.isAuthorized("essentials.exp.set")) + { + if (args.length == 3 && user.isAuthorized("essentials.exp.set.others")) + { + expMatch(server, user.getSource(), args[1], args[2], false); + } + else + { + setExp(user.getSource(), user, args[1], false); + } + } + else if (args.length > 1 && args[0].equalsIgnoreCase("give") && user.isAuthorized("essentials.exp.give")) + { + if (args.length == 3 && user.isAuthorized("essentials.exp.give.others")) + { + expMatch(server, user.getSource(), args[1], args[2], true); + } + else + { + setExp(user.getSource(), user, args[1], true); + } + } + else if (args[0].equalsIgnoreCase("show")) + { + if (args.length >= 2 && user.isAuthorized("essentials.exp.others")) + { + String match = args[1].trim(); + showMatch(server, user.getSource(), match); + } + else + { + showExp(user.getSource(), user); + } + } + else + { + if (args.length >= 1 && NumberUtil.isInt(args[0].toLowerCase(Locale.ENGLISH).replace("l", "")) && user.isAuthorized("essentials.exp.give")) + { + if (args.length >= 2 && user.isAuthorized("essentials.exp.give.others")) + { + expMatch(server, user.getSource(), args[1], args[0], true); + } + else + { + setExp(user.getSource(), user, args[0], true); + } + } + else if (args.length >= 1 && user.isAuthorized("essentials.exp.others")) + { + String match = args[0].trim(); + showMatch(server, user.getSource(), match); + } + else + { + showExp(user.getSource(), user); + } + } + } + + @Override + public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + else if (args.length > 2 && args[0].equalsIgnoreCase("set")) + { + expMatch(server, sender, args[1], args[2], false); + } + else if (args.length > 2 && args[0].equalsIgnoreCase("give")) + { + expMatch(server, sender, args[1], args[2], true); + } + else + { + String match = args[0].trim(); + if (args.length >= 2 && NumberUtil.isInt(args[0].toLowerCase(Locale.ENGLISH).replace("l", ""))) + { + match = args[1].trim(); + expMatch(server, sender, match, args[0], true); + } + else if (args.length == 1) + { + match = args[0].trim(); + } + showMatch(server, sender, match); + } + } + + private void showMatch(final Server server, final CommandSource sender, final String match) throws PlayerNotFoundException + { + boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).canInteractVanished(); + boolean foundUser = false; + final List matchedPlayers = server.matchPlayer(match); + for (Player matchPlayer : matchedPlayers) + { + final User player = ess.getUser(matchPlayer); + if (skipHidden && player.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(matchPlayer)) + { + continue; + } + foundUser = true; + showExp(sender, player); + } + if (!foundUser) + { + throw new PlayerNotFoundException(); + } + } + + private void expMatch(final Server server, final CommandSource sender, final String match, String amount, final boolean give) throws NotEnoughArgumentsException, PlayerNotFoundException + { + boolean skipHidden = sender.isPlayer() && !ess.getUser(sender.getPlayer()).canInteractVanished(); + boolean foundUser = false; + final List matchedPlayers = server.matchPlayer(match); + for (Player matchPlayer : matchedPlayers) + { + final User player = ess.getUser(matchPlayer); + if (skipHidden && player.isHidden(sender.getPlayer()) && !sender.getPlayer().canSee(matchPlayer)) + { + continue; + } + foundUser = true; + setExp(sender, player, amount, give); + } + if (!foundUser) + { + throw new PlayerNotFoundException(); + } + } + + private void showExp(final CommandSource sender, final User target) + { + sender.sendMessage(tl("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target.getBase()), target.getBase().getLevel(), SetExpFix.getExpUntilNextLevel(target.getBase()))); + } + + //TODO: Limit who can give negative exp? + private void setExp(final CommandSource sender, final User target, String strAmount, final boolean give) throws NotEnoughArgumentsException + { + long amount; + strAmount = strAmount.toLowerCase(Locale.ENGLISH); + if (strAmount.contains("l")) + { + strAmount = strAmount.replaceAll("l", ""); + int neededLevel = Integer.parseInt(strAmount); + if (give) + { + neededLevel += target.getBase().getLevel(); + } + amount = (long)SetExpFix.getExpToLevel(neededLevel); + SetExpFix.setTotalExperience(target.getBase(), 0); + } + else + { + amount = Long.parseLong(strAmount); + if (amount > Integer.MAX_VALUE || amount < Integer.MIN_VALUE) + { + throw new NotEnoughArgumentsException(); + } + } + + if (give) + { + amount += SetExpFix.getTotalExperience(target.getBase()); + } + if (amount > Integer.MAX_VALUE) + { + amount = (long)Integer.MAX_VALUE; + } + if (amount < 0l) + { + amount = 0l; + } + SetExpFix.setTotalExperience(target.getBase(), (int)amount); + sender.sendMessage(tl("expSet", target.getDisplayName(), amount)); + } +} diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java index ec4fa896f5..db0f87fdd3 100755 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java @@ -1,202 +1,202 @@ -package com.earth2me.essentials.commands; - -import com.earth2me.essentials.CommandSource; -import static com.earth2me.essentials.I18n.tl; -import com.earth2me.essentials.User; -import com.earth2me.essentials.utils.NumberUtil; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import org.bukkit.Material; -import org.bukkit.Server; -import org.bukkit.inventory.*; - - -public class Commandrecipe extends EssentialsCommand -{ - public Commandrecipe() - { - super("recipe"); - } - - @Override - public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception - { - if (args.length < 1) - { - throw new NotEnoughArgumentsException(); - } - - final ItemStack itemType = ess.getItemDb().get(args[0]); - int recipeNo = 0; - - if (args.length > 1) - { - if (NumberUtil.isInt(args[1])) - { - recipeNo = Integer.parseInt(args[1]) - 1; - } - else - { - throw new Exception(tl("invalidNumber")); - } - } - - final List recipesOfType = ess.getServer().getRecipesFor(itemType); - if (recipesOfType.size() < 1) - { - throw new Exception(tl("recipeNone", getMaterialName(itemType))); - } - - if (recipeNo < 0 || recipeNo >= recipesOfType.size()) - { - throw new Exception(tl("recipeBadIndex")); - } - - final Recipe selectedRecipe = recipesOfType.get(recipeNo); - sender.sendMessage(tl("recipe", getMaterialName(itemType), recipeNo + 1, recipesOfType.size())); - - if (selectedRecipe instanceof FurnaceRecipe) - { - furnaceRecipe(sender, (FurnaceRecipe)selectedRecipe); - } - else if (selectedRecipe instanceof ShapedRecipe) - { - shapedRecipe(sender, (ShapedRecipe)selectedRecipe, sender.isPlayer()); - } - else if (selectedRecipe instanceof ShapelessRecipe) - { - if (recipesOfType.size() == 1 && itemType.getType() == Material.FIREWORK) - { - ShapelessRecipe shapelessRecipe = new ShapelessRecipe(itemType); - shapelessRecipe.addIngredient(Material.SULPHUR); - shapelessRecipe.addIngredient(Material.PAPER); - shapelessRecipe.addIngredient(Material.FIREWORK_CHARGE); - shapelessRecipe(sender, shapelessRecipe, sender.isPlayer()); - } - else - { - shapelessRecipe(sender, (ShapelessRecipe)selectedRecipe, sender.isPlayer()); - } - } - - if (recipesOfType.size() > 1 && args.length == 1) - { - sender.sendMessage(tl("recipeMore", commandLabel, args[0], getMaterialName(itemType))); - } - } - - public void furnaceRecipe(final CommandSource sender, final FurnaceRecipe recipe) - { - sender.sendMessage(tl("recipeFurnace", getMaterialName(recipe.getInput()))); - } - - public void shapedRecipe(final CommandSource sender, final ShapedRecipe recipe, final boolean showWindow) - { - final Map recipeMap = recipe.getIngredientMap(); - - if (showWindow) - { - final User user = ess.getUser(sender.getPlayer()); - user.getBase().closeInventory(); - user.setRecipeSee(true); - final InventoryView view = user.getBase().openWorkbench(null, true); - final String[] recipeShape = recipe.getShape(); - final Map ingredientMap = recipe.getIngredientMap(); - for (int j = 0; j < recipeShape.length; j++) - { - for (int k = 0; k < recipeShape[j].length(); k++) - { - final ItemStack item = ingredientMap.get(recipeShape[j].toCharArray()[k]); - if (item == null) - { - continue; - } - item.setAmount(0); - view.getTopInventory().setItem(j * 3 + k + 1, item); - } - } - } - else - { - final HashMap colorMap = new HashMap(); - int i = 1; - for (Character c : "abcdefghi".toCharArray()) - { - ItemStack item = recipeMap.get(c); - if (!colorMap.containsKey(item == null ? null : item.getType())) - { - colorMap.put(item == null ? null : item.getType(), String.valueOf(i++)); - } - } - final Material[][] materials = new Material[3][3]; - for (int j = 0; j < recipe.getShape().length; j++) - { - for (int k = 0; k < recipe.getShape()[j].length(); k++) - { - ItemStack item = recipe.getIngredientMap().get(recipe.getShape()[j].toCharArray()[k]); - materials[j][k] = item == null ? null : item.getType(); - } - } - sender.sendMessage(tl("recipeGrid", colorMap.get(materials[0][0]), colorMap.get(materials[0][1]), colorMap.get(materials[0][2]))); - sender.sendMessage(tl("recipeGrid", colorMap.get(materials[1][0]), colorMap.get(materials[1][1]), colorMap.get(materials[1][2]))); - sender.sendMessage(tl("recipeGrid", colorMap.get(materials[2][0]), colorMap.get(materials[2][1]), colorMap.get(materials[2][2]))); - - StringBuilder s = new StringBuilder(); - for (Material items : colorMap.keySet().toArray(new Material[colorMap.size()])) - { - s.append(tl("recipeGridItem", colorMap.get(items), getMaterialName(items))); - } - sender.sendMessage(tl("recipeWhere", s.toString())); - } - } - - public void shapelessRecipe(final CommandSource sender, final ShapelessRecipe recipe, final boolean showWindow) - { - final List ingredients = recipe.getIngredientList(); - if (showWindow) - { - final User user = ess.getUser(sender.getPlayer()); - user.setRecipeSee(true); - final InventoryView view = user.getBase().openWorkbench(null, true); - for (int i = 0; i < ingredients.size(); i++) - { - view.setItem(i + 1, ingredients.get(i)); - } - - } - else - { - StringBuilder s = new StringBuilder(); - for (int i = 0; i < ingredients.size(); i++) - { - s.append(getMaterialName(ingredients.get(i))); - if (i != ingredients.size() - 1) - { - s.append(","); - } - s.append(" "); - } - sender.sendMessage(tl("recipeShapeless", s.toString())); - } - } - - public String getMaterialName(final ItemStack stack) - { - if (stack == null) - { - return tl("recipeNothing"); - } - return getMaterialName(stack.getType()); - } - - public String getMaterialName(final Material type) - { - if (type == null) - { - return tl("recipeNothing"); - } - return type.toString().replace("_", " ").toLowerCase(Locale.ENGLISH); - } -} +package com.earth2me.essentials.commands; + +import com.earth2me.essentials.CommandSource; +import static com.earth2me.essentials.I18n.tl; +import com.earth2me.essentials.User; +import com.earth2me.essentials.utils.NumberUtil; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import org.bukkit.Material; +import org.bukkit.Server; +import org.bukkit.inventory.*; + + +public class Commandrecipe extends EssentialsCommand +{ + public Commandrecipe() + { + super("recipe"); + } + + @Override + public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + + final ItemStack itemType = ess.getItemDb().get(args[0]); + int recipeNo = 0; + + if (args.length > 1) + { + if (NumberUtil.isInt(args[1])) + { + recipeNo = Integer.parseInt(args[1]) - 1; + } + else + { + throw new Exception(tl("invalidNumber")); + } + } + + final List recipesOfType = ess.getServer().getRecipesFor(itemType); + if (recipesOfType.size() < 1) + { + throw new Exception(tl("recipeNone", getMaterialName(itemType))); + } + + if (recipeNo < 0 || recipeNo >= recipesOfType.size()) + { + throw new Exception(tl("recipeBadIndex")); + } + + final Recipe selectedRecipe = recipesOfType.get(recipeNo); + sender.sendMessage(tl("recipe", getMaterialName(itemType), recipeNo + 1, recipesOfType.size())); + + if (selectedRecipe instanceof FurnaceRecipe) + { + furnaceRecipe(sender, (FurnaceRecipe)selectedRecipe); + } + else if (selectedRecipe instanceof ShapedRecipe) + { + shapedRecipe(sender, (ShapedRecipe)selectedRecipe, sender.isPlayer()); + } + else if (selectedRecipe instanceof ShapelessRecipe) + { + if (recipesOfType.size() == 1 && itemType.getType() == Material.FIREWORK) + { + ShapelessRecipe shapelessRecipe = new ShapelessRecipe(itemType); + shapelessRecipe.addIngredient(Material.SULPHUR); + shapelessRecipe.addIngredient(Material.PAPER); + shapelessRecipe.addIngredient(Material.FIREWORK_CHARGE); + shapelessRecipe(sender, shapelessRecipe, sender.isPlayer()); + } + else + { + shapelessRecipe(sender, (ShapelessRecipe)selectedRecipe, sender.isPlayer()); + } + } + + if (recipesOfType.size() > 1 && args.length == 1) + { + sender.sendMessage(tl("recipeMore", commandLabel, args[0], getMaterialName(itemType))); + } + } + + public void furnaceRecipe(final CommandSource sender, final FurnaceRecipe recipe) + { + sender.sendMessage(tl("recipeFurnace", getMaterialName(recipe.getInput()))); + } + + public void shapedRecipe(final CommandSource sender, final ShapedRecipe recipe, final boolean showWindow) + { + final Map recipeMap = recipe.getIngredientMap(); + + if (showWindow) + { + final User user = ess.getUser(sender.getPlayer()); + user.getBase().closeInventory(); + user.setRecipeSee(true); + final InventoryView view = user.getBase().openWorkbench(null, true); + final String[] recipeShape = recipe.getShape(); + final Map ingredientMap = recipe.getIngredientMap(); + for (int j = 0; j < recipeShape.length; j++) + { + for (int k = 0; k < recipeShape[j].length(); k++) + { + final ItemStack item = ingredientMap.get(recipeShape[j].toCharArray()[k]); + if (item == null) + { + continue; + } + item.setAmount(0); + view.getTopInventory().setItem(j * 3 + k + 1, item); + } + } + } + else + { + final HashMap colorMap = new HashMap(); + int i = 1; + for (Character c : "abcdefghi".toCharArray()) + { + ItemStack item = recipeMap.get(c); + if (!colorMap.containsKey(item == null ? null : item.getType())) + { + colorMap.put(item == null ? null : item.getType(), String.valueOf(i++)); + } + } + final Material[][] materials = new Material[3][3]; + for (int j = 0; j < recipe.getShape().length; j++) + { + for (int k = 0; k < recipe.getShape()[j].length(); k++) + { + ItemStack item = recipe.getIngredientMap().get(recipe.getShape()[j].toCharArray()[k]); + materials[j][k] = item == null ? null : item.getType(); + } + } + sender.sendMessage(tl("recipeGrid", colorMap.get(materials[0][0]), colorMap.get(materials[0][1]), colorMap.get(materials[0][2]))); + sender.sendMessage(tl("recipeGrid", colorMap.get(materials[1][0]), colorMap.get(materials[1][1]), colorMap.get(materials[1][2]))); + sender.sendMessage(tl("recipeGrid", colorMap.get(materials[2][0]), colorMap.get(materials[2][1]), colorMap.get(materials[2][2]))); + + StringBuilder s = new StringBuilder(); + for (Material items : colorMap.keySet().toArray(new Material[colorMap.size()])) + { + s.append(tl("recipeGridItem", colorMap.get(items), getMaterialName(items))); + } + sender.sendMessage(tl("recipeWhere", s.toString())); + } + } + + public void shapelessRecipe(final CommandSource sender, final ShapelessRecipe recipe, final boolean showWindow) + { + final List ingredients = recipe.getIngredientList(); + if (showWindow) + { + final User user = ess.getUser(sender.getPlayer()); + user.setRecipeSee(true); + final InventoryView view = user.getBase().openWorkbench(null, true); + for (int i = 0; i < ingredients.size(); i++) + { + view.setItem(i + 1, ingredients.get(i)); + } + + } + else + { + StringBuilder s = new StringBuilder(); + for (int i = 0; i < ingredients.size(); i++) + { + s.append(getMaterialName(ingredients.get(i))); + if (i != ingredients.size() - 1) + { + s.append(","); + } + s.append(" "); + } + sender.sendMessage(tl("recipeShapeless", s.toString())); + } + } + + public String getMaterialName(final ItemStack stack) + { + if (stack == null) + { + return tl("recipeNothing"); + } + return getMaterialName(stack.getType()); + } + + public String getMaterialName(final Material type) + { + if (type == null) + { + return tl("recipeNothing"); + } + return type.toString().replace("_", " ").toLowerCase(Locale.ENGLISH); + } +} diff --git a/Essentials/src/com/earth2me/essentials/signs/SignWarp.java b/Essentials/src/com/earth2me/essentials/signs/SignWarp.java index 2281ec6501..afa4d82637 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignWarp.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignWarp.java @@ -12,7 +12,7 @@ public class SignWarp extends EssentialsSign { public SignWarp() { - super("Warp"); + super("Warp (tp)"); } @Override