diff options
author | snowleo <schneeleo@gmail.com> | 2013-04-07 15:00:40 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2013-04-07 15:00:40 +0200 |
commit | dbf0125eec13ada653bb1c9134f689f56d5c5e83 (patch) | |
tree | 115554e27f51d101751dbd09dba473a5c17b4c50 | |
parent | ee98136fc50f842231cb9052c40578d54e3d75a6 (diff) | |
download | Essentials-dbf0125eec13ada653bb1c9134f689f56d5c5e83.tar Essentials-dbf0125eec13ada653bb1c9134f689f56d5c5e83.tar.gz Essentials-dbf0125eec13ada653bb1c9134f689f56d5c5e83.tar.lz Essentials-dbf0125eec13ada653bb1c9134f689f56d5c5e83.tar.xz Essentials-dbf0125eec13ada653bb1c9134f689f56d5c5e83.zip |
Format everything using Netbeans
135 files changed, 1575 insertions, 1710 deletions
diff --git a/Essentials/nb-configuration.xml b/Essentials/nb-configuration.xml index 3486bc9d7..ee640467a 100644 --- a/Essentials/nb-configuration.xml +++ b/Essentials/nb-configuration.xml @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> <project-shared-configuration> + <!-- + This file contains additional configuration written by modules in the NetBeans IDE. + The configuration is intended to be shared among all the users of project and + therefore it is assumed to be part of version control checkout. + Without this configuration present, some functionality in the IDE may be limited or fail altogether. + --> + <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> <!-- -This file contains additional configuration written by modules in the NetBeans IDE. -The configuration is intended to be shared among all the users of project and -therefore it is assumed to be part of version control checkout. -Without this configuration present, some functionality in the IDE may be limited or fail altogether. ---> - <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> - <!-- -Properties that influence various parts of the IDE, especially code formatting and the like. -You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. -That way multiple projects can share the same settings (useful for formatting rules for example). -Any value defined here will override the pom.xml file value but is only applicable to the current project. ---> - <netbeans.compile.on.save>all</netbeans.compile.on.save> - </properties> + Properties that influence various parts of the IDE, especially code formatting and the like. + You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. + That way multiple projects can share the same settings (useful for formatting rules for example). + Any value defined here will override the pom.xml file value but is only applicable to the current project. + --> + <netbeans.compile.on.save>all</netbeans.compile.on.save> + </properties> </project-shared-configuration> diff --git a/Essentials/src/net/ess3/I18n.java b/Essentials/src/net/ess3/I18n.java index 081658614..9cc7b10dd 100644 --- a/Essentials/src/net/ess3/I18n.java +++ b/Essentials/src/net/ess3/I18n.java @@ -67,7 +67,7 @@ public class I18n implements II18n return string; } } - + public static String _(final String string) { if (instance == null) @@ -99,12 +99,11 @@ public class I18n implements II18n MessageFormat messageFormat = messageFormatCache.get(format); if (messageFormat == null) { - messageFormat = new MessageFormat(format.replace("'","''")); + messageFormat = new MessageFormat(format.replace("'", "''")); messageFormatCache.put(format, messageFormat); } return messageFormat.format(objects); } - private final Pattern partSplit = Pattern.compile("[_\\.]"); public void updateLocale(final String loc) diff --git a/Essentials/src/net/ess3/ItemDb.java b/Essentials/src/net/ess3/ItemDb.java index 497042e74..3a2113dcc 100644 --- a/Essentials/src/net/ess3/ItemDb.java +++ b/Essentials/src/net/ess3/ItemDb.java @@ -26,7 +26,6 @@ public class ItemDb implements IItemDb this.ess = ess; file = new ManagedFile("items.csv", ess); } - private final Map<String, Long> items = new HashMap<String, Long>(); private final ManagedFile file; private static final Pattern SPLIT = Pattern.compile("[^a-zA-Z0-9]"); @@ -95,7 +94,6 @@ public class ItemDb implements IItemDb retval.setAmount(quantity); return retval; } - private final Pattern idMatch = Pattern.compile("^\\d+[:+',;.]\\d+$"); private final Pattern metaSplit = Pattern.compile("[:+',;.]"); private final Pattern conjoined = Pattern.compile("^[^:+',;.]+[:+',;.]\\d+$"); diff --git a/Essentials/src/net/ess3/Jails.java b/Essentials/src/net/ess3/Jails.java index fafe3be79..d3f1679cf 100644 --- a/Essentials/src/net/ess3/Jails.java +++ b/Essentials/src/net/ess3/Jails.java @@ -110,9 +110,9 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp throw new UnsupportedOperationException("Not supported yet."); } + private class JailBlockListener implements Listener { - @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockBreak(final BlockBreakEvent event) { diff --git a/Essentials/src/net/ess3/MetaItemStack.java b/Essentials/src/net/ess3/MetaItemStack.java index 94a6d0b93..a067da49a 100644 --- a/Essentials/src/net/ess3/MetaItemStack.java +++ b/Essentials/src/net/ess3/MetaItemStack.java @@ -28,503 +28,503 @@ import org.bukkit.potion.PotionEffectType; public class MetaItemStack { - private final transient Pattern splitPattern = Pattern.compile("[:+',;.]"); - private final ItemStack stack; - private final static Map<String, DyeColor> colorMap = new HashMap<String, DyeColor>(); - private final static Map<String, FireworkEffect.Type> fireworkShape = new HashMap<String, FireworkEffect.Type>(); - private FireworkEffect.Builder builder = FireworkEffect.builder(); - private PotionEffectType pEffectType; - private PotionEffect pEffect; - private boolean validFirework = false; - private boolean validPotionEffect = false; - private boolean validPotionDuration = false; - private boolean validPotionPower = false; - private boolean completePotion = false; - private int power = 1; - private int duration = 120; - - static - { - for (DyeColor color : DyeColor.values()) - { - colorMap.put(color.name(), color); - } - for (FireworkEffect.Type type : FireworkEffect.Type.values()) - { - fireworkShape.put(type.name(), type); - } - } - - public MetaItemStack(final ItemStack stack) - { - this.stack = stack.clone(); - } - - public ItemStack getItemStack() - { - return stack; - } - - public boolean isValidFirework() - { - return validFirework; - } - - public boolean isValidPotion() - { - return validPotionEffect && validPotionDuration && validPotionPower; - } - - public FireworkEffect.Builder getFireworkBuilder() - { - return builder; - } - - public PotionEffect getPotionEffect() - { - return pEffect; - } - - public boolean completePotion() - { - return completePotion; - } - - private void resetPotionMeta() - { - pEffect = null; - pEffectType = null; - validPotionEffect = false; - validPotionDuration = false; - validPotionPower = false; - completePotion = true; - } - - public void parseStringMeta(final CommandSender sender, final boolean allowUnsafe, String[] string, int fromArg, final IEssentials ess) throws Exception - { - - for (int i = fromArg; i < string.length; i++) - { - addStringMeta(sender, allowUnsafe, string[i], ess); - } - if (validFirework) - { - if (!hasMetaPermission(sender, "firework", true, true, ess)) - { - throw new Exception(_("§4You do not have permission to apply firework meta.")); - } - FireworkEffect effect = builder.build(); - FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta(); - fmeta.addEffect(effect); - if (fmeta.getEffects().size() > 1 && !hasMetaPermission(sender, "firework-multiple", true, true, ess)) - { - throw new Exception(_("§4You cannot apply more than one charge to this firework.")); - } - stack.setItemMeta(fmeta); - } - } - - private void addStringMeta(final CommandSender sender, final boolean allowUnsafe, final String string, final IEssentials ess) throws Exception - { - final String[] split = splitPattern.split(string, 2); - if (split.length < 1) - { - return; - } - - if (split.length > 1 && split[0].equalsIgnoreCase("name") && hasMetaPermission(sender, "name", false, true, ess)) - { - final String displayName = FormatUtil.replaceFormat(split[1].replace('_', ' ')); - final ItemMeta meta = stack.getItemMeta(); - meta.setDisplayName(displayName); - stack.setItemMeta(meta); - } - else if (split.length > 1 && (split[0].equalsIgnoreCase("lore") || split[0].equalsIgnoreCase("desc")) && hasMetaPermission(sender, "lore", false, true, ess)) - { - final List<String> lore = new ArrayList<String>(); - for (String line : split[1].split("\\|")) - { - lore.add(FormatUtil.replaceFormat(line.replace('_', ' '))); - } - final ItemMeta meta = stack.getItemMeta(); - meta.setLore(lore); - stack.setItemMeta(meta); - } - else if (split.length > 1 && (split[0].equalsIgnoreCase("player") || split[0].equalsIgnoreCase("owner")) && stack.getType() == Material.SKULL_ITEM && hasMetaPermission(sender, "head", false, true, ess)) - { - if (stack.getDurability() == 3) - { - final String owner = split[1]; - final SkullMeta meta = (SkullMeta)stack.getItemMeta(); - meta.setOwner(owner); - stack.setItemMeta(meta); - } - else - { - throw new Exception(_("§4You can only set the owner of player skulls (397:3).")); - } - } - else if (split.length > 1 && split[0].equalsIgnoreCase("book") && stack.getType() == Material.WRITTEN_BOOK && hasMetaPermission(sender, "book", false, true, ess)) - { - final BookMeta meta = (BookMeta)stack.getItemMeta(); - final IText input = new BookInput("book", true, ess); - final BookPager pager = new BookPager(input); - - if (hasMetaPermission(sender, "chapter", true, true, ess) || hasMetaPermission(sender, "chapter-" + split[1].toLowerCase(Locale.ENGLISH), true, true, ess)) - { - List<String> pages = pager.getPages(split[1]); - meta.setPages(pages); - stack.setItemMeta(meta); - } - else - { - throw new Exception(_("§4You do not have permission to create dynamic books.")); - } - - } - else if (split.length > 1 && split[0].equalsIgnoreCase("author") && stack.getType() == Material.WRITTEN_BOOK && hasMetaPermission(sender, "author", false, true, ess)) - { - final String author = split[1]; - final BookMeta meta = (BookMeta)stack.getItemMeta(); - meta.setAuthor(author); - stack.setItemMeta(meta); - } - else if (split.length > 1 && split[0].equalsIgnoreCase("title") && stack.getType() == Material.WRITTEN_BOOK && hasMetaPermission(sender, "title", false, true, ess)) - { - final String title = FormatUtil.replaceFormat(split[1].replace('_', ' ')); - final BookMeta meta = (BookMeta)stack.getItemMeta(); - meta.setTitle(title); - stack.setItemMeta(meta); - } - else if (split.length > 1 && split[0].equalsIgnoreCase("power") && stack.getType() == Material.FIREWORK && hasMetaPermission(sender, "firework-power", false, true, ess)) - { - final int power = Util.isInt(split[1]) ? Integer.parseInt(split[1]) : 0; - final FireworkMeta meta = (FireworkMeta)stack.getItemMeta(); - meta.setPower(power > 3 ? 4 : power); - stack.setItemMeta(meta); - } - else if (stack.getType() == Material.FIREWORK) //WARNING - Meta for fireworks will be ignored after this point. - { - addFireworkMeta(sender, false, string, ess); - } - else if (stack.getType() == Material.POTION) //WARNING - Meta for Potions: {0}. will be ignored after this point. - { - addPotionMeta(sender, false, string, ess); - } - else if (split.length > 1 && (split[0].equalsIgnoreCase("color") || split[0].equalsIgnoreCase("colour")) - && (stack.getType() == Material.LEATHER_BOOTS - || stack.getType() == Material.LEATHER_CHESTPLATE - || stack.getType() == Material.LEATHER_HELMET - || stack.getType() == Material.LEATHER_LEGGINGS)) - { - final String[] color = split[1].split("(\\||,)"); - if (color.length == 3) - { - final int red = Util.isInt(color[0]) ? Integer.parseInt(color[0]) : 0; - final int green = Util.isInt(color[1]) ? Integer.parseInt(color[1]) : 0; - final int blue = Util.isInt(color[2]) ? Integer.parseInt(color[2]) : 0; - final LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta(); - meta.setColor(Color.fromRGB(red, green, blue)); - stack.setItemMeta(meta); - } - else - { - throw new Exception(_("§6Leather Color Syntax: color:<red>,<green>,<blue> eg: color:255,0,0.")); - } - } - else - { - parseEnchantmentStrings(sender, allowUnsafe, split, ess); - } - } - - public void addFireworkMeta(final CommandSender sender, final boolean allowShortName, final String string, final IEssentials ess) throws Exception - { - if (stack.getType() == Material.FIREWORK) - { - final String[] split = splitPattern.split(string, 2); - - if (split.length < 2) - { - return; - } - - if (split[0].equalsIgnoreCase("color") || split[0].equalsIgnoreCase("colour") || (allowShortName && split[0].equalsIgnoreCase("c"))) - { - if (validFirework) - { - if (!hasMetaPermission(sender, "firework", true, true, ess)) - { - throw new Exception(_("§4You do not have permission to apply firework meta.")); - } - FireworkEffect effect = builder.build(); - FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta(); - fmeta.addEffect(effect); - if (fmeta.getEffects().size() > 1 && !hasMetaPermission(sender, "firework-multiple", true, true, ess)) - { - throw new Exception(_("§4You cannot apply more than one charge to this firework.")); - } - stack.setItemMeta(fmeta); - builder = FireworkEffect.builder(); - } - - List<Color> primaryColors = new ArrayList<Color>(); - String[] colors = split[1].split(","); - for (String color : colors) - { - if (colorMap.containsKey(color.toUpperCase())) - { - validFirework = true; - primaryColors.add(colorMap.get(color.toUpperCase()).getFireworkColor()); - } - else - { - throw new Exception(_("§6The option §4{0} §6is not a valid value for §4{1}§6.", split[1], split[0])); - } - } - builder.withColor(primaryColors); - } - else if (split[0].equalsIgnoreCase("shape") || split[0].equalsIgnoreCase("type") || (allowShortName && (split[0].equalsIgnoreCase("s") || split[0].equalsIgnoreCase("t")))) - { - FireworkEffect.Type finalEffect; - split[1] = (split[1].equalsIgnoreCase("large") ? "BALL_LARGE" : split[1]); - if (fireworkShape.containsKey(split[1].toUpperCase())) - { - finalEffect = fireworkShape.get(split[1].toUpperCase()); - } - else - { - throw new Exception(_("§6The option §4{0} §6is not a valid value for §4{1}§6.", split[1], split[0])); - } - if (finalEffect != null) - { - builder.with(finalEffect); - } - } - else if (split[0].equalsIgnoreCase("fade") || (allowShortName && split[0].equalsIgnoreCase("f"))) - { - List<Color> fadeColors = new ArrayList<Color>(); - String[] colors = split[1].split(","); - for (String color : colors) - { - if (colorMap.containsKey(color.toUpperCase())) - { - fadeColors.add(colorMap.get(color.toUpperCase()).getFireworkColor()); - } - else - { - throw new Exception(_("§6The option §4{0} §6is not a valid value for §4{1}§6.", split[1], split[0])); - } - } - if (!fadeColors.isEmpty()) - { - builder.withFade(fadeColors); - } - } - else if (split[0].equalsIgnoreCase("effect") || (allowShortName && split[0].equalsIgnoreCase("e"))) - { - String[] effects = split[1].split(","); - for (String effect : effects) - { - if (effect.equalsIgnoreCase("twinkle")) - { - builder.flicker(true); - } - else if (effect.equalsIgnoreCase("trail")) - { - builder.trail(true); - } - else - { - throw new Exception(_("§6The option §4{0} §6is not a valid value for §4{1}§6.", split[1], split[0])); - } - } - } - } - } - - public void addPotionMeta(final CommandSender sender, final boolean allowShortName, final String string, final IEssentials ess) throws Exception - { - if (stack.getType() == Material.POTION) - { - final String[] split = splitPattern.split(string, 2); - - if (split.length < 2) - { - return; - } - - if (split[0].equalsIgnoreCase("effect") || (allowShortName && split[0].equalsIgnoreCase("e"))) - { - pEffectType = Potions.getByName(split[1]); - if (pEffectType != null && pEffectType.getName() != null) - { - if (hasMetaPermission(sender, "Potions: {0}.." + pEffectType.getName().toLowerCase(Locale.ENGLISH), true, false, ess)) - { - validPotionEffect = true; - } - else - { - throw new Exception(_("§4You do not have permission to apply potion effect §c{0} §4to this potion.", pEffectType.getName().toLowerCase(Locale.ENGLISH))); - } - } - else - { - throw new Exception(_("§4Invalid potion meta: §c{0}§4.", split[1])); - } - } - else if (split[0].equalsIgnoreCase("power") || (allowShortName && split[0].equalsIgnoreCase("p"))) - { - if (Util.isInt(split[1])) - { - validPotionPower = true; - power = Integer.parseInt(split[1]); - if (power > 0 && power < 4) - { - power -= 1; - } - } - else - { - throw new Exception(_("§4Invalid potion meta: §c{0}§4.", split[1])); - } - } - else if (split[0].equalsIgnoreCase("duration") || (allowShortName && split[0].equalsIgnoreCase("d"))) - { - if (Util.isInt(split[1])) - { - validPotionDuration = true; - duration = Integer.parseInt(split[1]) * 20; //Duration is in ticks by default, converted to seconds - } - else - { - throw new Exception(_("§4Invalid potion meta: §c{0}§4.", split[1])); - } - } - - if (isValidPotion()) - { - PotionMeta pmeta = (PotionMeta)stack.getItemMeta(); - pEffect = pEffectType.createEffect(duration, power); - if (pmeta.getCustomEffects().size() > 1 && !hasMetaPermission(sender, "Potions: {0}..multiple", true, false, ess)) - { - throw new Exception(_("§4You cannot apply more than one effect to this potion.")); - } - pmeta.addCustomEffect(pEffect, true); - stack.setItemMeta(pmeta); - resetPotionMeta(); - } - } - } - - private void parseEnchantmentStrings(final CommandSender sender, final boolean allowUnsafe, final String[] split, final IEssentials ess) throws Exception - { - final Enchantment enchantment = Enchantments.getByName(split[0]); - if (enchantment == null || !hasMetaPermission(sender, "enchantments." + enchantment.getName().toLowerCase(Locale.ENGLISH), false, false, ess)) - { - return; - } - - int level = -1; - if (split.length > 1) - { - try - { - level = Integer.parseInt(split[1]); - } - catch (NumberFormatException ex) - { - level = -1; - } - } - - if (level < 0 || (!allowUnsafe && level > enchantment.getMaxLevel())) - { - level = enchantment.getMaxLevel(); - } - addEnchantment(sender, allowUnsafe, enchantment, level); - } - - public void addEnchantment(final CommandSender sender, final boolean allowUnsafe, final Enchantment enchantment, final int level) throws Exception - { - try - { - if (stack.getType().equals(Material.ENCHANTED_BOOK)) - { - EnchantmentStorageMeta meta = (EnchantmentStorageMeta)stack.getItemMeta(); - if (level == 0) - { - meta.removeStoredEnchant(enchantment); - } - else - { - meta.addStoredEnchant(enchantment, level, allowUnsafe); - } - stack.setItemMeta(meta); - } - else // all other material types besides ENCHANTED_BOOK - { - if (level == 0) - { - stack.removeEnchantment(enchantment); - } - else - { - if (allowUnsafe) - { - stack.addUnsafeEnchantment(enchantment, level); - } - else - { - stack.addEnchantment(enchantment, level); - } - } - } - } - catch (Exception ex) - { - throw new Exception("Enchantment " + enchantment.getName() + ": " + ex.getMessage(), ex); - } - } - - public Enchantment getEnchantment(final IUser user, final String name) throws Exception - { - final Enchantment enchantment = Enchantments.getByName(name); - if (enchantment == null) - { - return null; - } - - final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); - - if (!hasMetaPermission(user, "enchantments." + enchantmentName, true, false)) - { - throw new Exception(_("§4You do not have the permission for§c {0}§4.", enchantmentName)); - } - return enchantment; - } - - private boolean hasMetaPermission(final CommandSender sender, final String metaPerm, final boolean graceful, final boolean includeBase, final IEssentials ess) throws Exception - { - final IUser user = ess.getUserMap().getUser((Player)sender); - - return hasMetaPermission(user, metaPerm, graceful, includeBase); - } - - private boolean hasMetaPermission(final IUser user, final String metaPerm, final boolean graceful, final boolean includeBase) throws Exception - { - if (user == null || (includeBase ? Permissions.ITEMSPAWN.isAuthorized(user, "meta-" + metaPerm) : Permissions.ESSENTIALS.isAuthorized(user, metaPerm))) - { - return true; - } - - if (graceful) - { - return false; - } - else - { - throw new Exception(_("§4You do not have permission to apply §c{0}§4 meta to this item.", metaPerm)); - } - } + private final transient Pattern splitPattern = Pattern.compile("[:+',;.]"); + private final ItemStack stack; + private final static Map<String, DyeColor> colorMap = new HashMap<String, DyeColor>(); + private final static Map<String, FireworkEffect.Type> fireworkShape = new HashMap<String, FireworkEffect.Type>(); + private FireworkEffect.Builder builder = FireworkEffect.builder(); + private PotionEffectType pEffectType; + private PotionEffect pEffect; + private boolean validFirework = false; + private boolean validPotionEffect = false; + private boolean validPotionDuration = false; + private boolean validPotionPower = false; + private boolean completePotion = false; + private int power = 1; + private int duration = 120; + + static + { + for (DyeColor color : DyeColor.values()) + { + colorMap.put(color.name(), color); + } + for (FireworkEffect.Type type : FireworkEffect.Type.values()) + { + fireworkShape.put(type.name(), type); + } + } + + public MetaItemStack(final ItemStack stack) + { + this.stack = stack.clone(); + } + + public ItemStack getItemStack() + { + return stack; + } + + public boolean isValidFirework() + { + return validFirework; + } + + public boolean isValidPotion() + { + return validPotionEffect && validPotionDuration && validPotionPower; + } + + public FireworkEffect.Builder getFireworkBuilder() + { + return builder; + } + + public PotionEffect getPotionEffect() + { + return pEffect; + } + + public boolean completePotion() + { + return completePotion; + } + + private void resetPotionMeta() + { + pEffect = null; + pEffectType = null; + validPotionEffect = false; + validPotionDuration = false; + validPotionPower = false; + completePotion = true; + } + + public void parseStringMeta(final CommandSender sender, final boolean allowUnsafe, String[] string, int fromArg, final IEssentials ess) throws Exception + { + + for (int i = fromArg; i < string.length; i++) + { + addStringMeta(sender, allowUnsafe, string[i], ess); + } + if (validFirework) + { + if (!hasMetaPermission(sender, "firework", true, true, ess)) + { + throw new Exception(_("§4You do not have permission to apply firework meta.")); + } + FireworkEffect effect = builder.build(); + FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta(); + fmeta.addEffect(effect); + if (fmeta.getEffects().size() > 1 && !hasMetaPermission(sender, "firework-multiple", true, true, ess)) + { + throw new Exception(_("§4You cannot apply more than one charge to this firework.")); + } + stack.setItemMeta(fmeta); + } + } + + private void addStringMeta(final CommandSender sender, final boolean allowUnsafe, final String string, final IEssentials ess) throws Exception + { + final String[] split = splitPattern.split(string, 2); + if (split.length < 1) + { + return; + } + + if (split.length > 1 && split[0].equalsIgnoreCase("name") && hasMetaPermission(sender, "name", false, true, ess)) + { + final String displayName = FormatUtil.replaceFormat(split[1].replace('_', ' ')); + final ItemMeta meta = stack.getItemMeta(); + meta.setDisplayName(displayName); + stack.setItemMeta(meta); + } + else if (split.length > 1 && (split[0].equalsIgnoreCase("lore") || split[0].equalsIgnoreCase("desc")) && hasMetaPermission(sender, "lore", false, true, ess)) + { + final List<String> lore = new ArrayList<String>(); + for (String line : split[1].split("\\|")) + { + lore.add(FormatUtil.replaceFormat(line.replace('_', ' '))); + } + final ItemMeta meta = stack.getItemMeta(); + meta.setLore(lore); + stack.setItemMeta(meta); + } + else if (split.length > 1 && (split[0].equalsIgnoreCase("player") || split[0].equalsIgnoreCase("owner")) && stack.getType() == Material.SKULL_ITEM && hasMetaPermission(sender, "head", false, true, ess)) + { + if (stack.getDurability() == 3) + { + final String owner = split[1]; + final SkullMeta meta = (SkullMeta)stack.getItemMeta(); + meta.setOwner(owner); + stack.setItemMeta(meta); + } + else + { + throw new Exception(_("§4You can only set the owner of player skulls (397:3).")); + } + } + else if (split.length > 1 && split[0].equalsIgnoreCase("book") && stack.getType() == Material.WRITTEN_BOOK && hasMetaPermission(sender, "book", false, true, ess)) + { + final BookMeta meta = (BookMeta)stack.getItemMeta(); + final IText input = new BookInput("book", true, ess); + final BookPager pager = new BookPager(input); + + if (hasMetaPermission(sender, "chapter", true, true, ess) || hasMetaPermission(sender, "chapter-" + split[1].toLowerCase(Locale.ENGLISH), true, true, ess)) + { + List<String> pages = pager.getPages(split[1]); + meta.setPages(pages); + stack.setItemMeta(meta); + } + else + { + throw new Exception(_("§4You do not have permission to create dynamic books.")); + } + + } + else if (split.length > 1 && split[0].equalsIgnoreCase("author") && stack.getType() == Material.WRITTEN_BOOK && hasMetaPermission(sender, "author", false, true, ess)) + { + final String author = split[1]; + final BookMeta meta = (BookMeta)stack.getItemMeta(); + meta.setAuthor(author); + stack.setItemMeta(meta); + } + else if (split.length > 1 && split[0].equalsIgnoreCase("title") && stack.getType() == Material.WRITTEN_BOOK && hasMetaPermission(sender, "title", false, true, ess)) + { + final String title = FormatUtil.replaceFormat(split[1].replace('_', ' ')); + final BookMeta meta = (BookMeta)stack.getItemMeta(); + meta.setTitle(title); + stack.setItemMeta(meta); + } + else if (split.length > 1 && split[0].equalsIgnoreCase("power") && stack.getType() == Material.FIREWORK && hasMetaPermission(sender, "firework-power", false, true, ess)) + { + final int power = Util.isInt(split[1]) ? Integer.parseInt(split[1]) : 0; + final FireworkMeta meta = (FireworkMeta)stack.getItemMeta(); + meta.setPower(power > 3 ? 4 : power); + stack.setItemMeta(meta); + } + else if (stack.getType() == Material.FIREWORK) //WARNING - Meta for fireworks will be ignored after this point. + { + addFireworkMeta(sender, false, string, ess); + } + else if (stack.getType() == Material.POTION) //WARNING - Meta for Potions: {0}. will be ignored after this point. + { + addPotionMeta(sender, false, string, ess); + } + else if (split.length > 1 && (split[0].equalsIgnoreCase("color") || split[0].equalsIgnoreCase("colour")) + && (stack.getType() == Material.LEATHER_BOOTS + || stack.getType() == Material.LEATHER_CHESTPLATE + || stack.getType() == Material.LEATHER_HELMET + || stack.getType() == Material.LEATHER_LEGGINGS)) + { + final String[] color = split[1].split("(\\||,)"); + if (color.length == 3) + { + final int red = Util.isInt(color[0]) ? Integer.parseInt(color[0]) : 0; + final int green = Util.isInt(color[1]) ? Integer.parseInt(color[1]) : 0; + final int blue = Util.isInt(color[2]) ? Integer.parseInt(color[2]) : 0; + final LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta(); + meta.setColor(Color.fromRGB(red, green, blue)); + stack.setItemMeta(meta); + } + else + { + throw new Exception(_("§6Leather Color Syntax: color:<red>,<green>,<blue> eg: color:255,0,0.")); + } + } + else + { + parseEnchantmentStrings(sender, allowUnsafe, split, ess); + } + } + + public void addFireworkMeta(final CommandSender sender, final boolean allowShortName, final String string, final IEssentials ess) throws Exception + { + if (stack.getType() == Material.FIREWORK) + { + final String[] split = splitPattern.split(string, 2); + + if (split.length < 2) + { + return; + } + + if (split[0].equalsIgnoreCase("color") || split[0].equalsIgnoreCase("colour") || (allowShortName && split[0].equalsIgnoreCase("c"))) + { + if (validFirework) + { + if (!hasMetaPermission(sender, "firework", true, true, ess)) + { + throw new Exception(_("§4You do not have permission to apply firework meta.")); + } + FireworkEffect effect = builder.build(); + FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta(); + fmeta.addEffect(effect); + if (fmeta.getEffects().size() > 1 && !hasMetaPermission(sender, "firework-multiple", true, true, ess)) + { + throw new Exception(_("§4You cannot apply more than one charge to this firework.")); + } + stack.setItemMeta(fmeta); + builder = FireworkEffect.builder(); + } + + List<Color> primaryColors = new ArrayList<Color>(); + String[] colors = split[1].split(","); + for (String color : colors) + { + if (colorMap.containsKey(color.toUpperCase())) + { + validFirework = true; + primaryColors.add(colorMap.get(color.toUpperCase()).getFireworkColor()); + } + else + { + throw new Exception(_("§6The option §4{0} §6is not a valid value for §4{1}§6.", split[1], split[0])); + } + } + builder.withColor(primaryColors); + } + else if (split[0].equalsIgnoreCase("shape") || split[0].equalsIgnoreCase("type") || (allowShortName && (split[0].equalsIgnoreCase("s") || split[0].equalsIgnoreCase("t")))) + { + FireworkEffect.Type finalEffect; + split[1] = (split[1].equalsIgnoreCase("large") ? "BALL_LARGE" : split[1]); + if (fireworkShape.containsKey(split[1].toUpperCase())) + { + finalEffect = fireworkShape.get(split[1].toUpperCase()); + } + else + { + throw new Exception(_("§6The option §4{0} §6is not a valid value for §4{1}§6.", split[1], split[0])); + } + if (finalEffect != null) + { + builder.with(finalEffect); + } + } + else if (split[0].equalsIgnoreCase("fade") || (allowShortName && split[0].equalsIgnoreCase("f"))) + { + List<Color> fadeColors = new ArrayList<Color>(); + String[] colors = split[1].split(","); + for (String color : colors) + { + if (colorMap.containsKey(color.toUpperCase())) + { + fadeColors.add(colorMap.get(color.toUpperCase()).getFireworkColor()); + } + else + { + throw new Exception(_("§6The option §4{0} §6is not a valid value for §4{1}§6.", split[1], split[0])); + } + } + if (!fadeColors.isEmpty()) + { + builder.withFade(fadeColors); + } + } + else if (split[0].equalsIgnoreCase("effect") || (allowShortName && split[0].equalsIgnoreCase("e"))) + { + String[] effects = split[1].split(","); + for (String effect : effects) + { + if (effect.equalsIgnoreCase("twinkle")) + { + builder.flicker(true); + } + else if (effect.equalsIgnoreCase("trail")) + { + builder.trail(true); + } + else + { + throw new Exception(_("§6The option §4{0} §6is not a valid value for §4{1}§6.", split[1], split[0])); + } + } + } + } + } + + public void addPotionMeta(final CommandSender sender, final boolean allowShortName, final String string, final IEssentials ess) throws Exception + { + if (stack.getType() == Material.POTION) + { + final String[] split = splitPattern.split(string, 2); + + if (split.length < 2) + { + return; + } + + if (split[0].equalsIgnoreCase("effect") || (allowShortName && split[0].equalsIgnoreCase("e"))) + { + pEffectType = Potions.getByName(split[1]); + if (pEffectType != null && pEffectType.getName() != null) + { + if (hasMetaPermission(sender, "Potions: {0}.." + pEffectType.getName().toLowerCase(Locale.ENGLISH), true, false, ess)) + { + validPotionEffect = true; + } + else + { + throw new Exception(_("§4You do not have permission to apply potion effect §c{0} §4to this potion.", pEffectType.getName().toLowerCase(Locale.ENGLISH))); + } + } + else + { + throw new Exception(_("§4Invalid potion meta: §c{0}§4.", split[1])); + } + } + else if (split[0].equalsIgnoreCase("power") || (allowShortName && split[0].equalsIgnoreCase("p"))) + { + if (Util.isInt(split[1])) + { + validPotionPower = true; + power = Integer.parseInt(split[1]); + if (power > 0 && power < 4) + { + power -= 1; + } + } + else + { + throw new Exception(_("§4Invalid potion meta: §c{0}§4.", split[1])); + } + } + else if (split[0].equalsIgnoreCase("duration") || (allowShortName && split[0].equalsIgnoreCase("d"))) + { + if (Util.isInt(split[1])) + { + validPotionDuration = true; + duration = Integer.parseInt(split[1]) * 20; //Duration is in ticks by default, converted to seconds + } + else + { + throw new Exception(_("§4Invalid potion meta: §c{0}§4.", split[1])); + } + } + + if (isValidPotion()) + { + PotionMeta pmeta = (PotionMeta)stack.getItemMeta(); + pEffect = pEffectType.createEffect(duration, power); + if (pmeta.getCustomEffects().size() > 1 && !hasMetaPermission(sender, "Potions: {0}..multiple", true, false, ess)) + { + throw new Exception(_("§4You cannot apply more than one effect to this potion.")); + } + pmeta.addCustomEffect(pEffect, true); + stack.setItemMeta(pmeta); + resetPotionMeta(); + } + } + } + + private void parseEnchantmentStrings(final CommandSender sender, final boolean allowUnsafe, final String[] split, final IEssentials ess) throws Exception + { + final Enchantment enchantment = Enchantments.getByName(split[0]); + if (enchantment == null || !hasMetaPermission(sender, "enchantments." + enchantment.getName().toLowerCase(Locale.ENGLISH), false, false, ess)) + { + return; + } + + int level = -1; + if (split.length > 1) + { + try + { + level = Integer.parseInt(split[1]); + } + catch (NumberFormatException ex) + { + level = -1; + } + } + + if (level < 0 || (!allowUnsafe && level > enchantment.getMaxLevel())) + { + level = enchantment.getMaxLevel(); + } + addEnchantment(sender, allowUnsafe, enchantment, level); + } + + public void addEnchantment(final CommandSender sender, final boolean allowUnsafe, final Enchantment enchantment, final int level) throws Exception + { + try + { + if (stack.getType().equals(Material.ENCHANTED_BOOK)) + { + EnchantmentStorageMeta meta = (EnchantmentStorageMeta)stack.getItemMeta(); + if (level == 0) + { + meta.removeStoredEnchant(enchantment); + } + else + { + meta.addStoredEnchant(enchantment, level, allowUnsafe); + } + stack.setItemMeta(meta); + } + else // all other material types besides ENCHANTED_BOOK + { + if (level == 0) + { + stack.removeEnchantment(enchantment); + } + else + { + if (allowUnsafe) + { + stack.addUnsafeEnchantment(enchantment, level); + } + else + { + stack.addEnchantment(enchantment, level); + } + } + } + } + catch (Exception ex) + { + throw new Exception("Enchantment " + enchantment.getName() + ": " + ex.getMessage(), ex); + } + } + + public Enchantment getEnchantment(final IUser user, final String name) throws Exception + { + final Enchantment enchantment = Enchantments.getByName(name); + if (enchantment == null) + { + return null; + } + + final String enchantmentName = enchantment.getName().toLowerCase(Locale.ENGLISH); + + if (!hasMetaPermission(user, "enchantments." + enchantmentName, true, false)) + { + throw new Exception(_("§4You do not have the permission for§c {0}§4.", enchantmentName)); + } + return enchantment; + } + + private boolean hasMetaPermission(final CommandSender sender, final String metaPerm, final boolean graceful, final boolean includeBase, final IEssentials ess) throws Exception + { + final IUser user = ess.getUserMap().getUser((Player)sender); + + return hasMetaPermission(user, metaPerm, graceful, includeBase); + } + + private boolean hasMetaPermission(final IUser user, final String metaPerm, final boolean graceful, final boolean includeBase) throws Exception + { + if (user == null || (includeBase ? Permissions.ITEMSPAWN.isAuthorized(user, "meta-" + metaPerm) : Permissions.ESSENTIALS.isAuthorized(user, metaPerm))) + { + return true; + } + + if (graceful) + { + return false; + } + else + { + throw new Exception(_("§4You do not have permission to apply §c{0}§4 meta to this item.", metaPerm)); + } + } } diff --git a/Essentials/src/net/ess3/Potions.java b/Essentials/src/net/ess3/Potions.java index cd14deca2..592e0c768 100644 --- a/Essentials/src/net/ess3/Potions.java +++ b/Essentials/src/net/ess3/Potions.java @@ -12,121 +12,121 @@ import org.bukkit.potion.PotionEffectType; public class Potions { - private static final Map<String, PotionEffectType> POTIONS = new HashMap<String, PotionEffectType>(); - private static final Map<String, PotionEffectType> ALIASPOTIONS = new HashMap<String, PotionEffectType>(); - - static - { - - POTIONS.put("speed", PotionEffectType.SPEED); - ALIASPOTIONS.put("fast", PotionEffectType.SPEED); - ALIASPOTIONS.put("runfast", PotionEffectType.SPEED); - ALIASPOTIONS.put("sprint", PotionEffectType.SPEED); - ALIASPOTIONS.put("swift", PotionEffectType.SPEED); - - POTIONS.put("slowness", PotionEffectType.SLOW); - ALIASPOTIONS.put("slow", PotionEffectType.SLOW); - ALIASPOTIONS.put("sluggish", PotionEffectType.SLOW); - - POTIONS.put("haste", PotionEffectType.FAST_DIGGING); - ALIASPOTIONS.put("superpick", PotionEffectType.FAST_DIGGING); - ALIASPOTIONS.put("quickmine", PotionEffectType.FAST_DIGGING); - ALIASPOTIONS.put("digspeed", PotionEffectType.FAST_DIGGING); - ALIASPOTIONS.put("digfast", PotionEffectType.FAST_DIGGING); - ALIASPOTIONS.put("sharp", PotionEffectType.FAST_DIGGING); - - POTIONS.put("fatigue", PotionEffectType.SLOW_DIGGING); - ALIASPOTIONS.put("slow", PotionEffectType.SLOW_DIGGING); - ALIASPOTIONS.put("dull", PotionEffectType.SLOW_DIGGING); - - POTIONS.put("strength", PotionEffectType.INCREASE_DAMAGE); - ALIASPOTIONS.put("strong", PotionEffectType.INCREASE_DAMAGE); - ALIASPOTIONS.put("bull", PotionEffectType.INCREASE_DAMAGE); - ALIASPOTIONS.put("attack", PotionEffectType.INCREASE_DAMAGE); - - POTIONS.put("heal", PotionEffectType.HEAL); - ALIASPOTIONS.put("healthy", PotionEffectType.HEAL); - ALIASPOTIONS.put("instaheal", PotionEffectType.HEAL); - - POTIONS.put("harm", PotionEffectType.HARM); - ALIASPOTIONS.put("harming", PotionEffectType.HARM); - ALIASPOTIONS.put("injure", PotionEffectType.HARM); - ALIASPOTIONS.put("damage", PotionEffectType.HARM); - ALIASPOTIONS.put("inflict", PotionEffectType.HARM); - - POTIONS.put("jump", PotionEffectType.JUMP); - ALIASPOTIONS.put("leap", PotionEffectType.JUMP); - - POTIONS.put("nausea", PotionEffectType.CONFUSION); - ALIASPOTIONS.put("sick", PotionEffectType.CONFUSION); - ALIASPOTIONS.put("sickness", PotionEffectType.CONFUSION); - ALIASPOTIONS.put("confusion", PotionEffectType.CONFUSION); - - POTIONS.put("regeneration", PotionEffectType.REGENERATION); - ALIASPOTIONS.put("regen", PotionEffectType.REGENERATION); - - POTIONS.put("resistance", PotionEffectType.DAMAGE_RESISTANCE); - ALIASPOTIONS.put("dmgresist", PotionEffectType.DAMAGE_RESISTANCE); - ALIASPOTIONS.put("armor", PotionEffectType.DAMAGE_RESISTANCE); - ALIASPOTIONS.put("dmgresist", PotionEffectType.DAMAGE_RESISTANCE); - - POTIONS.put("fireresist", PotionEffectType.FIRE_RESISTANCE); - ALIASPOTIONS.put("fireresistance", PotionEffectType.FIRE_RESISTANCE); - ALIASPOTIONS.put("resistfire", PotionEffectType.FIRE_RESISTANCE); - - POTIONS.put("waterbreath", PotionEffectType.WATER_BREATHING); - ALIASPOTIONS.put("waterbreathing", PotionEffectType.WATER_BREATHING); - - POTIONS.put("invisibility", PotionEffectType.INVISIBILITY); - ALIASPOTIONS.put("invisible", PotionEffectType.INVISIBILITY); - ALIASPOTIONS.put("invis", PotionEffectType.INVISIBILITY); - ALIASPOTIONS.put("vanish", PotionEffectType.INVISIBILITY); - ALIASPOTIONS.put("disappear", PotionEffectType.INVISIBILITY); - - POTIONS.put("blindness", PotionEffectType.BLINDNESS); - ALIASPOTIONS.put("blind", PotionEffectType.BLINDNESS); - - POTIONS.put("nightvision", PotionEffectType.NIGHT_VISION); - ALIASPOTIONS.put("vision", PotionEffectType.NIGHT_VISION); - - POTIONS.put("hunger", PotionEffectType.HUNGER); - ALIASPOTIONS.put("hungry", PotionEffectType.HUNGER); - ALIASPOTIONS.put("starve", PotionEffectType.HUNGER); - - POTIONS.put("weakness", PotionEffectType.WEAKNESS); - ALIASPOTIONS.put("weak", PotionEffectType.WEAKNESS); - - POTIONS.put("poison", PotionEffectType.POISON); - ALIASPOTIONS.put("venom", PotionEffectType.POISON); - - POTIONS.put("wither", PotionEffectType.WITHER); - ALIASPOTIONS.put("decay", PotionEffectType.WITHER); - } - - public static PotionEffectType getByName(String name) - { - PotionEffectType peffect; - if (Util.isInt(name)) - { - peffect = PotionEffectType.getById(Integer.parseInt(name)); - } - else - { - peffect = PotionEffectType.getByName(name.toUpperCase(Locale.ENGLISH)); - } - if (peffect == null) - { - peffect = POTIONS.get(name.toLowerCase(Locale.ENGLISH)); - } - if (peffect == null) - { - peffect = ALIASPOTIONS.get(name.toLowerCase(Locale.ENGLISH)); - } - return peffect; - } - - public static Set<Entry<String, PotionEffectType>> entrySet() - { - return POTIONS.entrySet(); - } + private static final Map<String, PotionEffectType> POTIONS = new HashMap<String, PotionEffectType>(); + private static final Map<String, PotionEffectType> ALIASPOTIONS = new HashMap<String, PotionEffectType>(); + + static + { + + POTIONS.put("speed", PotionEffectType.SPEED); + ALIASPOTIONS.put("fast", PotionEffectType.SPEED); + ALIASPOTIONS.put("runfast", PotionEffectType.SPEED); + ALIASPOTIONS.put("sprint", PotionEffectType.SPEED); + ALIASPOTIONS.put("swift", PotionEffectType.SPEED); + + POTIONS.put("slowness", PotionEffectType.SLOW); + ALIASPOTIONS.put("slow", PotionEffectType.SLOW); + ALIASPOTIONS.put("sluggish", PotionEffectType.SLOW); + + POTIONS.put("haste", PotionEffectType.FAST_DIGGING); + ALIASPOTIONS.put("superpick", PotionEffectType.FAST_DIGGING); + ALIASPOTIONS.put("quickmine", PotionEffectType.FAST_DIGGING); + ALIASPOTIONS.put("digspeed", PotionEffectType.FAST_DIGGING); + ALIASPOTIONS.put("digfast", PotionEffectType.FAST_DIGGING); + ALIASPOTIONS.put("sharp", PotionEffectType.FAST_DIGGING); + + POTIONS.put("fatigue", PotionEffectType.SLOW_DIGGING); + ALIASPOTIONS.put("slow", PotionEffectType.SLOW_DIGGING); + ALIASPOTIONS.put("dull", PotionEffectType.SLOW_DIGGING); + + POTIONS.put("strength", PotionEffectType.INCREASE_DAMAGE); + ALIASPOTIONS.put("strong", PotionEffectType.INCREASE_DAMAGE); + ALIASPOTIONS.put("bull", PotionEffectType.INCREASE_DAMAGE); + ALIASPOTIONS.put("attack", PotionEffectType.INCREASE_DAMAGE); + + POTIONS.put("heal", PotionEffectType.HEAL); + ALIASPOTIONS.put("healthy", PotionEffectType.HEAL); + ALIASPOTIONS.put("instaheal", PotionEffectType.HEAL); + + POTIONS.put("harm", PotionEffectType.HARM); + ALIASPOTIONS.put("harming", PotionEffectType.HARM); + ALIASPOTIONS.put("injure", PotionEffectType.HARM); + ALIASPOTIONS.put("damage", PotionEffectType.HARM); + ALIASPOTIONS.put("inflict", PotionEffectType.HARM); + + POTIONS.put("jump", PotionEffectType.JUMP); + ALIASPOTIONS.put("leap", PotionEffectType.JUMP); + + POTIONS.put("nausea", PotionEffectType.CONFUSION); + ALIASPOTIONS.put("sick", PotionEffectType.CONFUSION); + ALIASPOTIONS.put("sickness", PotionEffectType.CONFUSION); + ALIASPOTIONS.put("confusion", PotionEffectType.CONFUSION); + + POTIONS.put("regeneration", PotionEffectType.REGENERATION); + ALIASPOTIONS.put("regen", PotionEffectType.REGENERATION); + + POTIONS.put("resistance", PotionEffectType.DAMAGE_RESISTANCE); + ALIASPOTIONS.put("dmgresist", PotionEffectType.DAMAGE_RESISTANCE); + ALIASPOTIONS.put("armor", PotionEffectType.DAMAGE_RESISTANCE); + ALIASPOTIONS.put("dmgresist", PotionEffectType.DAMAGE_RESISTANCE); + + POTIONS.put("fireresist", PotionEffectType.FIRE_RESISTANCE); + ALIASPOTIONS.put("fireresistance", PotionEffectType.FIRE_RESISTANCE); + ALIASPOTIONS.put("resistfire", PotionEffectType.FIRE_RESISTANCE); + + POTIONS.put("waterbreath", PotionEffectType.WATER_BREATHING); + ALIASPOTIONS.put("waterbreathing", PotionEffectType.WATER_BREATHING); + + POTIONS.put("invisibility", PotionEffectType.INVISIBILITY); + ALIASPOTIONS.put("invisible", PotionEffectType.INVISIBILITY); + ALIASPOTIONS.put("invis", PotionEffectType.INVISIBILITY); + ALIASPOTIONS.put("vanish", PotionEffectType.INVISIBILITY); + ALIASPOTIONS.put("disappear", PotionEffectType.INVISIBILITY); + + POTIONS.put("blindness", PotionEffectType.BLINDNESS); + ALIASPOTIONS.put("blind", PotionEffectType.BLINDNESS); + + POTIONS.put("nightvision", PotionEffectType.NIGHT_VISION); + ALIASPOTIONS.put("vision", PotionEffectType.NIGHT_VISION); + + POTIONS.put("hunger", PotionEffectType.HUNGER); + ALIASPOTIONS.put("hungry", PotionEffectType.HUNGER); + ALIASPOTIONS.put("starve", PotionEffectType.HUNGER); + + POTIONS.put("weakness", PotionEffectType.WEAKNESS); + ALIASPOTIONS.put("weak", PotionEffectType.WEAKNESS); + + POTIONS.put("poison", PotionEffectType.POISON); + ALIASPOTIONS.put("venom", PotionEffectType.POISON); + + POTIONS.put("wither", PotionEffectType.WITHER); + ALIASPOTIONS.put("decay", PotionEffectType.WITHER); + } + + public static PotionEffectType getByName(String name) + { + PotionEffectType peffect; + if (Util.isInt(name)) + { + peffect = PotionEffectType.getById(Integer.parseInt(name)); + } + else + { + peffect = PotionEffectType.getByName(name.toUpperCase(Locale.ENGLISH)); + } + if (peffect == null) + { + peffect = POTIONS.get(name.toLowerCase(Locale.ENGLISH)); + } + if (peffect == null) + { + peffect = ALIASPOTIONS.get(name.toLowerCase(Locale.ENGLISH)); + } + return peffect; + } + + public static Set<Entry<String, PotionEffectType>> entrySet() + { + return POTIONS.entrySet(); + } } diff --git a/Essentials/src/net/ess3/SpawnMob.java b/Essentials/src/net/ess3/SpawnMob.java index 1f4eee3b0..2d1bd2bfb 100644 --- a/Essentials/src/net/ess3/SpawnMob.java +++ b/Essentials/src/net/ess3/SpawnMob.java @@ -162,7 +162,7 @@ public class SpawnMob if (i == 0) { mob = EntityType.fromName(parts.get(i)); - spawnedMob = spawningWorld.spawn(sloc, (Class<? extends LivingEntity>) mob.getEntityClass()); + spawnedMob = spawningWorld.spawn(sloc, (Class<? extends LivingEntity>)mob.getEntityClass()); if (data.get(i) != null) { @@ -174,7 +174,7 @@ public class SpawnMob if (next < parts.size()) { EntityType mMob = EntityType.fromName(parts.get(next)); - spawnedMount = spawningWorld.spawn(sloc, (Class<? extends LivingEntity>) mMob.getEntityClass()); + spawnedMount = spawningWorld.spawn(sloc, (Class<? extends LivingEntity>)mMob.getEntityClass()); if (data.get(next) != null) { @@ -195,7 +195,7 @@ public class SpawnMob throw new Exception(_("Invalid mob type.")); } - if (!Permissions.SPAWNMOB.isAuthorized((User) sender, mob.getName())) + if (!Permissions.SPAWNMOB.isAuthorized((User)sender, mob.getName())) { throw new Exception(_("§4You don't have permission to spawn this mob.")); } @@ -209,7 +209,7 @@ public class SpawnMob { try { - ((Slime) spawned).setSize(Integer.parseInt(data)); + ((Slime)spawned).setSize(Integer.parseInt(data)); } catch (Exception e) { @@ -218,7 +218,7 @@ public class SpawnMob } if (spawned instanceof Ageable && data.contains("baby")) { - ((Ageable) spawned).setBaby(); + ((Ageable)spawned).setBaby(); data = data.replace("baby", ""); } if (spawned instanceof Colorable) @@ -229,11 +229,11 @@ public class SpawnMob if (color.equals("RANDOM")) { final Random rand = new Random(); - ((Colorable) spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]); + ((Colorable)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]); } else { - ((Colorable) spawned).setColor(DyeColor.valueOf(color)); + ((Colorable)spawned).setColor(DyeColor.valueOf(color)); } } catch (Exception e) @@ -243,32 +243,32 @@ public class SpawnMob } if (spawned instanceof Tameable && data.contains("tamed") && target != null) { - final Tameable tameable = ((Tameable) spawned); + final Tameable tameable = ((Tameable)spawned); tameable.setTamed(true); tameable.setOwner(target.getPlayer()); data = data.replace("tamed", ""); } if (type == EntityType.WOLF && data.contains("angry")) { - ((Wolf) spawned).setAngry(true); + ((Wolf)spawned).setAngry(true); } if (type == EntityType.CREEPER && data.contains("powered")) { - ((Creeper) spawned).setPowered(true); + ((Creeper)spawned).setPowered(true); } if (type == EntityType.OCELOT) { if (data.contains("siamese") || data.contains("white")) { - ((Ocelot) spawned).setCatType(Ocelot.Type.SIAMESE_CAT); + ((Ocelot)spawned).setCatType(Ocelot.Type.SIAMESE_CAT); } else if (data.contains("red") || data.contains("orange") || data.contains("tabby")) { - ((Ocelot) spawned).setCatType(Ocelot.Type.RED_CAT); + ((Ocelot)spawned).setCatType(Ocelot.Type.RED_CAT); } else if (data.contains("black") || data.contains("tuxedo")) { - ((Ocelot) spawned).setCatType(Ocelot.Type.BLACK_CAT); + ((Ocelot)spawned).setCatType(Ocelot.Type.BLACK_CAT); } } if (type == EntityType.VILLAGER) @@ -277,7 +277,7 @@ public class SpawnMob { if (data.contains(prof.toString().toLowerCase(Locale.ENGLISH))) { - ((Villager) spawned).setProfession(prof); + ((Villager)spawned).setProfession(prof); } } } @@ -285,23 +285,23 @@ public class SpawnMob { if (data.contains("villager")) { - ((Zombie) spawned).setVillager(true); + ((Zombie)spawned).setVillager(true); } if (data.contains("baby")) { - ((Zombie) spawned).setBaby(true); + ((Zombie)spawned).setBaby(true); } } if (type == EntityType.SKELETON) { if (data.contains("wither")) { - ((Skeleton) spawned).setSkeletonType(Skeleton.SkeletonType.WITHER); + ((Skeleton)spawned).setSkeletonType(Skeleton.SkeletonType.WITHER); } } if (type == EntityType.EXPERIENCE_ORB) { - ((ExperienceOrb) spawned).setExperience(Integer.parseInt(data)); + ((ExperienceOrb)spawned).setExperience(Integer.parseInt(data)); } } } diff --git a/Essentials/src/net/ess3/Teleport.java b/Essentials/src/net/ess3/Teleport.java index 003279e7a..3c85f2ba1 100644 --- a/Essentials/src/net/ess3/Teleport.java +++ b/Essentials/src/net/ess3/Teleport.java @@ -21,7 +21,6 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Teleport implements Runnable, ITeleport { private static final double MOVE_CONSTANT = 0.3; - private IUser user; private IUser teleportUser; private int teleTimer = -1; @@ -75,9 +74,9 @@ public class Teleport implements Runnable, ITeleport } if (!Permissions.TELEPORT_TIMER_MOVE.isAuthorized(user) && (Math.round( - teleportUser.getPlayer().getLocation().getX() * MOVE_CONSTANT) != initX || Math.round( - teleportUser.getPlayer().getLocation().getY() * MOVE_CONSTANT) != initY || Math.round( - teleportUser.getPlayer().getLocation().getZ() * MOVE_CONSTANT) != initZ || teleportUser.getPlayer().getHealth() < health)) + teleportUser.getPlayer().getLocation().getX() * MOVE_CONSTANT) != initX || Math.round( + teleportUser.getPlayer().getLocation().getY() * MOVE_CONSTANT) != initY || Math.round( + teleportUser.getPlayer().getLocation().getZ() * MOVE_CONSTANT) != initZ || teleportUser.getPlayer().getHealth() < health)) { // user moved, cancel teleport cancel(true); return; @@ -123,7 +122,6 @@ public class Teleport implements Runnable, ITeleport this.ess = ess; } - public void cooldown(boolean check) throws Exception { try @@ -233,7 +231,6 @@ public class Teleport implements Runnable, ITeleport now(new Target(loc), cause); } - @Override //The now function is used when you want to skip tp delay when teleporting someone to a location or player. public void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception diff --git a/Essentials/src/net/ess3/api/Economy.java b/Essentials/src/net/ess3/api/Economy.java index d59c28aa9..4fdec6d13 100644 --- a/Essentials/src/net/ess3/api/Economy.java +++ b/Essentials/src/net/ess3/api/Economy.java @@ -4,15 +4,13 @@ import net.ess3.utils.FormatUtil; /** - * Instead of using this api directly, we recommend to use the register plugin: - * http://bit.ly/RegisterMethod + * Instead of using this api directly, we recommend to use the register plugin: http://bit.ly/RegisterMethod */ public final class Economy { private Economy() { } - private static IEssentials ess; private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded."; @@ -35,10 +33,10 @@ public final class Economy /** * Sets the balance of a user * - * @param name Name of the user + * @param name Name of the user * @param balance The balance you want to set * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException { @@ -52,10 +50,10 @@ public final class Economy /** * Adds money to the balance of a user * - * @param name Name of the user + * @param name Name of the user * @param amount The money you want to add * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException { @@ -66,10 +64,10 @@ public final class Economy /** * Subtracts money from the balance of a user * - * @param name Name of the user + * @param name Name of the user * @param amount The money you want to subtract * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException { @@ -80,10 +78,10 @@ public final class Economy /** * Divides the balance of a user by a value * - * @param name Name of the user + * @param name Name of the user * @param value The balance is divided by this value * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException { @@ -94,10 +92,10 @@ public final class Economy /** * Multiplies the balance of a user by a value * - * @param name Name of the user + * @param name Name of the user * @param value The balance is multiplied by this value * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException { @@ -110,7 +108,7 @@ public final class Economy * * @param name Name of the user * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException { @@ -122,7 +120,7 @@ public final class Economy } /** - * @param name Name of the user + * @param name Name of the user * @param amount The amount of money the user should have * @return true, if the user has more or an equal amount of money * @throws UserDoesNotExistException If a user by that name does not exists @@ -133,7 +131,7 @@ public final class Economy } /** - * @param name Name of the user + * @param name Name of the user * @param amount The amount of money the user should have * @return true, if the user has more money * @throws UserDoesNotExistException If a user by that name does not exists @@ -144,7 +142,7 @@ public final class Economy } /** - * @param name Name of the user + * @param name Name of the user * @param amount The amount of money the user should not have * @return true, if the user has less money * @throws UserDoesNotExistException If a user by that name does not exists @@ -167,8 +165,7 @@ public final class Economy } /** - * Formats the amount of money like all other Essentials functions. - * Example: $100000 or $12345.67 + * Formats the amount of money like all other Essentials functions. Example: $100000 or $12345.67 * * @param amount The amount of money * @return Formatted money diff --git a/Essentials/src/net/ess3/api/IComponent.java b/Essentials/src/net/ess3/api/IComponent.java index 5cdee2b16..bc30f8c37 100644 --- a/Essentials/src/net/ess3/api/IComponent.java +++ b/Essentials/src/net/ess3/api/IComponent.java @@ -1,5 +1,6 @@ package net.ess3.api; + public interface IComponent extends IReload { /** diff --git a/Essentials/src/net/ess3/api/IEssentials.java b/Essentials/src/net/ess3/api/IEssentials.java index 68d975b57..226448f24 100644 --- a/Essentials/src/net/ess3/api/IEssentials.java +++ b/Essentials/src/net/ess3/api/IEssentials.java @@ -66,5 +66,4 @@ public interface IEssentials extends IComponent SpawnsHolder getSpawns(); StorageQueue getStorageQueue(); - } diff --git a/Essentials/src/net/ess3/api/IPlugin.java b/Essentials/src/net/ess3/api/IPlugin.java index 111d3e529..5a61fa39a 100644 --- a/Essentials/src/net/ess3/api/IPlugin.java +++ b/Essentials/src/net/ess3/api/IPlugin.java @@ -40,7 +40,7 @@ public interface IPlugin extends Plugin * @return - BukkitTask for the task created */ BukkitTask runTaskLaterAsynchronously(final Runnable run, final long delay); - + BukkitTask runTaskTimerAsynchronously(final Runnable run, final long delay, final long delay2); /** diff --git a/Essentials/src/net/ess3/api/IWorth.java b/Essentials/src/net/ess3/api/IWorth.java index 1cec6b6f1..23065ab60 100644 --- a/Essentials/src/net/ess3/api/IWorth.java +++ b/Essentials/src/net/ess3/api/IWorth.java @@ -17,7 +17,7 @@ public interface IWorth extends IReload * Set the price of an ItemStack * * @param itemStack - ItemStack to set price for - * @param price - Price to set on item + * @param price - Price to set on item */ void setPrice(ItemStack itemStack, double price); } diff --git a/Essentials/src/net/ess3/backup/Backup.java b/Essentials/src/net/ess3/backup/Backup.java index a4df0ab7a..490d81c72 100644 --- a/Essentials/src/net/ess3/backup/Backup.java +++ b/Essentials/src/net/ess3/backup/Backup.java @@ -60,10 +60,10 @@ public class Backup implements Runnable, IBackup final net.ess3.settings.Backup backupSettings = settings.getData().getGeneral().getBackup(); String backupCommand = backupSettings.getCommand() == null || backupSettings.getCommand().isEmpty() ? ("NORUN") : backupSettings.getCommand(); - + /*if (backupCommand.equals("NORUN")) { TODO: Un-comment if you do not want commands to be run if there is no backup command - return; - }*/ + return; + }*/ ess.getLogger().log(Level.INFO, _("§6Backup started.")); diff --git a/Essentials/src/net/ess3/bukkit/BukkitPlugin.java b/Essentials/src/net/ess3/bukkit/BukkitPlugin.java index d67f49596..fc4df61e1 100644 --- a/Essentials/src/net/ess3/bukkit/BukkitPlugin.java +++ b/Essentials/src/net/ess3/bukkit/BukkitPlugin.java @@ -102,8 +102,10 @@ public class BukkitPlugin extends JavaPlugin implements IPlugin final MetricsStarter metricsStarter = new MetricsStarter(ess); if (metricsStarter.getStart() != null) { - if(metricsStarter.getStart()) + if (metricsStarter.getStart()) + { getServer().getScheduler().runTaskLaterAsynchronously(this, metricsStarter, 1); + } else { final MetricsListener metricsListener = new MetricsListener(ess, metricsStarter); diff --git a/Essentials/src/net/ess3/bukkit/Enchantments.java b/Essentials/src/net/ess3/bukkit/Enchantments.java index e76adc8b5..2e54e7caf 100644 --- a/Essentials/src/net/ess3/bukkit/Enchantments.java +++ b/Essentials/src/net/ess3/bukkit/Enchantments.java @@ -11,11 +11,9 @@ import org.bukkit.enchantments.Enchantment; public final class Enchantments { - private Enchantments() { } - private static final Map<String, Enchantment> ENCHANTMENTS = new HashMap<String, Enchantment>(); static diff --git a/Essentials/src/net/ess3/bukkit/LivingEntities.java b/Essentials/src/net/ess3/bukkit/LivingEntities.java index c51285973..7057eb399 100644 --- a/Essentials/src/net/ess3/bukkit/LivingEntities.java +++ b/Essentials/src/net/ess3/bukkit/LivingEntities.java @@ -8,7 +8,6 @@ import org.bukkit.entity.EntityType; public class LivingEntities { final private static Map<String, EntityType> entities = new HashMap<String, EntityType>(); - final private static EnumMap<EntityType, String> entityI18n = new EnumMap<EntityType, String>(EntityType.class); final private static EnumMap<EntityType, String> entityI18nPlural = new EnumMap<EntityType, String>(EntityType.class); @@ -41,9 +40,9 @@ public class LivingEntities return count == 1 ? _(entityI18n.get(type)) : _(entityI18nPlural.get(type)); } + public static class MobException extends Exception { private static final long serialVersionUID = 1L; } - } diff --git a/Essentials/src/net/ess3/commands/Commandbanip.java b/Essentials/src/net/ess3/commands/Commandbanip.java index b26f69ccb..cae583023 100644 --- a/Essentials/src/net/ess3/commands/Commandbanip.java +++ b/Essentials/src/net/ess3/commands/Commandbanip.java @@ -19,15 +19,15 @@ public class Commandbanip extends EssentialsCommand if (player == null) { - if(args[0].matches("\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b")) - { - ess.getServer().banIP(args[0]); - sender.sendMessage(_("Banned IP address")); - } - else - { - sender.sendMessage(_("invalidIpAddress")); - } + if (args[0].matches("\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b")) + { + ess.getServer().banIP(args[0]); + sender.sendMessage(_("Banned IP address")); + } + else + { + sender.sendMessage(_("invalidIpAddress")); + } } else { diff --git a/Essentials/src/net/ess3/commands/Commandbigtree.java b/Essentials/src/net/ess3/commands/Commandbigtree.java index c1b2cb003..926ccc202 100644 --- a/Essentials/src/net/ess3/commands/Commandbigtree.java +++ b/Essentials/src/net/ess3/commands/Commandbigtree.java @@ -10,13 +10,13 @@ import org.bukkit.TreeType; public class Commandbigtree extends EssentialsCommand { - private static enum BigTree { + private static enum BigTree + { REDWOOD(TreeType.TALL_REDWOOD), TREE(TreeType.BIG_TREE), JUNGLE(TreeType.JUNGLE); - private final TreeType bukkitType; - + private BigTree(final TreeType bukkitType) { this.bukkitType = bukkitType; @@ -27,9 +27,8 @@ public class Commandbigtree extends EssentialsCommand return bukkitType; } } - private final static EnumConverter<BigTree> BIGTREE_PARSER = EnumConverter.getInstance(BigTree.class); - + @Override public void run(final IUser user, final String commandLabel, final String[] args) throws Exception { diff --git a/Essentials/src/net/ess3/commands/Commandbook.java b/Essentials/src/net/ess3/commands/Commandbook.java index f041127c8..315b03ba7 100644 --- a/Essentials/src/net/ess3/commands/Commandbook.java +++ b/Essentials/src/net/ess3/commands/Commandbook.java @@ -9,83 +9,81 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; - - public class Commandbook extends EssentialsCommand { - //TODO: Translate this - @Override - public void run( final IUser user, final String commandLabel, final String[] args) throws Exception - { + //TODO: Translate this + @Override + public void run(final IUser user, final String commandLabel, final String[] args) throws Exception + { - final Player player = user.getPlayer(); - final ItemStack item = player.getItemInHand(); - if (item.getType() == Material.WRITTEN_BOOK) - { - BookMeta bmeta = (BookMeta)item.getItemMeta(); + final Player player = user.getPlayer(); + final ItemStack item = player.getItemInHand(); + if (item.getType() == Material.WRITTEN_BOOK) + { + BookMeta bmeta = (BookMeta)item.getItemMeta(); - if (args.length > 1 && args[0].equalsIgnoreCase("author")) - { - if (Permissions.BOOK_AUTHOR.isAuthorized(user) && (isAuthor(bmeta, player.getName()) || Permissions.BOOK_OTHERS.isAuthorized(user))) - { - bmeta.setAuthor(args[1]); - item.setItemMeta(bmeta); - user.sendMessage(_("§6Author of the book set to {0}.", getFinalArg(args, 1))); - } - else - { - throw new Exception(_("§4You cannot change the author of this book.")); - } - } - else if (args.length > 1 && args[0].equalsIgnoreCase("title")) - { - if (Permissions.BOOK_TITLE.isAuthorized(user) && (isAuthor(bmeta, player.getName()) || Permissions.BOOK_OTHERS.isAuthorized(user))) - { - bmeta.setTitle(args[1]); - item.setItemMeta(bmeta); - user.sendMessage(_("§6Title of the book set to {0}.", getFinalArg(args, 1))); - } - else - { - throw new Exception(_("§4You cannot change the title of this book.")); - } - } - else - { - if (isAuthor(bmeta, player.getName()) || Permissions.BOOK_OTHERS.isAuthorized(user)) - { - ItemStack newItem = new ItemStack(Material.BOOK_AND_QUILL, item.getAmount()); - newItem.setItemMeta(bmeta); - user.getPlayer().setItemInHand(newItem); - user.sendMessage(_("§eYou may now edit the contents of this book.")); - } - else - { - throw new Exception(_("§4You cannot unlock this book.")); - } - } - } - else if (item.getType() == Material.BOOK_AND_QUILL) - { - BookMeta bmeta = (BookMeta)item.getItemMeta(); - if (!Permissions.BOOK_AUTHOR.isAuthorized(user)) - { - bmeta.setAuthor(player.getName()); - } - ItemStack newItem = new ItemStack(Material.WRITTEN_BOOK, item.getAmount()); - newItem.setItemMeta(bmeta); - player.setItemInHand(newItem); - user.sendMessage(_("§6This book is now locked.")); - } - else - { - throw new Exception(_("§4You are not holding a writable book.")); - } - } + if (args.length > 1 && args[0].equalsIgnoreCase("author")) + { + if (Permissions.BOOK_AUTHOR.isAuthorized(user) && (isAuthor(bmeta, player.getName()) || Permissions.BOOK_OTHERS.isAuthorized(user))) + { + bmeta.setAuthor(args[1]); + item.setItemMeta(bmeta); + user.sendMessage(_("§6Author of the book set to {0}.", getFinalArg(args, 1))); + } + else + { + throw new Exception(_("§4You cannot change the author of this book.")); + } + } + else if (args.length > 1 && args[0].equalsIgnoreCase("title")) + { + if (Permissions.BOOK_TITLE.isAuthorized(user) && (isAuthor(bmeta, player.getName()) || Permissions.BOOK_OTHERS.isAuthorized(user))) + { + bmeta.setTitle(args[1]); + item.setItemMeta(bmeta); + user.sendMessage(_("§6Title of the book set to {0}.", getFinalArg(args, 1))); + } + else + { + throw new Exception(_("§4You cannot change the title of this book.")); + } + } + else + { + if (isAuthor(bmeta, player.getName()) || Permissions.BOOK_OTHERS.isAuthorized(user)) + { + ItemStack newItem = new ItemStack(Material.BOOK_AND_QUILL, item.getAmount()); + newItem.setItemMeta(bmeta); + user.getPlayer().setItemInHand(newItem); + user.sendMessage(_("§eYou may now edit the contents of this book.")); + } + else + { + throw new Exception(_("§4You cannot unlock this book.")); + } + } + } + else if (item.getType() == Material.BOOK_AND_QUILL) + { + BookMeta bmeta = (BookMeta)item.getItemMeta(); + if (!Permissions.BOOK_AUTHOR.isAuthorized(user)) + { + bmeta.setAuthor(player.getName()); + } + ItemStack newItem = new ItemStack(Material.WRITTEN_BOOK, item.getAmount()); + newItem.setItemMeta(bmeta); + player.setItemInHand(newItem); + user.sendMessage(_("§6This book is now locked.")); + } + else + { + throw new Exception(_("§4You are not holding a writable book.")); + } + } - private boolean isAuthor(BookMeta bmeta, String player) - { - String author = bmeta.getAuthor(); - return author != null && author.equalsIgnoreCase(player); - } + private boolean isAuthor(BookMeta bmeta, String player) + { + String author = bmeta.getAuthor(); + return author != null && author.equalsIgnoreCase(player); + } } diff --git a/Essentials/src/net/ess3/commands/Commandenderchest.java b/Essentials/src/net/ess3/commands/Commandenderchest.java index 31d011597..85efb75f2 100644 --- a/Essentials/src/net/ess3/commands/Commandenderchest.java +++ b/Essentials/src/net/ess3/commands/Commandenderchest.java @@ -7,7 +7,6 @@ import org.bukkit.entity.Player; public class Commandenderchest extends EssentialsCommand { - @Override protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception { diff --git a/Essentials/src/net/ess3/commands/Commandfireball.java b/Essentials/src/net/ess3/commands/Commandfireball.java index e82379086..2cc263c0f 100644 --- a/Essentials/src/net/ess3/commands/Commandfireball.java +++ b/Essentials/src/net/ess3/commands/Commandfireball.java @@ -13,31 +13,31 @@ public class Commandfireball extends EssentialsCommand Class<? extends Entity> clazz = Fireball.class; if (args.length > 0) { - if(args[0].equalsIgnoreCase("small")) + if (args[0].equalsIgnoreCase("small")) { clazz = SmallFireball.class; } - else if(args[0].equalsIgnoreCase("arrow")) + else if (args[0].equalsIgnoreCase("arrow")) { clazz = Arrow.class; } - else if(args[0].equalsIgnoreCase("skull")) + else if (args[0].equalsIgnoreCase("skull")) { clazz = WitherSkull.class; } - else if(args[0].equalsIgnoreCase("egg")) + else if (args[0].equalsIgnoreCase("egg")) { clazz = Egg.class; } - else if(args[0].equalsIgnoreCase("snowball")) + else if (args[0].equalsIgnoreCase("snowball")) { clazz = Snowball.class; } - else if(args[0].equalsIgnoreCase("expbottle")) + else if (args[0].equalsIgnoreCase("expbottle")) { clazz = ThrownExpBottle.class; } - else if(args[0].equalsIgnoreCase("large")) + else if (args[0].equalsIgnoreCase("large")) { clazz = LargeFireball.class; } diff --git a/Essentials/src/net/ess3/commands/Commandfirework.java b/Essentials/src/net/ess3/commands/Commandfirework.java index c822a3c67..ad398a6c1 100644 --- a/Essentials/src/net/ess3/commands/Commandfirework.java +++ b/Essentials/src/net/ess3/commands/Commandfirework.java @@ -33,122 +33,121 @@ import org.bukkit.util.Vector; //4: Full Syntax: color:<color[,color,..]> [fade:<color[,color,..]>] [shape:<shape>] [effect:<effect[,effect]>] //4: Possible Shapes: star, ball, large, creeper, burst //4: Possible Effects trail, twinkle - public class Commandfirework extends EssentialsCommand { - private final transient Pattern splitPattern = Pattern.compile("[:+',;.]"); + private final transient Pattern splitPattern = Pattern.compile("[:+',;.]"); - @Override - protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception - { - final Player player = user.getPlayer(); - final ItemStack stack = user.getPlayer().getItemInHand(); - if (stack.getType() == Material.FIREWORK) - { - if (args.length > 0) - { - if (args[0].equalsIgnoreCase("clear")) - { - FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta(); - fmeta.clearEffects(); - stack.setItemMeta(fmeta); - user.sendMessage(_("§6Removed all effects from held stack.")); - } - else if (args.length > 1 && (args[0].equalsIgnoreCase("power") || (args[0].equalsIgnoreCase("p")))) - { - FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta(); - try - { - int power = Integer.parseInt(args[1]); - fmeta.setPower(power > 3 ? 4 : power); - } - catch (NumberFormatException e) - { - throw new Exception(_("§6The option §4{0} §6is not a valid value for §4{1}§6.", args[1], args[0])); - } - stack.setItemMeta(fmeta); - } - else if ((args[0].equalsIgnoreCase("fire") || (args[0].equalsIgnoreCase("f"))) - && Permissions.FIREWORK_FIRE.isAuthorized(user)) - { - int amount = 1; - boolean direction = false; - if (args.length > 1) - { - if (Util.isInt(args[1])) - { - ISettings settings = ess.getSettings(); - int serverLimit = settings.getData().getCommands().getSpawnmob().getLimit(); - amount = Integer.parseInt(args[1]); - if (amount > serverLimit) - { - amount = serverLimit; - user.sendMessage(_("Mob quantity limited to server limit.")); - } - } - else - { - direction = true; - } - } - for (int i = 0; i < amount; i++) - { - Firework firework = (Firework)player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK); - FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta(); - if (direction) - { - final Vector vector = player.getEyeLocation().getDirection().multiply(0.070); - if (fmeta.getPower() > 1) - { - fmeta.setPower(1); - } - firework.setVelocity(vector); - } - firework.setFireworkMeta(fmeta); - } - } - else - { - final MetaItemStack mStack = new MetaItemStack(stack); - for (String arg : args) - { - try - { - mStack.addFireworkMeta(user, true, arg, ess); - } - catch (Exception e) - { - user.sendMessage(_("§6Firework parameters:§c color:<color> [fade:<color>] [shape:<shape>] [effect:<effect>]n§6To use multiple colors/effects, separate values with commas: §cred,blue,pinkn§6Shapes:§c star, ball, large, creeper, burst §6Effects:§c trail, twinkle.")); - throw e; - } - } + @Override + protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception + { + final Player player = user.getPlayer(); + final ItemStack stack = user.getPlayer().getItemInHand(); + if (stack.getType() == Material.FIREWORK) + { + if (args.length > 0) + { + if (args[0].equalsIgnoreCase("clear")) + { + FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta(); + fmeta.clearEffects(); + stack.setItemMeta(fmeta); + user.sendMessage(_("§6Removed all effects from held stack.")); + } + else if (args.length > 1 && (args[0].equalsIgnoreCase("power") || (args[0].equalsIgnoreCase("p")))) + { + FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta(); + try + { + int power = Integer.parseInt(args[1]); + fmeta.setPower(power > 3 ? 4 : power); + } + catch (NumberFormatException e) + { + throw new Exception(_("§6The option §4{0} §6is not a valid value for §4{1}§6.", args[1], args[0])); + } + stack.setItemMeta(fmeta); + } + else if ((args[0].equalsIgnoreCase("fire") || (args[0].equalsIgnoreCase("f"))) + && Permissions.FIREWORK_FIRE.isAuthorized(user)) + { + int amount = 1; + boolean direction = false; + if (args.length > 1) + { + if (Util.isInt(args[1])) + { + ISettings settings = ess.getSettings(); + int serverLimit = settings.getData().getCommands().getSpawnmob().getLimit(); + amount = Integer.parseInt(args[1]); + if (amount > serverLimit) + { + amount = serverLimit; + user.sendMessage(_("Mob quantity limited to server limit.")); + } + } + else + { + direction = true; + } + } + for (int i = 0; i < amount; i++) + { + Firework firework = (Firework)player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK); + FireworkMeta fmeta = (FireworkMeta)stack.getItemMeta(); + if (direction) + { + final Vector vector = player.getEyeLocation().getDirection().multiply(0.070); + if (fmeta.getPower() > 1) + { + fmeta.setPower(1); + } + firework.setVelocity(vector); + } + firework.setFireworkMeta(fmeta); + } + } + else + { + final MetaItemStack mStack = new MetaItemStack(stack); + for (String arg : args) + { + try + { + mStack.addFireworkMeta(user, true, arg, ess); + } + catch (Exception e) + { + user.sendMessage(_("§6Firework parameters:§c color:<color> [fade:<color>] [shape:<shape>] [effect:<effect>]n§6To use multiple colors/effects, separate values with commas: §cred,blue,pinkn§6Shapes:§c star, ball, large, creeper, burst §6Effects:§c trail, twinkle.")); + throw e; + } + } - if (mStack.isValidFirework()) - { - FireworkMeta fmeta = (FireworkMeta)mStack.getItemStack().getItemMeta(); - FireworkEffect effect = mStack.getFireworkBuilder().build(); - if (fmeta.getEffects().size() > 0 && !Permissions.FIREWORK_MULTIPLE.isAuthorized(user)) - { - throw new Exception(_("§4You cannot apply more than one charge to this firework.")); - } - fmeta.addEffect(effect); - stack.setItemMeta(fmeta); - } - else - { - user.sendMessage(_("§6Firework parameters:§c color:<color> [fade:<color>] [shape:<shape>] [effect:<effect>]n§6To use multiple colors/effects, separate values with commas: §cred,blue,pinkn§6Shapes:§c star, ball, large, creeper, burst §6Effects:§c trail, twinkle.")); - throw new Exception(_("§4Invalid firework charge parameters inserted, must set a color first.")); - } - } - } - else - { - throw new NotEnoughArgumentsException(); - } - } - else - { - throw new Exception(_("§4You must be holding a firework to add effects.")); - } - } + if (mStack.isValidFirework()) + { + FireworkMeta fmeta = (FireworkMeta)mStack.getItemStack().getItemMeta(); + FireworkEffect effect = mStack.getFireworkBuilder().build(); + if (fmeta.getEffects().size() > 0 && !Permissions.FIREWORK_MULTIPLE.isAuthorized(user)) + { + throw new Exception(_("§4You cannot apply more than one charge to this firework.")); + } + fmeta.addEffect(effect); + stack.setItemMeta(fmeta); + } + else + { + user.sendMessage(_("§6Firework parameters:§c color:<color> [fade:<color>] [shape:<shape>] [effect:<effect>]n§6To use multiple colors/effects, separate values with commas: §cred,blue,pinkn§6Shapes:§c star, ball, large, creeper, burst §6Effects:§c trail, twinkle.")); + throw new Exception(_("§4Invalid firework charge parameters inserted, must set a color first.")); + } + } + } + else + { + throw new NotEnoughArgumentsException(); + } + } + else + { + throw new Exception(_("§4You must be holding a firework to add effects.")); + } + } } diff --git a/Essentials/src/net/ess3/commands/Commandgamemode.java b/Essentials/src/net/ess3/commands/Commandgamemode.java index bcaeb4986..0692d1c9b 100644 --- a/Essentials/src/net/ess3/commands/Commandgamemode.java +++ b/Essentials/src/net/ess3/commands/Commandgamemode.java @@ -10,7 +10,6 @@ import org.bukkit.command.CommandSender; public class Commandgamemode extends EssentialsSettingsCommand { - protected void setValue(final IUser player, GameMode value) { if (value == null) @@ -124,5 +123,4 @@ public class Commandgamemode extends EssentialsSettingsCommand } return mode; } - } diff --git a/Essentials/src/net/ess3/commands/Commandmore.java b/Essentials/src/net/ess3/commands/Commandmore.java index 6a612cd26..97678ce24 100644 --- a/Essentials/src/net/ess3/commands/Commandmore.java +++ b/Essentials/src/net/ess3/commands/Commandmore.java @@ -24,8 +24,9 @@ public class Commandmore extends EssentialsCommand } else { - stacks = new ItemStack[]{ - player.getItemInHand() + stacks = new ItemStack[] + { + player.getItemInHand() }; } for (ItemStack stack : stacks) diff --git a/Essentials/src/net/ess3/commands/Commandmute.java b/Essentials/src/net/ess3/commands/Commandmute.java index 1d8af2590..ec24412e3 100644 --- a/Essentials/src/net/ess3/commands/Commandmute.java +++ b/Essentials/src/net/ess3/commands/Commandmute.java @@ -39,8 +39,8 @@ public class Commandmute extends EssentialsCommand final boolean muted = player.getData().isMuted(); sender.sendMessage( muted ? (muteTimestamp > 0 ? _("§6Player {0} §6muted for {1}.", player.getPlayer().getDisplayName(), DateUtil.formatDateDiff(muteTimestamp)) : _( - "mutedPlayer", player.getPlayer().getDisplayName())) : _( - "unmutedPlayer", player.getPlayer().getDisplayName())); + "mutedPlayer", player.getPlayer().getDisplayName())) : _( + "unmutedPlayer", player.getPlayer().getDisplayName())); player.sendMessage( muted ? (muteTimestamp > 0 ? _("§6You have been muted for§c {0}.", DateUtil.formatDateDiff(muteTimestamp)) : _("§6You have been muted!")) : _("§6You have been unmuted.")); } diff --git a/Essentials/src/net/ess3/commands/Commandrecipe.java b/Essentials/src/net/ess3/commands/Commandrecipe.java index 8011bd1cb..6e93b7ca7 100644 --- a/Essentials/src/net/ess3/commands/Commandrecipe.java +++ b/Essentials/src/net/ess3/commands/Commandrecipe.java @@ -14,7 +14,6 @@ import org.bukkit.inventory.*; public class Commandrecipe extends EssentialsCommand { - @Override public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { @@ -39,7 +38,7 @@ public class Commandrecipe extends EssentialsCommand } final List<Recipe> recipesOfType = ess.getServer().getRecipesFor(itemType); - if (recipesOfType.size() < 1) + if (recipesOfType.size() < 1) { throw new Exception(_("No recipes exist for {0}", getMaterialName(itemType))); } @@ -89,7 +88,7 @@ public class Commandrecipe extends EssentialsCommand for (int k = 0; k < recipe.getShape()[j].length(); k++) { final ItemStack item = recipe.getIngredientMap().get(recipe.getShape()[j].toCharArray()[k]); - if(item == null) + if (item == null) { continue; } diff --git a/Essentials/src/net/ess3/commands/Commandseen.java b/Essentials/src/net/ess3/commands/Commandseen.java index 294a3de66..0a1ad816c 100644 --- a/Essentials/src/net/ess3/commands/Commandseen.java +++ b/Essentials/src/net/ess3/commands/Commandseen.java @@ -34,21 +34,21 @@ public class Commandseen extends EssentialsCommand final IUser u = ess.getUserMap().matchUserExcludingHidden(args[0], getPlayerOrNull(sender)); u.setDisplayNick(); sender.sendMessage(_("§6Player§c {0} §6is §aonline§6 since {1}.", u.getPlayer().getDisplayName(), DateUtil.formatDateDiff(u.getTimestamp(TimestampType.LOGIN)))); - if(u.getData().isAfk()) + if (u.getData().isAfk()) { sender.sendMessage(_("§6 - AFK:§r {0}", _("§atrue§r"))); } - if(u.getData().isJailed()) + if (u.getData().isJailed()) { sender.sendMessage(_("§6 - Jail:§r {0}", u.getTimestamp(TimestampType.JAIL) > 0 - ? DateUtil.formatDateDiff(u.getTimestamp(TimestampType.JAIL)) - : _("§atrue§r"))); + ? DateUtil.formatDateDiff(u.getTimestamp(TimestampType.JAIL)) + : _("§atrue§r"))); } - if(u.getData().isMuted()) + if (u.getData().isMuted()) { sender.sendMessage(_("§6 - Muted:§r {0}", u.getTimestamp(TimestampType.MUTE) > 0 - ? DateUtil.formatDateDiff(u.getTimestamp(TimestampType.MUTE)) - : _("§atrue§r"))); + ? DateUtil.formatDateDiff(u.getTimestamp(TimestampType.MUTE)) + : _("§atrue§r"))); } } catch (PlayerNotFoundException e) diff --git a/Essentials/src/net/ess3/commands/Commandsell.java b/Essentials/src/net/ess3/commands/Commandsell.java index 36e1893d1..64cba4593 100644 --- a/Essentials/src/net/ess3/commands/Commandsell.java +++ b/Essentials/src/net/ess3/commands/Commandsell.java @@ -148,8 +148,8 @@ public class Commandsell extends EssentialsCommand user.giveMoney(worth * amount); user.sendMessage( _( - "itemSold", FormatUtil.displayCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), - FormatUtil.displayCurrency(worth, ess))); + "itemSold", FormatUtil.displayCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), + FormatUtil.displayCurrency(worth, ess))); logger.log( Level.INFO, _( "itemSoldConsole", player.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), diff --git a/Essentials/src/net/ess3/commands/Commandsethome.java b/Essentials/src/net/ess3/commands/Commandsethome.java index 2141ac248..7cc63950e 100644 --- a/Essentials/src/net/ess3/commands/Commandsethome.java +++ b/Essentials/src/net/ess3/commands/Commandsethome.java @@ -78,8 +78,8 @@ public class Commandsethome extends EssentialsCommand } user.sendMessage( _( - "homeSet", user.getPlayer().getLocation().getWorld().getName(), user.getPlayer().getLocation().getBlockX(), - user.getPlayer().getLocation().getBlockY(), user.getPlayer().getLocation().getBlockZ())); + "homeSet", user.getPlayer().getLocation().getWorld().getName(), user.getPlayer().getLocation().getBlockX(), + user.getPlayer().getLocation().getBlockY(), user.getPlayer().getLocation().getBlockZ())); } } diff --git a/Essentials/src/net/ess3/commands/Commandsetwarp.java b/Essentials/src/net/ess3/commands/Commandsetwarp.java index 6843d3dd4..82b27e372 100644 --- a/Essentials/src/net/ess3/commands/Commandsetwarp.java +++ b/Essentials/src/net/ess3/commands/Commandsetwarp.java @@ -36,7 +36,6 @@ public class Commandsetwarp extends EssentialsCommand } if (warpLoc == null || Permissions.WARP_OVERWRITE.isAuthorized(user, args[0])) - { warps.setWarp(args[0], loc); } diff --git a/Essentials/src/net/ess3/commands/Commandsocialspy.java b/Essentials/src/net/ess3/commands/Commandsocialspy.java index 765d7668f..9dbe96f8a 100644 --- a/Essentials/src/net/ess3/commands/Commandsocialspy.java +++ b/Essentials/src/net/ess3/commands/Commandsocialspy.java @@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender; public class Commandsocialspy extends EssentialsToggleCommand { - @Override protected void setValue(final IUser player, final boolean value) { diff --git a/Essentials/src/net/ess3/commands/Commandspawner.java b/Essentials/src/net/ess3/commands/Commandspawner.java index 14925769e..b93d6d4ba 100644 --- a/Essentials/src/net/ess3/commands/Commandspawner.java +++ b/Essentials/src/net/ess3/commands/Commandspawner.java @@ -45,7 +45,7 @@ public class Commandspawner extends EssentialsCommand throw new Exception(_("§4Unable to spawn mob.")); } int delay = 0; - if(args.length > 1 && Util.isInt(args[1])) + if (args.length > 1 && Util.isInt(args[1])) { delay = Integer.parseInt(args[1]); } diff --git a/Essentials/src/net/ess3/commands/Commandspawnmob.java b/Essentials/src/net/ess3/commands/Commandspawnmob.java index 4688e6e3d..4d902abbb 100644 --- a/Essentials/src/net/ess3/commands/Commandspawnmob.java +++ b/Essentials/src/net/ess3/commands/Commandspawnmob.java @@ -9,7 +9,6 @@ import java.util.List; public class Commandspawnmob extends EssentialsCommand { - @Override public void run(final IUser user, final String commandLabel, final String[] args) throws Exception { diff --git a/Essentials/src/net/ess3/commands/Commandspeed.java b/Essentials/src/net/ess3/commands/Commandspeed.java index 852aded8b..9e489308b 100644 --- a/Essentials/src/net/ess3/commands/Commandspeed.java +++ b/Essentials/src/net/ess3/commands/Commandspeed.java @@ -10,7 +10,6 @@ import org.bukkit.entity.Player; public class Commandspeed extends EssentialsCommand { - @Override protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { diff --git a/Essentials/src/net/ess3/commands/Commandtempban.java b/Essentials/src/net/ess3/commands/Commandtempban.java index d022063d9..a1973c357 100644 --- a/Essentials/src/net/ess3/commands/Commandtempban.java +++ b/Essentials/src/net/ess3/commands/Commandtempban.java @@ -43,7 +43,7 @@ public class Commandtempban extends EssentialsCommand final long banTimestamp = DateUtil.parseDateDiff(time, true); final long max = ess.getSettings().getData().getCommands().getTempban().getMaxTempbanTime(); - if(max != -1 && banTimestamp - Calendar.getInstance().getTimeInMillis() > max && !Permissions.TEMPBAN_UNLIMITED.isAuthorized(sender)) + if (max != -1 && banTimestamp - Calendar.getInstance().getTimeInMillis() > max && !Permissions.TEMPBAN_UNLIMITED.isAuthorized(sender)) { sender.sendMessage(_("tempbanOversized")); return; diff --git a/Essentials/src/net/ess3/commands/Commandtpa.java b/Essentials/src/net/ess3/commands/Commandtpa.java index c816aaac3..238754813 100644 --- a/Essentials/src/net/ess3/commands/Commandtpa.java +++ b/Essentials/src/net/ess3/commands/Commandtpa.java @@ -24,10 +24,10 @@ public class Commandtpa extends EssentialsCommand } ISettings settings = ess.getSettings(); if (settings.getData().getGeneral().isPerGroupTeleport() && !Permissions.PERGROUPTELEPORT.isAuthorized( - user, ess.getRanks().getMainGroup(player))) - { - throw new Exception(_("§4You do not have the §c{0}§4 permission.", "essentials.teleport.groups." + ess.getRanks().getMainGroup(player))); - } + user, ess.getRanks().getMainGroup(player))) + { + throw new Exception(_("§4You do not have the §c{0}§4 permission.", "essentials.teleport.groups." + ess.getRanks().getMainGroup(player))); + } if (user.getPlayer().getWorld() != player.getPlayer().getWorld() && ess.getSettings().getData().getGeneral().isWorldTeleportPermissions() && !Permissions.WORLD.isAuthorized( user, user.getPlayer().getWorld().getName())) { diff --git a/Essentials/src/net/ess3/commands/Commandtpaccept.java b/Essentials/src/net/ess3/commands/Commandtpaccept.java index 9dc6ede85..861a7d4fa 100644 --- a/Essentials/src/net/ess3/commands/Commandtpaccept.java +++ b/Essentials/src/net/ess3/commands/Commandtpaccept.java @@ -21,7 +21,7 @@ public class Commandtpaccept extends EssentialsCommand final IUser target = user.getTeleportRequester(); if (target == null || !target.isOnline() || (user.isTpRequestHere() && !Permissions.TPAHERE.isAuthorized( - target)) || (!user.isTpRequestHere() && !Permissions.TPA.isAuthorized(target) && !Permissions.TPAALL.isAuthorized(target))) + target)) || (!user.isTpRequestHere() && !Permissions.TPA.isAuthorized(target) && !Permissions.TPAALL.isAuthorized(target))) { throw new Exception(_("§4You do not have a pending request.")); } diff --git a/Essentials/src/net/ess3/commands/Commandtpahere.java b/Essentials/src/net/ess3/commands/Commandtpahere.java index 71af791a8..c40b6244b 100644 --- a/Essentials/src/net/ess3/commands/Commandtpahere.java +++ b/Essentials/src/net/ess3/commands/Commandtpahere.java @@ -25,10 +25,10 @@ public class Commandtpahere extends EssentialsCommand ISettings settings = ess.getSettings(); if (settings.getData().getGeneral().isPerGroupTeleport() && !Permissions.PERGROUPTELEPORT.isAuthorized( - user, ess.getRanks().getMainGroup(player))) - { - throw new Exception(_("§4You do not have the §c{0}§4 permission.", "essentials.teleport.groups." + ess.getRanks().getMainGroup(player))); - } + user, ess.getRanks().getMainGroup(player))) + { + throw new Exception(_("§4You do not have the §c{0}§4 permission.", "essentials.teleport.groups." + ess.getRanks().getMainGroup(player))); + } if (user.getPlayer().getWorld() != player.getPlayer().getWorld() && settings.getData().getGeneral().isWorldTeleportPermissions() && !Permissions.WORLD.isAuthorized( user, user.getPlayer().getWorld().getName())) { diff --git a/Essentials/src/net/ess3/commands/Commandtpall.java b/Essentials/src/net/ess3/commands/Commandtpall.java index f4ddad8d3..aea83f854 100644 --- a/Essentials/src/net/ess3/commands/Commandtpall.java +++ b/Essentials/src/net/ess3/commands/Commandtpall.java @@ -27,7 +27,7 @@ public class Commandtpall extends EssentialsCommand final IUser player = ess.getUserMap().matchUserExcludingHidden(args[0], getPlayerOrNull(sender)); teleportAllPlayers(sender, player); } - + private void teleportAllPlayers(CommandSender sender, IUser user) { sender.sendMessage(_("§6Teleporting all players...")); diff --git a/Essentials/src/net/ess3/commands/Commandtphere.java b/Essentials/src/net/ess3/commands/Commandtphere.java index 857a21e5c..1095ef708 100644 --- a/Essentials/src/net/ess3/commands/Commandtphere.java +++ b/Essentials/src/net/ess3/commands/Commandtphere.java @@ -20,10 +20,10 @@ public class Commandtphere extends EssentialsCommand } ISettings settings = ess.getSettings(); if (settings.getData().getGeneral().isPerGroupTeleport() && !Permissions.PERGROUPTELEPORT.isAuthorized( - user, ess.getRanks().getMainGroup(player))) - { - throw new Exception(_("§4You do not have the §c{0}§4 permission.", "essentials.teleport.groups." + ess.getRanks().getMainGroup(player))); - } + user, ess.getRanks().getMainGroup(player))) + { + throw new Exception(_("§4You do not have the §c{0}§4 permission.", "essentials.teleport.groups." + ess.getRanks().getMainGroup(player))); + } user.getTeleport().teleportToMe(player, new Trade(commandName, ess), TeleportCause.COMMAND); user.sendMessage(_("§6Teleporting...")); diff --git a/Essentials/src/net/ess3/commands/Commandtpo.java b/Essentials/src/net/ess3/commands/Commandtpo.java index fd4e4f470..628a551e2 100644 --- a/Essentials/src/net/ess3/commands/Commandtpo.java +++ b/Essentials/src/net/ess3/commands/Commandtpo.java @@ -22,10 +22,10 @@ public class Commandtpo extends EssentialsCommand ISettings settings = ess.getSettings(); if (settings.getData().getGeneral().isPerGroupTeleport() && !Permissions.PERGROUPTELEPORT.isAuthorized( - user, ess.getRanks().getMainGroup(player))) - { - throw new Exception(_("§4You do not have the §c{0}§4 permission.", "essentials.teleport.groups." + ess.getRanks().getMainGroup(player))); - } + user, ess.getRanks().getMainGroup(player))) + { + throw new Exception(_("§4You do not have the §c{0}§4 permission.", "essentials.teleport.groups." + ess.getRanks().getMainGroup(player))); + } // Verify permission if (user.getPlayer().canSee(player.getPlayer()) || Permissions.TELEPORT_HIDDEN.isAuthorized(user)) { diff --git a/Essentials/src/net/ess3/commands/Commandtpohere.java b/Essentials/src/net/ess3/commands/Commandtpohere.java index df459ca4e..91fbfbd25 100644 --- a/Essentials/src/net/ess3/commands/Commandtpohere.java +++ b/Essentials/src/net/ess3/commands/Commandtpohere.java @@ -28,10 +28,10 @@ public class Commandtpohere extends EssentialsCommand throw new Exception(_("§4You do not have the §c{0}§4 permission.", "essentials.world." + user.getPlayer().getWorld().getName())); } if (settings.getData().getGeneral().isPerGroupTeleport() && !Permissions.PERGROUPTELEPORT.isAuthorized( - user, ess.getRanks().getMainGroup(player))) - { - throw new Exception(_("§4You do not have the §c{0}§4 permission.", "essentials.teleport.groups." + ess.getRanks().getMainGroup(player))); - } + user, ess.getRanks().getMainGroup(player))) + { + throw new Exception(_("§4You do not have the §c{0}§4 permission.", "essentials.teleport.groups." + ess.getRanks().getMainGroup(player))); + } // Verify permission diff --git a/Essentials/src/net/ess3/commands/Commandtptoggle.java b/Essentials/src/net/ess3/commands/Commandtptoggle.java index 7be6506f8..194a40285 100644 --- a/Essentials/src/net/ess3/commands/Commandtptoggle.java +++ b/Essentials/src/net/ess3/commands/Commandtptoggle.java @@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender; public class Commandtptoggle extends EssentialsToggleCommand { - @Override protected void setValue(final IUser player, final boolean value) { diff --git a/Essentials/src/net/ess3/commands/Commandwhois.java b/Essentials/src/net/ess3/commands/Commandwhois.java index 90d5951a1..4bc2f1e83 100644 --- a/Essentials/src/net/ess3/commands/Commandwhois.java +++ b/Essentials/src/net/ess3/commands/Commandwhois.java @@ -61,8 +61,8 @@ public class Commandwhois extends EssentialsCommand sender.sendMessage(_("§6 - Exp:§r {0} (Level {1})", SetExpFix.getTotalExperience(player), player.getLevel())); sender.sendMessage( _( - "whoisLocation", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), - player.getLocation().getBlockZ())); + "whoisLocation", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), + player.getLocation().getBlockZ())); sender.sendMessage(_("§6 - Money:§r {0}", FormatUtil.displayCurrency(user.getMoney(), ess))); sender.sendMessage(_("§6 - IP Address:§r {0}", player.getAddress().getAddress().toString())); final String location = userData.getGeolocation(); @@ -77,12 +77,12 @@ public class Commandwhois extends EssentialsCommand sender.sendMessage(_("§6 - AFK:§r {0}", (userData.isAfk() ? _("§atrue§r") : _("§4false§r")))); sender.sendMessage( _( - "whoisJail", (userData.isJailed() ? user.getTimestamp(UserData.TimestampType.JAIL) > 0 ? DateUtil.formatDateDiff( - user.getTimestamp(UserData.TimestampType.JAIL)) : _("§atrue§r") : _("§4false§r")))); + "whoisJail", (userData.isJailed() ? user.getTimestamp(UserData.TimestampType.JAIL) > 0 ? DateUtil.formatDateDiff( + user.getTimestamp(UserData.TimestampType.JAIL)) : _("§atrue§r") : _("§4false§r")))); sender.sendMessage( _( - "whoisMute", (userData.isMuted() ? user.getTimestamp(UserData.TimestampType.MUTE) > 0 ? DateUtil.formatDateDiff( - user.getTimestamp(UserData.TimestampType.MUTE)) : _("§atrue§r") : _("§4false§r")))); + "whoisMute", (userData.isMuted() ? user.getTimestamp(UserData.TimestampType.MUTE) > 0 ? DateUtil.formatDateDiff( + user.getTimestamp(UserData.TimestampType.MUTE)) : _("§atrue§r") : _("§4false§r")))); } if (!foundPlayer) { diff --git a/Essentials/src/net/ess3/commands/Commandworth.java b/Essentials/src/net/ess3/commands/Commandworth.java index e7f99a6de..397cda270 100644 --- a/Essentials/src/net/ess3/commands/Commandworth.java +++ b/Essentials/src/net/ess3/commands/Commandworth.java @@ -43,10 +43,10 @@ public class Commandworth extends EssentialsCommand user.sendMessage( iStack.getDurability() != 0 ? _( - "worthMeta", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), iStack.getDurability(), - FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)) : _( - "worth", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), FormatUtil.displayCurrency(worth * amount, ess), - amount, FormatUtil.displayCurrency(worth, ess))); + "worthMeta", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), iStack.getDurability(), + FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)) : _( + "worth", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), FormatUtil.displayCurrency(worth * amount, ess), + amount, FormatUtil.displayCurrency(worth, ess))); } @Override @@ -81,10 +81,10 @@ public class Commandworth extends EssentialsCommand sender.sendMessage( iStack.getDurability() != 0 ? _( - "worthMeta", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), iStack.getDurability(), - FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)) : _( - "worth", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), FormatUtil.displayCurrency(worth * amount, ess), - amount, FormatUtil.displayCurrency(worth, ess))); + "worthMeta", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), iStack.getDurability(), + FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)) : _( + "worth", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), FormatUtil.displayCurrency(worth * amount, ess), + amount, FormatUtil.displayCurrency(worth, ess))); } } diff --git a/Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java b/Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java index 1ab327667..440bda706 100644 --- a/Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java +++ b/Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java @@ -8,7 +8,6 @@ import org.bukkit.command.CommandSender; public abstract class EssentialsSettingsCommand extends EssentialsCommand { - abstract protected void informSender(final CommandSender sender, final boolean value, final IUser player); abstract protected void informPlayer(final IUser player); @@ -82,5 +81,4 @@ public abstract class EssentialsSettingsCommand extends EssentialsCommand informSender(sender, true, matchPlayer); } } - } diff --git a/Essentials/src/net/ess3/commands/EssentialsToggleCommand.java b/Essentials/src/net/ess3/commands/EssentialsToggleCommand.java index c62fda512..2d5b723cb 100644 --- a/Essentials/src/net/ess3/commands/EssentialsToggleCommand.java +++ b/Essentials/src/net/ess3/commands/EssentialsToggleCommand.java @@ -5,7 +5,6 @@ import net.ess3.api.IUser; public abstract class EssentialsToggleCommand extends EssentialsSettingsCommand { - abstract protected void setValue(final IUser player, final boolean value); abstract protected boolean getValue(final IUser player); diff --git a/Essentials/src/net/ess3/commands/WarpNotFoundException.java b/Essentials/src/net/ess3/commands/WarpNotFoundException.java index d2580dc12..476c4813e 100644 --- a/Essentials/src/net/ess3/commands/WarpNotFoundException.java +++ b/Essentials/src/net/ess3/commands/WarpNotFoundException.java @@ -17,5 +17,3 @@ public class WarpNotFoundException extends Exception super(message); } } - - diff --git a/Essentials/src/net/ess3/converter/EnumConverter.java b/Essentials/src/net/ess3/converter/EnumConverter.java index ab45bdfb6..a31b08124 100644 --- a/Essentials/src/net/ess3/converter/EnumConverter.java +++ b/Essentials/src/net/ess3/converter/EnumConverter.java @@ -14,7 +14,7 @@ public class EnumConverter<E extends Enum<E>> implements ArgumentsParser<E>, Ser private static final Pattern REPLACE = Pattern.compile("[_-]"); private final Map<String, E> enumMap = new HashMap<String, E>(); private final Map<E, String> serializedMap; - + private EnumConverter(final Class<E> enumClass) { serializedMap = new EnumMap<E, String>(enumClass); @@ -24,7 +24,7 @@ public class EnumConverter<E extends Enum<E>> implements ArgumentsParser<E>, Ser serializedMap.put(t, prettifyString(t.name())); } } - + public static <T extends Enum<T>> EnumConverter<T> getInstance(final Class<T> enumClass) { synchronized (converterMap) @@ -38,7 +38,7 @@ public class EnumConverter<E extends Enum<E>> implements ArgumentsParser<E>, Ser return converter; } } - + @Override public ParserResult<E> parse(final String... args) { @@ -51,18 +51,18 @@ public class EnumConverter<E extends Enum<E>> implements ArgumentsParser<E>, Ser } return new FirstEntryParserResult<E>(e, args); } - + @Override public String serialize(final E input) { return serializedMap.get(input); } - + private String cleanString(final String input) { return REPLACE.matcher(input).replaceAll("").toLowerCase(Locale.ENGLISH); } - + private String prettifyString(final String input) { return input.replace('_', '-').toLowerCase(Locale.ENGLISH); diff --git a/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java b/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java index d7230fcde..e8397c47b 100644 --- a/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java +++ b/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java @@ -11,7 +11,6 @@ import org.bukkit.inventory.ItemStack; * TODO: make sure this is up-to date */ - public final class InventoryWorkaround { private InventoryWorkaround() @@ -28,7 +27,7 @@ public final class InventoryWorkaround for (int i = 0; i < stacks.length; i++) { final ItemStack cItem = stacks[i]; - if(cItem != null && cItem.getAmount() < maxAmount && cItem.isSimilar(item)) + if (cItem != null && cItem.getAmount() < maxAmount && cItem.isSimilar(item)) { return i; } diff --git a/Essentials/src/net/ess3/economy/Money.java b/Essentials/src/net/ess3/economy/Money.java index 2373cc7f7..180ec305a 100644 --- a/Essentials/src/net/ess3/economy/Money.java +++ b/Essentials/src/net/ess3/economy/Money.java @@ -35,6 +35,4 @@ public class Money implements StorageObject balanceMap.remove(name); balances = balanceMap; } - - } diff --git a/Essentials/src/net/ess3/economy/Trade.java b/Essentials/src/net/ess3/economy/Trade.java index ca133d6b2..5f305eb53 100644 --- a/Essentials/src/net/ess3/economy/Trade.java +++ b/Essentials/src/net/ess3/economy/Trade.java @@ -211,7 +211,6 @@ public class Trade } return cost; } - private static FileWriter fw = null; public static void log(String type, String subtype, String event, String sender, Trade charge, String receiver, Trade pay, Location loc, IEssentials ess) diff --git a/Essentials/src/net/ess3/economy/Worth.java b/Essentials/src/net/ess3/economy/Worth.java index f2f3d2d64..6f94204a9 100644 --- a/Essentials/src/net/ess3/economy/Worth.java +++ b/Essentials/src/net/ess3/economy/Worth.java @@ -26,7 +26,6 @@ public class Worth implements StorageObject { return sell == null ? Collections.<MaterialData, Double>emptyMap() : Collections.unmodifiableMap(sell); } - @MapKeyType(MaterialData.class) @MapValueType(Double.class) @Getter(AccessLevel.NONE) @@ -37,7 +36,6 @@ public class Worth implements StorageObject { return buy == null ? Collections.<MaterialData, Double>emptyMap() : Collections.unmodifiableMap(buy); } - @MapKeyType(EnchantmentLevel.class) @MapValueType(Double.class) @Getter(AccessLevel.NONE) diff --git a/Essentials/src/net/ess3/economy/register/Method.java b/Essentials/src/net/ess3/economy/register/Method.java index 2ded29805..8ad3ecbc8 100644 --- a/Essentials/src/net/ess3/economy/register/Method.java +++ b/Essentials/src/net/ess3/economy/register/Method.java @@ -6,7 +6,8 @@ import org.bukkit.plugin.Plugin; /** * Interface to be implemented by a payment method. * - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) + * @author Nijikokun <nijikokun@shortmail.com> ( + * @nijikokun) * @copyright Copyright (C) 2011 * @license AOL license <http://aol.nexua.org> */ @@ -16,9 +17,8 @@ public interface Method * Encodes the Plugin into an Object disguised as the Plugin. If you want the original Plugin Class you must cast it * to the correct Plugin, to do so you have to verify the name and or version then cast. * <p/> - * <pre> - * if(method.getName().equalsIgnoreCase("iConomy")) - * iConomy plugin = ((iConomy)method.getPlugin());</pre> + * < + * pre> if(method.getName().equalsIgnoreCase("iConomy")) iConomy plugin = ((iConomy)method.getPlugin());</pre> * * @return <code>Object</code> * @see #getName() @@ -48,8 +48,7 @@ public interface Method public String getVersion(); /** - * Returns the amount of decimal places that get stored - * NOTE: it will return -1 if there is no rounding + * Returns the amount of decimal places that get stored NOTE: it will return -1 if there is no rounding * * @return <code>int</code> for each decimal place */ @@ -88,7 +87,9 @@ public interface Method public boolean hasAccount(String name); /** - * Check to see if an account <code>name</code> is tied to a <code>bank</code>. + * Check to see if an account + * <code>name</code> is tied to a + * <code>bank</code>. * * @param bank Bank name * @param name Account name @@ -107,14 +108,16 @@ public interface Method /** * Forces an account creation * - * @param name Account name + * @param name Account name * @param balance Initial account balance * @return <code>boolean</code> */ public boolean createAccount(String name, Double balance); /** - * Returns a <code>MethodAccount</code> class for an account <code>name</code>. + * Returns a + * <code>MethodAccount</code> class for an account + * <code>name</code>. * * @param name Account name * @return <code>MethodAccount</code> <em>or</em> <code>Null</code> @@ -122,7 +125,9 @@ public interface Method public MethodAccount getAccount(String name); /** - * Returns a <code>MethodBankAccount</code> class for an account <code>name</code>. + * Returns a + * <code>MethodBankAccount</code> class for an account + * <code>name</code>. * * @param bank Bank name * @param name Account name @@ -131,8 +136,7 @@ public interface Method public MethodBankAccount getBankAccount(String bank, String name); /** - * Checks to verify the compatibility between this Method and a plugin. - * Internal usage only, for the most part. + * Checks to verify the compatibility between this Method and a plugin. Internal usage only, for the most part. * * @param plugin Plugin * @return <code>boolean</code> diff --git a/Essentials/src/net/ess3/economy/register/Methods.java b/Essentials/src/net/ess3/economy/register/Methods.java index 93a92ba42..d3f378870 100644 --- a/Essentials/src/net/ess3/economy/register/Methods.java +++ b/Essentials/src/net/ess3/economy/register/Methods.java @@ -22,8 +22,10 @@ import org.bukkit.plugin.PluginManager; * preferred: "iConomy" * </pre></blockquote> * - * @author: Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright: Copyright (C) 2011 @license: AOL license - * <http://aol.nexua.org> + * @author: Nijikokun <nijikokun@shortmail.com> ( + * @nijikokun) + * @copyright: Copyright (C) 2011 + * @license: AOL license <http://aol.nexua.org> */ public class Methods { @@ -255,8 +257,7 @@ public class Methods /** * Grab the existing and initialized (hopefully) Method Class. * - * @return <code>Method</code> <em>or</em> - * <code>Null</code> + * @return <code>Method</code> <em>or</em> <code>Null</code> */ public static Method getMethod() { diff --git a/Essentials/src/net/ess3/economy/register/methods/BOSE7.java b/Essentials/src/net/ess3/economy/register/methods/BOSE7.java index 24dbcacee..6cfff9225 100644 --- a/Essentials/src/net/ess3/economy/register/methods/BOSE7.java +++ b/Essentials/src/net/ess3/economy/register/methods/BOSE7.java @@ -9,8 +9,10 @@ import org.bukkit.plugin.Plugin; * BOSEconomy 7 Implementation of Method * * @author Acrobot - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license - * <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> ( + * @nijikokun) + * @copyright (c) 2011 + * @license AOL license <http://aol.nexua.org> */ public class BOSE7 implements Method { diff --git a/Essentials/src/net/ess3/economy/register/methods/iCo5.java b/Essentials/src/net/ess3/economy/register/methods/iCo5.java index f559ab701..09ee7cc7d 100644 --- a/Essentials/src/net/ess3/economy/register/methods/iCo5.java +++ b/Essentials/src/net/ess3/economy/register/methods/iCo5.java @@ -12,8 +12,10 @@ import org.bukkit.plugin.Plugin; /** * iConomy 5 Implementation of Method * - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license - * <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> ( + * @nijikokun) + * @copyright (c) 2011 + * @license AOL license <http://aol.nexua.org> */ public class iCo5 implements Method { diff --git a/Essentials/src/net/ess3/economy/register/methods/iCo6.java b/Essentials/src/net/ess3/economy/register/methods/iCo6.java index 4b2b3e641..0c0ad2dc0 100644 --- a/Essentials/src/net/ess3/economy/register/methods/iCo6.java +++ b/Essentials/src/net/ess3/economy/register/methods/iCo6.java @@ -11,8 +11,10 @@ import org.bukkit.plugin.Plugin; /** * iConomy 6 Implementation of Method * - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license - * <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> ( + * @nijikokun) + * @copyright (c) 2011 + * @license AOL license <http://aol.nexua.org> */ public class iCo6 implements Method { @@ -81,7 +83,7 @@ public class iCo6 implements Method @Override public boolean createAccount(String name) { - return !hasAccount(name) && (new Accounts()) .create(name); + return !hasAccount(name) && (new Accounts()).create(name); } @Override diff --git a/Essentials/src/net/ess3/listener/EssentialsEntityListener.java b/Essentials/src/net/ess3/listener/EssentialsEntityListener.java index a20874325..3adb35b47 100644 --- a/Essentials/src/net/ess3/listener/EssentialsEntityListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsEntityListener.java @@ -41,7 +41,7 @@ public class EssentialsEntityListener implements Listener attacker.updateActivity(true); if (settings.getData().getGeneral().getLoginAttackDelay() > 0 && !Permissions.PVPDELAY_EXEMPT.isAuthorized( attacker) && (System.currentTimeMillis() < (attacker.getTimestamp( - TimestampType.LOGIN) + settings.getData().getGeneral().getLoginAttackDelay()))) + TimestampType.LOGIN) + settings.getData().getGeneral().getLoginAttackDelay()))) { event.setCancelled(true); } diff --git a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java index ef634e8c2..8b74e1af7 100644 --- a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java @@ -56,7 +56,8 @@ public class EssentialsPlayerListener implements Listener public void onPlayerRespawn(final PlayerRespawnEvent event) { final Player player = event.getPlayer(); - if (!player.isOnline()) { + if (!player.isOnline()) + { return; } final IUser user = userMap.getUser(player); @@ -173,83 +174,83 @@ public class EssentialsPlayerListener implements Listener delayedJoin(event.getPlayer()); } }); -/* TODO: Make sure my update is good - if (!event.getPlayer().isOnline()) - { - return; - } - - ess.getBackup().startTask(); - - final String joinMessage = ess.getSettings().getData().getGeneral().getJoinMessage(); - if (joinMessage != null) - { - final IText itOutput = new KeywordReplacer(new SimpleTextInput(joinMessage), ess.getUserMap().getUser(event.getPlayer()), ess); - final SimpleTextPager stPager = new SimpleTextPager(itOutput); - event.setJoinMessage(FormatUtil.replaceFormat(stPager.getString(0))); - } - else - { - event.setJoinMessage(joinMessage); - } - - final IUser user = ess.getUserMap().getUser(event.getPlayer()); - - user.updateDisplayName(); - user.getData().setIpAddress(user.getPlayer().getAddress().getAddress().getHostAddress()); - user.updateActivity(false); - - for (String p : ess.getVanishedPlayers()) - { - if (!Permissions.VANISH_SEE_OTHERS.isAuthorized(user)) - { - user.getPlayer().hidePlayer(ess.getUserMap().getUser(p).getPlayer()); - } - } - - if (Permissions.SLEEPINGIGNORED.isAuthorized(user)) - { - user.getPlayer().setSleepingIgnored(true); - } - user.queueSave(); - - - final ISettings settings = ess.getSettings(); - - if (!settings.getData().getCommands().isDisabled("motd") && Permissions.MOTD.isAuthorized(user)) - { - try - { - final IText input = new TextInput(user, "motd", true, ess); - final IText output = new KeywordReplacer(input, user, ess); - final TextPager pager = new TextPager(output, true); - pager.showPage("1", null, "motd", user); - } - catch (IOException ex) - { - if (settings.getData().getGeneral().isDebug()) - { - LOGGER.log(Level.WARNING, ex.getMessage(), ex); - } - else - { - LOGGER.log(Level.WARNING, ex.getMessage()); - } - } - } - - if (!settings.getData().getCommands().isDisabled("mail") && Permissions.MAIL.isAuthorized(user)) - { - final List<String> mail = user.getData().getMails(); - if (mail == null || mail.isEmpty()) - { - user.sendMessage(_("§6You have no new mail.")); - } - else - { - user.sendMessage(_("§6You have§c {0} §6messages! Type §c/mail read§6 to view your mail.", mail.size())); - } - }*/ + /* TODO: Make sure my update is good + if (!event.getPlayer().isOnline()) + { + return; + } + + ess.getBackup().startTask(); + + final String joinMessage = ess.getSettings().getData().getGeneral().getJoinMessage(); + if (joinMessage != null) + { + final IText itOutput = new KeywordReplacer(new SimpleTextInput(joinMessage), ess.getUserMap().getUser(event.getPlayer()), ess); + final SimpleTextPager stPager = new SimpleTextPager(itOutput); + event.setJoinMessage(FormatUtil.replaceFormat(stPager.getString(0))); + } + else + { + event.setJoinMessage(joinMessage); + } + + final IUser user = ess.getUserMap().getUser(event.getPlayer()); + + user.updateDisplayName(); + user.getData().setIpAddress(user.getPlayer().getAddress().getAddress().getHostAddress()); + user.updateActivity(false); + + for (String p : ess.getVanishedPlayers()) + { + if (!Permissions.VANISH_SEE_OTHERS.isAuthorized(user)) + { + user.getPlayer().hidePlayer(ess.getUserMap().getUser(p).getPlayer()); + } + } + + if (Permissions.SLEEPINGIGNORED.isAuthorized(user)) + { + user.getPlayer().setSleepingIgnored(true); + } + user.queueSave(); + + + final ISettings settings = ess.getSettings(); + + if (!settings.getData().getCommands().isDisabled("motd") && Permissions.MOTD.isAuthorized(user)) + { + try + { + final IText input = new TextInput(user, "motd", true, ess); + final IText output = new KeywordReplacer(input, user, ess); + final TextPager pager = new TextPager(output, true); + pager.showPage("1", null, "motd", user); + } + catch (IOException ex) + { + if (settings.getData().getGeneral().isDebug()) + { + LOGGER.log(Level.WARNING, ex.getMessage(), ex); + } + else + { + LOGGER.log(Level.WARNING, ex.getMessage()); + } + } + } + + if (!settings.getData().getCommands().isDisabled("mail") && Permissions.MAIL.isAuthorized(user)) + { + final List<String> mail = user.getData().getMails(); + if (mail == null || mail.isEmpty()) + { + user.sendMessage(_("§6You have no new mail.")); + } + else + { + user.sendMessage(_("§6You have§c {0} §6messages! Type §c/mail read§6 to view your mail.", mail.size())); + } + }*/ } public void delayedJoin(final Player player) @@ -330,19 +331,19 @@ public class EssentialsPlayerListener implements Listener user.sendMessage(_("§6You have§c {0} §6messages! Type §c/mail read§6 to view your mail.", mail.size())); } } - if(Permissions.FLY_SAFELOGIN.isAuthorized(user)) + if (Permissions.FLY_SAFELOGIN.isAuthorized(user)) { final Location loc = user.getPlayer().getLocation(); final World world = loc.getWorld(); final int x = loc.getBlockX(); int y = loc.getBlockY(); final int z = loc.getBlockZ(); - while(LocationUtil.isBlockUnsafe(world, x, y, z) && y > -1) + while (LocationUtil.isBlockUnsafe(world, x, y, z) && y > -1) { y--; } - if(loc.getBlockY() - y > 1 || y < 0) + if (loc.getBlockY() - y > 1 || y < 0) { user.getPlayer().setAllowFlight(true); user.getPlayer().setFlying(true); @@ -351,7 +352,6 @@ public class EssentialsPlayerListener implements Listener } } - @EventHandler(priority = EventPriority.HIGH) public void onPlayerLogin(final PlayerLoginEvent event) { @@ -449,7 +449,6 @@ public class EssentialsPlayerListener implements Listener }); } } - private final Pattern spaceSplit = Pattern.compile(" "); @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -612,7 +611,7 @@ public class EssentialsPlayerListener implements Listener { final IUser invOwner = userMap.getUser((Player)invHolder); if (user.isInvSee() && (!Permissions.INVSEE_MODIFY.isAuthorized(user) || Permissions.INVSEE_PREVENT_MODIFY.isAuthorized( - invOwner) || !invOwner.isOnline())) + invOwner) || !invOwner.isOnline())) { event.setCancelled(true); } @@ -620,7 +619,7 @@ public class EssentialsPlayerListener implements Listener } if (event.getView().getTopInventory().getType() == InventoryType.WORKBENCH) { - final IUser user = userMap.getUser((Player) event.getWhoClicked()); + final IUser user = userMap.getUser((Player)event.getWhoClicked()); if (user.isRecipeSee()) { event.setCancelled(true); diff --git a/Essentials/src/net/ess3/listener/EssentialsPluginListener.java b/Essentials/src/net/ess3/listener/EssentialsPluginListener.java index 9fa17750c..792d02b5c 100644 --- a/Essentials/src/net/ess3/listener/EssentialsPluginListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsPluginListener.java @@ -36,9 +36,10 @@ public class EssentialsPluginListener implements Listener, IReload if (!Methods.hasMethod() && Methods.setMethod(ess.getServer().getPluginManager())) { ess.getLogger().log( - Level.INFO, "Payment method found ({0} version: {1})", new Object[]{ - Methods.getMethod().getName(), Methods.getMethod().getVersion() - }); + Level.INFO, "Payment method found ({0} version: {1})", new Object[] + { + Methods.getMethod().getName(), Methods.getMethod().getVersion() + }); } } diff --git a/Essentials/src/net/ess3/metrics/MetricsListener.java b/Essentials/src/net/ess3/metrics/MetricsListener.java index d001e72f6..20fd00cc1 100644 --- a/Essentials/src/net/ess3/metrics/MetricsListener.java +++ b/Essentials/src/net/ess3/metrics/MetricsListener.java @@ -30,7 +30,7 @@ public class MetricsListener implements Listener ISettings settings = ess.getSettings(); if (settings.getData().getGeneral().getMetricsEnabled() == null && (Permissions.ESSENTIALS.isAuthorized( - event.getPlayer()) || event.getPlayer().hasPermission("bukkit.broadcast.admin"))) + event.getPlayer()) || event.getPlayer().hasPermission("bukkit.broadcast.admin"))) { player.sendMessage(_("metrics1")); player.sendMessage(_("metrics2")); diff --git a/Essentials/src/net/ess3/metrics/MetricsStarter.java b/Essentials/src/net/ess3/metrics/MetricsStarter.java index 412742bef..75caf6c65 100644 --- a/Essentials/src/net/ess3/metrics/MetricsStarter.java +++ b/Essentials/src/net/ess3/metrics/MetricsStarter.java @@ -53,10 +53,10 @@ public class MetricsStarter implements Runnable ess.getLogger().info(_("metrics4")); start = false; } - else if (settings.getData().getGeneral().getMetricsEnabled()) - { - start = true; - } + else if (settings.getData().getGeneral().getMetricsEnabled()) + { + start = true; + } } } catch (Exception ex) diff --git a/Essentials/src/net/ess3/permissions/BasePermission.java b/Essentials/src/net/ess3/permissions/BasePermission.java index b1cb0be68..5312ebb93 100644 --- a/Essentials/src/net/ess3/permissions/BasePermission.java +++ b/Essentials/src/net/ess3/permissions/BasePermission.java @@ -1,5 +1,6 @@ package net.ess3.permissions; + public class BasePermission extends AbstractSuperpermsPermission { protected String permission; diff --git a/Essentials/src/net/ess3/permissions/Permissions.java b/Essentials/src/net/ess3/permissions/Permissions.java index 2ae61391f..fbacba29d 100644 --- a/Essentials/src/net/ess3/permissions/Permissions.java +++ b/Essentials/src/net/ess3/permissions/Permissions.java @@ -21,9 +21,9 @@ public enum Permissions implements IPermission BAN_EXEMPT, BAN_NOTIFY, BAN_OFFLINE, - BOOK_AUTHOR, - BOOK_OTHERS, - BOOK_TITLE, + BOOK_AUTHOR, + BOOK_OTHERS, + BOOK_TITLE, BREAK_BEDROCK, CHAT_COLOR, CHAT_IGNORE_EXEMPT, @@ -39,8 +39,8 @@ public enum Permissions implements IPermission EXP_SET_OTHERS, EXP_OTHERS, FEED_OTHERS, - FIREWORK_FIRE, - FIREWORK_MULTIPLE, + FIREWORK_FIRE, + FIREWORK_MULTIPLE, FLY_EXEMPT, FLY_OTHERS, FLY_SAFELOGIN, @@ -170,8 +170,7 @@ public enum Permissions implements IPermission { return PermissionFactory.checkPermission(sender, this); } - - public static final DotStarPermission ESSENTIALS = new DotStarPermission("essentials."); + public static final DotStarPermission ESSENTIALS = new DotStarPermission("essentials."); public static final DotStarPermission ENCHANT = new DotStarPermission("essentials.enchant"); public static final DotStarPermission PERGROUPTELEPORT = new DotStarPermission("essentials.teleport.groups"); public static final MaterialDotStarPermission GIVE = new MaterialDotStarPermission("essentials.give", PermissionDefault.TRUE); diff --git a/Essentials/src/net/ess3/settings/Kits.java b/Essentials/src/net/ess3/settings/Kits.java index f68ac5d83..2892729c4 100644 --- a/Essentials/src/net/ess3/settings/Kits.java +++ b/Essentials/src/net/ess3/settings/Kits.java @@ -21,11 +21,10 @@ public class Kits implements StorageObject kit.setDelay(10.0); kit.setItems( Arrays.<ItemStack>asList( - new ItemStack(Material.DIAMOND_SPADE, 1), new ItemStack(Material.DIAMOND_PICKAXE, 1), new ItemStack(Material.DIAMOND_AXE, 1))); + new ItemStack(Material.DIAMOND_SPADE, 1), new ItemStack(Material.DIAMOND_PICKAXE, 1), new ItemStack(Material.DIAMOND_AXE, 1))); kits = new HashMap<String, Kit>(); kits.put("tools", kit); } - @MapValueType(Kit.class) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) diff --git a/Essentials/src/net/ess3/settings/SpawnsHolder.java b/Essentials/src/net/ess3/settings/SpawnsHolder.java index 666c808fa..00ca4a48f 100644 --- a/Essentials/src/net/ess3/settings/SpawnsHolder.java +++ b/Essentials/src/net/ess3/settings/SpawnsHolder.java @@ -36,7 +36,7 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> /** * Sets a spawn location * - * @param loc - Location you want to set as spawn + * @param loc - Location you want to set as spawn * @param group - Group to save it under in the config */ public void setSpawn(final Location loc, final String group) diff --git a/Essentials/src/net/ess3/settings/WorldOptions.java b/Essentials/src/net/ess3/settings/WorldOptions.java index e49ebb181..40e57dee7 100644 --- a/Essentials/src/net/ess3/settings/WorldOptions.java +++ b/Essentials/src/net/ess3/settings/WorldOptions.java @@ -26,7 +26,6 @@ public class WorldOptions implements StorageObject } } } - @Comment("Disables godmode for all players if they teleport to this world.") private boolean godmode = true; @Comment("Prevent creatures spawning") diff --git a/Essentials/src/net/ess3/settings/Worlds.java b/Essentials/src/net/ess3/settings/Worlds.java index b65dd1de4..0ef4f7ea2 100644 --- a/Essentials/src/net/ess3/settings/Worlds.java +++ b/Essentials/src/net/ess3/settings/Worlds.java @@ -9,5 +9,4 @@ import net.ess3.storage.StorageObject; @EqualsAndHashCode(callSuper = false) public class Worlds implements StorageObject { - } diff --git a/Essentials/src/net/ess3/settings/antibuild/Alert.java b/Essentials/src/net/ess3/settings/antibuild/Alert.java index 4553f84ed..c2c538103 100644 --- a/Essentials/src/net/ess3/settings/antibuild/Alert.java +++ b/Essentials/src/net/ess3/settings/antibuild/Alert.java @@ -32,8 +32,9 @@ public class Alert implements StorageObject public void setupDefaults() { - Material[] mat = { - Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET + Material[] mat = + { + Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET }; alertOnPlacement.addAll(Arrays.asList(mat)); alertOnUse.add(Material.LAVA_BUCKET); diff --git a/Essentials/src/net/ess3/settings/commands/List.java b/Essentials/src/net/ess3/settings/commands/List.java index e2b869aaf..ea47d9115 100644 --- a/Essentials/src/net/ess3/settings/commands/List.java +++ b/Essentials/src/net/ess3/settings/commands/List.java @@ -1,6 +1,5 @@ package net.ess3.settings.commands; - import lombok.Data; import lombok.EqualsAndHashCode; import net.ess3.storage.Comment; diff --git a/Essentials/src/net/ess3/settings/commands/SocialSpy.java b/Essentials/src/net/ess3/settings/commands/SocialSpy.java index 4460c0cfd..9cb572689 100644 --- a/Essentials/src/net/ess3/settings/commands/SocialSpy.java +++ b/Essentials/src/net/ess3/settings/commands/SocialSpy.java @@ -21,7 +21,6 @@ public class SocialSpy implements StorageObject socialspyCommands.addAll(Arrays.asList("msg", "r", "mail", "m", "t", "emsg", "tell", "er", "reply", "ereply", "email")); } } - @ListType @Comment("Commands to listen for in socialspy") private List<String> socialspyCommands = new ArrayList<String>(); diff --git a/Essentials/src/net/ess3/settings/commands/Speed.java b/Essentials/src/net/ess3/settings/commands/Speed.java index a59991dd1..696d4280f 100644 --- a/Essentials/src/net/ess3/settings/commands/Speed.java +++ b/Essentials/src/net/ess3/settings/commands/Speed.java @@ -12,7 +12,6 @@ public class Speed implements StorageObject { @Comment("Set the max fly speed, values range from 0.2 to 1.0") private double maxFlySpeed = 1.0f; - @Comment("Set the max walk speed, values range from 0.1 to 1.0") private double maxWalkSpeed = 0.8f; } diff --git a/Essentials/src/net/ess3/settings/commands/Tempban.java b/Essentials/src/net/ess3/settings/commands/Tempban.java index aacebec88..1b49f3fbb 100644 --- a/Essentials/src/net/ess3/settings/commands/Tempban.java +++ b/Essentials/src/net/ess3/settings/commands/Tempban.java @@ -5,13 +5,13 @@ import lombok.EqualsAndHashCode; import net.ess3.storage.Comment; import net.ess3.storage.StorageObject; + @Data @EqualsAndHashCode(callSuper = false) public class Tempban implements StorageObject { @Comment( - "Set to the maximum time in seconds a player can be tempbanned for.\n"+ - "Set to -1 to disable, and override with essentials.tempban.unlimited" - ) + "Set to the maximum time in seconds a player can be tempbanned for.\n" + + "Set to -1 to disable, and override with essentials.tempban.unlimited") private long maxTempbanTime = -1; } diff --git a/Essentials/src/net/ess3/storage/StorageQueue.java b/Essentials/src/net/ess3/storage/StorageQueue.java index 94880c542..44c1d804e 100644 --- a/Essentials/src/net/ess3/storage/StorageQueue.java +++ b/Essentials/src/net/ess3/storage/StorageQueue.java @@ -71,10 +71,14 @@ public class StorageQueue implements Runnable { if (this.enabled.getAndSet(enabled) != enabled) { - if (enabled) { + if (enabled) + { startThread(); - } else { - while (queue.size() > 0) { + } + else + { + while (queue.size() > 0) + { work(); try { @@ -86,7 +90,7 @@ public class StorageQueue implements Runnable } } } - + } public int getQueueSize() diff --git a/Essentials/src/net/ess3/user/CooldownException.java b/Essentials/src/net/ess3/user/CooldownException.java index 08e163522..2cd9ac543 100644 --- a/Essentials/src/net/ess3/user/CooldownException.java +++ b/Essentials/src/net/ess3/user/CooldownException.java @@ -3,12 +3,10 @@ package net.ess3.user; public class CooldownException extends Exception { - private static final long serialVersionUID = 913632836257457319L; public CooldownException(String timeLeft) { super(timeLeft); } - } diff --git a/Essentials/src/net/ess3/user/IOfflinePlayer.java b/Essentials/src/net/ess3/user/IOfflinePlayer.java index b6032d09f..8a15a003f 100644 --- a/Essentials/src/net/ess3/user/IOfflinePlayer.java +++ b/Essentials/src/net/ess3/user/IOfflinePlayer.java @@ -10,7 +10,6 @@ public interface IOfflinePlayer String getDisplayName(); //Location getBedSpawnLocation(); - void setBanned(boolean bln); boolean hasPermission(Permission perm); diff --git a/Essentials/src/net/ess3/user/IOfflineUser.java b/Essentials/src/net/ess3/user/IOfflineUser.java index b5361da4f..237569825 100644 --- a/Essentials/src/net/ess3/user/IOfflineUser.java +++ b/Essentials/src/net/ess3/user/IOfflineUser.java @@ -5,5 +5,4 @@ import net.ess3.storage.IStorageObjectHolder; public interface IOfflineUser extends IStorageObjectHolder<UserData>//, IOfflinePlayer { - } diff --git a/Essentials/src/net/ess3/user/PlayerNotFoundException.java b/Essentials/src/net/ess3/user/PlayerNotFoundException.java index a61757d95..d4fa6b436 100644 --- a/Essentials/src/net/ess3/user/PlayerNotFoundException.java +++ b/Essentials/src/net/ess3/user/PlayerNotFoundException.java @@ -5,7 +5,6 @@ import static net.ess3.I18n._; public class PlayerNotFoundException extends Exception { - private static final long serialVersionUID = -510752839980332640L; public PlayerNotFoundException() diff --git a/Essentials/src/net/ess3/user/User.java b/Essentials/src/net/ess3/user/User.java index e74a0b878..6e0bfb13a 100644 --- a/Essentials/src/net/ess3/user/User.java +++ b/Essentials/src/net/ess3/user/User.java @@ -592,7 +592,6 @@ public class User extends UserBase implements IUser { return true; } - private long teleportInvulnerabilityTimestamp = 0; public void enableInvulnerabilityAfterTeleport() @@ -635,7 +634,7 @@ public class User extends UserBase implements IUser } } ess.getVanishedPlayers().add(getName()); - if(Permissions.VANISH_EFFECT.isAuthorized(this)) + if (Permissions.VANISH_EFFECT.isAuthorized(this)) { getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false)); } @@ -647,7 +646,7 @@ public class User extends UserBase implements IUser p.showPlayer(getPlayer()); } ess.getVanishedPlayers().remove(getName()); - if(Permissions.VANISH_EFFECT.isAuthorized(this)) + if (Permissions.VANISH_EFFECT.isAuthorized(this)) { getPlayer().removePotionEffect(PotionEffectType.INVISIBILITY); } diff --git a/Essentials/src/net/ess3/user/UserData.java b/Essentials/src/net/ess3/user/UserData.java index b9d684930..9b63fab2f 100644 --- a/Essentials/src/net/ess3/user/UserData.java +++ b/Essentials/src/net/ess3/user/UserData.java @@ -6,6 +6,7 @@ import net.ess3.storage.*; import org.bukkit.Location; import org.bukkit.Material; + @Data @EqualsAndHashCode(callSuper = false) public class UserData implements StorageObject @@ -14,8 +15,6 @@ public class UserData implements StorageObject { JAIL, MUTE, LASTHEAL, LASTTELEPORT, LOGIN, LOGOUT, KIT, COMMAND } - - private String nickname; private Double money; @MapValueType(StoredLocation.class) @@ -27,7 +26,6 @@ public class UserData implements StorageObject { return homes == null ? Collections.<String, StoredLocation>emptyMap() : Collections.unmodifiableMap(homes); } - @ListType(Material.class) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) @@ -37,7 +35,6 @@ public class UserData implements StorageObject { return unlimited == null ? Collections.<Material>emptySet() : Collections.unmodifiableSet(unlimited); } - @MapValueType(List.class) @MapKeyType(Material.class) @Getter(AccessLevel.NONE) @@ -48,7 +45,6 @@ public class UserData implements StorageObject { return powerTools == null ? Collections.<Material, List<String>>emptyMap() : Collections.unmodifiableMap(powerTools); } - private StoredLocation lastLocation; @MapKeyType(String.class) @MapValueType(Long.class) @@ -60,7 +56,6 @@ public class UserData implements StorageObject { return timestamps == null ? Collections.<String, Long>emptyMap() : Collections.unmodifiableMap(timestamps); } - private String jail; @ListType @Getter(AccessLevel.NONE) @@ -71,7 +66,6 @@ public class UserData implements StorageObject { return mails == null ? Collections.<String>emptyList() : Collections.unmodifiableList(mails); } - private Inventory inventory; private boolean teleportEnabled; @ListType @@ -83,7 +77,6 @@ public class UserData implements StorageObject { return ignore == null ? Collections.<String>emptySet() : Collections.unmodifiableSet(ignore); } - private boolean godmode; private boolean muted; private boolean jailed; diff --git a/Essentials/src/net/ess3/user/UserMap.java b/Essentials/src/net/ess3/user/UserMap.java index c83047f0c..9df31e543 100644 --- a/Essentials/src/net/ess3/user/UserMap.java +++ b/Essentials/src/net/ess3/user/UserMap.java @@ -141,7 +141,6 @@ public class UserMap extends StorageObjectMap<IUser> implements IUserMap { return matchUsers(name, false, false, requester); } - private final Pattern comma = Pattern.compile(","); public Set<IUser> matchUsers(final String name, final boolean includeHidden, final boolean includeOffline, final Player requester) diff --git a/Essentials/src/net/ess3/utils/DateUtil.java b/Essentials/src/net/ess3/utils/DateUtil.java index af3de2536..5fd569246 100644 --- a/Essentials/src/net/ess3/utils/DateUtil.java +++ b/Essentials/src/net/ess3/utils/DateUtil.java @@ -30,11 +30,13 @@ public class DateUtil } StringBuilder sb = new StringBuilder(); - int[] types = new int[]{ - Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND + int[] types = new int[] + { + Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND }; - String[] names = new String[]{ - _("year"), _("years"), _("month"), _("months"), _("day"), _("days"), _("hour"), _("hours"), _("minute"), _("minutes"), _("second"), _("seconds") + String[] names = new String[] + { + _("year"), _("years"), _("month"), _("months"), _("day"), _("days"), _("hour"), _("hours"), _("minute"), _("minutes"), _("second"), _("seconds") }; for (int i = 0; i < types.length; i++) { diff --git a/Essentials/src/net/ess3/utils/ExecuteTimer.java b/Essentials/src/net/ess3/utils/ExecuteTimer.java index 2d7b77605..bf97ee420 100644 --- a/Essentials/src/net/ess3/utils/ExecuteTimer.java +++ b/Essentials/src/net/ess3/utils/ExecuteTimer.java @@ -12,7 +12,6 @@ public class ExecuteTimer private final List<ExecuteRecord> times; private final DecimalFormat decimalFormat = new DecimalFormat("#0.000", DecimalFormatSymbols.getInstance(Locale.US)); - public ExecuteTimer() { times = new ArrayList<ExecuteRecord>(); diff --git a/Essentials/src/net/ess3/utils/LocationUtil.java b/Essentials/src/net/ess3/utils/LocationUtil.java index 8455f4864..664b0e74f 100644 --- a/Essentials/src/net/ess3/utils/LocationUtil.java +++ b/Essentials/src/net/ess3/utils/LocationUtil.java @@ -69,7 +69,6 @@ public class LocationUtil } return block.getLocation(); } - public final static int RADIUS = 3; public final static Vector3D[] VOLUME; @@ -82,13 +81,11 @@ public class LocationUtil this.y = y; this.z = z; } - public int x; public int y; public int z; } - static { List<Vector3D> pos = new ArrayList<Vector3D>(); @@ -213,7 +210,7 @@ public class LocationUtil } if ((!AIR_MATERIALS.contains(world.getBlockAt(x, y, z).getType().getId())) || (!AIR_MATERIALS.contains( - world.getBlockAt(x, y + 1, z).getType().getId()))) + world.getBlockAt(x, y + 1, z).getType().getId()))) { return true; } diff --git a/Essentials/src/net/ess3/utils/Target.java b/Essentials/src/net/ess3/utils/Target.java index 6e871a051..04fa17e1f 100644 --- a/Essentials/src/net/ess3/utils/Target.java +++ b/Essentials/src/net/ess3/utils/Target.java @@ -30,4 +30,3 @@ public class Target return location; } } - diff --git a/Essentials/src/net/ess3/utils/Util.java b/Essentials/src/net/ess3/utils/Util.java index 0817448bd..6f93b0909 100644 --- a/Essentials/src/net/ess3/utils/Util.java +++ b/Essentials/src/net/ess3/utils/Util.java @@ -16,7 +16,6 @@ public final class Util private Util() { } - private final static Pattern INVALIDFILECHARS = Pattern.compile("[^\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]"); private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]"); @@ -82,7 +81,7 @@ public final class Util public static ItemStack convertBlockToItem(final Block block) { final ItemStack is = new ItemStack(block.getType(), 1, block.getData()); - + final short durability = 0; switch (is.getType()) @@ -215,5 +214,4 @@ public final class Util } return buf.toString(); } - } diff --git a/Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java b/Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java index ee72d36df..c1946c84f 100644 --- a/Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java +++ b/Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java @@ -2,38 +2,26 @@ package net.ess3.utils.gnu.inet.encoding; /** - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software - * Foundation, Inc. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. * * Author: Oliver Hitz * * This file is part of GNU Libidn. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - - /** - * This class offers static methods for encoding/decoding strings - * using the Punycode algorithm. - * <ul> - * <li>RFC3492 Punycode - * </ul> - * Note that this implementation only supports 16-bit Unicode code - * points. + * This class offers static methods for encoding/decoding strings using the Punycode algorithm. <ul> <li>RFC3492 + * Punycode </ul> Note that this implementation only supports 16-bit Unicode code points. */ /* * Changes by snowleo: @@ -124,7 +112,7 @@ public class Punycode { int q = delta; - for (int k = BASE; ; k += BASE) + for (int k = BASE;; k += BASE) { int t; if (k <= bias) @@ -203,7 +191,7 @@ public class Punycode int oldi = i; int w = 1; - for (int k = BASE; ; k += BASE) + for (int k = BASE;; k += BASE) { if (d == input.length()) { diff --git a/Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java b/Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java index 7e4da7d79..fb1f3d0ce 100644 --- a/Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java +++ b/Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java @@ -2,30 +2,23 @@ package net.ess3.utils.gnu.inet.encoding; /** - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software - * Foundation, Inc. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. * * Author: Oliver Hitz * * This file is part of GNU Libidn. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. + * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + * details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA + * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - - /** * Exception handling for Punycode class. */ diff --git a/Essentials/src/net/ess3/utils/textreader/ArrayListInput.java b/Essentials/src/net/ess3/utils/textreader/ArrayListInput.java index 2bd0d914e..31b1ac991 100644 --- a/Essentials/src/net/ess3/utils/textreader/ArrayListInput.java +++ b/Essentials/src/net/ess3/utils/textreader/ArrayListInput.java @@ -27,5 +27,4 @@ public class ArrayListInput implements IText { return Collections.emptyMap(); } - } diff --git a/Essentials/src/net/ess3/utils/textreader/BookInput.java b/Essentials/src/net/ess3/utils/textreader/BookInput.java index b36d640dd..6f2543095 100644 --- a/Essentials/src/net/ess3/utils/textreader/BookInput.java +++ b/Essentials/src/net/ess3/utils/textreader/BookInput.java @@ -9,121 +9,121 @@ import java.util.*; public class BookInput implements IText { - private final transient List<String> lines; - private final transient List<String> chapters; - private final transient Map<String, Integer> bookmarks; - private final transient long lastChange; - private final static HashMap<String, SoftReference<BookInput>> cache = new HashMap<String, SoftReference<BookInput>>(); + private final transient List<String> lines; + private final transient List<String> chapters; + private final transient Map<String, Integer> bookmarks; + private final transient long lastChange; + private final static HashMap<String, SoftReference<BookInput>> cache = new HashMap<String, SoftReference<BookInput>>(); - public BookInput(final String filename, final boolean createFile, final IEssentials ess) throws IOException - { + public BookInput(final String filename, final boolean createFile, final IEssentials ess) throws IOException + { - File file = null; - if (file == null || !file.exists()) - { - file = new File(ess.getPlugin().getDataFolder(), filename + ".txt"); - } - if (!file.exists()) - { - if (createFile) - { - final InputStream input = ess.getPlugin().getResource(filename + ".txt"); - final OutputStream output = new FileOutputStream(file); - try - { - final byte[] buffer = new byte[1024]; - int length = input.read(buffer); - while (length > 0) - { - output.write(buffer, 0, length); - length = input.read(buffer); - } - } - finally - { - output.close(); - input.close(); - } - ess.getLogger().info("File " + filename + ".txt does not exist. Creating one for you."); - } - } - if (!file.exists()) - { - lastChange = 0; - lines = Collections.emptyList(); - chapters = Collections.emptyList(); - bookmarks = Collections.emptyMap(); - throw new FileNotFoundException("Could not create " + filename + ".txt"); - } - else - { - lastChange = file.lastModified(); - boolean readFromfile; - synchronized (cache) - { - final SoftReference<BookInput> inputRef = cache.get(file.getName()); - BookInput input; - if (inputRef == null || (input = inputRef.get()) == null || input.lastChange < lastChange) - { - lines = new ArrayList<String>(); - chapters = new ArrayList<String>(); - bookmarks = new HashMap<String, Integer>(); - cache.put(file.getName(), new SoftReference<BookInput>(this)); - readFromfile = true; - } - else - { - lines = Collections.unmodifiableList(input.getLines()); - chapters = Collections.unmodifiableList(input.getChapters()); - bookmarks = Collections.unmodifiableMap(input.getBookmarks()); - readFromfile = false; - } - } - if (readFromfile) - { - final BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); - try - { - int lineNumber = 0; - while (bufferedReader.ready()) - { - final String line = bufferedReader.readLine(); - if (line == null) - { - break; - } - if (line.length() > 0 && line.charAt(0) == '#') - { - bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-fk]", ""), lineNumber); - chapters.add(line.substring(1).replace('&', '§').replace("§§", "&")); - } - lines.add(line.replace('&', '§').replace("§§", "&")); - lineNumber++; - } - } - finally - { - bufferedReader.close(); - } - } - } - } + File file = null; + if (file == null || !file.exists()) + { + file = new File(ess.getPlugin().getDataFolder(), filename + ".txt"); + } + if (!file.exists()) + { + if (createFile) + { + final InputStream input = ess.getPlugin().getResource(filename + ".txt"); + final OutputStream output = new FileOutputStream(file); + try + { + final byte[] buffer = new byte[1024]; + int length = input.read(buffer); + while (length > 0) + { + output.write(buffer, 0, length); + length = input.read(buffer); + } + } + finally + { + output.close(); + input.close(); + } + ess.getLogger().info("File " + filename + ".txt does not exist. Creating one for you."); + } + } + if (!file.exists()) + { + lastChange = 0; + lines = Collections.emptyList(); + chapters = Collections.emptyList(); + bookmarks = Collections.emptyMap(); + throw new FileNotFoundException("Could not create " + filename + ".txt"); + } + else + { + lastChange = file.lastModified(); + boolean readFromfile; + synchronized (cache) + { + final SoftReference<BookInput> inputRef = cache.get(file.getName()); + BookInput input; + if (inputRef == null || (input = inputRef.get()) == null || input.lastChange < lastChange) + { + lines = new ArrayList<String>(); + chapters = new ArrayList<String>(); + bookmarks = new HashMap<String, Integer>(); + cache.put(file.getName(), new SoftReference<BookInput>(this)); + readFromfile = true; + } + else + { + lines = Collections.unmodifiableList(input.getLines()); + chapters = Collections.unmodifiableList(input.getChapters()); + bookmarks = Collections.unmodifiableMap(input.getBookmarks()); + readFromfile = false; + } + } + if (readFromfile) + { + final BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); + try + { + int lineNumber = 0; + while (bufferedReader.ready()) + { + final String line = bufferedReader.readLine(); + if (line == null) + { + break; + } + if (line.length() > 0 && line.charAt(0) == '#') + { + bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-fk]", ""), lineNumber); + chapters.add(line.substring(1).replace('&', '§').replace("§§", "&")); + } + lines.add(line.replace('&', '§').replace("§§", "&")); + lineNumber++; + } + } + finally + { + bufferedReader.close(); + } + } + } + } - @Override - public List<String> getLines() - { - return lines; - } + @Override + public List<String> getLines() + { + return lines; + } - @Override - public List<String> getChapters() - { - return chapters; - } + @Override + public List<String> getChapters() + { + return chapters; + } - @Override - public Map<String, Integer> getBookmarks() - { - return bookmarks; - } + @Override + public Map<String, Integer> getBookmarks() + { + return bookmarks; + } } diff --git a/Essentials/src/net/ess3/utils/textreader/BookPager.java b/Essentials/src/net/ess3/utils/textreader/BookPager.java index dd3332b40..e5113024c 100644 --- a/Essentials/src/net/ess3/utils/textreader/BookPager.java +++ b/Essentials/src/net/ess3/utils/textreader/BookPager.java @@ -9,103 +9,103 @@ import java.util.Map; public class BookPager { - private final transient IText text; + private final transient IText text; - public BookPager(final IText text) - { - this.text = text; - } + public BookPager(final IText text) + { + this.text = text; + } - public List<String> getPages(final String pageStr) throws Exception - { - List<String> lines = text.getLines(); - List<String> chapters = text.getChapters(); - List<String> pageLines = new ArrayList<String>(); - Map<String, Integer> bookmarks = text.getBookmarks(); + public List<String> getPages(final String pageStr) throws Exception + { + List<String> lines = text.getLines(); + List<String> chapters = text.getChapters(); + List<String> pageLines = new ArrayList<String>(); + Map<String, Integer> bookmarks = text.getBookmarks(); - //This checks to see if we have the chapter in the index - if (!bookmarks.containsKey(pageStr.toLowerCase(Locale.ENGLISH))) - { - throw new Exception(_("Unknown chapter.")); - } + //This checks to see if we have the chapter in the index + if (!bookmarks.containsKey(pageStr.toLowerCase(Locale.ENGLISH))) + { + throw new Exception(_("Unknown chapter.")); + } - //Since we have a valid chapter, count the number of lines in the chapter - final int chapterstart = bookmarks.get(pageStr.toLowerCase(Locale.ENGLISH)) + 1; - int chapterend; - for (chapterend = chapterstart; chapterend < lines.size(); chapterend++) - { - final String line = lines.get(chapterend); - if (line.length() > 0 && line.charAt(0) == '#') - { - break; - } - } + //Since we have a valid chapter, count the number of lines in the chapter + final int chapterstart = bookmarks.get(pageStr.toLowerCase(Locale.ENGLISH)) + 1; + int chapterend; + for (chapterend = chapterstart; chapterend < lines.size(); chapterend++) + { + final String line = lines.get(chapterend); + if (line.length() > 0 && line.charAt(0) == '#') + { + break; + } + } - for (int lineNo = chapterstart; lineNo < chapterend; lineNo += 1) - { - String pageLine = "\u00a70" + lines.get(lineNo); - String tempLine; - final double max = 18; - final int lineLength = pageLine.length(); - double length = 0; - int pointer = 0; - int start = 0; - double weight = 1; + for (int lineNo = chapterstart; lineNo < chapterend; lineNo += 1) + { + String pageLine = "\u00a70" + lines.get(lineNo); + String tempLine; + final double max = 18; + final int lineLength = pageLine.length(); + double length = 0; + int pointer = 0; + int start = 0; + double weight = 1; - while (pointer < lineLength) - { - if (length >= max) - { - tempLine = pageLine.substring(start, pointer); - pageLines.add(tempLine); - start = pointer; - length = 0; - } + while (pointer < lineLength) + { + if (length >= max) + { + tempLine = pageLine.substring(start, pointer); + pageLines.add(tempLine); + start = pointer; + length = 0; + } - Character letter = pageLine.charAt(pointer); + Character letter = pageLine.charAt(pointer); - if (letter == '\u00a7') - { - Character nextLetter = pageLine.charAt(pointer + 1); - if (nextLetter == 'l' || nextLetter == 'L') - { - weight = 1.25; - } - else - { - weight = 1; - } - pointer++; - } - else if (letter == ' ') - { - length += (0.7 * weight); - } - else - { - length += weight; - } - pointer++; - } - if (length > 0) - { - tempLine = pageLine.substring(start, lineLength); - pageLines.add(tempLine); - } - } + if (letter == '\u00a7') + { + Character nextLetter = pageLine.charAt(pointer + 1); + if (nextLetter == 'l' || nextLetter == 'L') + { + weight = 1.25; + } + else + { + weight = 1; + } + pointer++; + } + else if (letter == ' ') + { + length += (0.7 * weight); + } + else + { + length += weight; + } + pointer++; + } + if (length > 0) + { + tempLine = pageLine.substring(start, lineLength); + pageLines.add(tempLine); + } + } - List<String> pages = new ArrayList<String>(); - for (int count = 0; count < pageLines.size(); count += 12) - { - StringBuilder newPage = new StringBuilder(); - for (int i = count; i < count + 12 && i < pageLines.size(); i++) - { - newPage.append("\n").append(pageLines.get(i)); - } + List<String> pages = new ArrayList<String>(); + for (int count = 0; count < pageLines.size(); count += 12) + { + StringBuilder newPage = new StringBuilder(); + for (int i = count; i < count + 12 && i < pageLines.size(); i++) + { + newPage.append("\n").append(pageLines.get(i)); + } - pages.add(newPage.toString()); - } + pages.add(newPage.toString()); + } - return pages; - } + return pages; + } } diff --git a/Essentials/src/net/ess3/utils/textreader/HelpInput.java b/Essentials/src/net/ess3/utils/textreader/HelpInput.java index 8044a5807..334b1d0cd 100644 --- a/Essentials/src/net/ess3/utils/textreader/HelpInput.java +++ b/Essentials/src/net/ess3/utils/textreader/HelpInput.java @@ -56,8 +56,8 @@ public class HelpInput implements IText try { if (!match.equalsIgnoreCase("") && (!pluginNameLow.contains(match)) && (!k.getKey().toLowerCase(Locale.ENGLISH).contains( - match)) && (!(k.getValue().get(DESCRIPTION) instanceof String && ((String)k.getValue().get(DESCRIPTION)).toLowerCase( - Locale.ENGLISH).contains(match)))) + match)) && (!(k.getValue().get(DESCRIPTION) instanceof String && ((String)k.getValue().get(DESCRIPTION)).toLowerCase( + Locale.ENGLISH).contains(match)))) { continue; } diff --git a/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java b/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java index 58493fc86..6ef3731c1 100644 --- a/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java +++ b/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java @@ -32,5 +32,4 @@ public class SimpleTextInput implements IText { return Collections.emptyMap(); } - } diff --git a/Essentials/test/net/ess3/EssentialsTest.java b/Essentials/test/net/ess3/EssentialsTest.java index f01e14a5a..b6e17720b 100644 --- a/Essentials/test/net/ess3/EssentialsTest.java +++ b/Essentials/test/net/ess3/EssentialsTest.java @@ -91,7 +91,7 @@ public abstract class EssentialsTest extends TestCase folder = new File(folder, "Essentials-" + System.currentTimeMillis()); when(plugin.getDataFolder()).thenReturn(folder); when(world.getName()).thenReturn("world"); - + } protected void createFolder() diff --git a/Essentials/test/net/ess3/StorageTest.java b/Essentials/test/net/ess3/StorageTest.java index 4ca05d9a8..4c96a165b 100644 --- a/Essentials/test/net/ess3/StorageTest.java +++ b/Essentials/test/net/ess3/StorageTest.java @@ -155,28 +155,28 @@ public class StorageTest extends EssentialsTest } /*@Test - public void testOldUserdata() - { - ExecuteTimer ext = new ExecuteTimer(); - ext.start(); - OfflinePlayer base1 = server.createPlayer("testPlayer1", ess); - server.addPlayer(base1); - ext.mark("fake user created"); - UserData user = (UserData)ess.getUserMap().getUser(base1); - ext.mark("load empty user"); - for (int j = 0; j < 1; j++) - { - user.setHome("home", new Location(world, j, j, j)); - } - ext.mark("change home 1 times"); - user.save(); - ext.mark("write user"); - user.save(); - ext.mark("write user (cached)"); - user.reloadConfig(); - ext.mark("reloaded file"); - user.reloadConfig(); - ext.mark("reloaded file (cached)"); - System.out.println(ext.end()); - }*/ + public void testOldUserdata() + { + ExecuteTimer ext = new ExecuteTimer(); + ext.start(); + OfflinePlayer base1 = server.createPlayer("testPlayer1", ess); + server.addPlayer(base1); + ext.mark("fake user created"); + UserData user = (UserData)ess.getUserMap().getUser(base1); + ext.mark("load empty user"); + for (int j = 0; j < 1; j++) + { + user.setHome("home", new Location(world, j, j, j)); + } + ext.mark("change home 1 times"); + user.save(); + ext.mark("write user"); + user.save(); + ext.mark("write user (cached)"); + user.reloadConfig(); + ext.mark("reloaded file"); + user.reloadConfig(); + ext.mark("reloaded file (cached)"); + System.out.println(ext.end()); + }*/ } diff --git a/Essentials/test/net/ess3/UserTest.java b/Essentials/test/net/ess3/UserTest.java index 6457ef637..418c8d155 100644 --- a/Essentials/test/net/ess3/UserTest.java +++ b/Essentials/test/net/ess3/UserTest.java @@ -6,7 +6,6 @@ import net.ess3.api.IUser; public class UserTest extends EssentialsTest { //private final IUser base1; - public UserTest(String testName) { super(testName); @@ -21,49 +20,48 @@ public class UserTest extends EssentialsTest } /*public void testUpdate() - { - OfflinePlayer base1alt = server.createPlayer(base1.getName(), ess); - assertEquals(base1alt, ess.getUserMap().getUser(base1alt).getBase()); - } + { + OfflinePlayer base1alt = server.createPlayer(base1.getName(), ess); + assertEquals(base1alt, ess.getUserMap().getUser(base1alt).getBase()); + } - public void testHome() - { - IUser user = ess.getUserMap().getUser(base1); - Location loc = base1.getLocation(); - user.setHome(); - OfflinePlayer base2 = server.createPlayer(base1.getName(), ess); - IUser user2 = ess.getUserMap().getUser(base2); + public void testHome() + { + IUser user = ess.getUserMap().getUser(base1); + Location loc = base1.getLocation(); + user.setHome(); + OfflinePlayer base2 = server.createPlayer(base1.getName(), ess); + IUser user2 = ess.getUserMap().getUser(base2); - Location home = user2.getHome(loc); - assertNotNull(home); - assertEquals(loc.getWorld().getName(), home.getWorld().getName()); - assertEquals(loc.getX(), home.getX()); - assertEquals(loc.getY(), home.getY()); - assertEquals(loc.getZ(), home.getZ()); - assertEquals(loc.getYaw(), home.getYaw()); - assertEquals(loc.getPitch(), home.getPitch()); - }*/ + Location home = user2.getHome(loc); + assertNotNull(home); + assertEquals(loc.getWorld().getName(), home.getWorld().getName()); + assertEquals(loc.getX(), home.getX()); + assertEquals(loc.getY(), home.getY()); + assertEquals(loc.getZ(), home.getZ()); + assertEquals(loc.getYaw(), home.getYaw()); + assertEquals(loc.getPitch(), home.getPitch()); + }*/ /*public void testMoney() - { - should("properly set, take, give, and get money"); - IUser user = ess.getUserMap().getUser(base1); - double i; - user.setMoney(i = 100.5); - user.takeMoney(50); - i -= 50; - user.giveMoney(25); - i += 25; - assertEquals(user.getMoney(), i); - }*/ + { + should("properly set, take, give, and get money"); + IUser user = ess.getUserMap().getUser(base1); + double i; + user.setMoney(i = 100.5); + user.takeMoney(50); + i -= 50; + user.giveMoney(25); + i += 25; + assertEquals(user.getMoney(), i); + }*/ /*public void testGetGroup() - { - should("return the default group"); - IUser user = ess.getUserMap().getUser(base1); - //assertEquals(user.getGroup(), "default"); - }*/ - + { + should("return the default group"); + IUser user = ess.getUserMap().getUser(base1); + //assertEquals(user.getGroup(), "default"); + }*/ public void testNoop() { assertTrue(true); diff --git a/Essentials/test/net/ess3/UtilTest.java b/Essentials/test/net/ess3/UtilTest.java index c4b218745..749ee1c5a 100644 --- a/Essentials/test/net/ess3/UtilTest.java +++ b/Essentials/test/net/ess3/UtilTest.java @@ -12,12 +12,11 @@ import static net.ess3.I18n._; public class UtilTest extends EssentialsTest { - public UtilTest(String name) { super(name); } - + public void testI18n() { _("Hello {0}, how are you?"); diff --git a/Essentials2Compat/pom.xml b/Essentials2Compat/pom.xml index 81dc96ac8..74222b99e 100644 --- a/Essentials2Compat/pom.xml +++ b/Essentials2Compat/pom.xml @@ -1,20 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> + <parent> + <groupId>net.essentials3</groupId> + <artifactId>BuildAll</artifactId> + <version>3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <artifactId>Essentials2Compat</artifactId> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>Essentials</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> + <artifactId>Essentials2Compat</artifactId> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>Essentials</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> </project> diff --git a/Essentials2Compat/src/com/earth2me/essentials/Economy.java b/Essentials2Compat/src/com/earth2me/essentials/Economy.java index aa383a40c..34ae3c60b 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/Economy.java +++ b/Essentials2Compat/src/com/earth2me/essentials/Economy.java @@ -14,7 +14,6 @@ public final class Economy private Economy() { } - private static IEssentials ess; private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded."; @@ -38,11 +37,10 @@ public final class Economy /** * Sets the balance of a user * - * @param name Name of the user + * @param name Name of the user * @param balance The balance you want to set * @throws UserDoesNotExistException If a user by that name does not exists - * @throws net.ess3.api.NoLoanPermittedException - * If the user is not allowed to have a negative balance + * @throws net.ess3.api.NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException { @@ -56,10 +54,10 @@ public final class Economy /** * Adds money to the balance of a user * - * @param name Name of the user + * @param name Name of the user * @param amount The money you want to add * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException { @@ -70,10 +68,10 @@ public final class Economy /** * Subtracts money from the balance of a user * - * @param name Name of the user + * @param name Name of the user * @param amount The money you want to subtract * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException { @@ -84,10 +82,10 @@ public final class Economy /** * Divides the balance of a user by a value * - * @param name Name of the user + * @param name Name of the user * @param value The balance is divided by this value * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException { @@ -98,10 +96,10 @@ public final class Economy /** * Multiplies the balance of a user by a value * - * @param name Name of the user + * @param name Name of the user * @param value The balance is multiplied by this value * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException { @@ -114,7 +112,7 @@ public final class Economy * * @param name Name of the user * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException { @@ -126,7 +124,7 @@ public final class Economy } /** - * @param name Name of the user + * @param name Name of the user * @param amount The amount of money the user should have * @return true, if the user has more or an equal amount of money * @throws UserDoesNotExistException If a user by that name does not exists @@ -137,7 +135,7 @@ public final class Economy } /** - * @param name Name of the user + * @param name Name of the user * @param amount The amount of money the user should have * @return true, if the user has more money * @throws UserDoesNotExistException If a user by that name does not exists @@ -148,7 +146,7 @@ public final class Economy } /** - * @param name Name of the user + * @param name Name of the user * @param amount The amount of money the user should not have * @return true, if the user has less money * @throws UserDoesNotExistException If a user by that name does not exists diff --git a/Essentials2Compat/src/com/earth2me/essentials/ISettings.java b/Essentials2Compat/src/com/earth2me/essentials/ISettings.java index 61cfcaad6..e566b82c9 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/ISettings.java +++ b/Essentials2Compat/src/com/earth2me/essentials/ISettings.java @@ -1,6 +1,5 @@ package com.earth2me.essentials; - import java.util.List; import java.util.Map; import java.util.Set; @@ -24,7 +23,6 @@ public interface ISettings long getBackupInterval(); //MessageFormat getChatFormat(String group); - int getChatRadius(); double getCommandCost(String label); diff --git a/Essentials2Compat/src/com/earth2me/essentials/Settings.java b/Essentials2Compat/src/com/earth2me/essentials/Settings.java index cda4a91c5..40ed1918c 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/Settings.java +++ b/Essentials2Compat/src/com/earth2me/essentials/Settings.java @@ -52,7 +52,6 @@ public final class Settings implements ISettings { return config.getInt("sethome-multiple." + set, config.getInt("sethome-multiple.default", 3)); } - private int chatRadius = 0; private int _getChatRadius() @@ -89,7 +88,6 @@ public final class Settings implements ISettings { return config.getInt("starting-balance", 0); } - private Set<String> disabledCommands = new HashSet<String>(); @Override @@ -142,10 +140,8 @@ public final class Settings implements ISettings } return config.getBoolean("override-" + name.toLowerCase(Locale.ENGLISH), false); } - private ConfigurationSection commandCosts; - public ConfigurationSection _getCommandCosts() { if (config.isConfigurationSection("command-costs")) @@ -178,7 +174,6 @@ public final class Settings implements ISettings } return 0.0; } - private String nicknamePrefix = "~"; private String _getNicknamePrefix() @@ -203,7 +198,6 @@ public final class Settings implements ISettings { return config.getDouble("heal-cooldown", 0); } - private ConfigurationSection kits; public ConfigurationSection _getKits() @@ -244,7 +238,6 @@ public final class Settings implements ISettings } return null; } - private ChatColor operatorColor = null; @Override @@ -318,31 +311,29 @@ public final class Settings implements ISettings { return config.getString("backup.command", null); } - private Map<String, MessageFormat> chatFormats = Collections.synchronizedMap(new HashMap<String, MessageFormat>()); /*@Override //TODO: implement this - public MessageFormat getChatFormat(String group) - { - MessageFormat mFormat = chatFormats.get(group); - if (mFormat == null) - { - String format = config.getString("chat.group-formats." + (group == null ? "Default" : group), - config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}")); - format = Util.replaceFormat(format); - format = format.replace("{DISPLAYNAME}", "%1$s"); - format = format.replace("{GROUP}", "{0}"); - format = format.replace("{MESSAGE}", "%2$s"); - format = format.replace("{WORLDNAME}", "{1}"); - format = format.replace("{SHORTWORLDNAME}", "{2}"); - format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]"); - format = "§r".concat(format); - mFormat = new MessageFormat(format); - chatFormats.put(group, mFormat); - } - return mFormat; - }*/ - + public MessageFormat getChatFormat(String group) + { + MessageFormat mFormat = chatFormats.get(group); + if (mFormat == null) + { + String format = config.getString("chat.group-formats." + (group == null ? "Default" : group), + config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}")); + format = Util.replaceFormat(format); + format = format.replace("{DISPLAYNAME}", "%1$s"); + format = format.replace("{GROUP}", "{0}"); + format = format.replace("{MESSAGE}", "%2$s"); + format = format.replace("{WORLDNAME}", "{1}"); + format = format.replace("{SHORTWORLDNAME}", "{2}"); + format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]"); + format = "§r".concat(format); + mFormat = new MessageFormat(format); + chatFormats.put(group, mFormat); + } + return mFormat; + }*/ public String getDefaultChatformat() { return config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"); @@ -384,7 +375,6 @@ public final class Settings implements ISettings return config.getBoolean("sort-list-by-groups", true); } - public void reloadConfig() { config.load(); @@ -415,7 +405,6 @@ public final class Settings implements ISettings warnOnBuildDisallow = _warnOnBuildDisallow(); mailsPerMinute = _getMailsPerMinute(); } - private List<Integer> itemSpawnBl = new ArrayList<Integer>(); @Override @@ -451,7 +440,6 @@ public final class Settings implements ISettings } return epItemSpwn; } - private List<String> enabledSigns = new ArrayList<String>(); private boolean signsEnabled = false; @@ -490,7 +478,6 @@ public final class Settings implements ISettings } return newSigns; } - private boolean warnOnBuildDisallow; private boolean _warnOnBuildDisallow() @@ -503,7 +490,6 @@ public final class Settings implements ISettings { return warnOnBuildDisallow; } - private boolean debug = false; private boolean configDebug = false; @@ -596,7 +582,6 @@ public final class Settings implements ISettings { return config.getBoolean(configName, def); } - private final static double MAXMONEY = 10000000000000.0; @Override @@ -609,7 +594,6 @@ public final class Settings implements ISettings } return max; } - private final static double MINMONEY = -10000000000000.0; @Override @@ -644,7 +628,6 @@ public final class Settings implements ISettings { return config.getBoolean("remove-god-on-disconnect", false); } - private boolean changeDisplayName = true; private boolean _changeDisplayName() @@ -657,7 +640,6 @@ public final class Settings implements ISettings { return changeDisplayName; } - private boolean changePlayerListName = false; private boolean _changePlayerListName() @@ -676,7 +658,6 @@ public final class Settings implements ISettings { return config.getBoolean("use-bukkit-permissions", false); } - private boolean prefixsuffixconfigured = false; private boolean addprefixsuffix = false; private boolean essentialsChatActive = false; @@ -702,7 +683,6 @@ public final class Settings implements ISettings { return prefixsuffixconfigured ? addprefixsuffix : essentialsChatActive; } - private boolean disablePrefix = false; private boolean _disablePrefix() @@ -715,7 +695,6 @@ public final class Settings implements ISettings { return disablePrefix; } - private boolean disableSuffix = false; private boolean _disableSuffix() @@ -740,7 +719,6 @@ public final class Settings implements ISettings { return config.getLong("auto-afk-kick", -1); } - private boolean getFreezeAfkPlayers; @Override @@ -753,7 +731,6 @@ public final class Settings implements ISettings { return config.getBoolean("freeze-afk-players", false); } - private boolean cancelAfkOnMove; @Override @@ -772,7 +749,6 @@ public final class Settings implements ISettings { return config.getBoolean("death-messages", true); } - private Set<String> noGodWorlds = new HashSet<String>(); @Override @@ -804,7 +780,6 @@ public final class Settings implements ISettings { return config.getBoolean("world-home-permissions", false); } - private boolean registerBackInListener; @Override @@ -817,7 +792,6 @@ public final class Settings implements ISettings { return config.getBoolean("register-back-in-listener", false); } - private boolean disableItemPickupWhileAfk; @Override @@ -875,7 +849,6 @@ public final class Settings implements ISettings { this.metricsEnabled = metricsEnabled; } - private boolean teleportInvulnerability; @Override @@ -894,7 +867,6 @@ public final class Settings implements ISettings { return teleportInvulnerability; } - private long loginAttackDelay; private long _getLoginAttackDelay() @@ -907,7 +879,6 @@ public final class Settings implements ISettings { return loginAttackDelay; } - private int signUsePerSecond; private int _getSignUsePerSecond() @@ -937,7 +908,6 @@ public final class Settings implements ISettings double maxSpeed = config.getDouble("max-walk-speed", 0.8); return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed); } - private int mailsPerMinute; private int _getMailsPerMinute() diff --git a/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java b/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java index 040fdd875..a34734cf9 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java +++ b/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java @@ -134,7 +134,6 @@ class UpdateUserFiles String realname = getPlayer(name); return realname == null ? BROKENNAME : realname; } - private final Map<String, String> players = new HashMap<String, String>(); private String getPlayer(String check) diff --git a/Essentials2Compat/src/com/earth2me/essentials/UserData.java b/Essentials2Compat/src/com/earth2me/essentials/UserData.java index 7acf309df..b7f6d2d40 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/UserData.java +++ b/Essentials2Compat/src/com/earth2me/essentials/UserData.java @@ -16,7 +16,6 @@ public class UserData private EssentialsConf config; private final File folder; - protected UserData(IEssentials ess, File file) { this.ess = ess; @@ -59,7 +58,6 @@ public class UserData kitTimestamps = _getKitTimestamps(); nickname = _getNickname(); } - private double money; private double _getMoney() @@ -91,7 +89,6 @@ public class UserData config.setProperty("money", value); config.save(); } - private Map<String, Object> homes; private Map<String, Object> _getHomes() @@ -124,7 +121,6 @@ public class UserData return config.getLocation("homes." + search, ess.getServer()); } - public List<String> getHomes() { return new ArrayList<String>(homes.keySet()); @@ -166,7 +162,6 @@ public class UserData } return false; } - private String nickname; public String _getNickname() @@ -185,7 +180,6 @@ public class UserData config.setProperty("nickname", nick); config.save(); } - private List<Integer> unlimited; private List<Integer> _getUnlimited() @@ -216,7 +210,6 @@ public class UserData config.setProperty("unlimited", unlimited); config.save(); } - private Map<String, Object> powertools; private Map<String, Object> _getPowertools() @@ -270,7 +263,6 @@ public class UserData { return !powertools.isEmpty(); } - private StoredLocation lastLocation; private StoredLocation _getLastLocation() @@ -289,8 +281,6 @@ public class UserData { return lastLocation; } - - private long lastTeleportTimestamp; private long _getLastTeleportTimestamp() @@ -309,7 +299,6 @@ public class UserData config.setProperty("timestamps.lastteleport", time); config.save(); } - private long lastHealTimestamp; private long _getLastHealTimestamp() @@ -328,7 +317,6 @@ public class UserData config.setProperty("timestamps.lastheal", time); config.save(); } - private String jail; private String _getJail() @@ -355,7 +343,6 @@ public class UserData } config.save(); } - private List<String> mails; private List<String> _getMails() @@ -388,7 +375,6 @@ public class UserData mails.add(mail); setMails(mails); } - private boolean teleportEnabled; private boolean getTeleportEnabled() @@ -421,7 +407,6 @@ public class UserData setSocialSpyEnabled(ret); return ret; } - private List<String> ignoredPlayers; public List<String> getIgnoredPlayers() @@ -443,8 +428,6 @@ public class UserData } config.save(); } - - private boolean godmode; private boolean _getGodModeEnabled() @@ -463,7 +446,6 @@ public class UserData config.setProperty("godmode", set); config.save(); } - private boolean muted; public boolean getMuted() @@ -482,7 +464,6 @@ public class UserData config.setProperty("muted", set); config.save(); } - private long muteTimeout; private long _getMuteTimeout() @@ -501,7 +482,6 @@ public class UserData config.setProperty("timestamps.mute", time); config.save(); } - private boolean jailed; private boolean getJailed() @@ -527,7 +507,6 @@ public class UserData setJailed(ret); return ret; } - private long jailTimeout; private long _getJailTimeout() @@ -568,7 +547,6 @@ public class UserData config.setProperty("ban.timeout", time); config.save(); } - private long lastLogin; private long _getLastLogin() @@ -586,8 +564,6 @@ public class UserData lastLogin = time; config.setProperty("timestamps.login", time); } - - private long lastLogout; private long _getLastLogout() @@ -606,7 +582,6 @@ public class UserData config.setProperty("timestamps.logout", time); config.save(); } - private String lastLoginAddress; private String _getLastLoginAddress() @@ -624,7 +599,6 @@ public class UserData lastLoginAddress = address; config.setProperty("ipAddress", address); } - private boolean afk; private boolean getAfk() @@ -650,7 +624,6 @@ public class UserData setAfk(ret); return ret; } - private boolean newplayer; //TODO: unused variable? private String geolocation; @@ -678,7 +651,6 @@ public class UserData } config.save(); } - private boolean isSocialSpyEnabled; private boolean _isSocialSpyEnabled() @@ -697,7 +669,6 @@ public class UserData config.setProperty("socialspy", status); config.save(); } - private boolean isNPC; private boolean _isNPC() @@ -716,7 +687,6 @@ public class UserData config.setProperty("npc", set); config.save(); } - private boolean arePowerToolsEnabled; public boolean arePowerToolsEnabled() @@ -742,7 +712,6 @@ public class UserData { return config.getBoolean("powertoolsenabled", true); } - private ConfigurationSection kitTimestamps; private ConfigurationSection _getKitTimestamps() diff --git a/Essentials2Compat/src/com/earth2me/essentials/Util.java b/Essentials2Compat/src/com/earth2me/essentials/Util.java index 21ff4e8b4..bb66d7dcc 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/Util.java +++ b/Essentials2Compat/src/com/earth2me/essentials/Util.java @@ -12,7 +12,6 @@ public class Util private Util() { } - private final static Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9]"); private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]"); @@ -33,8 +32,6 @@ public class Util { return INVALIDCHARS.matcher(string).replaceAll(""); } - - private static DecimalFormat dFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US)); public static String formatAsCurrency(final double value) diff --git a/EssentialsAntiBuild/pom.xml b/EssentialsAntiBuild/pom.xml index 0db30ef3b..b99f53c5d 100644 --- a/EssentialsAntiBuild/pom.xml +++ b/EssentialsAntiBuild/pom.xml @@ -1,20 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> + <parent> + <groupId>net.essentials3</groupId> + <artifactId>BuildAll</artifactId> + <version>3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <artifactId>EssentialsAntiBuild</artifactId> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>Essentials</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> + <artifactId>EssentialsAntiBuild</artifactId> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>Essentials</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> </project> diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java b/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java index 51e49c463..1cbd4df6e 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java @@ -1,6 +1,5 @@ package net.ess3.antibuild; - import org.bukkit.plugin.Plugin; diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java b/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java index f280be873..eb980a2b2 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java @@ -67,12 +67,10 @@ public enum Permissions implements IPermission { return PermissionFactory.checkPermission(sender, this); } - public static MaterialDotStarPermission PLACEMENT = new MaterialDotStarPermission("essentials.build.place"); public static MaterialDotStarPermission BREAK = new MaterialDotStarPermission("essentials.build.break"); public static MaterialDotStarPermission INTERACT = new MaterialDotStarPermission("essentials.build.interact"); public static MaterialDotStarPermission CRAFT = new MaterialDotStarPermission("essentials.build.craft"); public static MaterialDotStarPermission PICKUP = new MaterialDotStarPermission("essentials.build.pickup"); public static MaterialDotStarPermission DROP = new MaterialDotStarPermission("essentials.build.drop"); - } diff --git a/EssentialsChat/pom.xml b/EssentialsChat/pom.xml index e59886710..6be18a14c 100644 --- a/EssentialsChat/pom.xml +++ b/EssentialsChat/pom.xml @@ -1,20 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> + <parent> + <groupId>net.essentials3</groupId> + <artifactId>BuildAll</artifactId> + <version>3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <artifactId>EssentialsChat</artifactId> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>Essentials</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> + <artifactId>EssentialsChat</artifactId> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>Essentials</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> </project> diff --git a/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java b/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java index 7b33ba1a4..15e2d3b8b 100644 --- a/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java @@ -83,9 +83,10 @@ public abstract class EssentialsChatPlayer implements Listener { event.setFormat( format.format( - new Object[]{ - group, world, world.substring(0, 1).toUpperCase(Locale.ENGLISH) - })); + new Object[] + { + group, world, world.substring(0, 1).toUpperCase(Locale.ENGLISH) + })); } } diff --git a/EssentialsExtra/pom.xml b/EssentialsExtra/pom.xml index fc2f8e23f..0caa52250 100644 --- a/EssentialsExtra/pom.xml +++ b/EssentialsExtra/pom.xml @@ -1,20 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> + <parent> + <groupId>net.essentials3</groupId> + <artifactId>BuildAll</artifactId> + <version>3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <artifactId>EssentialsExtra</artifactId> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>Essentials</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> + <artifactId>EssentialsExtra</artifactId> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>Essentials</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> </project> diff --git a/EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java b/EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java index 05418e9d8..258b53bb5 100644 --- a/EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java +++ b/EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java @@ -14,6 +14,7 @@ public @interface AnnotatedCommand String usage() default ""; - String[] aliases() default { + String[] aliases() default + { }; } diff --git a/EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java b/EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java index 4445dbd11..90cfb85aa 100644 --- a/EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java +++ b/EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java @@ -68,8 +68,9 @@ public class EssentialsExtra extends JavaPlugin } } } - urls = new URL[]{ - commandDir.toURI().toURL() + urls = new URL[] + { + commandDir.toURI().toURL() }; } catch (Exception ex) diff --git a/EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java b/EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java index a6173a243..36ee400e0 100644 --- a/EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java +++ b/EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java @@ -1,6 +1,5 @@ package net.ess3.extra.commands; - import java.util.Random; import net.ess3.api.IUser; import net.ess3.commands.EssentialsCommand; diff --git a/EssentialsGeoIP/pom.xml b/EssentialsGeoIP/pom.xml index 18727e281..4b3808f01 100644 --- a/EssentialsGeoIP/pom.xml +++ b/EssentialsGeoIP/pom.xml @@ -35,11 +35,11 @@ <goal>shade</goal> </goals> <configuration> - <artifactSet> - <includes> - <include>org.kohsuke:geoip</include> - </includes> - </artifactSet> + <artifactSet> + <includes> + <include>org.kohsuke:geoip</include> + </includes> + </artifactSet> </configuration> </execution> </executions> diff --git a/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java b/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java index e96b8094c..07e68c3ee 100644 --- a/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java +++ b/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java @@ -10,7 +10,7 @@ import org.bukkit.plugin.Plugin; public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP> { private final Plugin geoip; - + public ConfigHolder(final IEssentials ess, final Plugin geoip) { super(ess, GeoIP.class, new File(geoip.getDataFolder(), "config.yml")); diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java index cb438335b..5e31c4996 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java @@ -75,7 +75,8 @@ public class GMGroupEvent extends Event public enum Action
{
- GROUP_PERMISSIONS_CHANGED, GROUP_INHERITANCE_CHANGED, GROUP_INFO_CHANGED, GROUP_ADDED, GROUP_REMOVED,}
+ GROUP_PERMISSIONS_CHANGED, GROUP_INHERITANCE_CHANGED, GROUP_INFO_CHANGED, GROUP_ADDED, GROUP_REMOVED,
+ }
public void schedule(final GMGroupEvent event)
{
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java index d7f2e276e..58d6a9f3e 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java @@ -49,7 +49,8 @@ public class GMSystemEvent extends Event public enum Action
{
- RELOADED, SAVED, DEFAULT_GROUP_CHANGED, VALIDATE_TOGGLE,}
+ RELOADED, SAVED, DEFAULT_GROUP_CHANGED, VALIDATE_TOGGLE,
+ }
public void schedule(final GMSystemEvent event)
{
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java index ed3f71c53..45dd13f7b 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java @@ -75,7 +75,8 @@ public class GMUserEvent extends Event public enum Action { - USER_PERMISSIONS_CHANGED, USER_INHERITANCE_CHANGED, USER_INFO_CHANGED, USER_GROUP_CHANGED, USER_SUBGROUP_CHANGED, USER_ADDED, USER_REMOVED,} + USER_PERMISSIONS_CHANGED, USER_INHERITANCE_CHANGED, USER_INFO_CHANGED, USER_GROUP_CHANGED, USER_SUBGROUP_CHANGED, USER_ADDED, USER_REMOVED, + } public void schedule(final GMUserEvent event) { diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java index 8fb893809..3500c6d3e 100644 --- a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java @@ -12,6 +12,7 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingBreakEvent; + public class EssentialsProtectEntityListener implements Listener { private final IProtect prot; @@ -38,7 +39,7 @@ public class EssentialsProtectEntityListener implements Listener return; } - final Player user = target instanceof Player ? (Player) target : null; + final Player user = target instanceof Player ? (Player)target : null; if (target instanceof Player && event instanceof EntityDamageByBlockEvent) { final DamageCause cause = event.getCause(); @@ -62,9 +63,9 @@ public class EssentialsProtectEntityListener implements Listener if (target instanceof Player && event instanceof EntityDamageByEntityEvent) { - final EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent) event; + final EntityDamageByEntityEvent edEvent = (EntityDamageByEntityEvent)event; final Entity eAttack = edEvent.getDamager(); - final Player attacker = eAttack instanceof Player ? (Player) eAttack : null; + final Player attacker = eAttack instanceof Player ? (Player)eAttack : null; // PVP Settings if (target instanceof Player && eAttack instanceof Player && (!Permissions.PVP.isAuthorized(user) || !Permissions.PVP.isAuthorized(attacker))) @@ -75,35 +76,35 @@ public class EssentialsProtectEntityListener implements Listener //Player damage prevention section if (eAttack instanceof Creeper && getSettings().isCreeperPlayerdamage() || (Permissions.PREVENTDAMAGE_CREEPER.isAuthorized( - user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) + user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) { event.setCancelled(true); return; } if (eAttack instanceof ExplosiveMinecart && getSettings().isTntMinecartPlayerdamage() || (Permissions.PREVENTDAMAGE_TNTMINECART.isAuthorized( - user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) + user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) { event.setCancelled(true); return; } if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball || event.getEntity() instanceof LargeFireball) && (Permissions.PREVENTDAMAGE_FIREBALL.isAuthorized( - user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) + user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) { event.setCancelled(true); return; } if ((eAttack instanceof WitherSkull && Permissions.PREVENTDAMAGE_WITHERSKULL.isAuthorized( - user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) + user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) { event.setCancelled(true); return; } if ((eAttack instanceof Wither && event.getCause() == DamageCause.ENTITY_EXPLOSION) && getSettings().isWitherSpawnPlayerdamage() || (Permissions.PREVENTDAMAGE_WITHER.isAuthorized( - user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) + user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) { event.setCancelled(true); return; @@ -116,9 +117,9 @@ public class EssentialsProtectEntityListener implements Listener } if (edEvent.getDamager() instanceof Projectile && ((Permissions.PREVENTDAMAGE_PROJECTILES.isAuthorized( - user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized( - user)) || (((Projectile) edEvent.getDamager()).getShooter() instanceof Player && (!Permissions.PVP.isAuthorized( - user) || !Permissions.PVP.isAuthorized((Player) ((Projectile) edEvent.getDamager()).getShooter()))))) + user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized( + user)) || (((Projectile)edEvent.getDamager()).getShooter() instanceof Player && (!Permissions.PVP.isAuthorized( + user) || !Permissions.PVP.isAuthorized((Player)((Projectile)edEvent.getDamager()).getShooter()))))) { event.setCancelled(true); return; @@ -135,13 +136,13 @@ public class EssentialsProtectEntityListener implements Listener } if (cause == DamageCause.SUFFOCATION && (Permissions.PREVENTDAMAGE_SUFFOCATION.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized( - user))) + user))) { event.setCancelled(true); return; } if ((cause == DamageCause.FIRE || cause == DamageCause.FIRE_TICK) && (Permissions.PREVENTDAMAGE_FIRE.isAuthorized( - user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) + user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) { event.setCancelled(true); return; @@ -152,7 +153,7 @@ public class EssentialsProtectEntityListener implements Listener return; } if (cause == DamageCause.LIGHTNING && (Permissions.PREVENTDAMAGE_LIGHTNING.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized( - user))) + user))) { event.setCancelled(true); } @@ -179,7 +180,7 @@ public class EssentialsProtectEntityListener implements Listener event.setCancelled(true); } else if (entity instanceof Creeper && (getSettings().isCreeperBlockdamage() || getSettings().isCreeperBlockdamage() - || (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight))) + || (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight))) { event.setCancelled(true); event.getLocation().getWorld().createExplosion(event.getLocation(), 0F); @@ -213,11 +214,11 @@ public class EssentialsProtectEntityListener implements Listener if (entity.getType() == EntityType.PLAYER) { - final Player user = (Player) event.getTarget(); + final Player user = (Player)event.getTarget(); if ((event.getReason() == TargetReason.CLOSEST_PLAYER || event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY || event.getReason() == TargetReason.PIG_ZOMBIE_TARGET - || event.getReason() == TargetReason.RANDOM_TARGET || event.getReason() == TargetReason.TARGET_ATTACKED_OWNER - || event.getReason() == TargetReason.OWNER_ATTACKED_TARGET) - && !prot.getSettings().getData().getPrevent().isEntitytarget() && !Permissions.ENTITY_TARGET_BYPASS.isAuthorized( + || event.getReason() == TargetReason.RANDOM_TARGET || event.getReason() == TargetReason.TARGET_ATTACKED_OWNER + || event.getReason() == TargetReason.OWNER_ATTACKED_TARGET) + && !prot.getSettings().getData().getPrevent().isEntitytarget() && !Permissions.ENTITY_TARGET_BYPASS.isAuthorized( user, event.getEntity().getType().getName().toLowerCase())) { event.setCancelled(true); @@ -253,12 +254,12 @@ public class EssentialsProtectEntityListener implements Listener final ProtectHolder settings = prot.getSettings(); Entity remover = event.getRemover(); if ((event.getCause() == HangingBreakEvent.RemoveCause.ENTITY) - && ((remover instanceof Creeper) && getSettings().isCreeperBlockdamage()) - || ((remover instanceof Wither) && getSettings().isWitherSpawnBlockdamage()) - || ((remover instanceof Fireball) && getSettings().isFireballBlockdamage()) - || ((remover instanceof TNTPrimed) && getSettings().isTntBlockdamage()) - || ((remover instanceof WitherSkull) && getSettings().isWitherskullBlockdamage()) - || ((remover instanceof ExplosiveMinecart) && getSettings().isTntMinecartBlockdamage())) + && ((remover instanceof Creeper) && getSettings().isCreeperBlockdamage()) + || ((remover instanceof Wither) && getSettings().isWitherSpawnBlockdamage()) + || ((remover instanceof Fireball) && getSettings().isFireballBlockdamage()) + || ((remover instanceof TNTPrimed) && getSettings().isTntBlockdamage()) + || ((remover instanceof WitherSkull) && getSettings().isWitherskullBlockdamage()) + || ((remover instanceof ExplosiveMinecart) && getSettings().isTntMinecartBlockdamage())) { event.setCancelled(true); } diff --git a/EssentialsProtect/src/net/ess3/protect/Permissions.java b/EssentialsProtect/src/net/ess3/protect/Permissions.java index 306a09152..f5e59d965 100644 --- a/EssentialsProtect/src/net/ess3/protect/Permissions.java +++ b/EssentialsProtect/src/net/ess3/protect/Permissions.java @@ -73,6 +73,5 @@ public enum Permissions implements IPermission { return PermissionFactory.checkPermission(sender, this); } - public static DotStarPermission ENTITY_TARGET_BYPASS = new DotStarPermission("essentials.protect.entitytarget.bypass"); } diff --git a/EssentialsSigns/pom.xml b/EssentialsSigns/pom.xml index 85a47c60b..781bd4512 100644 --- a/EssentialsSigns/pom.xml +++ b/EssentialsSigns/pom.xml @@ -1,20 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> + <parent> + <groupId>net.essentials3</groupId> + <artifactId>BuildAll</artifactId> + <version>3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <artifactId>EssentialsSigns</artifactId> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>Essentials</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> + <artifactId>EssentialsSigns</artifactId> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>Essentials</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> </project> diff --git a/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java b/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java index e1dd99367..385147ef8 100644 --- a/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java +++ b/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java @@ -212,8 +212,9 @@ public class EssentialsSign { return true; } - final BlockFace[] directions = new BlockFace[]{ - BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST + final BlockFace[] directions = new BlockFace[] + { + BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST }; for (BlockFace blockFace : directions) { @@ -254,7 +255,7 @@ public class EssentialsSign { return EMPTY_SET; } - + protected final void validateTrade(final ISign sign, final int index, final IEssentials ess) throws SignException { final String line = sign.getLine(index).trim(); diff --git a/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java b/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java index 7af02af5b..69ca1b4c2 100644 --- a/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java +++ b/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java @@ -150,7 +150,7 @@ public class SignBlockListener implements Listener final Block block = event.getBlock(); if (((block.getTypeId() == WALL_SIGN || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign( - new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) + new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); return; @@ -175,7 +175,7 @@ public class SignBlockListener implements Listener final Block block = event.getBlock(); if (((block.getTypeId() == WALL_SIGN || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign( - new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) + new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); return; @@ -201,7 +201,7 @@ public class SignBlockListener implements Listener for (Block block : event.getBlocks()) { if (((block.getTypeId() == WALL_SIGN || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign( - new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) + new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); return; @@ -229,7 +229,7 @@ public class SignBlockListener implements Listener { final Block block = event.getBlock(); if (((block.getTypeId() == WALL_SIGN || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign( - new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) + new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); return; diff --git a/EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java b/EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java index 272d7ac11..be1e5398e 100644 --- a/EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java +++ b/EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java @@ -34,7 +34,7 @@ public class SignEntityListener implements Listener for (Block block : event.blockList()) { if (((block.getTypeId() == Material.WALL_SIGN.getId() || block.getTypeId() == Material.SIGN_POST.getId()) && EssentialsSign.isValidSign( - new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) + new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); return; @@ -60,7 +60,7 @@ public class SignEntityListener implements Listener final Block block = event.getBlock(); if (((block.getTypeId() == Material.WALL_SIGN.getId() || block.getTypeId() == Material.SIGN_POST.getId()) && EssentialsSign.isValidSign( - new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) + new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); return; diff --git a/EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java b/EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java index fb2521c8c..b7873a9cb 100644 --- a/EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java +++ b/EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java @@ -90,7 +90,7 @@ public class SignEnchant extends EssentialsSign final ItemStack playerHand = player.getPlayer().getItemInHand(); if (playerHand == null || playerHand.getAmount() != 1 || (playerHand.containsEnchantment(enchantment) && playerHand.getEnchantmentLevel( - enchantment) == level)) + enchantment) == level)) { throw new SignException(_("§4You do not have {0}x {1}.", 1, sign.getLine(1))); } diff --git a/EssentialsSigns/src/net/ess3/signs/signs/SignKit.java b/EssentialsSigns/src/net/ess3/signs/signs/SignKit.java index 4cee8ab41..636805319 100644 --- a/EssentialsSigns/src/net/ess3/signs/signs/SignKit.java +++ b/EssentialsSigns/src/net/ess3/signs/signs/SignKit.java @@ -55,7 +55,7 @@ public class SignKit extends EssentialsSign final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH); final String group = sign.getLine(2); if ((!group.isEmpty() && ("§2Everyone".equals(group) || ess.getRanks().inGroup(player, group))) || (group.isEmpty() && Permissions.KITS.isAuthorized( - player, kitName))) + player, kitName))) { final Trade charge = getTrade(sign, 3, ess); charge.isAffordableFor(player); diff --git a/EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java b/EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java index 7c69c6372..3c1620bcd 100644 --- a/EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java +++ b/EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java @@ -40,8 +40,9 @@ public class SignRepair extends EssentialsSign Commandrepair command = new Commandrepair(); command.init(ess, "repair"); - String[] args = new String[]{ - sign.getLine(1) + String[] args = new String[] + { + sign.getLine(1) }; try { diff --git a/EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java b/EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java index 43e4792aa..750e71ee7 100644 --- a/EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java +++ b/EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java @@ -53,7 +53,7 @@ public class SignWarp extends EssentialsSign final String group = sign.getLine(2); if ((!group.isEmpty() && ("§2Everyone".equals(group) || ess.getRanks().inGroup(player, group))) || (group.isEmpty() && Permissions.WARPS.isAuthorized( - player, warpName))) + player, warpName))) { final Trade charge = getTrade(sign, 3, ess); try diff --git a/EssentialsUpdate/pom.xml b/EssentialsUpdate/pom.xml index 69ac828e3..06836d177 100644 --- a/EssentialsUpdate/pom.xml +++ b/EssentialsUpdate/pom.xml @@ -36,11 +36,11 @@ <goal>shade</goal> </goals> <configuration> - <artifactSet> - <includes> - <include>pircbot:pircbot</include> - </includes> - </artifactSet> + <artifactSet> + <includes> + <include>pircbot:pircbot</include> + </includes> + </artifactSet> </configuration> </execution> </executions> diff --git a/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java b/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java index 5b6f62353..6b39beb1a 100644 --- a/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java +++ b/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java @@ -10,7 +10,6 @@ public abstract class AbstractWorkListener this.plugin = plugin; this.newVersionInfo = newVersionInfo; } - private final Plugin plugin; private final VersionInfo newVersionInfo; diff --git a/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java b/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java index 3deda79af..9d09264e3 100644 --- a/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java +++ b/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java @@ -96,7 +96,8 @@ public class UpdateProcess implements Listener { UpdateProcess.this.currentPlayer = null; } - //TODO: make sure this is threadsafe + //TODO: make sure this is threadsafe + @EventHandler(priority = EventPriority.LOWEST) public void onPlayerChat(final AsyncPlayerChatEvent event) { diff --git a/EssentialsUpdate/src/net/ess3/update/Version.java b/EssentialsUpdate/src/net/ess3/update/Version.java index 3611705ec..9910882c8 100644 --- a/EssentialsUpdate/src/net/ess3/update/Version.java +++ b/EssentialsUpdate/src/net/ess3/update/Version.java @@ -30,7 +30,6 @@ public class Version implements Comparable<Version> { return type; } - private final int major; private final int minor; private final int build; diff --git a/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java b/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java index 5a5279b71..8b3509639 100644 --- a/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java +++ b/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java @@ -14,8 +14,6 @@ public class StateMachine extends AbstractWorkListener implements Runnable { ABORT, WAIT, DONE, NONE } - - private final StateMap states = new StateMap(); private AbstractState current; private Player player; @@ -84,7 +82,6 @@ public class StateMachine extends AbstractWorkListener implements Runnable } return result; } - private Iterator<AbstractState> iterator; public void startWork() |