diff options
author | Iaccidentally <coryhuckaby@gmail.com> | 2013-11-06 21:22:32 -0500 |
---|---|---|
committer | Iaccidentally <coryhuckaby@gmail.com> | 2013-11-06 21:22:32 -0500 |
commit | f056d430c45d64c4cc30cb835151bdf9e0742c53 (patch) | |
tree | 80d883e66b2445695f2970008e18cc77d6ca9b7b | |
parent | 5415207c88aca486371f8719a9444fce0112a9f0 (diff) | |
download | Essentials-f056d430c45d64c4cc30cb835151bdf9e0742c53.tar Essentials-f056d430c45d64c4cc30cb835151bdf9e0742c53.tar.gz Essentials-f056d430c45d64c4cc30cb835151bdf9e0742c53.tar.lz Essentials-f056d430c45d64c4cc30cb835151bdf9e0742c53.tar.xz Essentials-f056d430c45d64c4cc30cb835151bdf9e0742c53.zip |
Cleanup various aspects of code, fix some formatting, more netbeans 7.4 stuff
65 files changed, 432 insertions, 443 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Console.java b/Essentials/src/com/earth2me/essentials/Console.java index 8596a585b..3954bbb0f 100644 --- a/Essentials/src/com/earth2me/essentials/Console.java +++ b/Essentials/src/com/earth2me/essentials/Console.java @@ -6,7 +6,7 @@ import org.bukkit.command.CommandSender; public final class Console implements IReplyTo { - private static Console instance = new Console(); + private static final Console instance = new Console(); private CommandSource replyTo; public final static String NAME = "Console"; diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 8dc131ff8..044f8bc93 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -240,7 +240,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials LOGGER.log(Level.INFO, "Essentials load " + timeroutput); } } - catch (Exception ex) + catch (NumberFormatException ex) { handleCrash(ex); } @@ -527,7 +527,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials } return true; } - catch (Throwable ex) + catch (Exception ex) { showError(sender, ex, commandLabel); return true; @@ -600,11 +600,13 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials return backup; } + @Override public Metrics getMetrics() { return metrics; } + @Override public void setMetrics(Metrics metrics) { this.metrics = metrics; diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index b810fbb2e..8a2782a8e 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -338,7 +338,7 @@ public class EssentialsConf extends YamlConfiguration { if (pendingDiskWrites.get() > 1) { - // Writes can be skipped, because they are stored in a queue (in the executor). + // Writes can be skipped, because they are stored in a queue (in the executor). // Only the last is actually written. pendingDiskWrites.decrementAndGet(); //LOGGER.log(Level.INFO, configFile + " skipped writing in " + (System.nanoTime() - startTime) + " nsec."); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 883b310a9..e87cb3ead 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -19,8 +19,8 @@ import org.bukkit.inventory.ItemStack; public class EssentialsEntityListener implements Listener { private static final Logger LOGGER = Logger.getLogger("Minecraft"); - private final IEssentials ess; private static final transient Pattern powertoolPlayer = Pattern.compile("\\{player\\}"); + private final IEssentials ess; public EssentialsEntityListener(IEssentials ess) { diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java index 760eb4f23..e917d2ec3 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java @@ -1,6 +1,7 @@ package com.earth2me.essentials; import com.earth2me.essentials.perm.PermissionsHandler; +import com.earth2me.essentials.register.payment.Methods; import java.util.logging.Level; import net.ess3.api.IEssentials; import org.bukkit.event.EventHandler; @@ -28,9 +29,9 @@ public class EssentialsPluginListener implements Listener, IConf } ess.getPermissionsHandler().checkPermissions(); ess.getAlternativeCommandsHandler().addPlugin(event.getPlugin()); - if (!ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().setMethod(ess.getServer().getPluginManager())) + if (!Methods.hasMethod() && Methods.setMethod(ess.getServer().getPluginManager())) { - ess.getLogger().log(Level.INFO, "Payment method found (" + ess.getPaymentMethod().getMethod().getLongName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")"); + ess.getLogger().log(Level.INFO, "Payment method found (" + Methods.getMethod().getLongName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")"); } } @@ -48,7 +49,7 @@ public class EssentialsPluginListener implements Listener, IConf } ess.getAlternativeCommandsHandler().removePlugin(event.getPlugin()); // Check to see if the plugin thats being disabled is the one we are using - if (ess.getPaymentMethod() != null && ess.getPaymentMethod().hasMethod() && ess.getPaymentMethod().checkDisabled(event.getPlugin())) + if (ess.getPaymentMethod() != null && Methods.hasMethod() && Methods.checkDisabled(event.getPlugin())) { ess.getPaymentMethod().reset(); ess.getLogger().log(Level.INFO, "Payment method was disabled. No longer accepting payments."); diff --git a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java index 25ed00ad6..89237892a 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsUpgrade.java @@ -71,7 +71,7 @@ public class EssentialsUpgrade doneFile.setProperty("moveWorthValuesToWorthYml", true); doneFile.save(); } - catch (Throwable e) + catch (Exception e) { LOGGER.log(Level.SEVERE, _("upgradingFilesError"), e); } @@ -115,7 +115,7 @@ public class EssentialsUpgrade doneFile.setProperty("move" + name + "ToFile", true); doneFile.save(); } - catch (Throwable e) + catch (IOException e) { LOGGER.log(Level.SEVERE, _("upgradingFilesError"), e); } @@ -575,10 +575,10 @@ public class EssentialsUpgrade return; } final File[] listOfFiles = usersFolder.listFiles(); - for (int i = 0; i < listOfFiles.length; i++) + for (File listOfFile : listOfFiles) { - final String filename = listOfFiles[i].getName(); - if (!listOfFiles[i].isFile() || !filename.endsWith(".yml")) + final String filename = listOfFile.getName(); + if (!listOfFile.isFile() || !filename.endsWith(".yml")) { continue; } @@ -587,9 +587,9 @@ public class EssentialsUpgrade { continue; } - final File tmpFile = new File(listOfFiles[i].getParentFile(), sanitizedFilename + ".tmp"); - final File newFile = new File(listOfFiles[i].getParentFile(), sanitizedFilename); - if (!listOfFiles[i].renameTo(tmpFile)) + final File tmpFile = new File(listOfFile.getParentFile(), sanitizedFilename + ".tmp"); + final File newFile = new File(listOfFile.getParentFile(), sanitizedFilename); + if (!listOfFile.renameTo(tmpFile)) { LOGGER.log(Level.WARNING, _("userdataMoveError", filename, sanitizedFilename)); continue; diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java index 5b87556d4..5086a3825 100644 --- a/Essentials/src/com/earth2me/essentials/ItemDb.java +++ b/Essentials/src/com/earth2me/essentials/ItemDb.java @@ -13,12 +13,6 @@ import org.bukkit.inventory.ItemStack; public class ItemDb implements IConf, net.ess3.api.IItemDb { private final transient IEssentials ess; - - public ItemDb(final IEssentials ess) - { - this.ess = ess; - file = new ManagedFile("items.csv", ess); - } private final transient Map<String, Integer> items = new HashMap<String, Integer>(); private final transient Map<ItemData, List<String>> names = new HashMap<ItemData, List<String>>(); private final transient Map<ItemData, String> primaryName = new HashMap<ItemData, String>(); @@ -26,6 +20,12 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb private final transient ManagedFile file; private final transient Pattern splitPattern = Pattern.compile("[:+',;.]"); + public ItemDb(final IEssentials ess) + { + this.ess = ess; + file = new ManagedFile("items.csv", ess); + } + @Override public void reloadConfig() { @@ -70,7 +70,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb Collections.sort(nameList, new LengthCompare()); } else - { + { List<String> nameList = new ArrayList<String>(); nameList.add(itemName); names.put(itemData, nameList); @@ -184,16 +184,16 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb { is.add(get(args[0])); } - + if (is.isEmpty() || is.get(0).getType() == Material.AIR) { throw new Exception(_("itemSellAir")); } - + return is; } - @Override +@Override public String names(ItemStack item) { ItemData itemData = new ItemData(item.getTypeId(), item.getDurability()); @@ -214,7 +214,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb } return StringUtil.joinList(", ", nameList); } - + @Override public String name(ItemStack item) { @@ -231,7 +231,7 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb } return name; } - + static class ItemData { final private int itemNo; diff --git a/Essentials/src/com/earth2me/essentials/MetaItemStack.java b/Essentials/src/com/earth2me/essentials/MetaItemStack.java index ead81a003..f0f965f1f 100644 --- a/Essentials/src/com/earth2me/essentials/MetaItemStack.java +++ b/Essentials/src/com/earth2me/essentials/MetaItemStack.java @@ -22,21 +22,8 @@ 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()) @@ -48,6 +35,18 @@ public class MetaItemStack fireworkShape.put(type.name(), type); } } + private final transient Pattern splitPattern = Pattern.compile("[:+',;.]"); + private final ItemStack stack; + 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; public MetaItemStack(final ItemStack stack) { @@ -150,7 +149,7 @@ public class MetaItemStack { final String owner = split[1]; final SkullMeta meta = (SkullMeta)stack.getItemMeta(); - boolean result = meta.setOwner(owner); + meta.setOwner(owner); stack.setItemMeta(meta); } else diff --git a/Essentials/src/com/earth2me/essentials/MobData.java b/Essentials/src/com/earth2me/essentials/MobData.java index 70a88a1af..f23c85091 100644 --- a/Essentials/src/com/earth2me/essentials/MobData.java +++ b/Essentials/src/com/earth2me/essentials/MobData.java @@ -281,7 +281,7 @@ public enum MobData ((ExperienceOrb)spawned).setExperience(Integer.parseInt(rawData)); this.matched = rawData; } - catch (Exception e) + catch (NumberFormatException e) { throw new Exception(_("invalidNumber"), e); } @@ -293,7 +293,7 @@ public enum MobData ((Slime)spawned).setSize(Integer.parseInt(rawData)); this.matched = rawData; } - catch (Exception e) + catch (NumberFormatException e) { throw new Exception(_("slimeMalformedSize"), e); } diff --git a/Essentials/src/com/earth2me/essentials/PlayerList.java b/Essentials/src/com/earth2me/essentials/PlayerList.java index 0b6c3dc49..d8f624fa7 100644 --- a/Essentials/src/com/earth2me/essentials/PlayerList.java +++ b/Essentials/src/com/earth2me/essentials/PlayerList.java @@ -104,7 +104,7 @@ public class PlayerList for (String groupValue : groupValues) { groupValue = groupValue.toLowerCase(Locale.ENGLISH); - if (groupValue == null || groupValue.equals("")) + if (groupValue == null || groupValue.isEmpty()) { continue; } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index a604d6032..0f36bf026 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -402,7 +402,7 @@ public class Settings implements net.ess3.api.ISettings { return config.getString("backup.command", null); } - private Map<String, String> chatFormats = Collections.synchronizedMap(new HashMap<String, String>()); + private final Map<String, String> chatFormats = Collections.synchronizedMap(new HashMap<String, String>()); @Override public String getChatFormat(String group) @@ -1114,6 +1114,7 @@ public class Settings implements net.ess3.api.ISettings } // #easteregg + @Override public int getMaxUserCacheCount() { long count = Runtime.getRuntime().maxMemory() / 1024 / 96; diff --git a/Essentials/src/com/earth2me/essentials/SpawnMob.java b/Essentials/src/com/earth2me/essentials/SpawnMob.java index b8447f2c5..7a8d1646f 100644 --- a/Essentials/src/com/earth2me/essentials/SpawnMob.java +++ b/Essentials/src/com/earth2me/essentials/SpawnMob.java @@ -212,7 +212,7 @@ public class SpawnMob { String data = inputData; - if (data.equals("")) + if (data.isEmpty()) { sender.sendMessage(_("mobDataList", StringUtil.joinList(MobData.getValidHelp(spawned)))); } diff --git a/Essentials/src/com/earth2me/essentials/Teleport.java b/Essentials/src/com/earth2me/essentials/Teleport.java index f30ba5d98..b33db4c4a 100644 --- a/Essentials/src/com/earth2me/essentials/Teleport.java +++ b/Essentials/src/com/earth2me/essentials/Teleport.java @@ -102,6 +102,7 @@ public class Teleport implements net.ess3.api.ITeleport //The teleportPlayer function is used when you want to normally teleportPlayer someone to a location or player. //This method is nolonger used internally and will be removed. @Deprecated + @Override public void teleport(Location loc, Trade chargeFor) throws Exception { teleport(loc, chargeFor, TeleportCause.PLUGIN); diff --git a/Essentials/src/com/earth2me/essentials/TimedTeleport.java b/Essentials/src/com/earth2me/essentials/TimedTeleport.java index 5287feaf1..549b9f9bf 100644 --- a/Essentials/src/com/earth2me/essentials/TimedTeleport.java +++ b/Essentials/src/com/earth2me/essentials/TimedTeleport.java @@ -13,22 +13,22 @@ public class TimedTeleport implements Runnable private final IUser teleportOwner; private final IEssentials ess; private final Teleport teleport; - private String timer_teleportee; + private final String timer_teleportee; private int timer_task = -1; - private long timer_started; // time this task was initiated - private long timer_delay; // how long to delay the teleportPlayer + private final long timer_started; // time this task was initiated + private final long timer_delay; // how long to delay the teleportPlayer private double timer_health; // note that I initially stored a clone of the location for reference, but... // when comparing locations, I got incorrect mismatches (rounding errors, looked like) // so, the X/Y/Z values are stored instead and rounded off - private long timer_initX; - private long timer_initY; - private long timer_initZ; - private ITarget timer_teleportTarget; - private boolean timer_respawn; - private boolean timer_canMove; - private Trade timer_chargeFor; - private TeleportCause timer_cause; + private final long timer_initX; + private final long timer_initY; + private final long timer_initZ; + private final ITarget timer_teleportTarget; + private final boolean timer_respawn; + private final boolean timer_canMove; + private final Trade timer_chargeFor; + private final TeleportCause timer_cause; public TimedTeleport(IUser user, IEssentials ess, Teleport teleport, long delay, IUser teleportUser, ITarget target, Trade chargeFor, TeleportCause cause, boolean respawn) { @@ -112,7 +112,7 @@ public class TimedTeleport implements Runnable timer_chargeFor.charge(teleportOwner); } } - catch (Throwable ex) + catch (Exception ex) { ess.showError(teleportOwner.getSource(), ex, "teleport"); } diff --git a/Essentials/src/com/earth2me/essentials/User.java b/Essentials/src/com/earth2me/essentials/User.java index b3c0bb33a..756d85ec5 100644 --- a/Essentials/src/com/earth2me/essentials/User.java +++ b/Essentials/src/com/earth2me/essentials/User.java @@ -3,6 +3,7 @@ package com.earth2me.essentials; import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.commands.IEssentialsCommand; import com.earth2me.essentials.register.payment.Method; +import com.earth2me.essentials.register.payment.Methods; import com.earth2me.essentials.utils.DateUtil; import com.earth2me.essentials.utils.FormatUtil; import com.earth2me.essentials.utils.NumberUtil; @@ -23,6 +24,7 @@ import org.bukkit.potion.PotionEffectType; public class User extends UserData implements Comparable<User>, IReplyTo, net.ess3.api.IUser { + private static final Logger logger = Logger.getLogger("Minecraft"); private CommandSource replyTo = null; private transient String teleportRequester; private transient boolean teleportRequestHere; @@ -39,7 +41,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es private boolean invSee = false; private boolean recipeSee = false; private boolean enderSee = false; - private static final Logger logger = Logger.getLogger("Minecraft"); + private transient long teleportInvulnerabilityTimestamp = 0; User(final Player base, final IEssentials ess) { @@ -150,7 +152,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es initiator.sendMessage(_("addedToOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess))); } } - + @Override @Deprecated public void giveMoney(final BigDecimal value, final CommandSender initiator) @@ -198,7 +200,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es initiator.sendMessage(_("takenFromOthersAccount", NumberUtil.displayCurrency(value, ess), this.getDisplayName(), NumberUtil.displayCurrency(getMoney(), ess))); } } - + @Override @Deprecated public void takeMoney(final BigDecimal value, final CommandSender initiator) @@ -417,19 +419,19 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es } return BigDecimal.ZERO; } - if (ess.getPaymentMethod().hasMethod()) + if (Methods.hasMethod()) { try { - final Method method = ess.getPaymentMethod().getMethod(); + final Method method = Methods.getMethod(); if (!method.hasAccount(this.getName())) { throw new Exception(); } - final Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName()); + final Method.MethodAccount account = Methods.getMethod().getAccount(this.getName()); return BigDecimal.valueOf(account.balance()); } - catch (Throwable ex) + catch (Exception ex) { } } @@ -447,19 +449,19 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es } return; } - if (ess.getPaymentMethod().hasMethod()) + if (Methods.hasMethod()) { try { - final Method method = ess.getPaymentMethod().getMethod(); + final Method method = Methods.getMethod(); if (!method.hasAccount(this.getName())) { throw new Exception(); } - final Method.MethodAccount account = ess.getPaymentMethod().getMethod().getAccount(this.getName()); + final Method.MethodAccount account = Methods.getMethod().getAccount(this.getName()); account.set(value.doubleValue()); } - catch (Throwable ex) + catch (Exception ex) { } } @@ -473,7 +475,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es { return; } - if (ess.getPaymentMethod().hasMethod() && super.getMoney() != value) + if (Methods.hasMethod() && super.getMoney() != value) { super.setMoney(value); } @@ -698,7 +700,6 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es { enderSee = set; } - private transient long teleportInvulnerabilityTimestamp = 0; @Override public void enableInvulnerabilityAfterTeleport() @@ -720,6 +721,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es } } + @Override public boolean hasInvulnerabilityAfterTeleport() { return teleportInvulnerabilityTimestamp != 0 && teleportInvulnerabilityTimestamp >= System.currentTimeMillis(); @@ -857,6 +859,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, net.es return this.getName().hashCode(); } + @Override public CommandSource getSource() { return new CommandSource(getBase()); diff --git a/Essentials/src/com/earth2me/essentials/UserData.java b/Essentials/src/com/earth2me/essentials/UserData.java index 12b396e13..1148402a7 100644 --- a/Essentials/src/com/earth2me/essentials/UserData.java +++ b/Essentials/src/com/earth2me/essentials/UserData.java @@ -7,6 +7,7 @@ import java.io.File; import java.math.BigDecimal; import java.util.*; import net.ess3.api.IEssentials; +import net.ess3.api.InvalidWorldException; import org.bukkit.Location; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; @@ -133,7 +134,7 @@ public abstract class UserData extends PlayerExtension implements IConf { search = getHomes().get(Integer.parseInt(search) - 1); } - catch (Exception e) + catch (NumberFormatException e) { } } @@ -167,7 +168,7 @@ public abstract class UserData extends PlayerExtension implements IConf loc = config.getLocation("homes." + getHomes().get(0), getServer()); return loc; } - catch (Exception ex) + catch (InvalidWorldException ex) { return null; } @@ -318,7 +319,7 @@ public abstract class UserData extends PlayerExtension implements IConf { return config.getLocation("lastlocation", getServer()); } - catch (Exception e) + catch (InvalidWorldException e) { return null; } @@ -347,7 +348,7 @@ public abstract class UserData extends PlayerExtension implements IConf { return config.getLocation("logoutlocation", getServer()); } - catch (Exception e) + catch (InvalidWorldException e) { return null; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java index 64ba74c91..f1e16fd51 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandbalancetop.java @@ -22,9 +22,9 @@ public class Commandbalancetop extends EssentialsCommand } private static final int CACHETIME = 2 * 60 * 1000; public static final int MINUSERS = 50; - private static SimpleTextInput cache = new SimpleTextInput(); + private static final SimpleTextInput cache = new SimpleTextInput(); private static long cacheage = 0; - private static ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); + private static final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); @Override protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index bd3a25aa3..4286ae19f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -8,7 +8,6 @@ import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import java.util.logging.Level; import org.bukkit.Server; -import org.bukkit.entity.Player; public class Commandban extends EssentialsCommand @@ -31,7 +30,7 @@ public class Commandban extends EssentialsCommand { user = getPlayer(server, args, 0, true, true); } - catch (NoSuchFieldException e) + catch (PlayerNotFoundException e) { nomatch = true; user = ess.getUser(new OfflinePlayer(args[0], ess)); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java index 8f5a3766d..96bd4b094 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java @@ -149,7 +149,7 @@ public class Commandessentials extends EssentialsCommand { Commandessentials.this.stopTune(); } - if (note.isEmpty() || note == null) + if (note == null || note.isEmpty()) { return; } @@ -277,7 +277,7 @@ public class Commandessentials extends EssentialsCommand continue; } - int ban = user.getBanReason().equals("") ? 0 : 1; + int ban = user.getBanReason().isEmpty() ? 0 : 1; long lastLog = user.getLastLogout(); if (lastLog == 0) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java index 940429165..250ecf6b7 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandignore.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandignore.java @@ -32,7 +32,7 @@ public class Commandignore extends EssentialsCommand { player = getPlayer(server, args, 0, true, true); } - catch (NoSuchFieldException ex) + catch (PlayerNotFoundException ex) { player = ess.getOfflineUser(args[0]); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java index 0d3d705b5..a07b10459 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commanditemdb.java @@ -4,7 +4,6 @@ import com.earth2me.essentials.CommandSource; import static com.earth2me.essentials.I18n._; import org.bukkit.Material; import org.bukkit.Server; -import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java index cc7cd6fac..746271076 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkickall.java @@ -22,11 +22,7 @@ public class Commandkickall extends EssentialsCommand for (Player onlinePlayer : server.getOnlinePlayers()) { - if (sender.isPlayer() && onlinePlayer.getName().equalsIgnoreCase(sender.getPlayer().getName())) - { - continue; - } - else + if (!sender.isPlayer() && !onlinePlayer.getName().equalsIgnoreCase(sender.getPlayer().getName())) { onlinePlayer.kickPlayer(kickReason); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java b/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java index c5e8bc995..d187274a9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkittycannon.java @@ -10,7 +10,7 @@ import org.bukkit.entity.Ocelot; // This command is not documented on the wiki #EasterEgg public class Commandkittycannon extends EssentialsCommand { - private static Random random = new Random(); + private static final Random random = new Random(); public Commandkittycannon() { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java index 80986425e..f6d5b6318 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandlightning.java @@ -5,7 +5,6 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.entity.LightningStrike; -import org.bukkit.entity.Player; public class Commandlightning extends EssentialsLoopCommand @@ -20,7 +19,7 @@ public class Commandlightning extends EssentialsLoopCommand @Override public void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { - User user = null; + User user; if (sender.isPlayer()) { user = ess.getUser(sender.getPlayer()); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java index 88b3f719e..0da22d7e4 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandmute.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandmute.java @@ -6,7 +6,6 @@ import com.earth2me.essentials.OfflinePlayer; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.DateUtil; import org.bukkit.Server; -import org.bukkit.entity.Player; public class Commandmute extends EssentialsCommand @@ -29,7 +28,7 @@ public class Commandmute extends EssentialsCommand { user = getPlayer(server, args, 0, true, true); } - catch (NoSuchFieldException e) + catch (PlayerNotFoundException e) { nomatch = true; user = ess.getUser(new OfflinePlayer(args[0], ess)); @@ -48,7 +47,7 @@ public class Commandmute extends EssentialsCommand throw new Exception(_("muteExempt")); } } - + long muteTimestamp = 0; if (args.length > 1) @@ -64,12 +63,12 @@ public class Commandmute extends EssentialsCommand user.setMuteTimeout(muteTimestamp); final boolean muted = user.getMuted(); String muteTime = DateUtil.formatDateDiff(muteTimestamp); - + if (nomatch) { sender.sendMessage(_("userUnknown", user.getName())); } - + if (muted) { if (muteTimestamp > 0) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandr.java b/Essentials/src/com/earth2me/essentials/commands/Commandr.java index 1a793556a..a9073a9eb 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandr.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandr.java @@ -7,7 +7,6 @@ import com.earth2me.essentials.IReplyTo; import com.earth2me.essentials.User; import com.earth2me.essentials.utils.FormatUtil; import org.bukkit.Server; -import org.bukkit.entity.Player; public class Commandr extends EssentialsCommand diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandremove.java b/Essentials/src/com/earth2me/essentials/commands/Commandremove.java index 1d7cc333c..b1e5ccc50 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandremove.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandremove.java @@ -17,19 +17,6 @@ public class Commandremove extends EssentialsCommand super("remove"); } - - private enum ToRemove - { - DROPS, - ARROWS, - BOATS, - MINECARTS, - XP, - PAINTINGS, - ITEMFRAMES, - ENDERCRYSTALS - } - @Override protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { @@ -105,7 +92,7 @@ public class Commandremove extends EssentialsCommand removeEntities(sender, world, toRemove, 0); } - protected void removeEntities(final CommandSource sender, final World world, final ToRemove toRemove, int radius) throws Exception + private void removeEntities(final CommandSource sender, final World world, final ToRemove toRemove, int radius) throws Exception { int removed = 0; if (radius > 0) @@ -191,4 +178,17 @@ public class Commandremove extends EssentialsCommand } sender.sendMessage(_("removed", removed)); } + + + private enum ToRemove + { + DROPS, + ARROWS, + BOATS, + MINECARTS, + XP, + PAINTINGS, + ITEMFRAMES, + ENDERCRYSTALS + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java index 0148f0e6b..a1c825ff9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsetwarp.java @@ -5,6 +5,7 @@ import com.earth2me.essentials.User; import com.earth2me.essentials.api.IWarps; import com.earth2me.essentials.utils.NumberUtil; import com.earth2me.essentials.utils.StringUtil; +import net.ess3.api.InvalidWorldException; import org.bukkit.Location; import org.bukkit.Server; @@ -37,7 +38,10 @@ public class Commandsetwarp extends EssentialsCommand { warpLoc = warps.getWarp(args[0]); } - catch (Exception ex) + catch (WarpNotFoundException ex) + { + } + catch (InvalidWorldException ex) { } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java index 54e18b159..95e1dd280 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsudo.java @@ -8,7 +8,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Server; import org.bukkit.command.PluginCommand; -import org.bukkit.entity.Player; public class Commandsudo extends EssentialsCommand @@ -61,7 +60,7 @@ public class Commandsudo extends EssentialsCommand public void run() { LOGGER.log(Level.INFO, String.format("[Sudo] %s issued server command: /%s %s", user.getName(), command, getFinalArg(arguments, 0))); - execCommand.execute(user.getBase(), command, arguments); + execCommand.execute(user.getBase(), command, arguments); } }); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java index 5ac2de186..0728f1a22 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java @@ -7,7 +7,6 @@ import com.earth2me.essentials.User; import com.earth2me.essentials.utils.DateUtil; import java.util.GregorianCalendar; import org.bukkit.Server; -import org.bukkit.entity.Player; public class Commandtempban extends EssentialsCommand diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java index ce1a755cc..ac83645b0 100644 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java @@ -36,7 +36,7 @@ public final class InventoryWorkaround } // Returns what it couldnt store - // This will will abort if it couldn't store all items + // This will will abort if it couldn't store all items public static Map<Integer, ItemStack> addAllItems(final Inventory inventory, final ItemStack... items) { final Inventory fakeInventory = Bukkit.getServer().createInventory(null, inventory.getType()); @@ -70,9 +70,9 @@ public final class InventoryWorkaround // combine items final ItemStack[] combined = new ItemStack[items.length]; - for (int i = 0; i < items.length; i++) + for (ItemStack item : items) { - if (items[i] == null || items[i].getAmount() < 1) + if (item == null || item.getAmount() < 1) { continue; } @@ -80,12 +80,12 @@ public final class InventoryWorkaround { if (combined[j] == null) { - combined[j] = items[i].clone(); + combined[j] = item.clone(); break; } - if (combined[j].isSimilar(items[i])) + if (combined[j].isSimilar(item)) { - combined[j].setAmount(combined[j].getAmount() + items[i].getAmount()); + combined[j].setAmount(combined[j].getAmount() + item.getAmount()); break; } } diff --git a/Essentials/src/com/earth2me/essentials/register/payment/Methods.java b/Essentials/src/com/earth2me/essentials/register/payment/Methods.java index 9eb5f0da3..3ba5393b1 100644 --- a/Essentials/src/com/earth2me/essentials/register/payment/Methods.java +++ b/Essentials/src/com/earth2me/essentials/register/payment/Methods.java @@ -31,9 +31,9 @@ public class Methods private static boolean self = false; private static Method Method = null; private static String preferred = ""; - private static Set<Method> Methods = new HashSet<Method>(); - private static Set<String> Dependencies = new HashSet<String>(); - private static Set<Method> Attachables = new HashSet<Method>(); + private static final Set<Method> Methods = new HashSet<Method>(); + private static final Set<String> Dependencies = new HashSet<String>(); + private static final Set<Method> Attachables = new HashSet<Method>(); static { diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java index 7aab8c459..a554548ea 100644 --- a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java +++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java @@ -147,8 +147,8 @@ public class BOSE7 implements Method public class BOSEAccount implements MethodAccount { - private String name; - private BOSEconomy BOSEconomy; + private final String name; + private final BOSEconomy BOSEconomy; public BOSEAccount(String name, BOSEconomy bOSEconomy) { @@ -229,8 +229,8 @@ public class BOSE7 implements Method public class BOSEBankAccount implements MethodBankAccount { - private String bank; - private BOSEconomy BOSEconomy; + private final String bank; + private final BOSEconomy BOSEconomy; public BOSEBankAccount(String bank, BOSEconomy bOSEconomy) { diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java index 92c4f4f19..efcb20fb9 100644 --- a/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java +++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java @@ -118,7 +118,7 @@ public class MCUR implements Method public class MCurrencyAccount implements MethodAccount { - private String name; + private final String name; public MCurrencyAccount(String name) { diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java index 87144fa34..75f052846 100644 --- a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java +++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java @@ -137,8 +137,8 @@ public class iCo5 implements Method public class iCoAccount implements MethodAccount { - private Account account; - private Holdings holdings; + private final Account account; + private final Holdings holdings; public iCoAccount(Account account) { @@ -251,8 +251,8 @@ public class iCo5 implements Method public class iCoBankAccount implements MethodBankAccount { - private BankAccount account; - private Holdings holdings; + private final BankAccount account; + private final Holdings holdings; public iCoBankAccount(BankAccount account) { diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java index ecd1d6aae..bf0c1c60a 100644 --- a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java +++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java @@ -129,8 +129,8 @@ public class iCo6 implements Method public class iCoAccount implements MethodAccount { - private Account account; - private Holdings holdings; + private final Account account; + private final Holdings holdings; public iCoAccount(Account account) { diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java index 36da6e354..ce1412332 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignBlockListener.java @@ -17,10 +17,10 @@ import org.bukkit.event.block.*; public class SignBlockListener implements Listener { - private final transient IEssentials ess; private final static Logger LOGGER = Logger.getLogger("Minecraft"); private final static Material WALL_SIGN = Material.WALL_SIGN; private final static Material SIGN_POST = Material.SIGN_POST; + private final transient IEssentials ess; public SignBlockListener(IEssentials ess) { diff --git a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java index a7d6b8fae..49ad92f59 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignProtection.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignProtection.java @@ -62,7 +62,6 @@ public class SignProtection extends EssentialsSign { if (b.getLocation().equals(ignoredBlock.getLocation())) { - continue; } } if (protectedBlocks.contains(b.getType())) @@ -118,12 +117,6 @@ public class SignProtection extends EssentialsSign } } - - public enum SignProtectionState - { - NOT_ALLOWED, ALLOWED, NOSIGN, OWNER - } - private SignProtectionState checkProtectionSign(final Block block, final User user, final String username) { if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN) @@ -353,4 +346,9 @@ public class SignProtection extends EssentialsSign return state == SignProtectionState.NOSIGN; } + + public enum SignProtectionState + { + NOT_ALLOWED, ALLOWED, NOSIGN, OWNER + } } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java index 501ea2a7b..d71bf95f1 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java @@ -19,14 +19,6 @@ public class SignTrade extends EssentialsSign super("Trade"); } - - public enum AmountType - { - TOTAL, - ROUNDED, - COST - } - @Override protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException { @@ -52,7 +44,7 @@ public class SignTrade extends EssentialsSign if (sign.getLine(3).substring(2).equalsIgnoreCase(username)) { final Trade store = rechargeSign(sign, ess, player); - Trade stored = null; + Trade stored; try { stored = getTrade(sign, 1, AmountType.TOTAL, true, ess); @@ -426,4 +418,12 @@ public class SignTrade extends EssentialsSign } throw new SignException(_("invalidSignLine", index + 1)); } + + + public enum AmountType + { + TOTAL, + ROUNDED, + COST + } } diff --git a/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java b/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java index f9dc52b18..5282587e7 100644 --- a/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java +++ b/Essentials/src/com/earth2me/essentials/storage/AsyncStorageObjectHolder.java @@ -24,22 +24,29 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen { this.data = clazz.newInstance(); } - catch (Exception ex) + catch (IllegalAccessException ex) + { + Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); + } + catch (InstantiationException ex) { Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); } } + @Override public T getData() { return data; } + @Override public void acquireReadLock() { rwl.readLock().lock(); } + @Override public void acquireWriteLock() { while (rwl.getReadHoldCount() > 0) @@ -50,11 +57,13 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen rwl.readLock().lock(); } + @Override public void close() { unlock(); } + @Override public void unlock() { if (rwl.isWriteLockedByCurrentThread()) @@ -79,11 +88,11 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen { new StorageObjectDataReader(); } - + public abstract void finishRead(); - + public abstract void finishWrite(); - + public abstract File getStorageFile(); @@ -143,7 +152,11 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen { data = clazz.newInstance(); } - catch (Exception ex) + catch (IllegalAccessException ex) + { + Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); + } + catch (InstantiationException ex) { Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex); } diff --git a/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java b/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java index a664929f3..f4cacea67 100644 --- a/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java +++ b/Essentials/src/com/earth2me/essentials/storage/EnchantmentLevel.java @@ -70,9 +70,9 @@ public class EnchantmentLevel implements Entry<Enchantment, Integer> if (entry.getKey() instanceof Enchantment && entry.getValue() instanceof Integer) { - final Enchantment enchantment = (Enchantment)entry.getKey(); - final Integer level = (Integer)entry.getValue(); - return this.enchantment.equals(enchantment) && this.level == level.intValue(); + final Enchantment enchant = (Enchantment)entry.getKey(); + final Integer lvl = (Integer)entry.getValue(); + return this.enchantment.equals(enchant) && this.level == lvl.intValue(); } } return false; diff --git a/Essentials/src/com/earth2me/essentials/storage/YamlStorageReader.java b/Essentials/src/com/earth2me/essentials/storage/YamlStorageReader.java index 5d1ff668a..6f921ec10 100644 --- a/Essentials/src/com/earth2me/essentials/storage/YamlStorageReader.java +++ b/Essentials/src/com/earth2me/essentials/storage/YamlStorageReader.java @@ -50,7 +50,11 @@ public class YamlStorageReader implements IStorageReader } return object; } - catch (Exception ex) + catch (IllegalAccessException ex) + { + throw new ObjectLoadException(ex); + } + catch (InstantiationException ex) { throw new ObjectLoadException(ex); } diff --git a/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java b/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java index fd1f0f863..f08e734f8 100644 --- a/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java +++ b/Essentials/src/com/earth2me/essentials/storage/YamlStorageWriter.java @@ -22,8 +22,8 @@ import org.yaml.snakeyaml.Yaml; public class YamlStorageWriter implements IStorageWriter { private transient static final Pattern NON_WORD_PATTERN = Pattern.compile("\\W"); - private transient final PrintWriter writer; private transient static final Yaml YAML = new Yaml(); + private transient final PrintWriter writer; public YamlStorageWriter(final PrintWriter writer) { diff --git a/Essentials/src/com/earth2me/essentials/textreader/BookInput.java b/Essentials/src/com/earth2me/essentials/textreader/BookInput.java index 47e81ddbb..4c0ee9236 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/BookInput.java +++ b/Essentials/src/com/earth2me/essentials/textreader/BookInput.java @@ -8,11 +8,11 @@ import net.ess3.api.IEssentials; public class BookInput implements IText { + 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 { diff --git a/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java b/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java index fbada7bb9..d0f708423 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java +++ b/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java @@ -16,10 +16,10 @@ public class HelpInput implements IText private static final String DESCRIPTION = "description"; private static final String PERMISSION = "permission"; private static final String PERMISSIONS = "permissions"; + private final static Logger logger = Logger.getLogger("Minecraft"); private final transient List<String> lines = new ArrayList<String>(); private final transient List<String> chapters = new ArrayList<String>(); private final transient Map<String, Integer> bookmarks = new HashMap<String, Integer>(); - private final static Logger logger = Logger.getLogger("Minecraft"); public HelpInput(final User user, final String match, final IEssentials ess) throws IOException { @@ -121,7 +121,6 @@ public class HelpInput implements IText } catch (NullPointerException ex) { - continue; } } if (!pluginLines.isEmpty()) @@ -139,7 +138,6 @@ public class HelpInput implements IText } catch (NullPointerException ex) { - continue; } catch (Exception ex) { @@ -148,7 +146,6 @@ public class HelpInput implements IText logger.log(Level.WARNING, _("commandHelpFailedForPlugin", pluginNameLow), ex); } reported = true; - continue; } } lines.addAll(newLines); diff --git a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java index def72e2ae..d936c4b10 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java +++ b/Essentials/src/com/earth2me/essentials/textreader/KeywordReplacer.java @@ -31,13 +31,13 @@ import org.bukkit.plugin.Plugin; public class KeywordReplacer implements IText { + private final static Pattern KEYWORD = Pattern.compile("\\{([^\\{\\}]+)\\}"); + private final static Pattern KEYWORDSPLIT = Pattern.compile("\\:"); private final transient IText input; private final transient List<String> replaced; private final transient IEssentials ess; private final transient boolean includePrivate; private transient ExecuteTimer execTimer; - private final static Pattern KEYWORD = Pattern.compile("\\{([^\\{\\}]+)\\}"); - private final static Pattern KEYWORDSPLIT = Pattern.compile("\\:"); private final EnumMap<KeywordType, Object> keywordCache = new EnumMap<KeywordType, Object>(KeywordType.class); public KeywordReplacer(final IText input, final CommandSource sender, final IEssentials ess) diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextInput.java b/Essentials/src/com/earth2me/essentials/textreader/TextInput.java index f375a3072..1dc68d237 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/TextInput.java +++ b/Essentials/src/com/earth2me/essentials/textreader/TextInput.java @@ -12,11 +12,11 @@ import net.ess3.api.IEssentials; public class TextInput implements IText { + private final static HashMap<String, SoftReference<TextInput>> cache = new HashMap<String, SoftReference<TextInput>>(); 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<TextInput>> cache = new HashMap<String, SoftReference<TextInput>>(); public TextInput(final CommandSource sender, final String filename, final boolean createFile, final IEssentials ess) throws IOException { diff --git a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java index d2f18984f..e3a259333 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/TextPager.java +++ b/Essentials/src/com/earth2me/essentials/textreader/TextPager.java @@ -64,7 +64,7 @@ public class TextPager { page = Integer.parseInt(pageStr); } - catch (Exception ex) + catch (NumberFormatException ex) { page = 1; } @@ -121,7 +121,7 @@ public class TextPager { chapterpage = Integer.parseInt(chapterPageStr) - 1; } - catch (Exception ex) + catch (NumberFormatException ex) { chapterpage = 0; } @@ -137,7 +137,7 @@ public class TextPager sender.sendMessage(_("infoUnknownChapter")); return; } - + //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; @@ -149,7 +149,7 @@ public class TextPager break; } } - + //Display the chapter from the starting position final int start = chapterstart + (onePage ? 0 : chapterpage * 9); final int page = chapterpage + 1; diff --git a/Essentials/src/com/earth2me/essentials/utils/DescParseTickFormat.java b/Essentials/src/com/earth2me/essentials/utils/DescParseTickFormat.java index 57a152c3a..b10412e60 100644 --- a/Essentials/src/com/earth2me/essentials/utils/DescParseTickFormat.java +++ b/Essentials/src/com/earth2me/essentials/utils/DescParseTickFormat.java @@ -61,13 +61,7 @@ public final class DescParseTickFormat resetAliases.add("default"); } - private DescParseTickFormat() - { - } - // ============================================ - // PARSE. From describing String to int - // -------------------------------------------- public static long parse(String desc) throws NumberFormatException { // Only look at alphanumeric and lowercase and : for 24:00 @@ -78,7 +72,7 @@ public final class DescParseTickFormat { return parseTicks(desc); } - catch (Exception e) + catch (NumberFormatException e) { } @@ -87,7 +81,7 @@ public final class DescParseTickFormat { return parse24(desc); } - catch (Exception e) + catch (NumberFormatException e) { } @@ -96,7 +90,7 @@ public final class DescParseTickFormat { return parse12(desc); } - catch (Exception e) + catch (NumberFormatException e) { } @@ -105,14 +99,13 @@ public final class DescParseTickFormat { return parseAlias(desc); } - catch (Exception e) + catch (NumberFormatException e) { } // Well we failed to understand... throw new NumberFormatException(); } - public static long parseTicks(String desc) throws NumberFormatException { if (!desc.matches("^[0-9]+ti?c?k?s?$")) @@ -227,13 +220,10 @@ public final class DescParseTickFormat } // ============================================ - // FORMAT. From int to describing String - // -------------------------------------------- public static String format(final long ticks) { return _("timeFormat", format24(ticks), format12(ticks), formatTicks(ticks)); } - public static String formatTicks(final long ticks) { return (ticks % ticksPerDay) + "ticks"; @@ -295,4 +285,8 @@ public final class DescParseTickFormat return cal.getTime(); } + + private DescParseTickFormat() + { + } } diff --git a/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java b/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java index ca66f5d82..e72530684 100644 --- a/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java +++ b/Essentials/src/com/earth2me/essentials/utils/FormatUtil.java @@ -66,7 +66,7 @@ public class FormatUtil } return replaceColor(input, REPLACE_ALL_PATTERN); } - + static String replaceColor(final String input, final Pattern pattern) { return REPLACE_PATTERN.matcher(pattern.matcher(input).replaceAll("\u00a7$1")).replaceAll("&"); @@ -106,7 +106,7 @@ public class FormatUtil } return message; } - + public static String stripLogColorFormat(final String input) { if (input == null) @@ -115,22 +115,22 @@ public class FormatUtil } return stripColor(input, LOGCOLOR_PATTERN); } - + static String stripColor(final String input, final Pattern pattern) { return pattern.matcher(input).replaceAll(""); } - + public static String lastCode(final String input) { - int pos = input.lastIndexOf("\u00a7"); + int pos = input.lastIndexOf('\u00a7'); if (pos == -1 || (pos + 1) == input.length()) { return ""; } return input.substring(pos, pos + 2); } - + static String blockURL(final String input) { if (input == null) @@ -144,7 +144,7 @@ public class FormatUtil } return text; } - + public static boolean validIP(String ipAddress) { return IPPATTERN.matcher(ipAddress).matches(); diff --git a/Essentials/src/com/earth2me/essentials/utils/LocationUtil.java b/Essentials/src/com/earth2me/essentials/utils/LocationUtil.java index 35754786b..0059e9f8c 100644 --- a/Essentials/src/com/earth2me/essentials/utils/LocationUtil.java +++ b/Essentials/src/com/earth2me/essentials/utils/LocationUtil.java @@ -157,15 +157,15 @@ public class LocationUtil public static class Vector3D { + public int x; + public int y; + public int z; public Vector3D(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } - public int x; - public int y; - public int z; } static diff --git a/Essentials/src/com/earth2me/essentials/utils/StringUtil.java b/Essentials/src/com/earth2me/essentials/utils/StringUtil.java index 10696d78e..c6efb4291 100644 --- a/Essentials/src/com/earth2me/essentials/utils/StringUtil.java +++ b/Essentials/src/com/earth2me/essentials/utils/StringUtil.java @@ -6,9 +6,6 @@ import java.util.regex.Pattern; public class StringUtil { - private StringUtil() - { - } 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]"); @@ -63,4 +60,7 @@ public class StringUtil } return buf.toString(); } + private StringUtil() + { + } } diff --git a/EssentialsAntiBuild/nbproject/build-impl.xml b/EssentialsAntiBuild/nbproject/build-impl.xml index 72a60d15a..4d7b80fec 100644 --- a/EssentialsAntiBuild/nbproject/build-impl.xml +++ b/EssentialsAntiBuild/nbproject/build-impl.xml @@ -79,6 +79,7 @@ is divided into following sections: <property file="nbproject/project.properties"/> </target> <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init"> + <property name="platform.java" value="${java.home}/bin/java"/> <available file="${manifest.file}" property="manifest.available"/> <condition property="splashscreen.available"> <and> @@ -96,10 +97,11 @@ is divided into following sections: </not> </and> </condition> - <condition property="manifest.available+main.class"> + <condition property="profile.available"> <and> - <isset property="manifest.available"/> - <isset property="main.class.available"/> + <isset property="javac.profile"/> + <length length="0" string="${javac.profile}" when="greater"/> + <matches pattern="1\.[89](\..*)?" string="${javac.source}"/> </and> </condition> <condition property="do.archive"> @@ -116,12 +118,6 @@ is divided into following sections: </not> </and> </condition> - <condition property="manifest.available+main.class+mkdist.available"> - <and> - <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </and> - </condition> <condition property="do.archive+manifest.available"> <and> <isset property="manifest.available"/> @@ -140,24 +136,12 @@ is divided into following sections: <istrue value="${do.archive}"/> </and> </condition> - <condition property="do.archive+manifest.available+main.class"> + <condition property="do.archive+profile.available"> <and> - <istrue value="${manifest.available+main.class}"/> + <isset property="profile.available"/> <istrue value="${do.archive}"/> </and> </condition> - <condition property="manifest.available-mkdist.available"> - <or> - <istrue value="${manifest.available}"/> - <isset property="do.mkdist"/> - </or> - </condition> - <condition property="manifest.available+main.class-mkdist.available"> - <or> - <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </or> - </condition> <condition property="have.tests"> <or> <available file="${test.src.dir}"/> @@ -211,7 +195,15 @@ is divided into following sections: </condition> <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> - <length length="0" string="${endorsed.classpath}" when="greater"/> + <and> + <isset property="endorsed.classpath"/> + <not> + <equals arg1="${endorsed.classpath}" arg2="" trim="true"/> + </not> + </and> + </condition> + <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}"> + <isset property="profile.available"/> </condition> <condition else="false" property="jdkBug6558476"> <and> @@ -300,6 +292,7 @@ is divided into following sections: <path path="@{classpath}"/> </classpath> <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.profile.cmd.line.arg}"/> <compilerarg line="${javac.compilerargs}"/> <compilerarg value="-processorpath"/> <compilerarg path="@{processorpath}:${empty.dir}"/> @@ -339,6 +332,7 @@ is divided into following sections: <path path="@{classpath}"/> </classpath> <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.profile.cmd.line.arg}"/> <compilerarg line="${javac.compilerargs}"/> <customize/> </javac> @@ -471,7 +465,7 @@ is divided into following sections: </fileset> </union> <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> - <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="EssentialsAntiBuild" testname="TestNG tests" workingDir="${work.dir}"> + <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="EssentialsAntiBuild" testname="TestNG tests" workingDir="${work.dir}"> <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> <propertyset> <propertyref prefix="test-sys-prop."/> @@ -862,8 +856,8 @@ is divided into following sections: </chainedmapper> </pathconvert> <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> - <fileset dir="${build.classes.dir}"/> + <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> + <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> <manifest> <attribute name="Class-Path" value="${jar.classpath}"/> <customize/> @@ -875,7 +869,7 @@ is divided into following sections: <target name="-init-presetdef-jar"> <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> - <j2seproject1:fileset dir="${build.classes.dir}"/> + <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> </jar> </presetdef> </target> @@ -998,41 +992,25 @@ is divided into following sections: <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available"> - <j2seproject1:jar/> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available"> - <j2seproject1:jar manifest="${manifest.file}"/> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> - <j2seproject1:jar manifest="${manifest.file}"> - <j2seproject1:manifest> - <j2seproject1:attribute name="Main-Class" value="${main.class}"/> - </j2seproject1:manifest> - </j2seproject1:jar> - <echo level="info">To run this application from the command line without Ant, try:</echo> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <property location="${dist.jar}" name="dist.jar.resolved"/> - <pathconvert property="run.classpath.with.dist.jar"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> - </pathconvert> - <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo> - </target> - <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available"> + <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available"> <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> <touch file="${tmp.manifest.file}" verbose="false"/> </target> - <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest"> + <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest"> <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/> </target> - <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main"> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass"> <manifest file="${tmp.manifest.file}" mode="update"> <attribute name="Main-Class" value="${main.class}"/> </manifest> </target> - <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen"> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile"> + <manifest file="${tmp.manifest.file}" mode="update"> + <attribute name="Profile" value="${javac.profile}"/> + </manifest> + </target> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen"> <basename file="${application.splash}" property="splashscreen.basename"/> <mkdir dir="${build.classes.dir}/META-INF"/> <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> @@ -1040,23 +1018,41 @@ is divided into following sections: <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> </manifest> </target> - <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack"> + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs"> <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> <echo level="info">To run this application from the command line without Ant, try:</echo> <property location="${dist.jar}" name="dist.jar.resolved"/> <echo level="info">java -jar "${dist.jar.resolved}"</echo> </target> - <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest"> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> + <j2seproject1:jar manifest="${tmp.manifest.file}"/> + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> + <property location="${dist.jar}" name="dist.jar.resolved"/> + <pathconvert property="run.classpath.with.dist.jar"> + <path path="${run.classpath}"/> + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> + </pathconvert> + <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}"> + <isset property="main.class.available"/> + </condition> + <condition else="debug" property="jar.usage.level" value="info"> + <isset property="main.class.available"/> + </condition> + <echo level="${jar.usage.level}" message="${jar.usage.message}"/> + </target> + <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest"> <delete> <fileset file="${tmp.manifest.file}"/> </delete> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/> <target name="-post-jar"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/> + <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/> + <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/> <!-- ================= EXECUTION SECTION diff --git a/EssentialsAntiBuild/nbproject/genfiles.properties b/EssentialsAntiBuild/nbproject/genfiles.properties index a00aaef2d..ff9fd681e 100644 --- a/EssentialsAntiBuild/nbproject/genfiles.properties +++ b/EssentialsAntiBuild/nbproject/genfiles.properties @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=28e38971@1.38.3.45 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=ddb4519c -nbproject/build-impl.xml.script.CRC32=1c67208a -nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.1.46 +nbproject/build-impl.xml.script.CRC32=61508afa +nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46 diff --git a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java index c81a38ab2..27ca5fe35 100644 --- a/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java +++ b/EssentialsAntiBuild/src/com/earth2me/essentials/antibuild/EssentialsAntiBuildListener.java @@ -200,7 +200,6 @@ public class EssentialsAntiBuildListener implements Listener if (prot.checkProtectionItems(AntiBuildConfig.blacklist_piston, block.getTypeId())) { event.setCancelled(true); - return; } } diff --git a/EssentialsChat/nbproject/build-impl.xml b/EssentialsChat/nbproject/build-impl.xml index 7fc117783..8b800a88b 100644 --- a/EssentialsChat/nbproject/build-impl.xml +++ b/EssentialsChat/nbproject/build-impl.xml @@ -79,6 +79,7 @@ is divided into following sections: <property file="nbproject/project.properties"/> </target> <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init"> + <property name="platform.java" value="${java.home}/bin/java"/> <available file="${manifest.file}" property="manifest.available"/> <condition property="splashscreen.available"> <and> @@ -96,10 +97,11 @@ is divided into following sections: </not> </and> </condition> - <condition property="manifest.available+main.class"> + <condition property="profile.available"> <and> - <isset property="manifest.available"/> - <isset property="main.class.available"/> + <isset property="javac.profile"/> + <length length="0" string="${javac.profile}" when="greater"/> + <matches pattern="1\.[89](\..*)?" string="${javac.source}"/> </and> </condition> <condition property="do.archive"> @@ -116,12 +118,6 @@ is divided into following sections: </not> </and> </condition> - <condition property="manifest.available+main.class+mkdist.available"> - <and> - <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </and> - </condition> <condition property="do.archive+manifest.available"> <and> <isset property="manifest.available"/> @@ -140,24 +136,12 @@ is divided into following sections: <istrue value="${do.archive}"/> </and> </condition> - <condition property="do.archive+manifest.available+main.class"> + <condition property="do.archive+profile.available"> <and> - <istrue value="${manifest.available+main.class}"/> + <isset property="profile.available"/> <istrue value="${do.archive}"/> </and> </condition> - <condition property="manifest.available-mkdist.available"> - <or> - <istrue value="${manifest.available}"/> - <isset property="do.mkdist"/> - </or> - </condition> - <condition property="manifest.available+main.class-mkdist.available"> - <or> - <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </or> - </condition> <condition property="have.tests"> <or> <available file="${test.src.dir}"/> @@ -211,7 +195,15 @@ is divided into following sections: </condition> <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> - <length length="0" string="${endorsed.classpath}" when="greater"/> + <and> + <isset property="endorsed.classpath"/> + <not> + <equals arg1="${endorsed.classpath}" arg2="" trim="true"/> + </not> + </and> + </condition> + <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}"> + <isset property="profile.available"/> </condition> <condition else="false" property="jdkBug6558476"> <and> @@ -300,6 +292,7 @@ is divided into following sections: <path path="@{classpath}"/> </classpath> <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.profile.cmd.line.arg}"/> <compilerarg line="${javac.compilerargs}"/> <compilerarg value="-processorpath"/> <compilerarg path="@{processorpath}:${empty.dir}"/> @@ -339,6 +332,7 @@ is divided into following sections: <path path="@{classpath}"/> </classpath> <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.profile.cmd.line.arg}"/> <compilerarg line="${javac.compilerargs}"/> <customize/> </javac> @@ -471,7 +465,7 @@ is divided into following sections: </fileset> </union> <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> - <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="EssentialsChat" testname="TestNG tests" workingDir="${work.dir}"> + <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="EssentialsChat" testname="TestNG tests" workingDir="${work.dir}"> <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> <propertyset> <propertyref prefix="test-sys-prop."/> @@ -862,8 +856,8 @@ is divided into following sections: </chainedmapper> </pathconvert> <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> - <fileset dir="${build.classes.dir}"/> + <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> + <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> <manifest> <attribute name="Class-Path" value="${jar.classpath}"/> <customize/> @@ -875,7 +869,7 @@ is divided into following sections: <target name="-init-presetdef-jar"> <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> - <j2seproject1:fileset dir="${build.classes.dir}"/> + <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> </jar> </presetdef> </target> @@ -998,41 +992,25 @@ is divided into following sections: <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available"> - <j2seproject1:jar/> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available"> - <j2seproject1:jar manifest="${manifest.file}"/> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> - <j2seproject1:jar manifest="${manifest.file}"> - <j2seproject1:manifest> - <j2seproject1:attribute name="Main-Class" value="${main.class}"/> - </j2seproject1:manifest> - </j2seproject1:jar> - <echo level="info">To run this application from the command line without Ant, try:</echo> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <property location="${dist.jar}" name="dist.jar.resolved"/> - <pathconvert property="run.classpath.with.dist.jar"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> - </pathconvert> - <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo> - </target> - <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available"> + <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available"> <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> <touch file="${tmp.manifest.file}" verbose="false"/> </target> - <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest"> + <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest"> <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/> </target> - <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main"> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass"> <manifest file="${tmp.manifest.file}" mode="update"> <attribute name="Main-Class" value="${main.class}"/> </manifest> </target> - <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen"> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile"> + <manifest file="${tmp.manifest.file}" mode="update"> + <attribute name="Profile" value="${javac.profile}"/> + </manifest> + </target> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen"> <basename file="${application.splash}" property="splashscreen.basename"/> <mkdir dir="${build.classes.dir}/META-INF"/> <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> @@ -1040,23 +1018,41 @@ is divided into following sections: <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> </manifest> </target> - <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack"> + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs"> <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> <echo level="info">To run this application from the command line without Ant, try:</echo> <property location="${dist.jar}" name="dist.jar.resolved"/> <echo level="info">java -jar "${dist.jar.resolved}"</echo> </target> - <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest"> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> + <j2seproject1:jar manifest="${tmp.manifest.file}"/> + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> + <property location="${dist.jar}" name="dist.jar.resolved"/> + <pathconvert property="run.classpath.with.dist.jar"> + <path path="${run.classpath}"/> + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> + </pathconvert> + <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}"> + <isset property="main.class.available"/> + </condition> + <condition else="debug" property="jar.usage.level" value="info"> + <isset property="main.class.available"/> + </condition> + <echo level="${jar.usage.level}" message="${jar.usage.message}"/> + </target> + <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest"> <delete> <fileset file="${tmp.manifest.file}"/> </delete> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/> <target name="-post-jar"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/> + <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/> + <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/> <!-- ================= EXECUTION SECTION diff --git a/EssentialsChat/nbproject/genfiles.properties b/EssentialsChat/nbproject/genfiles.properties index d624bd5de..13388d69b 100644 --- a/EssentialsChat/nbproject/genfiles.properties +++ b/EssentialsChat/nbproject/genfiles.properties @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=28e38971@1.38.2.45 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=7c7f517b -nbproject/build-impl.xml.script.CRC32=c6c8dc20 -nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.1.46 +nbproject/build-impl.xml.script.CRC32=32fc3d78 +nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46 diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java b/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java index 4c5f8dd90..8e40a3dff 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java @@ -34,7 +34,7 @@ public class ChatStore return type; } - public String getLongType() + public final String getLongType() { return type.length() == 0 ? "chat" : "chat-" + type; } diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java index 8a8cf41ee..959277b9c 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java @@ -5,7 +5,6 @@ import net.ess3.api.IEssentials; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.ConcurrentSkipListMap; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.event.player.AsyncPlayerChatEvent; diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java index 78b9d1a7f..9554c63f6 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java @@ -12,8 +12,8 @@ import org.bukkit.event.player.AsyncPlayerChatEvent; public abstract class EssentialsChatPlayer implements Listener { - protected transient IEssentials ess; protected final static Logger logger = Logger.getLogger("Minecraft"); + protected transient IEssentials ess; protected final transient Server server; protected final transient Map<AsyncPlayerChatEvent, ChatStore> chatStorage; diff --git a/EssentialsProtect/nbproject/build-impl.xml b/EssentialsProtect/nbproject/build-impl.xml index 8c6e33a7f..23d8e4c4e 100644 --- a/EssentialsProtect/nbproject/build-impl.xml +++ b/EssentialsProtect/nbproject/build-impl.xml @@ -79,6 +79,7 @@ is divided into following sections: <property file="nbproject/project.properties"/> </target> <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init"> + <property name="platform.java" value="${java.home}/bin/java"/> <available file="${manifest.file}" property="manifest.available"/> <condition property="splashscreen.available"> <and> @@ -96,10 +97,11 @@ is divided into following sections: </not> </and> </condition> - <condition property="manifest.available+main.class"> + <condition property="profile.available"> <and> - <isset property="manifest.available"/> - <isset property="main.class.available"/> + <isset property="javac.profile"/> + <length length="0" string="${javac.profile}" when="greater"/> + <matches pattern="1\.[89](\..*)?" string="${javac.source}"/> </and> </condition> <condition property="do.archive"> @@ -116,12 +118,6 @@ is divided into following sections: </not> </and> </condition> - <condition property="manifest.available+main.class+mkdist.available"> - <and> - <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </and> - </condition> <condition property="do.archive+manifest.available"> <and> <isset property="manifest.available"/> @@ -140,24 +136,12 @@ is divided into following sections: <istrue value="${do.archive}"/> </and> </condition> - <condition property="do.archive+manifest.available+main.class"> + <condition property="do.archive+profile.available"> <and> - <istrue value="${manifest.available+main.class}"/> + <isset property="profile.available"/> <istrue value="${do.archive}"/> </and> </condition> - <condition property="manifest.available-mkdist.available"> - <or> - <istrue value="${manifest.available}"/> - <isset property="do.mkdist"/> - </or> - </condition> - <condition property="manifest.available+main.class-mkdist.available"> - <or> - <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </or> - </condition> <condition property="have.tests"> <or> <available file="${test.src.dir}"/> @@ -211,7 +195,15 @@ is divided into following sections: </condition> <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> - <length length="0" string="${endorsed.classpath}" when="greater"/> + <and> + <isset property="endorsed.classpath"/> + <not> + <equals arg1="${endorsed.classpath}" arg2="" trim="true"/> + </not> + </and> + </condition> + <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}"> + <isset property="profile.available"/> </condition> <condition else="false" property="jdkBug6558476"> <and> @@ -300,6 +292,7 @@ is divided into following sections: <path path="@{classpath}"/> </classpath> <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.profile.cmd.line.arg}"/> <compilerarg line="${javac.compilerargs}"/> <compilerarg value="-processorpath"/> <compilerarg path="@{processorpath}:${empty.dir}"/> @@ -339,6 +332,7 @@ is divided into following sections: <path path="@{classpath}"/> </classpath> <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.profile.cmd.line.arg}"/> <compilerarg line="${javac.compilerargs}"/> <customize/> </javac> @@ -471,7 +465,7 @@ is divided into following sections: </fileset> </union> <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> - <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="EssentialsProtect" testname="TestNG tests" workingDir="${work.dir}"> + <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="EssentialsProtect" testname="TestNG tests" workingDir="${work.dir}"> <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> <propertyset> <propertyref prefix="test-sys-prop."/> @@ -862,8 +856,8 @@ is divided into following sections: </chainedmapper> </pathconvert> <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> - <fileset dir="${build.classes.dir}"/> + <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> + <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> <manifest> <attribute name="Class-Path" value="${jar.classpath}"/> <customize/> @@ -875,7 +869,7 @@ is divided into following sections: <target name="-init-presetdef-jar"> <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> - <j2seproject1:fileset dir="${build.classes.dir}"/> + <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> </jar> </presetdef> </target> @@ -998,41 +992,25 @@ is divided into following sections: <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available"> - <j2seproject1:jar/> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available"> - <j2seproject1:jar manifest="${manifest.file}"/> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> - <j2seproject1:jar manifest="${manifest.file}"> - <j2seproject1:manifest> - <j2seproject1:attribute name="Main-Class" value="${main.class}"/> - </j2seproject1:manifest> - </j2seproject1:jar> - <echo level="info">To run this application from the command line without Ant, try:</echo> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <property location="${dist.jar}" name="dist.jar.resolved"/> - <pathconvert property="run.classpath.with.dist.jar"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> - </pathconvert> - <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo> - </target> - <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available"> + <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available"> <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> <touch file="${tmp.manifest.file}" verbose="false"/> </target> - <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest"> + <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest"> <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/> </target> - <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main"> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass"> <manifest file="${tmp.manifest.file}" mode="update"> <attribute name="Main-Class" value="${main.class}"/> </manifest> </target> - <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen"> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile"> + <manifest file="${tmp.manifest.file}" mode="update"> + <attribute name="Profile" value="${javac.profile}"/> + </manifest> + </target> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen"> <basename file="${application.splash}" property="splashscreen.basename"/> <mkdir dir="${build.classes.dir}/META-INF"/> <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> @@ -1040,23 +1018,41 @@ is divided into following sections: <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> </manifest> </target> - <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack"> + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs"> <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> <echo level="info">To run this application from the command line without Ant, try:</echo> <property location="${dist.jar}" name="dist.jar.resolved"/> <echo level="info">java -jar "${dist.jar.resolved}"</echo> </target> - <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest"> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> + <j2seproject1:jar manifest="${tmp.manifest.file}"/> + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> + <property location="${dist.jar}" name="dist.jar.resolved"/> + <pathconvert property="run.classpath.with.dist.jar"> + <path path="${run.classpath}"/> + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> + </pathconvert> + <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}"> + <isset property="main.class.available"/> + </condition> + <condition else="debug" property="jar.usage.level" value="info"> + <isset property="main.class.available"/> + </condition> + <echo level="${jar.usage.level}" message="${jar.usage.message}"/> + </target> + <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest"> <delete> <fileset file="${tmp.manifest.file}"/> </delete> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/> <target name="-post-jar"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/> + <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/> + <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/> <!-- ================= EXECUTION SECTION diff --git a/EssentialsProtect/nbproject/genfiles.properties b/EssentialsProtect/nbproject/genfiles.properties index 52527c86a..6516061ab 100644 --- a/EssentialsProtect/nbproject/genfiles.properties +++ b/EssentialsProtect/nbproject/genfiles.properties @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=28e38971@1.38.3.45 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=40644caa -nbproject/build-impl.xml.script.CRC32=60fc07c9 -nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.1.46 +nbproject/build-impl.xml.script.CRC32=b766656c +nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46 diff --git a/EssentialsSpawn/nbproject/build-impl.xml b/EssentialsSpawn/nbproject/build-impl.xml index 8163b5e31..07e880cfc 100644 --- a/EssentialsSpawn/nbproject/build-impl.xml +++ b/EssentialsSpawn/nbproject/build-impl.xml @@ -79,6 +79,7 @@ is divided into following sections: <property file="nbproject/project.properties"/> </target> <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init"> + <property name="platform.java" value="${java.home}/bin/java"/> <available file="${manifest.file}" property="manifest.available"/> <condition property="splashscreen.available"> <and> @@ -96,10 +97,11 @@ is divided into following sections: </not> </and> </condition> - <condition property="manifest.available+main.class"> + <condition property="profile.available"> <and> - <isset property="manifest.available"/> - <isset property="main.class.available"/> + <isset property="javac.profile"/> + <length length="0" string="${javac.profile}" when="greater"/> + <matches pattern="1\.[89](\..*)?" string="${javac.source}"/> </and> </condition> <condition property="do.archive"> @@ -116,12 +118,6 @@ is divided into following sections: </not> </and> </condition> - <condition property="manifest.available+main.class+mkdist.available"> - <and> - <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </and> - </condition> <condition property="do.archive+manifest.available"> <and> <isset property="manifest.available"/> @@ -140,24 +136,12 @@ is divided into following sections: <istrue value="${do.archive}"/> </and> </condition> - <condition property="do.archive+manifest.available+main.class"> + <condition property="do.archive+profile.available"> <and> - <istrue value="${manifest.available+main.class}"/> + <isset property="profile.available"/> <istrue value="${do.archive}"/> </and> </condition> - <condition property="manifest.available-mkdist.available"> - <or> - <istrue value="${manifest.available}"/> - <isset property="do.mkdist"/> - </or> - </condition> - <condition property="manifest.available+main.class-mkdist.available"> - <or> - <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </or> - </condition> <condition property="have.tests"> <or> <available file="${test.src.dir}"/> @@ -211,7 +195,15 @@ is divided into following sections: </condition> <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> - <length length="0" string="${endorsed.classpath}" when="greater"/> + <and> + <isset property="endorsed.classpath"/> + <not> + <equals arg1="${endorsed.classpath}" arg2="" trim="true"/> + </not> + </and> + </condition> + <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}"> + <isset property="profile.available"/> </condition> <condition else="false" property="jdkBug6558476"> <and> @@ -300,6 +292,7 @@ is divided into following sections: <path path="@{classpath}"/> </classpath> <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.profile.cmd.line.arg}"/> <compilerarg line="${javac.compilerargs}"/> <compilerarg value="-processorpath"/> <compilerarg path="@{processorpath}:${empty.dir}"/> @@ -339,6 +332,7 @@ is divided into following sections: <path path="@{classpath}"/> </classpath> <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> + <compilerarg line="${javac.profile.cmd.line.arg}"/> <compilerarg line="${javac.compilerargs}"/> <customize/> </javac> @@ -471,7 +465,7 @@ is divided into following sections: </fileset> </union> <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> - <testng classfilesetref="test.set" failureProperty="tests.failed" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="EssentialsSpawn" testname="TestNG tests" workingDir="${work.dir}"> + <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="EssentialsSpawn" testname="TestNG tests" workingDir="${work.dir}"> <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> <propertyset> <propertyref prefix="test-sys-prop."/> @@ -862,8 +856,8 @@ is divided into following sections: </chainedmapper> </pathconvert> <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> - <fileset dir="${build.classes.dir}"/> + <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> + <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> <manifest> <attribute name="Class-Path" value="${jar.classpath}"/> <customize/> @@ -875,7 +869,7 @@ is divided into following sections: <target name="-init-presetdef-jar"> <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> - <j2seproject1:fileset dir="${build.classes.dir}"/> + <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> </jar> </presetdef> </target> @@ -998,41 +992,25 @@ is divided into following sections: <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available"> - <j2seproject1:jar/> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available"> - <j2seproject1:jar manifest="${manifest.file}"/> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> - <j2seproject1:jar manifest="${manifest.file}"> - <j2seproject1:manifest> - <j2seproject1:attribute name="Main-Class" value="${main.class}"/> - </j2seproject1:manifest> - </j2seproject1:jar> - <echo level="info">To run this application from the command line without Ant, try:</echo> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <property location="${dist.jar}" name="dist.jar.resolved"/> - <pathconvert property="run.classpath.with.dist.jar"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> - </pathconvert> - <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo> - </target> - <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available"> + <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available"> <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> <touch file="${tmp.manifest.file}" verbose="false"/> </target> - <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest"> + <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest"> <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/> </target> - <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main"> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass"> <manifest file="${tmp.manifest.file}" mode="update"> <attribute name="Main-Class" value="${main.class}"/> </manifest> </target> - <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen"> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile"> + <manifest file="${tmp.manifest.file}" mode="update"> + <attribute name="Profile" value="${javac.profile}"/> + </manifest> + </target> + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen"> <basename file="${application.splash}" property="splashscreen.basename"/> <mkdir dir="${build.classes.dir}/META-INF"/> <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> @@ -1040,23 +1018,41 @@ is divided into following sections: <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> </manifest> </target> - <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack"> + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs"> <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> <echo level="info">To run this application from the command line without Ant, try:</echo> <property location="${dist.jar}" name="dist.jar.resolved"/> <echo level="info">java -jar "${dist.jar.resolved}"</echo> </target> - <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest"> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> + <j2seproject1:jar manifest="${tmp.manifest.file}"/> + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> + <property location="${dist.jar}" name="dist.jar.resolved"/> + <pathconvert property="run.classpath.with.dist.jar"> + <path path="${run.classpath}"/> + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> + </pathconvert> + <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}"> + <isset property="main.class.available"/> + </condition> + <condition else="debug" property="jar.usage.level" value="info"> + <isset property="main.class.available"/> + </condition> + <echo level="${jar.usage.level}" message="${jar.usage.message}"/> + </target> + <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest"> <delete> <fileset file="${tmp.manifest.file}"/> </delete> </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/> + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/> <target name="-post-jar"> <!-- Empty placeholder for easier customization. --> <!-- You can override this target in the ../build.xml file. --> </target> - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/> + <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/> + <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/> <!-- ================= EXECUTION SECTION diff --git a/EssentialsSpawn/nbproject/genfiles.properties b/EssentialsSpawn/nbproject/genfiles.properties index fd3a6cd1e..b2ee6a42a 100644 --- a/EssentialsSpawn/nbproject/genfiles.properties +++ b/EssentialsSpawn/nbproject/genfiles.properties @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=28e38971@1.38.2.45 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=e7b96939 -nbproject/build-impl.xml.script.CRC32=1d8d66ff -nbproject/build-impl.xml.stylesheet.CRC32=c6d2a60f@1.56.1.46 +nbproject/build-impl.xml.script.CRC32=6051a009 +nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46 diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index 668294970..b1732f578 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -24,9 +24,9 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class EssentialsSpawnPlayerListener implements Listener { + private static final Logger LOGGER = Bukkit.getLogger(); private final transient IEssentials ess; private final transient SpawnStorage spawns; - private static final Logger LOGGER = Bukkit.getLogger(); public EssentialsSpawnPlayerListener(final IEssentials ess, final SpawnStorage spawns) { |