From ecf5d47e97adb2d7bda0ed269f64aff86320fc39 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Mon, 17 Dec 2012 02:12:38 +1100 Subject: [PATCH 1/3] Add tempban limit (with override node) and console override to exempt node. --- Essentials/src/com/earth2me/essentials/ISettings.java | 2 ++ Essentials/src/com/earth2me/essentials/Settings.java | 6 ++++++ .../earth2me/essentials/commands/Commandtempban.java | 11 ++++++++++- Essentials/src/config.yml | 4 ++++ Essentials/src/messages.properties | 1 + Essentials/src/messages_cs.properties | 1 + Essentials/src/messages_da.properties | 1 + Essentials/src/messages_de.properties | 1 + Essentials/src/messages_en.properties | 1 + Essentials/src/messages_es.properties | 1 + Essentials/src/messages_fi.properties | 1 + Essentials/src/messages_fr.properties | 1 + Essentials/src/messages_it.properties | 1 + Essentials/src/messages_nl.properties | 1 + Essentials/src/messages_pl.properties | 1 + Essentials/src/messages_pt.properties | 1 + Essentials/src/messages_se.properties | 1 + 17 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index fb0073c8a..1ad9b0207 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -183,4 +183,6 @@ public interface ISettings extends IConf public int getMailsPerMinute(); public void setEssentialsChatActive(boolean b); + + long getMaxTempban(); } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 416602c4d..46f7ee770 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -982,4 +982,10 @@ public class Settings implements ISettings { return mailsPerMinute; } + + @Override + public long getMaxTempban() + { + return config.getLong("max-tempban-time", -1); + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java index 0549e9c0d..4ac2db89c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java @@ -4,6 +4,8 @@ import com.earth2me.essentials.Console; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; +import java.util.Calendar; +import java.util.GregorianCalendar; import org.bukkit.Server; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -35,7 +37,7 @@ public class Commandtempban extends EssentialsCommand } else { - if (user.isAuthorized("essentials.tempban.exempt")) + if (user.isAuthorized("essentials.tempban.exempt") && sender instanceof Player) { sender.sendMessage(_("tempbanExempt")); return; @@ -44,6 +46,13 @@ public class Commandtempban extends EssentialsCommand final String time = getFinalArg(args, 1); final long banTimestamp = Util.parseDateDiff(time, true); + final long max = ess.getSettings().getMaxTempban(); + if(max != 0 && banTimestamp - GregorianCalendar.getInstance().getTimeInMillis() > max * 1000 && ess.getUser(sender).isAuthorized("essentials.tempban.unlimited")) + { + sender.sendMessage(_("oversizedTempban")); + throw new NoChargeException(); + } + final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; final String banReason = _("tempBanned", Util.formatDateDiff(banTimestamp), senderName); user.setBanReason(banReason); diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index a766e0549..e428354a8 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -351,6 +351,10 @@ sethome-multiple: # Set to 0 for no timeout tpa-accept-cancellation: 0 +# Set the maximum time /tempban can be used for in seconds. +# Set to -1 to disable, and essentials.tempban.unlimited can be used to override. +max-tempban-time: -1 + ############################################################ # +------------------------------------------------------+ # # | EssentialsEco | # diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 8a17513cf..a84e9cdab 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index 5cc095f15..dca74c0e0 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -469,3 +469,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 6beff781a..e9099f3cf 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 4db624c6a..35f584f52 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 8a17513cf..a84e9cdab 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index 8d0ad7892..c3bbfb80c 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index fef0aeb78..ceb44335e 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index e5cfd4975..bed11e666 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index f24899599..9afb93c4d 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 0c4fd2cd0..5ec926da5 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index 804784f19..a3c27652c 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 4c039bc1c..5aa293a73 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index b6017786b..3a184f675 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -466,3 +466,4 @@ teleportationEnabledFor=\u00a76Teleportation enabled for {0} teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack +oversizedTempban=\u00a74You may not ban a player for this period of time. From 1f8a0a811fcc538ed31ccfb0abfb3b73a2b64659 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Wed, 19 Dec 2012 14:57:12 +1100 Subject: [PATCH 2/3] Add /recipe command --- .../essentials/EssentialsPlayerListener.java | 19 +- .../src/com/earth2me/essentials/User.java | 11 ++ .../essentials/commands/Commandrecipe.java | 167 ++++++++++++++++++ Essentials/src/messages.properties | 11 ++ Essentials/src/messages_cs.properties | 11 ++ Essentials/src/messages_da.properties | 11 ++ Essentials/src/messages_de.properties | 11 ++ Essentials/src/messages_en.properties | 11 ++ Essentials/src/messages_es.properties | 11 ++ Essentials/src/messages_fi.properties | 11 ++ Essentials/src/messages_fr.properties | 11 ++ Essentials/src/messages_it.properties | 11 ++ Essentials/src/messages_nl.properties | 11 ++ Essentials/src/messages_pl.properties | 11 ++ Essentials/src/messages_pt.properties | 11 ++ Essentials/src/messages_se.properties | 11 ++ Essentials/src/plugin.yml | 4 + 17 files changed, 343 insertions(+), 1 deletion(-) create mode 100755 Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index 2b0704779..433fe816f 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -538,6 +538,14 @@ public class EssentialsPlayerListener implements Listener event.setCancelled(true); } } + else if (event.getView().getTopInventory().getType() == InventoryType.WORKBENCH) + { + User user = ess.getUser(event.getWhoClicked()); + if (user.isRecipeSee()) + { + event.setCancelled(true); + } + } } @EventHandler(priority = EventPriority.MONITOR) @@ -553,8 +561,17 @@ public class EssentialsPlayerListener implements Listener final User user = ess.getUser(event.getPlayer()); user.setEnderSee(false); } + if (event.getView().getTopInventory().getType() == InventoryType.WORKBENCH) + { + final User user = ess.getUser(event.getPlayer()); + if(user.isRecipeSee()) + { + user.setRecipeSee(false); + event.getView().getTopInventory().clear(); + } + } } - + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerFishEvent(final PlayerFishEvent event) { diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index 5de4b7609..1c5d04530 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -29,6 +29,7 @@ public class User extends UserData implements Comparable, IReplyTo, IUser private boolean rightClickJump = false; private transient Location afkPosition = null; private boolean invSee = false; + private boolean recipeSee = false; private boolean enderSee = false; private static final Logger logger = Logger.getLogger("Minecraft"); @@ -743,4 +744,14 @@ public class User extends UserData implements Comparable, IReplyTo, IUser { return this.isAuthorized("essentials.chat.ignoreexempt"); } + + public boolean isRecipeSee() + { + return recipeSee; + } + + public void setRecipeSee(boolean recipeSee) + { + this.recipeSee = recipeSee; + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java new file mode 100755 index 000000000..80f7ed71a --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java @@ -0,0 +1,167 @@ +package com.earth2me.essentials.commands; + +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; +import org.bukkit.Material; +import org.bukkit.Server; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.FurnaceRecipe; +import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.Recipe; +import org.bukkit.inventory.ShapedRecipe; +import org.bukkit.inventory.ShapelessRecipe; + + +public class Commandrecipe extends EssentialsCommand +{ + public Commandrecipe() + { + super("recipe"); + } + + @Override + public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + final ItemStack item = ess.getItemDb().get(args[0]); + final List recipes = ess.getServer().getRecipesFor(item); + if (recipes.size() < 1) + { + throw new Exception(_("recipeNone", getMaterialName(item))); + } + int recipeNo = 0; + if (args.length > 1) + { + if (Util.isInt(args[1])) + { + recipeNo = Integer.parseInt(args[1]) - 1; + } + else + { + throw new Exception(_("invalidNumber")); + } + } + if (recipeNo < 0 || recipeNo >= recipes.size()) + { + throw new Exception(_("recipeBadIndex")); + } + final Recipe recipe = recipes.get(recipeNo); + sender.sendMessage(_("recipe", getMaterialName(item), recipeNo + 1, recipes.size())); + if (recipe instanceof FurnaceRecipe) + { + furnaceRecipe(sender, (FurnaceRecipe)recipe); + } + else if (recipe instanceof ShapedRecipe) + { + shapedRecipe(sender, (ShapedRecipe)recipe); + } + else if (recipe instanceof ShapelessRecipe) + { + shapelessRecipe(sender, (ShapelessRecipe)recipe); + } + if (recipes.size() > 1 && args.length == 1) + { + sender.sendMessage(_("recipeMore", commandLabel, args[0], getMaterialName(item))); + } + } + + public void furnaceRecipe(CommandSender sender, FurnaceRecipe recipe) + { + sender.sendMessage(_("recipeFurnace", getMaterialName(recipe.getInput()))); + } + + public void shapedRecipe(CommandSender sender, ShapedRecipe recipe) + { + Map recipeMap = recipe.getIngredientMap(); + if (!(sender instanceof Player)) + { + HashMap colorMap = new HashMap(); + int i = 1; + for (Character c : "abcdefghi".toCharArray()) + { + if (!colorMap.containsKey(recipeMap.get(c))) + { + colorMap.put(recipeMap.get(c), String.valueOf(i++)); + } + } + sender.sendMessage(_("recipeGrid", colorMap.get(recipeMap.get('a')), colorMap.get(recipeMap.get('b')), colorMap.get(recipeMap.get('c')))); + sender.sendMessage(_("recipeGrid", colorMap.get(recipeMap.get('d')), colorMap.get(recipeMap.get('e')), colorMap.get(recipeMap.get('f')))); + sender.sendMessage(_("recipeGrid", colorMap.get(recipeMap.get('g')), colorMap.get(recipeMap.get('h')), colorMap.get(recipeMap.get('i')))); + + StringBuilder s = new StringBuilder(); + for (ItemStack items : colorMap.keySet().toArray(new ItemStack[colorMap.size()])) + { + s.append(_("recipeGridItem", colorMap.get(items), getMaterialName(items))); + } + sender.sendMessage(_("recipeWhere", s.toString())); + } + else + { + User user = ess.getUser(sender); + user.setRecipeSee(true); + InventoryView view = user.openWorkbench(null, true); + for (Entry e : ((ShapedRecipe)recipe).getIngredientMap().entrySet()) + { + view.setItem(" abcdefghi".indexOf(e.getKey()), e.getValue()); + } + } + } + + public void shapelessRecipe(CommandSender sender, ShapelessRecipe recipe) + { + List ingredients = recipe.getIngredientList(); + if (!(sender instanceof Player)) + { + 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(_("recipeShapeless", s.toString())); + } + else + { + User user = ess.getUser(sender); + user.setRecipeSee(true); + InventoryView view = user.openWorkbench(null, true); + for (int i = 0; i < ingredients.size(); i++) + { + view.setItem(i + 1, ingredients.get(i)); + } + } + } + + public String getMaterialName(ItemStack stack) + { + if (stack == null) + { + return _("recipeNothing"); + } + return getMaterialName(stack.getType()); + } + + public String getMaterialName(Material type) + { + if (type == null) + { + return _("recipeNothing"); + } + return type.toString().replace("_", " ").toLowerCase(Locale.ENGLISH); + } +} \ No newline at end of file diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index a84e9cdab..170f4b371 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -467,3 +467,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index dca74c0e0..37a2e5c78 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -470,3 +470,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index e9099f3cf..bf8105ea6 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -467,3 +467,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 35f584f52..1e4af4cb6 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -467,3 +467,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index a84e9cdab..170f4b371 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -467,3 +467,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index c3bbfb80c..c9eb4562e 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -467,3 +467,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index ceb44335e..ccfe32b4b 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -467,3 +467,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index bed11e666..1a45b51c4 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -467,3 +467,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index 9afb93c4d..c6ee3e5d8 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -467,3 +467,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 5ec926da5..589ca60e1 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -467,3 +467,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index a3c27652c..9b9ff06b8 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -467,3 +467,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 5aa293a73..a0ebd8ad5 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -467,3 +467,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index 3a184f675..4b8f5ae4e 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -467,3 +467,14 @@ teleportationDisabledFor=\u00a76Teleportation disabled for {0} kitOnce=\u00a74You can't use that kit again. fullStack=\u00a74You already have a full stack oversizedTempban=\u00a74You may not ban a player for this period of time. +recipeNone=No recipes exist for {0} +invalidNumber=Invalid Number +recipeBadIndex=There is no recipe by that number +recipeNothing=nothing +recipeShapeless=\u00a7eCombine \u00a7c{0} +recipe=\u00a76Recipe for \u00a7c{0}\u00a76 ({1} of {2}) +recipeFurnace=\u00a76Smelt \u00a7c{0} +recipeGrid=\u00a7{0}X \u00a76| \u00a7{1}X \u00a76| \u00a7{2}X +recipeGridItem=\ \u00a7{0}X \u00a76is \u00a7c{1} +recipeMore=\u00a76Type /{0} \u00a7c{1}\u00a76 to see other recipes for \u00a7c{2} +recipeWhere=\u00a76Where: {0} diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index ab9b2438e..bd6aea253 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -278,6 +278,10 @@ commands: description: Displays the username of a user based on nick. usage: / aliases: [erealname] + recipe: + description: Displays how to craft items. + usage: / [number] + aliases: [erecipe] remove: description: Removes entities in your world usage: / [radius] From 87f5ec491e465ff14557b9bd4d08dcec62324540 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 19 Dec 2012 19:10:02 +1100 Subject: [PATCH 3/3] Simply using the SnakeYaml default (which in turn defaults to Class.forName) appears to be enough to get the classes for our custom configuration. This avoid Bukkit depreciation. --- .../essentials/storage/BukkitConstructor.java | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java index b6fbe3b33..e5fc19ea3 100644 --- a/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java +++ b/Essentials/src/com/earth2me/essentials/storage/BukkitConstructor.java @@ -284,7 +284,8 @@ public class BukkitConstructor extends Constructor final Field typeDefField = Constructor.class.getDeclaredField("typeDefinitions"); typeDefField.setAccessible(true); typeDefinitions = (Map, TypeDescription>)typeDefField.get((Constructor)BukkitConstructor.this); - if (typeDefinitions == null) { + if (typeDefinitions == null) + { throw new NullPointerException(); } } @@ -402,29 +403,4 @@ public class BukkitConstructor extends Constructor return object; } } - - @Override - protected Class getClassForNode(final Node node) - { - Class clazz; - final String name = node.getTag().getClassName(); - if (plugin == null) - { - clazz = super.getClassForNode(node); - } - else - { - final JavaPluginLoader jpl = (JavaPluginLoader)plugin.getPluginLoader(); - clazz = jpl.getClassByName(name); - } - - if (clazz == null) - { - throw new YAMLException("Class not found: " + name); - } - else - { - return clazz; - } - } }