From 7df0802e88e87f7a875950cad99fdc87e2bab985 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Wed, 19 Dec 2012 22:36:37 +1100 Subject: Fix indents, file perms (sorry! XD) --- .../src/net/ess3/commands/Commandrecipe.java | 264 ++++++++++----------- .../ess3/listener/EssentialsPlayerListener.java | 36 +-- Essentials/src/net/ess3/user/User.java | 6 +- 3 files changed, 153 insertions(+), 153 deletions(-) mode change 100755 => 100644 Essentials/src/net/ess3/commands/Commandrecipe.java mode change 100755 => 100644 Essentials/src/net/ess3/listener/EssentialsPlayerListener.java mode change 100755 => 100644 Essentials/src/net/ess3/user/User.java diff --git a/Essentials/src/net/ess3/commands/Commandrecipe.java b/Essentials/src/net/ess3/commands/Commandrecipe.java old mode 100755 new mode 100644 index d367da5e7..667cf23c4 --- a/Essentials/src/net/ess3/commands/Commandrecipe.java +++ b/Essentials/src/net/ess3/commands/Commandrecipe.java @@ -18,142 +18,142 @@ import java.util.Map; public class Commandrecipe extends EssentialsCommand { - @Override - public void run(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))); - } - } + @Override + public void run(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 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 IUser) - { - IUser user = getUser(sender); - user.setRecipeSee(true); - InventoryView view = user.getPlayer().openWorkbench(null, true); - for (Map.Entry e : recipe.getIngredientMap().entrySet()) - { - view.setItem(" abcdefghi".indexOf(e.getKey()), e.getValue()); - } - } - else - { - 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')))); + public void shapedRecipe(CommandSender sender, ShapedRecipe recipe) + { + Map recipeMap = recipe.getIngredientMap(); + if (sender instanceof IUser) + { + IUser user = getUser(sender); + user.setRecipeSee(true); + InventoryView view = user.getPlayer().openWorkbench(null, true); + for (Map.Entry e : recipe.getIngredientMap().entrySet()) + { + view.setItem(" abcdefghi".indexOf(e.getKey()), e.getValue()); + } + } + else + { + 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())); - } - } + 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())); + } + } - public void shapelessRecipe(CommandSender sender, ShapelessRecipe recipe) - { - List ingredients = recipe.getIngredientList(); - if (sender instanceof IUser) - { - IUser user = getUser(sender); - user.setRecipeSee(true); - InventoryView view = user.getPlayer().openWorkbench(null, true); - for (int i = 0; i < ingredients.size(); i++) - { - view.setItem(i + 1, ingredients.get(i)); - } - } - else - { - ess.getLogger().info(sender.getClass().getName()); - 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())); - } - } + public void shapelessRecipe(CommandSender sender, ShapelessRecipe recipe) + { + List ingredients = recipe.getIngredientList(); + if (sender instanceof IUser) + { + IUser user = getUser(sender); + user.setRecipeSee(true); + InventoryView view = user.getPlayer().openWorkbench(null, true); + for (int i = 0; i < ingredients.size(); i++) + { + view.setItem(i + 1, ingredients.get(i)); + } + } + else + { + ess.getLogger().info(sender.getClass().getName()); + 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())); + } + } - public String getMaterialName(ItemStack stack) - { - if (stack == null) - { - return _("recipeNothing"); - } - return getMaterialName(stack.getType()); - } + 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); - } + 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/net/ess3/listener/EssentialsPlayerListener.java b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java old mode 100755 new mode 100644 index 277820fba..de737a79c --- a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java @@ -495,14 +495,14 @@ public class EssentialsPlayerListener implements Listener } } } - if (event.getView().getTopInventory().getType() == InventoryType.WORKBENCH) - { - final IUser user = ess.getUserMap().getUser((Player)event.getWhoClicked()); - if(user.isRecipeSee()) - { - event.setCancelled(true); - } - } + if (event.getView().getTopInventory().getType() == InventoryType.WORKBENCH) + { + final IUser user = ess.getUserMap().getUser((Player)event.getWhoClicked()); + if(user.isRecipeSee()) + { + event.setCancelled(true); + } + } } @EventHandler(priority = EventPriority.MONITOR) @@ -513,17 +513,17 @@ public class EssentialsPlayerListener implements Listener final IUser user = ess.getUserMap().getUser((Player)event.getPlayer()); user.setInvSee(false); } - else if (event.getView().getTopInventory().getType() == InventoryType.WORKBENCH) - { - final IUser user = ess.getUserMap().getUser((Player)event.getPlayer()); - if(user.isRecipeSee()) - { - user.setRecipeSee(false); - event.getView().getTopInventory().clear(); - } - } + else if (event.getView().getTopInventory().getType() == InventoryType.WORKBENCH) + { + final IUser user = ess.getUserMap().getUser((Player)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/net/ess3/user/User.java b/Essentials/src/net/ess3/user/User.java old mode 100755 new mode 100644 index 9aa10d366..aaae52ead --- a/Essentials/src/net/ess3/user/User.java +++ b/Essentials/src/net/ess3/user/User.java @@ -54,9 +54,9 @@ public class User extends UserBase implements IUser private transient Location afkPosition; private AtomicBoolean gotMailInfo = new AtomicBoolean(false); private WeakReference playerCache; - @Getter - @Setter - private boolean recipeSee = false; + @Getter + @Setter + private boolean recipeSee = false; public User(final OfflinePlayer base, final IEssentials ess) throws InvalidNameException { -- cgit v1.2.3