diff options
198 files changed, 1212 insertions, 1061 deletions
diff --git a/Essentials/nb-configuration.xml b/Essentials/nb-configuration.xml index ee640467a..3486bc9d7 100644 --- a/Essentials/nb-configuration.xml +++ b/Essentials/nb-configuration.xml @@ -1,18 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> <project-shared-configuration> - <!-- - This file contains additional configuration written by modules in the NetBeans IDE. - The configuration is intended to be shared among all the users of project and - therefore it is assumed to be part of version control checkout. - Without this configuration present, some functionality in the IDE may be limited or fail altogether. - --> - <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> <!-- - Properties that influence various parts of the IDE, especially code formatting and the like. - You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. - That way multiple projects can share the same settings (useful for formatting rules for example). - Any value defined here will override the pom.xml file value but is only applicable to the current project. - --> - <netbeans.compile.on.save>all</netbeans.compile.on.save> - </properties> +This file contains additional configuration written by modules in the NetBeans IDE. +The configuration is intended to be shared among all the users of project and +therefore it is assumed to be part of version control checkout. +Without this configuration present, some functionality in the IDE may be limited or fail altogether. +--> + <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> + <!-- +Properties that influence various parts of the IDE, especially code formatting and the like. +You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. +That way multiple projects can share the same settings (useful for formatting rules for example). +Any value defined here will override the pom.xml file value but is only applicable to the current project. +--> + <netbeans.compile.on.save>all</netbeans.compile.on.save> + </properties> </project-shared-configuration> diff --git a/Essentials/pom.xml b/Essentials/pom.xml index 50dd95bc0..e98a39882 100644 --- a/Essentials/pom.xml +++ b/Essentials/pom.xml @@ -1,108 +1,108 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> + <parent> + <groupId>net.essentials3</groupId> + <artifactId>BuildAll</artifactId> + <version>3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <artifactId>Essentials</artifactId> - <dependencies> - <!-- Internal Depends --> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>EssentialsGroupManager</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <version>0.11.6</version> - </dependency> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>2.4</version> - </dependency> - <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-compress</artifactId> - <version>1.4.1</version> - </dependency> - <!-- Test Depends --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.10</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <version>1.9.5</version> - <scope>test</scope> - </dependency> - <!-- External Plugin Depends --> - <dependency> - <groupId>cosine</groupId> - <artifactId>BOSEconomy</artifactId> - <version>0.7</version> - </dependency> - <dependency> - <groupId>com.iConomy</groupId> - <artifactId>iConomy</artifactId> - <version>5.0</version> - </dependency> - <dependency> - <groupId>com.iCo6</groupId> - <artifactId>iConomy</artifactId> - <version>6.0</version> - </dependency> - <dependency> - <groupId>me.ashtheking</groupId> - <artifactId>MultiCurrency</artifactId> - <version>0.05</version> - </dependency> - <dependency> - <groupId>net.milkbowl</groupId> - <artifactId>Vault</artifactId> - <version>1.2</version> - </dependency> - </dependencies> + <artifactId>Essentials</artifactId> + <dependencies> + <!-- Internal Depends --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>EssentialsGroupManager</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>0.11.6</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.4</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + <version>1.4.1</version> + </dependency> + <!-- Test Depends --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.10</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>1.9.5</version> + <scope>test</scope> + </dependency> + <!-- External Plugin Depends --> + <dependency> + <groupId>cosine</groupId> + <artifactId>BOSEconomy</artifactId> + <version>0.7</version> + </dependency> + <dependency> + <groupId>com.iConomy</groupId> + <artifactId>iConomy</artifactId> + <version>5.0</version> + </dependency> + <dependency> + <groupId>com.iCo6</groupId> + <artifactId>iConomy</artifactId> + <version>6.0</version> + </dependency> + <dependency> + <groupId>me.ashtheking</groupId> + <artifactId>MultiCurrency</artifactId> + <version>0.05</version> + </dependency> + <dependency> + <groupId>net.milkbowl</groupId> + <artifactId>Vault</artifactId> + <version>1.2</version> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>2.0</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <artifactSet> - <includes> - <include>commons-io:*</include> - <include>org.apache.commons:*</include> - </includes> - </artifactSet> - <minimizeJar>true</minimizeJar> - <relocations> - <relocation> - <pattern>org.apache.commons</pattern> - <shadedPattern>net.ess3.commons</shadedPattern> - </relocation> - </relocations> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>2.0</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <artifactSet> + <includes> + <include>commons-io:*</include> + <include>org.apache.commons:*</include> + </includes> + </artifactSet> + <minimizeJar>true</minimizeJar> + <relocations> + <relocation> + <pattern>org.apache.commons</pattern> + <shadedPattern>net.ess3.commons</shadedPattern> + </relocation> + </relocations> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> diff --git a/Essentials/src/net/ess3/Essentials.java b/Essentials/src/net/ess3/Essentials.java index c1c506a9b..3bbe79411 100644 --- a/Essentials/src/net/ess3/Essentials.java +++ b/Essentials/src/net/ess3/Essentials.java @@ -49,34 +49,34 @@ import org.bukkit.plugin.InvalidDescriptionException; public class Essentials implements IEssentials { @Getter - private ISettings settings; + private transient ISettings settings; @Getter - private IJails jails; + private transient IJails jails; @Getter - private IKits kits; + private transient IKits kits; @Getter - private IWarps warps; + private transient IWarps warps; @Getter - private IWorth worth; + private transient IWorth worth; @Getter - private IBackup backup; + private transient IBackup backup; @Getter - private IItemDb itemDb; + private transient IItemDb itemDb; @Getter @Setter - private IRanks ranks; + private transient IRanks ranks; @Getter - private SpawnsHolder spawns; + private transient SpawnsHolder spawns; @Getter - private final Methods paymentMethod = new Methods(); + private transient final Methods paymentMethod = new Methods(); @Getter - private IUserMap userMap; + private transient IUserMap userMap; @Getter private final I18n i18n; @Getter - private ICommandHandler commandHandler; + private transient ICommandHandler commandHandler; @Getter - private Economy economy; + private transient Economy economy; @Getter private final Server server; @Getter @@ -85,16 +85,16 @@ public class Essentials implements IEssentials private final IPlugin plugin; @Getter @Setter - private Metrics metrics; + private transient Metrics metrics; @Getter - private EssentialsTimer timer; + private transient EssentialsTimer timer; @Getter - private List<String> vanishedPlayers = new ArrayList<String>(); + private transient List<String> vanishedPlayers = new ArrayList<String>(); @Getter - private final StorageQueue storageQueue; - private ExecuteTimer execTimer; + private final transient StorageQueue storageQueue; + private transient ExecuteTimer execTimer; public static boolean testing; - private List<IReload> reloadList; + private transient List<IReload> reloadList; public Essentials(final Server server, final Logger logger, final IPlugin plugin) { diff --git a/Essentials/src/net/ess3/EssentialsTimer.java b/Essentials/src/net/ess3/EssentialsTimer.java index 58599f840..0bd902b17 100644 --- a/Essentials/src/net/ess3/EssentialsTimer.java +++ b/Essentials/src/net/ess3/EssentialsTimer.java @@ -12,10 +12,10 @@ import org.bukkit.entity.Player; public class EssentialsTimer implements Runnable { - private final IEssentials ess; - private final Set<IUser> onlineUsers = new HashSet<IUser>(); - private long lastPoll = System.currentTimeMillis(); - private final LinkedList<Float> history = new LinkedList<Float>(); + private final transient IEssentials ess; + private final transient Set<IUser> onlineUsers = new HashSet<IUser>(); + private transient long lastPoll = System.currentTimeMillis(); + private final transient LinkedList<Float> history = new LinkedList<Float>(); EssentialsTimer(final IEssentials ess) { diff --git a/Essentials/src/net/ess3/I18n.java b/Essentials/src/net/ess3/I18n.java index 5f1c522cd..8f31963eb 100644 --- a/Essentials/src/net/ess3/I18n.java +++ b/Essentials/src/net/ess3/I18n.java @@ -19,13 +19,13 @@ public class I18n implements II18n { private static I18n instance; private static final String MESSAGES = "messages"; - private final Locale defaultLocale = Locale.getDefault(); - private Locale currentLocale = defaultLocale; - private ResourceBundle customBundle; - private ResourceBundle localeBundle; - private final ResourceBundle defaultBundle; - private final Map<String, MessageFormat> messageFormatCache = new HashMap<String, MessageFormat>(); - private final IEssentials ess; + private final transient Locale defaultLocale = Locale.getDefault(); + private transient Locale currentLocale = defaultLocale; + private transient ResourceBundle customBundle; + private transient ResourceBundle localeBundle; + private final transient ResourceBundle defaultBundle; + private final transient Map<String, MessageFormat> messageFormatCache = new HashMap<String, MessageFormat>(); + private final transient IEssentials ess; public I18n(final IEssentials ess) { @@ -100,6 +100,7 @@ public class I18n implements II18n } return messageFormat.format(objects); } + private final Pattern partSplit = Pattern.compile("[_\\.]"); public void updateLocale(final String loc) @@ -135,7 +136,7 @@ public class I18n implements II18n private static class FileResClassLoader extends ClassLoader { - private final File dataFolder; + private final transient File dataFolder; public FileResClassLoader(final ClassLoader classLoader, final IEssentials ess) { diff --git a/Essentials/src/net/ess3/ItemDb.java b/Essentials/src/net/ess3/ItemDb.java index 15d32a6e6..7e7ca0ede 100644 --- a/Essentials/src/net/ess3/ItemDb.java +++ b/Essentials/src/net/ess3/ItemDb.java @@ -19,15 +19,16 @@ import org.bukkit.inventory.ItemStack; public class ItemDb implements IItemDb { - private final IEssentials ess; + private final transient IEssentials ess; public ItemDb(final IEssentials ess) { this.ess = ess; file = new ManagedFile("items.csv", ess); } - private final Map<String, Long> items = new HashMap<String, Long>(); - private final ManagedFile file; + + private final transient Map<String, Long> items = new HashMap<String, Long>(); + private final transient ManagedFile file; private static final Pattern SPLIT = Pattern.compile("[^a-zA-Z0-9]"); @Override @@ -94,6 +95,7 @@ public class ItemDb implements IItemDb retval.setAmount(quantity); return retval; } + private final Pattern idMatch = Pattern.compile("^\\d+[:+',;.]\\d+$"); private final Pattern metaSplit = Pattern.compile("[:+',;.]"); private final Pattern conjoined = Pattern.compile("^[^:+',;.]+[:+',;.]\\d+$"); diff --git a/Essentials/src/net/ess3/Jails.java b/Essentials/src/net/ess3/Jails.java index f191edd81..0affe3fca 100644 --- a/Essentials/src/net/ess3/Jails.java +++ b/Essentials/src/net/ess3/Jails.java @@ -30,7 +30,7 @@ import org.bukkit.plugin.PluginManager; public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> implements IJails { - private static final Logger LOGGER = Bukkit.getLogger(); + private static final transient Logger LOGGER = Bukkit.getLogger(); public Jails(final IEssentials ess) { @@ -110,9 +110,9 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp throw new UnsupportedOperationException("Not supported yet."); } - private class JailBlockListener implements Listener { + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockBreak(final BlockBreakEvent event) { diff --git a/Essentials/src/net/ess3/SpawnMob.java b/Essentials/src/net/ess3/SpawnMob.java index 0b22569ca..47cd07049 100644 --- a/Essentials/src/net/ess3/SpawnMob.java +++ b/Essentials/src/net/ess3/SpawnMob.java @@ -25,8 +25,8 @@ import org.bukkit.material.Colorable; public class SpawnMob { - private static Pattern colon = Pattern.compile(":"); - private static Pattern comma = Pattern.compile(","); + private static transient Pattern colon = Pattern.compile(":"); + private static transient Pattern comma = Pattern.compile(","); public static String mobList(final IUser user) throws NotEnoughArgumentsException { diff --git a/Essentials/src/net/ess3/Teleport.java b/Essentials/src/net/ess3/Teleport.java index 81afaf97f..b97b1f58d 100644 --- a/Essentials/src/net/ess3/Teleport.java +++ b/Essentials/src/net/ess3/Teleport.java @@ -21,6 +21,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Teleport implements Runnable, ITeleport { private static final double MOVE_CONSTANT = 0.3; + private IUser user; private IUser teleportUser; private int teleTimer = -1; @@ -74,9 +75,9 @@ public class Teleport implements Runnable, ITeleport } if (!Permissions.TELEPORT_TIMER_MOVE.isAuthorized(user) && (Math.round( - teleportUser.getPlayer().getLocation().getX() * MOVE_CONSTANT) != initX || Math.round( - teleportUser.getPlayer().getLocation().getY() * MOVE_CONSTANT) != initY || Math.round( - teleportUser.getPlayer().getLocation().getZ() * MOVE_CONSTANT) != initZ || teleportUser.getPlayer().getHealth() < health)) + teleportUser.getPlayer().getLocation().getX() * MOVE_CONSTANT) != initX || Math.round( + teleportUser.getPlayer().getLocation().getY() * MOVE_CONSTANT) != initY || Math.round( + teleportUser.getPlayer().getLocation().getZ() * MOVE_CONSTANT) != initZ || teleportUser.getPlayer().getHealth() < health)) { // user moved, cancel teleport cancel(true); return; @@ -122,6 +123,7 @@ public class Teleport implements Runnable, ITeleport this.ess = ess; } + public void cooldown(boolean check) throws Exception { try @@ -231,6 +233,7 @@ public class Teleport implements Runnable, ITeleport now(new Target(loc), cause); } + @Override //The now function is used when you want to skip tp delay when teleporting someone to a location or player. public void now(Entity entity, boolean cooldown, TeleportCause cause) throws Exception diff --git a/Essentials/src/net/ess3/api/Economy.java b/Essentials/src/net/ess3/api/Economy.java index 19c2d8451..046c6e1f6 100644 --- a/Essentials/src/net/ess3/api/Economy.java +++ b/Essentials/src/net/ess3/api/Economy.java @@ -4,13 +4,15 @@ import net.ess3.utils.FormatUtil; /** - * Instead of using this api directly, we recommend to use the register plugin: http://bit.ly/RegisterMethod + * Instead of using this api directly, we recommend to use the register plugin: + * http://bit.ly/RegisterMethod */ public final class Economy { private Economy() { } + private static IEssentials ess; private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded."; @@ -33,10 +35,10 @@ public final class Economy /** * Sets the balance of a user * - * @param name Name of the user + * @param name Name of the user * @param balance The balance you want to set * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException { @@ -50,10 +52,10 @@ public final class Economy /** * Adds money to the balance of a user * - * @param name Name of the user + * @param name Name of the user * @param amount The money you want to add * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException { @@ -64,10 +66,10 @@ public final class Economy /** * Substracts money from the balance of a user * - * @param name Name of the user + * @param name Name of the user * @param amount The money you want to substract * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException { @@ -78,10 +80,10 @@ public final class Economy /** * Divides the balance of a user by a value * - * @param name Name of the user + * @param name Name of the user * @param value The balance is divided by this value * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException { @@ -92,10 +94,10 @@ public final class Economy /** * Multiplies the balance of a user by a value * - * @param name Name of the user + * @param name Name of the user * @param value The balance is multiplied by this value * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException { @@ -108,7 +110,7 @@ public final class Economy * * @param name Name of the user * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException { @@ -120,7 +122,7 @@ public final class Economy } /** - * @param name Name of the user + * @param name Name of the user * @param amount The amount of money the user should have * @return true, if the user has more or an equal amount of money * @throws UserDoesNotExistException If a user by that name does not exists @@ -131,7 +133,7 @@ public final class Economy } /** - * @param name Name of the user + * @param name Name of the user * @param amount The amount of money the user should have * @return true, if the user has more money * @throws UserDoesNotExistException If a user by that name does not exists @@ -142,7 +144,7 @@ public final class Economy } /** - * @param name Name of the user + * @param name Name of the user * @param amount The amount of money the user should not have * @return true, if the user has less money * @throws UserDoesNotExistException If a user by that name does not exists @@ -165,7 +167,8 @@ public final class Economy } /** - * Formats the amount of money like all other Essentials functions. Example: $100000 or $12345.67 + * Formats the amount of money like all other Essentials functions. + * Example: $100000 or $12345.67 * * @param amount The amount of money * @return Formatted money diff --git a/Essentials/src/net/ess3/api/IComponent.java b/Essentials/src/net/ess3/api/IComponent.java index bc30f8c37..5cdee2b16 100644 --- a/Essentials/src/net/ess3/api/IComponent.java +++ b/Essentials/src/net/ess3/api/IComponent.java @@ -1,6 +1,5 @@ package net.ess3.api; - public interface IComponent extends IReload { /** diff --git a/Essentials/src/net/ess3/api/IEssentials.java b/Essentials/src/net/ess3/api/IEssentials.java index 226448f24..68d975b57 100644 --- a/Essentials/src/net/ess3/api/IEssentials.java +++ b/Essentials/src/net/ess3/api/IEssentials.java @@ -66,4 +66,5 @@ public interface IEssentials extends IComponent SpawnsHolder getSpawns(); StorageQueue getStorageQueue(); + } diff --git a/Essentials/src/net/ess3/api/IPlugin.java b/Essentials/src/net/ess3/api/IPlugin.java index 18da574b4..8348c9490 100644 --- a/Essentials/src/net/ess3/api/IPlugin.java +++ b/Essentials/src/net/ess3/api/IPlugin.java @@ -9,6 +9,7 @@ import org.bukkit.scheduler.BukkitTask; public interface IPlugin extends Plugin { + /** * Get an instance of essentials * @@ -35,7 +36,7 @@ public interface IPlugin extends Plugin /** * Call an a-sync task to be run with a given delay * - * @param run - Code to be run + * @param run - Code to be run * @param delay - Long that represents how long to wait * @return - BukkitTask for the task created */ @@ -44,7 +45,7 @@ public interface IPlugin extends Plugin /** * Schedule a sync (ran in main thread) delayed task * - * @param run - Code to run + * @param run - Code to run * @param delay - Long that represents how long to wait * @return - Integer of the task ID */ @@ -53,8 +54,8 @@ public interface IPlugin extends Plugin /** * Schedule a sync (in the main thread) repeating task * - * @param run - Code to run - * @param delay - Delay for the first run + * @param run - Code to run + * @param delay - Delay for the first run * @param period - Time to wait between every run after the first * @return - int of the task ID */ @@ -63,8 +64,8 @@ public interface IPlugin extends Plugin /** * Schedule an a-sync repeating task * - * @param run - Code to run - * @param delay - Delay for the first run + * @param run - Code to run + * @param delay - Delay for the first run * @param period - Time to wait between every run after the first * @return - int of the task ID */ @@ -104,8 +105,8 @@ public interface IPlugin extends Plugin /** * Call a re-spawn event on a player * - * @param player - Player to re-spawn - * @param loc - Location to send + * @param player - Player to re-spawn + * @param loc - Location to send * @param bedSpawn - do you use bed? * @return - Location after event called */ @@ -136,4 +137,5 @@ public interface IPlugin extends Plugin * @param module - Your plugin instance */ void registerModule(Plugin module); + } diff --git a/Essentials/src/net/ess3/api/ITeleport.java b/Essentials/src/net/ess3/api/ITeleport.java index 3971cb1d7..a88b72071 100644 --- a/Essentials/src/net/ess3/api/ITeleport.java +++ b/Essentials/src/net/ess3/api/ITeleport.java @@ -12,9 +12,9 @@ public interface ITeleport /** * Teleport to a location now * - * @param loc - location to send to + * @param loc - location to send to * @param cooldown - To check cooldown - * @param cause - Why was the send caused? Use a {@link TeleportCause} + * @param cause - Why was the send caused? Use a {@link TeleportCause} * @throws Exception */ void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception; diff --git a/Essentials/src/net/ess3/api/IWarps.java b/Essentials/src/net/ess3/api/IWarps.java index fa5d64ece..48bc6cd61 100644 --- a/Essentials/src/net/ess3/api/IWarps.java +++ b/Essentials/src/net/ess3/api/IWarps.java @@ -35,7 +35,7 @@ public interface IWarps extends IReload * Set a warp * * @param name - Name of warp - * @param loc - Location of warp + * @param loc - Location of warp * @throws Exception */ void setWarp(String name, Location loc) throws Exception; diff --git a/Essentials/src/net/ess3/api/IWorth.java b/Essentials/src/net/ess3/api/IWorth.java index 23065ab60..1cec6b6f1 100644 --- a/Essentials/src/net/ess3/api/IWorth.java +++ b/Essentials/src/net/ess3/api/IWorth.java @@ -17,7 +17,7 @@ public interface IWorth extends IReload * Set the price of an ItemStack * * @param itemStack - ItemStack to set price for - * @param price - Price to set on item + * @param price - Price to set on item */ void setPrice(ItemStack itemStack, double price); } diff --git a/Essentials/src/net/ess3/backup/Backup.java b/Essentials/src/net/ess3/backup/Backup.java index 8575525f4..bbff922cc 100644 --- a/Essentials/src/net/ess3/backup/Backup.java +++ b/Essentials/src/net/ess3/backup/Backup.java @@ -15,11 +15,11 @@ import org.bukkit.command.CommandSender; public class Backup implements Runnable, IBackup { - private final Server server; - private final IEssentials ess; - private final AtomicBoolean running = new AtomicBoolean(false); - private int taskId = -1; - private final AtomicBoolean active = new AtomicBoolean(false); + private transient final Server server; + private transient final IEssentials ess; + private transient final AtomicBoolean running = new AtomicBoolean(false); + private transient int taskId = -1; + private transient final AtomicBoolean active = new AtomicBoolean(false); public Backup(final IEssentials ess) { @@ -60,10 +60,10 @@ public class Backup implements Runnable, IBackup final net.ess3.settings.Backup backupSettings = settings.getData().getGeneral().getBackup(); String backupCommand = backupSettings.getCommand() == null || backupSettings.getCommand().isEmpty() ? ("NORUN") : backupSettings.getCommand(); - + /*if (backupCommand.equals("NORUN")) { TODO: Un-comment if you do not want commands to be run if there is no backup command - return; - }*/ + return; + }*/ ess.getLogger().log(Level.INFO, _("backupStarted")); @@ -82,7 +82,7 @@ public class Backup implements Runnable, IBackup private class BackupRunner implements Runnable { - private final String command; + private final transient String command; public BackupRunner(final String command) { diff --git a/Essentials/src/net/ess3/bukkit/Enchantments.java b/Essentials/src/net/ess3/bukkit/Enchantments.java index 2e54e7caf..e76adc8b5 100644 --- a/Essentials/src/net/ess3/bukkit/Enchantments.java +++ b/Essentials/src/net/ess3/bukkit/Enchantments.java @@ -11,9 +11,11 @@ import org.bukkit.enchantments.Enchantment; public final class Enchantments { + private Enchantments() { } + private static final Map<String, Enchantment> ENCHANTMENTS = new HashMap<String, Enchantment>(); static diff --git a/Essentials/src/net/ess3/bukkit/LivingEntities.java b/Essentials/src/net/ess3/bukkit/LivingEntities.java index 7057eb399..c51285973 100644 --- a/Essentials/src/net/ess3/bukkit/LivingEntities.java +++ b/Essentials/src/net/ess3/bukkit/LivingEntities.java @@ -8,6 +8,7 @@ import org.bukkit.entity.EntityType; public class LivingEntities { final private static Map<String, EntityType> entities = new HashMap<String, EntityType>(); + final private static EnumMap<EntityType, String> entityI18n = new EnumMap<EntityType, String>(EntityType.class); final private static EnumMap<EntityType, String> entityI18nPlural = new EnumMap<EntityType, String>(EntityType.class); @@ -40,9 +41,9 @@ public class LivingEntities return count == 1 ? _(entityI18n.get(type)) : _(entityI18nPlural.get(type)); } - public static class MobException extends Exception { private static final long serialVersionUID = 1L; } + } diff --git a/Essentials/src/net/ess3/commands/Commandbalancetop.java b/Essentials/src/net/ess3/commands/Commandbalancetop.java index 874945cfb..1d4201224 100644 --- a/Essentials/src/net/ess3/commands/Commandbalancetop.java +++ b/Essentials/src/net/ess3/commands/Commandbalancetop.java @@ -109,7 +109,7 @@ public class Commandbalancetop extends EssentialsCommand private class Calculator implements Runnable { - private final Viewer viewer; + private final transient Viewer viewer; private final boolean force; public Calculator(final Viewer viewer, final boolean force) @@ -176,9 +176,9 @@ public class Commandbalancetop extends EssentialsCommand private class Viewer implements Runnable { - private final CommandSender sender; - private final int page; - private final boolean force; + private final transient CommandSender sender; + private final transient int page; + private final transient boolean force; public Viewer(final CommandSender sender, final int page, final boolean force) { diff --git a/Essentials/src/net/ess3/commands/Commandbigtree.java b/Essentials/src/net/ess3/commands/Commandbigtree.java index edf6eebff..7d2b4e069 100644 --- a/Essentials/src/net/ess3/commands/Commandbigtree.java +++ b/Essentials/src/net/ess3/commands/Commandbigtree.java @@ -10,13 +10,13 @@ import org.bukkit.TreeType; public class Commandbigtree extends EssentialsCommand { - private static enum BigTree - { + private static enum BigTree { REDWOOD(TreeType.TALL_REDWOOD), TREE(TreeType.BIG_TREE), JUNGLE(TreeType.JUNGLE); - private final TreeType bukkitType; + private final TreeType bukkitType; + private BigTree(final TreeType bukkitType) { this.bukkitType = bukkitType; @@ -27,8 +27,9 @@ public class Commandbigtree extends EssentialsCommand return bukkitType; } } + private final static EnumConverter<BigTree> BIGTREE_PARSER = EnumConverter.getInstance(BigTree.class); - + @Override public void run(final IUser user, final String commandLabel, final String[] args) throws Exception { diff --git a/Essentials/src/net/ess3/commands/Commanddelhome.java b/Essentials/src/net/ess3/commands/Commanddelhome.java index c32c390d4..133db6769 100644 --- a/Essentials/src/net/ess3/commands/Commanddelhome.java +++ b/Essentials/src/net/ess3/commands/Commanddelhome.java @@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender; public class Commanddelhome extends EssentialsCommand { - private final Pattern colon = Pattern.compile(":"); + private final transient Pattern colon = Pattern.compile(":"); @Override protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception diff --git a/Essentials/src/net/ess3/commands/Commandenderchest.java b/Essentials/src/net/ess3/commands/Commandenderchest.java index 85efb75f2..31d011597 100644 --- a/Essentials/src/net/ess3/commands/Commandenderchest.java +++ b/Essentials/src/net/ess3/commands/Commandenderchest.java @@ -7,6 +7,7 @@ import org.bukkit.entity.Player; public class Commandenderchest extends EssentialsCommand { + @Override protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception { diff --git a/Essentials/src/net/ess3/commands/Commandessentials.java b/Essentials/src/net/ess3/commands/Commandessentials.java index 0ed491850..405a3c3d1 100644 --- a/Essentials/src/net/ess3/commands/Commandessentials.java +++ b/Essentials/src/net/ess3/commands/Commandessentials.java @@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender; public class Commandessentials extends EssentialsCommand { - private int taskid; // TODO: Needed? + private transient int taskid; // TODO: Needed? @Override protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception diff --git a/Essentials/src/net/ess3/commands/Commandfireball.java b/Essentials/src/net/ess3/commands/Commandfireball.java index 2cc263c0f..e82379086 100644 --- a/Essentials/src/net/ess3/commands/Commandfireball.java +++ b/Essentials/src/net/ess3/commands/Commandfireball.java @@ -13,31 +13,31 @@ public class Commandfireball extends EssentialsCommand Class<? extends Entity> clazz = Fireball.class; if (args.length > 0) { - if (args[0].equalsIgnoreCase("small")) + if(args[0].equalsIgnoreCase("small")) { clazz = SmallFireball.class; } - else if (args[0].equalsIgnoreCase("arrow")) + else if(args[0].equalsIgnoreCase("arrow")) { clazz = Arrow.class; } - else if (args[0].equalsIgnoreCase("skull")) + else if(args[0].equalsIgnoreCase("skull")) { clazz = WitherSkull.class; } - else if (args[0].equalsIgnoreCase("egg")) + else if(args[0].equalsIgnoreCase("egg")) { clazz = Egg.class; } - else if (args[0].equalsIgnoreCase("snowball")) + else if(args[0].equalsIgnoreCase("snowball")) { clazz = Snowball.class; } - else if (args[0].equalsIgnoreCase("expbottle")) + else if(args[0].equalsIgnoreCase("expbottle")) { clazz = ThrownExpBottle.class; } - else if (args[0].equalsIgnoreCase("large")) + else if(args[0].equalsIgnoreCase("large")) { clazz = LargeFireball.class; } diff --git a/Essentials/src/net/ess3/commands/Commandgamemode.java b/Essentials/src/net/ess3/commands/Commandgamemode.java index e5fed21c0..96eb7ae1f 100644 --- a/Essentials/src/net/ess3/commands/Commandgamemode.java +++ b/Essentials/src/net/ess3/commands/Commandgamemode.java @@ -10,6 +10,7 @@ import org.bukkit.command.CommandSender; public class Commandgamemode extends EssentialsSettingsCommand { + protected void setValue(final IUser player, GameMode value) { if (value == null) @@ -123,4 +124,5 @@ public class Commandgamemode extends EssentialsSettingsCommand } return mode; } + } diff --git a/Essentials/src/net/ess3/commands/Commandgive.java b/Essentials/src/net/ess3/commands/Commandgive.java index ce03e0930..d102becfa 100644 --- a/Essentials/src/net/ess3/commands/Commandgive.java +++ b/Essentials/src/net/ess3/commands/Commandgive.java @@ -13,7 +13,7 @@ import org.bukkit.inventory.ItemStack; public class Commandgive extends EssentialsCommand { - private final Pattern data = Pattern.compile("[:+',;.]"); + private final transient Pattern data = Pattern.compile("[:+',;.]"); @Override protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception diff --git a/Essentials/src/net/ess3/commands/Commandhome.java b/Essentials/src/net/ess3/commands/Commandhome.java index 7f74e1287..5781b5124 100644 --- a/Essentials/src/net/ess3/commands/Commandhome.java +++ b/Essentials/src/net/ess3/commands/Commandhome.java @@ -15,7 +15,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Commandhome extends EssentialsCommand { - private final Pattern colon = Pattern.compile(":"); + private final transient Pattern colon = Pattern.compile(":"); @Override public void run(final IUser user, final String commandLabel, final String[] args) throws Exception diff --git a/Essentials/src/net/ess3/commands/Commanditem.java b/Essentials/src/net/ess3/commands/Commanditem.java index df34d7eca..416bed766 100644 --- a/Essentials/src/net/ess3/commands/Commanditem.java +++ b/Essentials/src/net/ess3/commands/Commanditem.java @@ -11,7 +11,7 @@ import org.bukkit.inventory.ItemStack; public class Commanditem extends EssentialsCommand { - private final Pattern data = Pattern.compile("[:+',;.]"); + private final transient Pattern data = Pattern.compile("[:+',;.]"); @Override public void run(final IUser user, final String commandLabel, final String[] args) throws Exception diff --git a/Essentials/src/net/ess3/commands/Commandmore.java b/Essentials/src/net/ess3/commands/Commandmore.java index 971b48dc8..3c4edf7ea 100644 --- a/Essentials/src/net/ess3/commands/Commandmore.java +++ b/Essentials/src/net/ess3/commands/Commandmore.java @@ -24,9 +24,8 @@ public class Commandmore extends EssentialsCommand } else { - stacks = new ItemStack[] - { - player.getItemInHand() + stacks = new ItemStack[]{ + player.getItemInHand() }; } for (ItemStack stack : stacks) diff --git a/Essentials/src/net/ess3/commands/Commandmute.java b/Essentials/src/net/ess3/commands/Commandmute.java index 6c46d98c7..7b7d232ed 100644 --- a/Essentials/src/net/ess3/commands/Commandmute.java +++ b/Essentials/src/net/ess3/commands/Commandmute.java @@ -39,8 +39,8 @@ public class Commandmute extends EssentialsCommand final boolean muted = player.getData().isMuted(); sender.sendMessage( muted ? (muteTimestamp > 0 ? _("mutedPlayerFor", player.getPlayer().getDisplayName(), DateUtil.formatDateDiff(muteTimestamp)) : _( - "mutedPlayer", player.getPlayer().getDisplayName())) : _( - "unmutedPlayer", player.getPlayer().getDisplayName())); + "mutedPlayer", player.getPlayer().getDisplayName())) : _( + "unmutedPlayer", player.getPlayer().getDisplayName())); player.sendMessage( muted ? (muteTimestamp > 0 ? _("playerMutedFor", DateUtil.formatDateDiff(muteTimestamp)) : _("playerMuted")) : _("playerUnmuted")); } diff --git a/Essentials/src/net/ess3/commands/Commandrecipe.java b/Essentials/src/net/ess3/commands/Commandrecipe.java index 836680707..69f586114 100644 --- a/Essentials/src/net/ess3/commands/Commandrecipe.java +++ b/Essentials/src/net/ess3/commands/Commandrecipe.java @@ -14,6 +14,7 @@ import org.bukkit.inventory.*; public class Commandrecipe extends EssentialsCommand { + @Override public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { @@ -88,7 +89,7 @@ public class Commandrecipe extends EssentialsCommand for (int k = 0; k < recipe.getShape()[j].length(); k++) { final ItemStack item = recipe.getIngredientMap().get(recipe.getShape()[j].toCharArray()[k]); - if (item == null) + if(item == null) { continue; } diff --git a/Essentials/src/net/ess3/commands/Commandseen.java b/Essentials/src/net/ess3/commands/Commandseen.java index 464c323ec..2851b42be 100644 --- a/Essentials/src/net/ess3/commands/Commandseen.java +++ b/Essentials/src/net/ess3/commands/Commandseen.java @@ -34,21 +34,21 @@ public class Commandseen extends EssentialsCommand final IUser u = ess.getUserMap().matchUserExcludingHidden(args[0], getPlayerOrNull(sender)); u.setDisplayNick(); sender.sendMessage(_("seenOnline", u.getPlayer().getDisplayName(), DateUtil.formatDateDiff(u.getTimestamp(TimestampType.LOGIN)))); - if (u.getData().isAfk()) + if(u.getData().isAfk()) { sender.sendMessage(_("whoisAFK", _("true"))); } - if (u.getData().isJailed()) + if(u.getData().isJailed()) { sender.sendMessage(_("whoisJail", u.getTimestamp(TimestampType.JAIL) > 0 - ? DateUtil.formatDateDiff(u.getTimestamp(TimestampType.JAIL)) - : _("true"))); + ? DateUtil.formatDateDiff(u.getTimestamp(TimestampType.JAIL)) + : _("true"))); } - if (u.getData().isMuted()) + if(u.getData().isMuted()) { sender.sendMessage(_("whoisMuted", u.getTimestamp(TimestampType.MUTE) > 0 - ? DateUtil.formatDateDiff(u.getTimestamp(TimestampType.MUTE)) - : _("true"))); + ? DateUtil.formatDateDiff(u.getTimestamp(TimestampType.MUTE)) + : _("true"))); } } catch (PlayerNotFoundException e) diff --git a/Essentials/src/net/ess3/commands/Commandsell.java b/Essentials/src/net/ess3/commands/Commandsell.java index 1a239ed0c..dde03f8d7 100644 --- a/Essentials/src/net/ess3/commands/Commandsell.java +++ b/Essentials/src/net/ess3/commands/Commandsell.java @@ -148,8 +148,8 @@ public class Commandsell extends EssentialsCommand user.giveMoney(worth * amount); user.sendMessage( _( - "itemSold", FormatUtil.displayCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), - FormatUtil.displayCurrency(worth, ess))); + "itemSold", FormatUtil.displayCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), + FormatUtil.displayCurrency(worth, ess))); logger.log( Level.INFO, _( "itemSoldConsole", player.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), diff --git a/Essentials/src/net/ess3/commands/Commandsethome.java b/Essentials/src/net/ess3/commands/Commandsethome.java index 700d84dc9..d4eb74df3 100644 --- a/Essentials/src/net/ess3/commands/Commandsethome.java +++ b/Essentials/src/net/ess3/commands/Commandsethome.java @@ -9,7 +9,7 @@ import net.ess3.permissions.Permissions; public class Commandsethome extends EssentialsCommand { - private final Pattern colon = Pattern.compile(":"); + private final transient Pattern colon = Pattern.compile(":"); @Override public void run(final IUser user, final String commandLabel, String[] args) throws Exception @@ -78,8 +78,8 @@ public class Commandsethome extends EssentialsCommand } user.sendMessage( _( - "homeSet", user.getPlayer().getLocation().getWorld().getName(), user.getPlayer().getLocation().getBlockX(), - user.getPlayer().getLocation().getBlockY(), user.getPlayer().getLocation().getBlockZ())); + "homeSet", user.getPlayer().getLocation().getWorld().getName(), user.getPlayer().getLocation().getBlockX(), + user.getPlayer().getLocation().getBlockY(), user.getPlayer().getLocation().getBlockZ())); } } diff --git a/Essentials/src/net/ess3/commands/Commandsetwarp.java b/Essentials/src/net/ess3/commands/Commandsetwarp.java index 0c890aeb6..401aa8ca9 100644 --- a/Essentials/src/net/ess3/commands/Commandsetwarp.java +++ b/Essentials/src/net/ess3/commands/Commandsetwarp.java @@ -36,6 +36,7 @@ public class Commandsetwarp extends EssentialsCommand } if (warpLoc == null || Permissions.WARP_OVERWRITE.isAuthorized(user, args[0])) + { warps.setWarp(args[0], loc); } diff --git a/Essentials/src/net/ess3/commands/Commandsocialspy.java b/Essentials/src/net/ess3/commands/Commandsocialspy.java index 9dbe96f8a..765d7668f 100644 --- a/Essentials/src/net/ess3/commands/Commandsocialspy.java +++ b/Essentials/src/net/ess3/commands/Commandsocialspy.java @@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender; public class Commandsocialspy extends EssentialsToggleCommand { + @Override protected void setValue(final IUser player, final boolean value) { diff --git a/Essentials/src/net/ess3/commands/Commandspawner.java b/Essentials/src/net/ess3/commands/Commandspawner.java index f4f1d7181..74be65774 100644 --- a/Essentials/src/net/ess3/commands/Commandspawner.java +++ b/Essentials/src/net/ess3/commands/Commandspawner.java @@ -46,7 +46,7 @@ public class Commandspawner extends EssentialsCommand throw new Exception(_("unableToSpawnMob")); } int delay = 0; - if (args.length > 1 && Util.isInt(args[1])) + if(args.length > 1 && Util.isInt(args[1])) { delay = Integer.parseInt(args[1]); } diff --git a/Essentials/src/net/ess3/commands/Commandspawnmob.java b/Essentials/src/net/ess3/commands/Commandspawnmob.java index 6e1ae9cd2..a9a410d62 100644 --- a/Essentials/src/net/ess3/commands/Commandspawnmob.java +++ b/Essentials/src/net/ess3/commands/Commandspawnmob.java @@ -7,6 +7,7 @@ import net.ess3.api.IUser; public class Commandspawnmob extends EssentialsCommand { + @Override public void run(final IUser user, final String commandLabel, final String[] args) throws Exception { diff --git a/Essentials/src/net/ess3/commands/Commandspeed.java b/Essentials/src/net/ess3/commands/Commandspeed.java index 7437710bc..c5f3b01fa 100644 --- a/Essentials/src/net/ess3/commands/Commandspeed.java +++ b/Essentials/src/net/ess3/commands/Commandspeed.java @@ -10,6 +10,7 @@ import org.bukkit.entity.Player; public class Commandspeed extends EssentialsCommand { + @Override protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { diff --git a/Essentials/src/net/ess3/commands/Commandtpaccept.java b/Essentials/src/net/ess3/commands/Commandtpaccept.java index 0fff1b983..2acc1b221 100644 --- a/Essentials/src/net/ess3/commands/Commandtpaccept.java +++ b/Essentials/src/net/ess3/commands/Commandtpaccept.java @@ -21,7 +21,7 @@ public class Commandtpaccept extends EssentialsCommand final IUser target = user.getTeleportRequester(); if (target == null || !target.isOnline() || (user.isTpRequestHere() && !Permissions.TPAHERE.isAuthorized( - target)) || (!user.isTpRequestHere() && !Permissions.TPA.isAuthorized(target) && !Permissions.TPAALL.isAuthorized(target))) + target)) || (!user.isTpRequestHere() && !Permissions.TPA.isAuthorized(target) && !Permissions.TPAALL.isAuthorized(target))) { throw new Exception(_("noPendingRequest")); } diff --git a/Essentials/src/net/ess3/commands/Commandtptoggle.java b/Essentials/src/net/ess3/commands/Commandtptoggle.java index 194a40285..7be6506f8 100644 --- a/Essentials/src/net/ess3/commands/Commandtptoggle.java +++ b/Essentials/src/net/ess3/commands/Commandtptoggle.java @@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender; public class Commandtptoggle extends EssentialsToggleCommand { + @Override protected void setValue(final IUser player, final boolean value) { diff --git a/Essentials/src/net/ess3/commands/Commandwhois.java b/Essentials/src/net/ess3/commands/Commandwhois.java index 2fdcfd40f..cb6fa55c4 100644 --- a/Essentials/src/net/ess3/commands/Commandwhois.java +++ b/Essentials/src/net/ess3/commands/Commandwhois.java @@ -61,8 +61,8 @@ public class Commandwhois extends EssentialsCommand sender.sendMessage(_("whoisExp", SetExpFix.getTotalExperience(player), player.getLevel())); sender.sendMessage( _( - "whoisLocation", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), - player.getLocation().getBlockZ())); + "whoisLocation", player.getLocation().getWorld().getName(), player.getLocation().getBlockX(), player.getLocation().getBlockY(), + player.getLocation().getBlockZ())); sender.sendMessage(_("whoisMoney", FormatUtil.displayCurrency(user.getMoney(), ess))); sender.sendMessage(_("whoisIPAddress", player.getAddress().getAddress().toString())); final String location = userData.getGeolocation(); @@ -77,12 +77,12 @@ public class Commandwhois extends EssentialsCommand sender.sendMessage(_("whoisAFK", (userData.isAfk() ? _("true") : _("false")))); sender.sendMessage( _( - "whoisJail", (userData.isJailed() ? user.getTimestamp(UserData.TimestampType.JAIL) > 0 ? DateUtil.formatDateDiff( - user.getTimestamp(UserData.TimestampType.JAIL)) : _("true") : _("false")))); + "whoisJail", (userData.isJailed() ? user.getTimestamp(UserData.TimestampType.JAIL) > 0 ? DateUtil.formatDateDiff( + user.getTimestamp(UserData.TimestampType.JAIL)) : _("true") : _("false")))); sender.sendMessage( _( - "whoisMute", (userData.isMuted() ? user.getTimestamp(UserData.TimestampType.MUTE) > 0 ? DateUtil.formatDateDiff( - user.getTimestamp(UserData.TimestampType.MUTE)) : _("true") : _("false")))); + "whoisMute", (userData.isMuted() ? user.getTimestamp(UserData.TimestampType.MUTE) > 0 ? DateUtil.formatDateDiff( + user.getTimestamp(UserData.TimestampType.MUTE)) : _("true") : _("false")))); if (!foundPlayer) { diff --git a/Essentials/src/net/ess3/commands/Commandworth.java b/Essentials/src/net/ess3/commands/Commandworth.java index c79d757a1..dad600602 100644 --- a/Essentials/src/net/ess3/commands/Commandworth.java +++ b/Essentials/src/net/ess3/commands/Commandworth.java @@ -43,10 +43,10 @@ public class Commandworth extends EssentialsCommand user.sendMessage( iStack.getDurability() != 0 ? _( - "worthMeta", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), iStack.getDurability(), - FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)) : _( - "worth", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), FormatUtil.displayCurrency(worth * amount, ess), - amount, FormatUtil.displayCurrency(worth, ess))); + "worthMeta", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), iStack.getDurability(), + FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)) : _( + "worth", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), FormatUtil.displayCurrency(worth * amount, ess), + amount, FormatUtil.displayCurrency(worth, ess))); } @Override @@ -81,10 +81,10 @@ public class Commandworth extends EssentialsCommand sender.sendMessage( iStack.getDurability() != 0 ? _( - "worthMeta", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), iStack.getDurability(), - FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)) : _( - "worth", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), FormatUtil.displayCurrency(worth * amount, ess), - amount, FormatUtil.displayCurrency(worth, ess))); + "worthMeta", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), iStack.getDurability(), + FormatUtil.displayCurrency(worth * amount, ess), amount, FormatUtil.displayCurrency(worth, ess)) : _( + "worth", iStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), FormatUtil.displayCurrency(worth * amount, ess), + amount, FormatUtil.displayCurrency(worth, ess))); } } diff --git a/Essentials/src/net/ess3/commands/EssentialsCommand.java b/Essentials/src/net/ess3/commands/EssentialsCommand.java index 02e6aff41..42fbd0f3d 100644 --- a/Essentials/src/net/ess3/commands/EssentialsCommand.java +++ b/Essentials/src/net/ess3/commands/EssentialsCommand.java @@ -16,12 +16,12 @@ import org.bukkit.entity.Player; public abstract class EssentialsCommand extends AbstractSuperpermsPermission implements IEssentialsCommand { - protected String commandName; - protected IEssentials ess; - protected IEssentialsModule module; - protected Server server; - protected Logger logger; - private String permission; + protected transient String commandName; + protected transient IEssentials ess; + protected transient IEssentialsModule module; + protected transient Server server; + protected transient Logger logger; + private transient String permission; @Override public void init(final IEssentials ess, final String commandName) diff --git a/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java b/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java index 1a6cc705f..aa9327fda 100644 --- a/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java +++ b/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java @@ -14,15 +14,15 @@ import org.bukkit.plugin.Plugin; public class EssentialsCommandHandler implements ICommandHandler, TabExecutor { - private final ClassLoader classLoader; - private final String commandPath; - private final String permissionPrefix; // TODO: Needed? - private final IEssentialsModule module; - private static final Logger LOGGER = Bukkit.getLogger(); - private final Map<String, List<PluginCommand>> altcommands = new HashMap<String, List<PluginCommand>>(); - private final Map<String, String> disabledList = new HashMap<String, String>(); - private final Map<String, IEssentialsCommand> commands = new HashMap<String, IEssentialsCommand>(); - private final IEssentials ess; + private final transient ClassLoader classLoader; + private final transient String commandPath; + private final transient String permissionPrefix;// TODO: Needed? + private final transient IEssentialsModule module; + private static final transient Logger LOGGER = Bukkit.getLogger(); + private final transient Map<String, List<PluginCommand>> altcommands = new HashMap<String, List<PluginCommand>>(); + private final transient Map<String, String> disabledList = new HashMap<String, String>(); + private final transient Map<String, IEssentialsCommand> commands = new HashMap<String, IEssentialsCommand>(); + private final transient IEssentials ess; public EssentialsCommandHandler(ClassLoader classLoader, String commandPath, String permissionPrefix, IEssentials ess) { diff --git a/Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java b/Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java index 440bda706..1ab327667 100644 --- a/Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java +++ b/Essentials/src/net/ess3/commands/EssentialsSettingsCommand.java @@ -8,6 +8,7 @@ import org.bukkit.command.CommandSender; public abstract class EssentialsSettingsCommand extends EssentialsCommand { + abstract protected void informSender(final CommandSender sender, final boolean value, final IUser player); abstract protected void informPlayer(final IUser player); @@ -81,4 +82,5 @@ public abstract class EssentialsSettingsCommand extends EssentialsCommand informSender(sender, true, matchPlayer); } } + } diff --git a/Essentials/src/net/ess3/commands/EssentialsToggleCommand.java b/Essentials/src/net/ess3/commands/EssentialsToggleCommand.java index 2d5b723cb..c62fda512 100644 --- a/Essentials/src/net/ess3/commands/EssentialsToggleCommand.java +++ b/Essentials/src/net/ess3/commands/EssentialsToggleCommand.java @@ -5,6 +5,7 @@ import net.ess3.api.IUser; public abstract class EssentialsToggleCommand extends EssentialsSettingsCommand { + abstract protected void setValue(final IUser player, final boolean value); abstract protected boolean getValue(final IUser player); diff --git a/Essentials/src/net/ess3/commands/WarpNotFoundException.java b/Essentials/src/net/ess3/commands/WarpNotFoundException.java index 3d725072a..73e9504c9 100644 --- a/Essentials/src/net/ess3/commands/WarpNotFoundException.java +++ b/Essentials/src/net/ess3/commands/WarpNotFoundException.java @@ -17,3 +17,5 @@ public class WarpNotFoundException extends Exception super(message); } } + + diff --git a/Essentials/src/net/ess3/converter/EnumConverter.java b/Essentials/src/net/ess3/converter/EnumConverter.java index a31b08124..ab45bdfb6 100644 --- a/Essentials/src/net/ess3/converter/EnumConverter.java +++ b/Essentials/src/net/ess3/converter/EnumConverter.java @@ -14,7 +14,7 @@ public class EnumConverter<E extends Enum<E>> implements ArgumentsParser<E>, Ser private static final Pattern REPLACE = Pattern.compile("[_-]"); private final Map<String, E> enumMap = new HashMap<String, E>(); private final Map<E, String> serializedMap; - + private EnumConverter(final Class<E> enumClass) { serializedMap = new EnumMap<E, String>(enumClass); @@ -24,7 +24,7 @@ public class EnumConverter<E extends Enum<E>> implements ArgumentsParser<E>, Ser serializedMap.put(t, prettifyString(t.name())); } } - + public static <T extends Enum<T>> EnumConverter<T> getInstance(final Class<T> enumClass) { synchronized (converterMap) @@ -38,7 +38,7 @@ public class EnumConverter<E extends Enum<E>> implements ArgumentsParser<E>, Ser return converter; } } - + @Override public ParserResult<E> parse(final String... args) { @@ -51,18 +51,18 @@ public class EnumConverter<E extends Enum<E>> implements ArgumentsParser<E>, Ser } return new FirstEntryParserResult<E>(e, args); } - + @Override public String serialize(final E input) { return serializedMap.get(input); } - + private String cleanString(final String input) { return REPLACE.matcher(input).replaceAll("").toLowerCase(Locale.ENGLISH); } - + private String prettifyString(final String input) { return input.replace('_', '-').toLowerCase(Locale.ENGLISH); diff --git a/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java b/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java index e8397c47b..d7230fcde 100644 --- a/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java +++ b/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java @@ -11,6 +11,7 @@ import org.bukkit.inventory.ItemStack; * TODO: make sure this is up-to date */ + public final class InventoryWorkaround { private InventoryWorkaround() @@ -27,7 +28,7 @@ public final class InventoryWorkaround for (int i = 0; i < stacks.length; i++) { final ItemStack cItem = stacks[i]; - if (cItem != null && cItem.getAmount() < maxAmount && cItem.isSimilar(item)) + if(cItem != null && cItem.getAmount() < maxAmount && cItem.isSimilar(item)) { return i; } diff --git a/Essentials/src/net/ess3/economy/Money.java b/Essentials/src/net/ess3/economy/Money.java index 180ec305a..2373cc7f7 100644 --- a/Essentials/src/net/ess3/economy/Money.java +++ b/Essentials/src/net/ess3/economy/Money.java @@ -35,4 +35,6 @@ public class Money implements StorageObject balanceMap.remove(name); balances = balanceMap; } + + } diff --git a/Essentials/src/net/ess3/economy/Trade.java b/Essentials/src/net/ess3/economy/Trade.java index c15145baf..15c2a2adc 100644 --- a/Essentials/src/net/ess3/economy/Trade.java +++ b/Essentials/src/net/ess3/economy/Trade.java @@ -22,12 +22,12 @@ import org.bukkit.inventory.ItemStack; public class Trade { - private final String command; - private final String fallbackCommand; - private final Double money; - private final ItemStack itemStack; - private final Integer exp; - private final IEssentials ess; + private final transient String command; + private final transient String fallbackCommand; + private final transient Double money; + private final transient ItemStack itemStack; + private final transient Integer exp; + private final transient IEssentials ess; public Trade(final String command, final IEssentials ess) { @@ -211,6 +211,7 @@ public class Trade } return cost; } + private static FileWriter fw = null; public static void log(String type, String subtype, String event, String sender, Trade charge, String receiver, Trade pay, Location loc, IEssentials ess) diff --git a/Essentials/src/net/ess3/economy/Worth.java b/Essentials/src/net/ess3/economy/Worth.java index 6f94204a9..f2f3d2d64 100644 --- a/Essentials/src/net/ess3/economy/Worth.java +++ b/Essentials/src/net/ess3/economy/Worth.java @@ -26,6 +26,7 @@ public class Worth implements StorageObject { return sell == null ? Collections.<MaterialData, Double>emptyMap() : Collections.unmodifiableMap(sell); } + @MapKeyType(MaterialData.class) @MapValueType(Double.class) @Getter(AccessLevel.NONE) @@ -36,6 +37,7 @@ public class Worth implements StorageObject { return buy == null ? Collections.<MaterialData, Double>emptyMap() : Collections.unmodifiableMap(buy); } + @MapKeyType(EnchantmentLevel.class) @MapValueType(Double.class) @Getter(AccessLevel.NONE) diff --git a/Essentials/src/net/ess3/economy/register/Method.java b/Essentials/src/net/ess3/economy/register/Method.java index f3f7fab4c..2ded29805 100644 --- a/Essentials/src/net/ess3/economy/register/Method.java +++ b/Essentials/src/net/ess3/economy/register/Method.java @@ -6,8 +6,7 @@ import org.bukkit.plugin.Plugin; /** * Interface to be implemented by a payment method. * - * @author Nijikokun <nijikokun@shortmail.com> ( - * @nijikokun) + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) * @copyright Copyright (C) 2011 * @license AOL license <http://aol.nexua.org> */ @@ -17,8 +16,7 @@ public interface Method * Encodes the Plugin into an Object disguised as the Plugin. If you want the original Plugin Class you must cast it * to the correct Plugin, to do so you have to verify the name and or version then cast. * <p/> - * < - * pre> + * <pre> * if(method.getName().equalsIgnoreCase("iConomy")) * iConomy plugin = ((iConomy)method.getPlugin());</pre> * @@ -50,7 +48,8 @@ public interface Method public String getVersion(); /** - * Returns the amount of decimal places that get stored NOTE: it will return -1 if there is no rounding + * Returns the amount of decimal places that get stored + * NOTE: it will return -1 if there is no rounding * * @return <code>int</code> for each decimal place */ @@ -89,9 +88,7 @@ public interface Method public boolean hasAccount(String name); /** - * Check to see if an account - * <code>name</code> is tied to a - * <code>bank</code>. + * Check to see if an account <code>name</code> is tied to a <code>bank</code>. * * @param bank Bank name * @param name Account name @@ -110,16 +107,14 @@ public interface Method /** * Forces an account creation * - * @param name Account name + * @param name Account name * @param balance Initial account balance * @return <code>boolean</code> */ public boolean createAccount(String name, Double balance); /** - * Returns a - * <code>MethodAccount</code> class for an account - * <code>name</code>. + * Returns a <code>MethodAccount</code> class for an account <code>name</code>. * * @param name Account name * @return <code>MethodAccount</code> <em>or</em> <code>Null</code> @@ -127,9 +122,7 @@ public interface Method public MethodAccount getAccount(String name); /** - * Returns a - * <code>MethodBankAccount</code> class for an account - * <code>name</code>. + * Returns a <code>MethodBankAccount</code> class for an account <code>name</code>. * * @param bank Bank name * @param name Account name @@ -138,7 +131,8 @@ public interface Method public MethodBankAccount getBankAccount(String bank, String name); /** - * Checks to verify the compatibility between this Method and a plugin. Internal usage only, for the most part. + * Checks to verify the compatibility between this Method and a plugin. + * Internal usage only, for the most part. * * @param plugin Plugin * @return <code>boolean</code> diff --git a/Essentials/src/net/ess3/economy/register/Methods.java b/Essentials/src/net/ess3/economy/register/Methods.java index 1ac716aa7..3c0772129 100644 --- a/Essentials/src/net/ess3/economy/register/Methods.java +++ b/Essentials/src/net/ess3/economy/register/Methods.java @@ -22,10 +22,8 @@ import org.bukkit.plugin.PluginManager; * preferred: "iConomy" * </pre></blockquote> * - * @author: Nijikokun <nijikokun@shortmail.com> ( - * @nijikokun) - * @copyright: Copyright (C) 2011 - * @license: AOL license <http://aol.nexua.org> + * @author: Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright: Copyright (C) 2011 @license: AOL license + * <http://aol.nexua.org> */ public class Methods { @@ -257,7 +255,8 @@ public class Methods /** * Grab the existing and initialized (hopefully) Method Class. * - * @return <code>Method</code> <em>or</em> <code>Null</code> + * @return <code>Method</code> <em>or</em> + * <code>Null</code> */ public static Method getMethod() { diff --git a/Essentials/src/net/ess3/economy/register/methods/BOSE7.java b/Essentials/src/net/ess3/economy/register/methods/BOSE7.java index f186dfadd..cbb9b9314 100644 --- a/Essentials/src/net/ess3/economy/register/methods/BOSE7.java +++ b/Essentials/src/net/ess3/economy/register/methods/BOSE7.java @@ -9,10 +9,8 @@ import org.bukkit.plugin.Plugin; * BOSEconomy 7 Implementation of Method * * @author Acrobot - * @author Nijikokun <nijikokun@shortmail.com> ( - * @nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ public class BOSE7 implements Method { diff --git a/Essentials/src/net/ess3/economy/register/methods/iCo5.java b/Essentials/src/net/ess3/economy/register/methods/iCo5.java index 9e4dab821..a615ada5d 100644 --- a/Essentials/src/net/ess3/economy/register/methods/iCo5.java +++ b/Essentials/src/net/ess3/economy/register/methods/iCo5.java @@ -12,10 +12,8 @@ import org.bukkit.plugin.Plugin; /** * iConomy 5 Implementation of Method * - * @author Nijikokun <nijikokun@shortmail.com> ( - * @nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ public class iCo5 implements Method { diff --git a/Essentials/src/net/ess3/economy/register/methods/iCo6.java b/Essentials/src/net/ess3/economy/register/methods/iCo6.java index d98819828..9dfdabe2e 100644 --- a/Essentials/src/net/ess3/economy/register/methods/iCo6.java +++ b/Essentials/src/net/ess3/economy/register/methods/iCo6.java @@ -11,10 +11,8 @@ import org.bukkit.plugin.Plugin; /** * iConomy 6 Implementation of Method * - * @author Nijikokun <nijikokun@shortmail.com> ( - * @nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ public class iCo6 implements Method { diff --git a/Essentials/src/net/ess3/listener/EssentialsBlockListener.java b/Essentials/src/net/ess3/listener/EssentialsBlockListener.java index f72b95e64..8d3f380a7 100644 --- a/Essentials/src/net/ess3/listener/EssentialsBlockListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsBlockListener.java @@ -15,7 +15,7 @@ import org.bukkit.inventory.ItemStack; public class EssentialsBlockListener implements Listener { - private final IEssentials ess; + private final transient IEssentials ess; public EssentialsBlockListener(final IEssentials ess) { diff --git a/Essentials/src/net/ess3/listener/EssentialsEntityListener.java b/Essentials/src/net/ess3/listener/EssentialsEntityListener.java index c0b5a54d0..41ed4503a 100644 --- a/Essentials/src/net/ess3/listener/EssentialsEntityListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsEntityListener.java @@ -19,7 +19,7 @@ import org.bukkit.inventory.ItemStack; public class EssentialsEntityListener implements Listener { - private final IEssentials ess; + private final transient IEssentials ess; public EssentialsEntityListener(final IEssentials ess) { @@ -41,7 +41,7 @@ public class EssentialsEntityListener implements Listener attacker.updateActivity(true); if (settings.getData().getGeneral().getLoginAttackDelay() > 0 && !Permissions.PVPDELAY_EXEMPT.isAuthorized( attacker) && (System.currentTimeMillis() < (attacker.getTimestamp( - TimestampType.LOGIN) + settings.getData().getGeneral().getLoginAttackDelay()))) + TimestampType.LOGIN) + settings.getData().getGeneral().getLoginAttackDelay()))) { event.setCancelled(true); } diff --git a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java index b5de18fd1..81ec8a397 100644 --- a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java @@ -40,9 +40,9 @@ import org.bukkit.inventory.ItemStack; public class EssentialsPlayerListener implements Listener { private static final Logger LOGGER = Logger.getLogger("Minecraft"); - private final Server server; - private final IEssentials ess; - private final IUserMap userMap; + private final transient Server server; + private final transient IEssentials ess; + private final transient IUserMap userMap; public EssentialsPlayerListener(final IEssentials parent) { @@ -56,8 +56,7 @@ public class EssentialsPlayerListener implements Listener public void onPlayerRespawn(final PlayerRespawnEvent event) { final Player player = event.getPlayer(); - if (!player.isOnline()) - { + if (!player.isOnline()) { return; } final IUser user = userMap.getUser(player); @@ -174,83 +173,83 @@ public class EssentialsPlayerListener implements Listener delayedJoin(event.getPlayer()); } }); - /* TODO: Make sure my update is good - if (!event.getPlayer().isOnline()) - { - return; - } - - ess.getBackup().startTask(); - - final String joinMessage = ess.getSettings().getData().getGeneral().getJoinMessage(); - if (joinMessage != null) - { - final IText itOutput = new KeywordReplacer(new SimpleTextInput(joinMessage), ess.getUserMap().getUser(event.getPlayer()), ess); - final SimpleTextPager stPager = new SimpleTextPager(itOutput); - event.setJoinMessage(FormatUtil.replaceFormat(stPager.getString(0))); - } - else - { - event.setJoinMessage(joinMessage); - } - - final IUser user = ess.getUserMap().getUser(event.getPlayer()); - - user.updateDisplayName(); - user.getData().setIpAddress(user.getPlayer().getAddress().getAddress().getHostAddress()); - user.updateActivity(false); - - for (String p : ess.getVanishedPlayers()) - { - if (!Permissions.VANISH_SEE_OTHERS.isAuthorized(user)) - { - user.getPlayer().hidePlayer(ess.getUserMap().getUser(p).getPlayer()); - } - } - - if (Permissions.SLEEPINGIGNORED.isAuthorized(user)) - { - user.getPlayer().setSleepingIgnored(true); - } - user.queueSave(); - - - final ISettings settings = ess.getSettings(); - - if (!settings.getData().getCommands().isDisabled("motd") && Permissions.MOTD.isAuthorized(user)) - { - try - { - final IText input = new TextInput(user, "motd", true, ess); - final IText output = new KeywordReplacer(input, user, ess); - final TextPager pager = new TextPager(output, true); - pager.showPage("1", null, "motd", user); - } - catch (IOException ex) - { - if (settings.getData().getGeneral().isDebug()) - { - LOGGER.log(Level.WARNING, ex.getMessage(), ex); - } - else - { - LOGGER.log(Level.WARNING, ex.getMessage()); - } - } - } - - if (!settings.getData().getCommands().isDisabled("mail") && Permissions.MAIL.isAuthorized(user)) - { - final List<String> mail = user.getData().getMails(); - if (mail == null || mail.isEmpty()) - { - user.sendMessage(_("noNewMail")); - } - else - { - user.sendMessage(_("youHaveNewMail", mail.size())); - } - }*/ +/* TODO: Make sure my update is good + if (!event.getPlayer().isOnline()) + { + return; + } + + ess.getBackup().startTask(); + + final String joinMessage = ess.getSettings().getData().getGeneral().getJoinMessage(); + if (joinMessage != null) + { + final IText itOutput = new KeywordReplacer(new SimpleTextInput(joinMessage), ess.getUserMap().getUser(event.getPlayer()), ess); + final SimpleTextPager stPager = new SimpleTextPager(itOutput); + event.setJoinMessage(FormatUtil.replaceFormat(stPager.getString(0))); + } + else + { + event.setJoinMessage(joinMessage); + } + + final IUser user = ess.getUserMap().getUser(event.getPlayer()); + + user.updateDisplayName(); + user.getData().setIpAddress(user.getPlayer().getAddress().getAddress().getHostAddress()); + user.updateActivity(false); + + for (String p : ess.getVanishedPlayers()) + { + if (!Permissions.VANISH_SEE_OTHERS.isAuthorized(user)) + { + user.getPlayer().hidePlayer(ess.getUserMap().getUser(p).getPlayer()); + } + } + + if (Permissions.SLEEPINGIGNORED.isAuthorized(user)) + { + user.getPlayer().setSleepingIgnored(true); + } + user.queueSave(); + + + final ISettings settings = ess.getSettings(); + + if (!settings.getData().getCommands().isDisabled("motd") && Permissions.MOTD.isAuthorized(user)) + { + try + { + final IText input = new TextInput(user, "motd", true, ess); + final IText output = new KeywordReplacer(input, user, ess); + final TextPager pager = new TextPager(output, true); + pager.showPage("1", null, "motd", user); + } + catch (IOException ex) + { + if (settings.getData().getGeneral().isDebug()) + { + LOGGER.log(Level.WARNING, ex.getMessage(), ex); + } + else + { + LOGGER.log(Level.WARNING, ex.getMessage()); + } + } + } + + if (!settings.getData().getCommands().isDisabled("mail") && Permissions.MAIL.isAuthorized(user)) + { + final List<String> mail = user.getData().getMails(); + if (mail == null || mail.isEmpty()) + { + user.sendMessage(_("noNewMail")); + } + else + { + user.sendMessage(_("youHaveNewMail", mail.size())); + } + }*/ } public void delayedJoin(final Player player) @@ -331,19 +330,19 @@ public class EssentialsPlayerListener implements Listener user.sendMessage(_("youHaveNewMail", mail.size())); } } - if (Permissions.FLY_SAFELOGIN.isAuthorized(user)) + if(Permissions.FLY_SAFELOGIN.isAuthorized(user)) { final Location loc = user.getPlayer().getLocation(); final World world = loc.getWorld(); final int x = loc.getBlockX(); int y = loc.getBlockY(); final int z = loc.getBlockZ(); - while (LocationUtil.isBlockUnsafe(world, x, y, z) && y > -1) + while(LocationUtil.isBlockUnsafe(world, x, y, z) && y > -1) { y--; } - if (loc.getBlockY() - y > 1 || y < 0) + if(loc.getBlockY() - y > 1 || y < 0) { user.getPlayer().setAllowFlight(true); user.getPlayer().setFlying(true); @@ -352,6 +351,7 @@ public class EssentialsPlayerListener implements Listener } } + @EventHandler(priority = EventPriority.HIGH) public void onPlayerLogin(final PlayerLoginEvent event) { @@ -449,6 +449,7 @@ public class EssentialsPlayerListener implements Listener }); } } + private final Pattern spaceSplit = Pattern.compile(" "); @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -612,7 +613,7 @@ public class EssentialsPlayerListener implements Listener { final IUser invOwner = userMap.getUser((Player)invHolder); if (user.isInvSee() && (!Permissions.INVSEE_MODIFY.isAuthorized(user) || Permissions.INVSEE_PREVENT_MODIFY.isAuthorized( - invOwner) || !invOwner.isOnline())) + invOwner) || !invOwner.isOnline())) { event.setCancelled(true); } @@ -620,7 +621,7 @@ public class EssentialsPlayerListener implements Listener } if (event.getView().getTopInventory().getType() == InventoryType.WORKBENCH) { - final IUser user = userMap.getUser((Player)event.getWhoClicked()); + final IUser user = userMap.getUser((Player) event.getWhoClicked()); if (user.isRecipeSee()) { event.setCancelled(true); diff --git a/Essentials/src/net/ess3/listener/EssentialsPluginListener.java b/Essentials/src/net/ess3/listener/EssentialsPluginListener.java index 8f5de1ec2..56e3add3d 100644 --- a/Essentials/src/net/ess3/listener/EssentialsPluginListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsPluginListener.java @@ -19,7 +19,7 @@ import org.bukkit.plugin.Plugin; public class EssentialsPluginListener implements Listener, IReload { - private final IEssentials ess; + private final transient IEssentials ess; public EssentialsPluginListener(final IEssentials ess) { @@ -36,10 +36,9 @@ public class EssentialsPluginListener implements Listener, IReload if (!Methods.hasMethod() && Methods.setMethod(ess.getServer().getPluginManager())) { ess.getLogger().log( - Level.INFO, "Payment method found ({0} version: {1})", new Object[] - { - Methods.getMethod().getName(), Methods.getMethod().getVersion() - }); + Level.INFO, "Payment method found ({0} version: {1})", new Object[]{ + Methods.getMethod().getName(), Methods.getMethod().getVersion() + }); } } diff --git a/Essentials/src/net/ess3/metrics/MetricsListener.java b/Essentials/src/net/ess3/metrics/MetricsListener.java index b83406e35..17664ab61 100644 --- a/Essentials/src/net/ess3/metrics/MetricsListener.java +++ b/Essentials/src/net/ess3/metrics/MetricsListener.java @@ -14,8 +14,8 @@ import org.bukkit.event.player.PlayerJoinEvent; public class MetricsListener implements Listener { - private final IEssentials ess; - private final MetricsStarter starter; + private final transient IEssentials ess; + private final transient MetricsStarter starter; public MetricsListener(final IEssentials parent, final MetricsStarter starter) { @@ -30,7 +30,7 @@ public class MetricsListener implements Listener ISettings settings = ess.getSettings(); if (settings.getData().getGeneral().getMetricsEnabled() == null && (Permissions.ESSENTIALS.isAuthorized( - event.getPlayer()) || event.getPlayer().hasPermission("bukkit.broadcast.admin"))) + event.getPlayer()) || event.getPlayer().hasPermission("bukkit.broadcast.admin"))) { player.sendMessage(_("metrics1")); player.sendMessage(_("metrics2")); diff --git a/Essentials/src/net/ess3/metrics/MetricsStarter.java b/Essentials/src/net/ess3/metrics/MetricsStarter.java index 0c1ac9df9..2c5314142 100644 --- a/Essentials/src/net/ess3/metrics/MetricsStarter.java +++ b/Essentials/src/net/ess3/metrics/MetricsStarter.java @@ -14,7 +14,7 @@ import net.ess3.metrics.Metrics.Plotter; public class MetricsStarter implements Runnable { private final IEssentials ess; - private Boolean start; + private transient Boolean start; private enum Modules @@ -30,7 +30,10 @@ public class MetricsStarter implements Runnable EssentialsProtect, EssentialsGeoIP, EssentialsXMPP - }; + } + + + ; public MetricsStarter(final IEssentials plugin) { diff --git a/Essentials/src/net/ess3/permissions/BasePermission.java b/Essentials/src/net/ess3/permissions/BasePermission.java index 5312ebb93..b1cb0be68 100644 --- a/Essentials/src/net/ess3/permissions/BasePermission.java +++ b/Essentials/src/net/ess3/permissions/BasePermission.java @@ -1,6 +1,5 @@ package net.ess3.permissions; - public class BasePermission extends AbstractSuperpermsPermission { protected String permission; diff --git a/Essentials/src/net/ess3/permissions/Permissions.java b/Essentials/src/net/ess3/permissions/Permissions.java index 4655ca309..c4c1e19c7 100644 --- a/Essentials/src/net/ess3/permissions/Permissions.java +++ b/Essentials/src/net/ess3/permissions/Permissions.java @@ -121,7 +121,7 @@ public enum Permissions implements IPermission private static final String base = "essentials."; private final String permission; private final PermissionDefault defaultPerm; - private String parent = null; + private transient String parent = null; private Permissions() { @@ -164,6 +164,7 @@ public enum Permissions implements IPermission { return PermissionFactory.checkPermission(sender, this); } + public static DotStarPermission ENCHANT = new DotStarPermission("essentials.enchant"); public static MaterialDotStarPermission GIVE = new MaterialDotStarPermission("essentials.give", PermissionDefault.TRUE); public static DotStarPermission RANKS = new DotStarPermission("essentials.ranks"); diff --git a/Essentials/src/net/ess3/ranks/GMGroups.java b/Essentials/src/net/ess3/ranks/GMGroups.java index 9e2bd745f..55a6295d3 100644 --- a/Essentials/src/net/ess3/ranks/GMGroups.java +++ b/Essentials/src/net/ess3/ranks/GMGroups.java @@ -12,8 +12,8 @@ import org.bukkit.plugin.Plugin; public class GMGroups extends AbstractRanks implements IRanks { - private final IEssentials ess; - private final GroupManager groupManager; + private final transient IEssentials ess; + private final transient GroupManager groupManager; public GMGroups(final IEssentials ess, final Plugin groupManager) { diff --git a/Essentials/src/net/ess3/ranks/Ranks.java b/Essentials/src/net/ess3/ranks/Ranks.java index 31a9bc34b..4e876b128 100644 --- a/Essentials/src/net/ess3/ranks/Ranks.java +++ b/Essentials/src/net/ess3/ranks/Ranks.java @@ -17,11 +17,12 @@ public class Ranks implements StorageObject final RankOptions defaultOptions = new RankOptions(); ranks.put("default", defaultOptions); } + @Comment( - { - "The order of the ranks matters, the ranks are checked from top to bottom.", "All rank names have to be lower case.", - "The ranks can be connected to users using the permission essentials.ranks.rankname" - }) + { + "The order of the ranks matters, the ranks are checked from top to bottom.", "All rank names have to be lower case.", + "The ranks can be connected to users using the permission essentials.ranks.rankname" + }) @MapValueType(RankOptions.class) private LinkedHashMap<String, RankOptions> ranks = new LinkedHashMap<String, RankOptions>(); } diff --git a/Essentials/src/net/ess3/settings/Backup.java b/Essentials/src/net/ess3/settings/Backup.java index 01ba37322..bbdef7bdf 100644 --- a/Essentials/src/net/ess3/settings/Backup.java +++ b/Essentials/src/net/ess3/settings/Backup.java @@ -18,16 +18,17 @@ public class Backup implements StorageObject @Comment("Add a command that backups your data, e.g. 'rdiff-backup World1 backups/World1'") private String command; @Comment( - { - "Runs these commands before a backup.", "This will run every time time (in minutes) you specify in the interval setting.", - "ex: say \"Hello World\" will make the server say Hello World" - }) + { + "Runs these commands before a backup.", "This will run every time time (in minutes) you specify in the interval setting.", + "ex: say \"Hello World\" will make the server say Hello World" + }) private List<String> commandsBeforeBackup; + @Comment( - { - "Runs these commands after a backup.", "This will run every time time (in minutes) you specify in the interval setting.", - "ex: say \"Hello World\" will make the server say Hello World" - }) + { + "Runs these commands after a backup.", "This will run every time time (in minutes) you specify in the interval setting.", + "ex: say \"Hello World\" will make the server say Hello World" + }) private List<String> commandsAfterBackup; public Backup() @@ -48,4 +49,5 @@ public class Backup implements StorageObject { return commandsAfterBackup == null ? Collections.<String>emptyList() : Collections.unmodifiableList(commandsAfterBackup); } + } diff --git a/Essentials/src/net/ess3/settings/Chat.java b/Essentials/src/net/ess3/settings/Chat.java index a7a99fe6e..14c7cc702 100644 --- a/Essentials/src/net/ess3/settings/Chat.java +++ b/Essentials/src/net/ess3/settings/Chat.java @@ -13,20 +13,20 @@ public class Chat implements StorageObject @Comment("The character(s) to prefix all nicknames, so that you know they are not true usernames.") private String nicknamePrefix = "~"; @Comment( - { - "Disable this if you have any other plugin, that modifies the displayname of a user.", - "If it is not set, it will be enabled if EssentialsChat is installed, otherwise not." - }) + { + "Disable this if you have any other plugin, that modifies the displayname of a user.", + "If it is not set, it will be enabled if EssentialsChat is installed, otherwise not." + }) private Boolean changeDisplayname; private String displaynameFormat = "{PREFIX}{NICKNAMEPREFIX}{NAME}{SUFFIX}"; @Comment( - { - "If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.", - "Note that users with the \"essentials.chat.spy\" permission will hear everything, regardless of this setting.", - "Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)", - "Or with essentials.chat.question can override this by prefixing text with a question mark (?)", - "You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section." - }) + { + "If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.", + "Note that users with the \"essentials.chat.spy\" permission will hear everything, regardless of this setting.", + "Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)", + "Or with essentials.chat.question can override this by prefixing text with a question mark (?)", + "You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section." + }) private int localRadius = 0; @Comment("Set the default chat format here, it will be overwritten by group specific chat formats.") private String defaultFormat = "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"; diff --git a/Essentials/src/net/ess3/settings/Commands.java b/Essentials/src/net/ess3/settings/Commands.java index 6bd29b4c7..e78e09f34 100644 --- a/Essentials/src/net/ess3/settings/Commands.java +++ b/Essentials/src/net/ess3/settings/Commands.java @@ -26,16 +26,16 @@ public class Commands implements StorageObject private Speed speed = new Speed(); @ListType @Comment( - { - "When a command conflicts with another plugin, by default, Essentials will try to force the OTHER plugin to take", - "priority. If a command is in this list, Essentials will try to give ITSELF priority. This does not always work:", - "usually whichever plugin was updated most recently wins out. However, the full name of the command will always work.", - "For example, if WorldGuard and Essentials are both enabled, and WorldGuard takes control over /god, /essentials:god", - "will still map to Essentials, whereas it might normally get forced upon WorldGuard. Commands prefixed with an \"e\",", - "such as /egod, will always grant Essentials priority.", - "We should try to take priority over /god. If this doesn't work, use /essentials:god or /egod.", - "If god is set using WorldGuard, use /ungod to remove then use whichever you see fit." - }) + { + "When a command conflicts with another plugin, by default, Essentials will try to force the OTHER plugin to take", + "priority. If a command is in this list, Essentials will try to give ITSELF priority. This does not always work:", + "usually whichever plugin was updated most recently wins out. However, the full name of the command will always work.", + "For example, if WorldGuard and Essentials are both enabled, and WorldGuard takes control over /god, /essentials:god", + "will still map to Essentials, whereas it might normally get forced upon WorldGuard. Commands prefixed with an \"e\",", + "such as /egod, will always grant Essentials priority.", + "We should try to take priority over /god. If this doesn't work, use /essentials:god or /egod.", + "If god is set using WorldGuard, use /ungod to remove then use whichever you see fit." + }) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) private List<String> overridden = null; diff --git a/Essentials/src/net/ess3/settings/Economy.java b/Essentials/src/net/ess3/settings/Economy.java index e43992b61..bd37372bd 100644 --- a/Essentials/src/net/ess3/settings/Economy.java +++ b/Essentials/src/net/ess3/settings/Economy.java @@ -26,29 +26,32 @@ public class Economy implements StorageObject { return currencySymbol == null || currencySymbol.isEmpty() ? "$" : currencySymbol.substring(0, 1); } - private final static double MAXMONEY = 10000000000000.0; + + private final transient static double MAXMONEY = 10000000000000.0; @Comment( - { - "Set the maximum amount of money a player can have", - "The amount is always limited to 10 trillions because of the limitations of a java double" - }) + { + "Set the maximum amount of money a player can have", + "The amount is always limited to 10 trillions because of the limitations of a java double" + }) private double maxMoney = MAXMONEY; public double getMaxMoney() { return Math.abs(maxMoney) > MAXMONEY ? MAXMONEY : Math.abs(maxMoney); } + @Comment( - { - "Set the minimum amount of money a player can have (must be above the negative of max-money).", - "Setting this to 0, will disable overdrafts/loans completely. Users need 'essentials.eco.loan' perm to go below 0." - }) + { + "Set the minimum amount of money a player can have (must be above the negative of max-money).", + "Setting this to 0, will disable overdrafts/loans completely. Users need 'essentials.eco.loan' perm to go below 0." + }) private double minMoney = -MAXMONEY; public double getMinMoney() { return Math.abs(minMoney) > MAXMONEY ? -MAXMONEY : minMoney; } + @Comment("Enable this to log all interactions with trade/buy/sell signs and sell command") private boolean logEnabled = false; private Worth worth = new Worth(); diff --git a/Essentials/src/net/ess3/settings/General.java b/Essentials/src/net/ess3/settings/General.java index 01ee58704..6fbdb5b8c 100644 --- a/Essentials/src/net/ess3/settings/General.java +++ b/Essentials/src/net/ess3/settings/General.java @@ -17,24 +17,24 @@ public class General implements StorageObject @Comment("Turn this on, if you want to see more error messages, if something goes wrong.") private boolean debug = false; @Comment( - { - "Set the locale here, if you want to change the language of Essentials.", - "If this is not set, Essentials will use the language of your computer.", "Available locales: da, de, en, fr, nl" - }) + { + "Set the locale here, if you want to change the language of Essentials.", + "If this is not set, Essentials will use the language of your computer.", "Available locales: da, de, en, fr, nl" + }) private String locale; @Comment( - { - "The number of items given, if the quantity parameter is left out in /item or /give.", - "If this number is below 1, the maximum stack size size is given. If oversized stacks", - "is not enabled, any number higher then the maximum stack size results in more than one stack." - }) + { + "The number of items given, if the quantity parameter is left out in /item or /give.", + "If this number is below 1, the maximum stack size size is given. If oversized stacks", + "is not enabled, any number higher then the maximum stack size results in more than one stack." + }) private int defaultStacksize = -1; @Comment( - { - "Oversized stacks are stacks that ignore the normal max stacksize.", - "They can be obtained using /give and /item, if the player has essentials.oversizedstacks permission.", - "How many items should be in a oversized stack?" - }) + { + "Oversized stacks are stacks that ignore the normal max stacksize.", + "They can be obtained using /give and /item, if the player has essentials.oversizedstacks permission.", + "How many items should be in a oversized stack?" + }) private int oversizedStacksize = 64; @@ -42,19 +42,21 @@ public class General implements StorageObject { FILE, GROUPMANAGER, VAULT } + + @Comment( - { - "Sets the place where group options should be stored:", " FILE: Options are stored inside groups.yml in the Essentials folder", - " GROUPMANAGER: Options are stored using the GroupManager groups", - " VAULT: Options are stored using a permissions plugin supported by Vault" - }) + { + "Sets the place where group options should be stored:", " FILE: Options are stored inside groups.yml in the Essentials folder", + " GROUPMANAGER: Options are stored using the GroupManager groups", + " VAULT: Options are stored using a permissions plugin supported by Vault" + }) private GroupStorage groupStorage = GroupStorage.FILE; @Comment( - { - "Set to true to enable per-world permissions for teleporting between worlds with essentials commands", - "This applies to /world, /back, /tp[a|o][here|all], but not warps.", - "Give someone permission to teleport to a world with essentials.world.<worldname>" - }) + { + "Set to true to enable per-world permissions for teleporting between worlds with essentials commands", + "This applies to /world, /back, /tp[a|o][here|all], but not warps.", + "Give someone permission to teleport to a world with essentials.world.<worldname>" + }) private boolean worldTeleportPermissions = false; private boolean worldHomePermissions = false; @Comment("Delay to wait before people can cause attack damage after logging in ") @@ -69,6 +71,7 @@ public class General implements StorageObject { this.loginAttackDelay = loginAttackDelay / 1000; } + private Boolean metricsEnabled = null; @Comment("The join message when players join the server") private String joinMessage = "&e{PLAYER} has joined the game"; diff --git a/Essentials/src/net/ess3/settings/Kits.java b/Essentials/src/net/ess3/settings/Kits.java index 2892729c4..f68ac5d83 100644 --- a/Essentials/src/net/ess3/settings/Kits.java +++ b/Essentials/src/net/ess3/settings/Kits.java @@ -21,10 +21,11 @@ public class Kits implements StorageObject kit.setDelay(10.0); kit.setItems( Arrays.<ItemStack>asList( - new ItemStack(Material.DIAMOND_SPADE, 1), new ItemStack(Material.DIAMOND_PICKAXE, 1), new ItemStack(Material.DIAMOND_AXE, 1))); + new ItemStack(Material.DIAMOND_SPADE, 1), new ItemStack(Material.DIAMOND_PICKAXE, 1), new ItemStack(Material.DIAMOND_AXE, 1))); kits = new HashMap<String, Kit>(); kits.put("tools", kit); } + @MapValueType(Kit.class) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) diff --git a/Essentials/src/net/ess3/settings/Settings.java b/Essentials/src/net/ess3/settings/Settings.java index 9552c4cc7..a73e5f42d 100644 --- a/Essentials/src/net/ess3/settings/Settings.java +++ b/Essentials/src/net/ess3/settings/Settings.java @@ -12,39 +12,39 @@ import net.ess3.storage.StorageObject; public class Settings implements StorageObject { @Comment( - { - "##########################################################", "+------------------------------------------------------+ #", - "| General Settings | #", "+------------------------------------------------------+ #", - "##########################################################" - }) + { + "##########################################################", "+------------------------------------------------------+ #", + "| General Settings | #", "+------------------------------------------------------+ #", + "##########################################################" + }) private General general = new General(); @Comment( - { - "##########################################################", "+------------------------------------------------------+ #", - "| Chat Settings | #", "+------------------------------------------------------+ #", - "##########################################################" - }) + { + "##########################################################", "+------------------------------------------------------+ #", + "| Chat Settings | #", "+------------------------------------------------------+ #", + "##########################################################" + }) private Chat chat = new Chat(); @Comment( - { - "##########################################################", "+------------------------------------------------------+ #", - "| Economy Settings | #", "+------------------------------------------------------+ #", - "##########################################################" - }) + { + "##########################################################", "+------------------------------------------------------+ #", + "| Economy Settings | #", "+------------------------------------------------------+ #", + "##########################################################" + }) private Economy economy = new Economy(); @Comment( - { - "##########################################################", "+------------------------------------------------------+ #", - "| Commands Settings | #", "+------------------------------------------------------+ #", - "##########################################################" - }) + { + "##########################################################", "+------------------------------------------------------+ #", + "| Commands Settings | #", "+------------------------------------------------------+ #", + "##########################################################" + }) private Commands commands = new Commands(); @Comment( - { - "##########################################################", "+------------------------------------------------------+ #", - "| Worlds Settings | #", "+------------------------------------------------------+ #", - "##########################################################" - }) + { + "##########################################################", "+------------------------------------------------------+ #", + "| Worlds Settings | #", "+------------------------------------------------------+ #", + "##########################################################" + }) @MapValueType(WorldOptions.class) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) diff --git a/Essentials/src/net/ess3/settings/SettingsHolder.java b/Essentials/src/net/ess3/settings/SettingsHolder.java index 5d5ab3934..e9b7f8af3 100644 --- a/Essentials/src/net/ess3/settings/SettingsHolder.java +++ b/Essentials/src/net/ess3/settings/SettingsHolder.java @@ -8,7 +8,7 @@ import net.ess3.storage.AsyncStorageObjectHolder; public class SettingsHolder extends AsyncStorageObjectHolder<Settings> implements ISettings { - private volatile boolean debug = false; + private transient volatile boolean debug = false; public SettingsHolder(final IEssentials ess) { diff --git a/Essentials/src/net/ess3/settings/Spawns.java b/Essentials/src/net/ess3/settings/Spawns.java index 57a63409c..7d05d55d2 100644 --- a/Essentials/src/net/ess3/settings/Spawns.java +++ b/Essentials/src/net/ess3/settings/Spawns.java @@ -16,22 +16,22 @@ import org.bukkit.Location; public class Spawns implements StorageObject { @Comment( - { - "Should we announce to the server when someone logs in for the first time?", - "If so, use this format, replacing {DISPLAYNAME} with the player name.", "If not, set to ''" - }) + { + "Should we announce to the server when someone logs in for the first time?", + "If so, use this format, replacing {DISPLAYNAME} with the player name.", "If not, set to ''" + }) private String newPlayerAnnouncement = "&dWelcome {DISPLAYNAME} to the server!"; @Comment( - { - "Priority of the respawn event listener", "Set this to lowest, if you want e.g. Multiverse to handle the respawning", - "Set this to normal, if you want EssentialsSpawn to handle the respawning", - "Set this to highest, if you want to force EssentialsSpawn to handle the respawning" - }) + { + "Priority of the respawn event listener", "Set this to lowest, if you want e.g. Multiverse to handle the respawning", + "Set this to normal, if you want EssentialsSpawn to handle the respawning", + "Set this to highest, if you want to force EssentialsSpawn to handle the respawning" + }) private String respawnPriority = "normal"; @Comment( - { - "When we spawn for the first time, which spawnpoint do we use?", "Set to none if you want to use the spawn point of the world." - }) + { + "When we spawn for the first time, which spawnpoint do we use?", "Set to none if you want to use the spawn point of the world." + }) private String newbieSpawn = "none"; @Comment("List of all spawnpoints") @MapValueType(StoredLocation.class) diff --git a/Essentials/src/net/ess3/settings/SpawnsHolder.java b/Essentials/src/net/ess3/settings/SpawnsHolder.java index 9aaaaa350..1c310c7c3 100644 --- a/Essentials/src/net/ess3/settings/SpawnsHolder.java +++ b/Essentials/src/net/ess3/settings/SpawnsHolder.java @@ -38,7 +38,7 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE /** * Sets a spawn location * - * @param loc - Location you want to set as spawn + * @param loc - Location you want to set as spawn * @param group - Group to save it undr in the config */ public void setSpawn(final Location loc, final String group) @@ -174,8 +174,8 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE private class SpawnPlayerListener implements Listener // TODO: What is this for? { - private final IEssentials ess; - private final SpawnsHolder spawns; + private final transient IEssentials ess; + private final transient SpawnsHolder spawns; public SpawnPlayerListener(final IEssentials ess, final SpawnsHolder spawns) { @@ -187,6 +187,8 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE public void onPlayerRespawn(final PlayerRespawnEvent event) { final IUser user = ess.getUserMap().getUser(event.getPlayer()); + + final ISettings settings = ess.getSettings(); boolean respawnAtHome = ess.getSettings().getData().getCommands().getHome().isRespawnAtHome(); if (respawnAtHome) { @@ -238,7 +240,7 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE private class NewPlayerTeleport implements Runnable { - private final IUser user; + private final transient IUser user; public NewPlayerTeleport(final IUser user) { diff --git a/Essentials/src/net/ess3/settings/WorldOptions.java b/Essentials/src/net/ess3/settings/WorldOptions.java index 40e57dee7..e49ebb181 100644 --- a/Essentials/src/net/ess3/settings/WorldOptions.java +++ b/Essentials/src/net/ess3/settings/WorldOptions.java @@ -26,6 +26,7 @@ public class WorldOptions implements StorageObject } } } + @Comment("Disables godmode for all players if they teleport to this world.") private boolean godmode = true; @Comment("Prevent creatures spawning") diff --git a/Essentials/src/net/ess3/settings/Worlds.java b/Essentials/src/net/ess3/settings/Worlds.java index 10dc63823..c3f1f09d0 100644 --- a/Essentials/src/net/ess3/settings/Worlds.java +++ b/Essentials/src/net/ess3/settings/Worlds.java @@ -9,4 +9,5 @@ import net.ess3.storage.StorageObject; @EqualsAndHashCode(callSuper = false) public class Worlds implements StorageObject { + }
\ No newline at end of file diff --git a/Essentials/src/net/ess3/settings/antibuild/Alert.java b/Essentials/src/net/ess3/settings/antibuild/Alert.java index dc11841b1..481cc39ec 100644 --- a/Essentials/src/net/ess3/settings/antibuild/Alert.java +++ b/Essentials/src/net/ess3/settings/antibuild/Alert.java @@ -32,9 +32,8 @@ public class Alert implements StorageObject public void setupDefaults() { - Material[] mat = - { - Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET + Material[] mat = { + Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET }; alertOnPlacement.addAll(Arrays.asList(mat)); alertOnUse.add(Material.LAVA_BUCKET); diff --git a/Essentials/src/net/ess3/settings/antibuild/AntiBuild.java b/Essentials/src/net/ess3/settings/antibuild/AntiBuild.java index b45c65e3e..3bbf32f42 100644 --- a/Essentials/src/net/ess3/settings/antibuild/AntiBuild.java +++ b/Essentials/src/net/ess3/settings/antibuild/AntiBuild.java @@ -11,22 +11,24 @@ import net.ess3.storage.StorageObject; public class AntiBuild implements StorageObject { @Comment( - { - "Should people with build: false in permissions be allowed to build", "Set true to disable building for those people", - "Setting to false means EssentialsAntiBuild will never prevent you from building" - }) + { + "Should people with build: false in permissions be allowed to build", "Set true to disable building for those people", + "Setting to false means EssentialsAntiBuild will never prevent you from building" + }) private boolean disableBuild = true; @Comment( - { - "Should people with build: false in permissions be allowed to use items", "Set true to disable using for those people", - "Setting to false means EssentialsAntiBuild will never prevent you from using" - }) + { + "Should people with build: false in permissions be allowed to use items", "Set true to disable using for those people", + "Setting to false means EssentialsAntiBuild will never prevent you from using" + }) private boolean disableUse = true; @Comment( - { - "Should we tell people they are not allowed to build" - }) + { + "Should we tell people they are not allowed to build" + }) private boolean warnOnBuildDisallow = true; + private Alert alert = new Alert(); private BlackList blacklist = new BlackList(); + } diff --git a/Essentials/src/net/ess3/settings/antibuild/BlackList.java b/Essentials/src/net/ess3/settings/antibuild/BlackList.java index ca67ab479..af9205f7e 100644 --- a/Essentials/src/net/ess3/settings/antibuild/BlackList.java +++ b/Essentials/src/net/ess3/settings/antibuild/BlackList.java @@ -15,33 +15,33 @@ import org.bukkit.Material; public class BlackList implements StorageObject { @Comment( - { - "Which blocks should people be prevented from placing" - }) + { + "Which blocks should people be prevented from placing" + }) @ListType(Material.class) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) private Set<Material> placement = new HashSet<Material>(); @Comment( - { - "Which items should people be prevented from using" - }) + { + "Which items should people be prevented from using" + }) @ListType(Material.class) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) private Set<Material> usage = new HashSet<Material>(); @Comment( - { - "Which blocks should people be prevented from breaking" - }) + { + "Which blocks should people be prevented from breaking" + }) @ListType(Material.class) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) private Set<Material> breaking = new HashSet<Material>(); @Comment( - { - "Which blocks should not be pushed by pistons" - }) + { + "Which blocks should not be pushed by pistons" + }) @ListType(Material.class) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) @@ -49,9 +49,8 @@ public class BlackList implements StorageObject public void setupDefaults() { - Material[] mat = - { - Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET + Material[] mat = { + Material.LAVA, Material.STATIONARY_LAVA, Material.TNT, Material.LAVA_BUCKET }; placement.addAll(Arrays.asList(mat)); } diff --git a/Essentials/src/net/ess3/settings/commands/Afk.java b/Essentials/src/net/ess3/settings/commands/Afk.java index 2f3ab65dd..5136dd8d0 100644 --- a/Essentials/src/net/ess3/settings/commands/Afk.java +++ b/Essentials/src/net/ess3/settings/commands/Afk.java @@ -11,21 +11,22 @@ import net.ess3.storage.StorageObject; public class Afk implements StorageObject { @Comment( - { - "After this timeout in seconds, the user will be set as afk.", "Set to -1 for no timeout." - }) + { + "After this timeout in seconds, the user will be set as afk.", "Set to -1 for no timeout." + }) private long autoAFK = 300; @Comment( - { - "Auto-AFK Kick", "After this timeout in seconds, the user will be kicked from the server.", "Set to -1 for no timeout." - }) + { + "Auto-AFK Kick", "After this timeout in seconds, the user will be kicked from the server.", "Set to -1 for no timeout." + }) private long autoAFKKick = -1; @Comment( - { - "Set this to true, if you want to freeze the player, if he is afk.", "Other players or monsters can't push him out of afk mode then.", - "This will also enable temporary god mode for the afk player.", "The player has to use the command /afk to leave the afk mode.", - "You have to add a message to your welcome message or help page,", "since the player will not get a message, if he tries to move." - }) + { + "Set this to true, if you want to freeze the player, if he is afk.", "Other players or monsters can't push him out of afk mode then.", + "This will also enable temporary god mode for the afk player.", "The player has to use the command /afk to leave the afk mode.", + "You have to add a message to your welcome message or help page,", "since the player will not get a message, if he tries to move." + }) private boolean freezeAFKPlayers = false; + private boolean disableItemPickupWhileAfk = true; } diff --git a/Essentials/src/net/ess3/settings/commands/Back.java b/Essentials/src/net/ess3/settings/commands/Back.java index e83c53860..c0e7ed7b6 100644 --- a/Essentials/src/net/ess3/settings/commands/Back.java +++ b/Essentials/src/net/ess3/settings/commands/Back.java @@ -11,9 +11,9 @@ import net.ess3.storage.StorageObject; public class Back implements StorageObject { @Comment( - { - "Do you want essentials to keep track of previous location for /back in the teleport listener?", - "If you set this to true any plugin that uses teleport will have the previous location registered." - }) + { + "Do you want essentials to keep track of previous location for /back in the teleport listener?", + "If you set this to true any plugin that uses teleport will have the previous location registered." + }) private boolean registerBackInListener = false; } diff --git a/Essentials/src/net/ess3/settings/commands/Help.java b/Essentials/src/net/ess3/settings/commands/Help.java index 585426dce..77eeacb55 100644 --- a/Essentials/src/net/ess3/settings/commands/Help.java +++ b/Essentials/src/net/ess3/settings/commands/Help.java @@ -13,11 +13,11 @@ public class Help implements StorageObject @Comment("Show other plugins commands in help") private boolean showNonEssCommandsInHelp = true; @Comment( - { - "Hide plugins which don't give a permission in their plugin.yml for each command.", - "You can override a true value here for a single plugin by adding a permission to a user/group.", - "The individual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.", - "You can use negative permissions to remove access to just a single plugins help if the following is enabled." - }) + { + "Hide plugins which don't give a permission in their plugin.yml for each command.", + "You can override a true value here for a single plugin by adding a permission to a user/group.", + "The individual permission is: essentials.help.<plugin>, anyone with essentials.* or '*' will see all help this setting reguardless.", + "You can use negative permissions to remove access to just a single plugins help if the following is enabled." + }) private boolean hidePermissionlessCommands = true; } diff --git a/Essentials/src/net/ess3/settings/commands/Home.java b/Essentials/src/net/ess3/settings/commands/Home.java index 8b4c7356b..2ef08fe1f 100644 --- a/Essentials/src/net/ess3/settings/commands/Home.java +++ b/Essentials/src/net/ess3/settings/commands/Home.java @@ -13,11 +13,11 @@ public class Home implements StorageObject @Comment("When players die, should they respawn at their homes, instead of the spawnpoint?") private boolean respawnAtHome = false; @Comment( - { - "When a player interacts with a bed, should their home be set to that location?", - "If you enable this and remove default player access to the /sethome command, ", - "you can make beds the only way for players to set their home location." - }) + { + "When a player interacts with a bed, should their home be set to that location?", + "If you enable this and remove default player access to the /sethome command, ", + "you can make beds the only way for players to set their home location." + }) private boolean bedSetsHome = false; @Comment("If no home is set, should the player be send to spawn, when /home is used.") private boolean spawnIfNoHome = false; diff --git a/Essentials/src/net/ess3/settings/commands/List.java b/Essentials/src/net/ess3/settings/commands/List.java index ea47d9115..e2b869aaf 100644 --- a/Essentials/src/net/ess3/settings/commands/List.java +++ b/Essentials/src/net/ess3/settings/commands/List.java @@ -1,5 +1,6 @@ package net.ess3.settings.commands; + import lombok.Data; import lombok.EqualsAndHashCode; import net.ess3.storage.Comment; diff --git a/Essentials/src/net/ess3/settings/commands/SocialSpy.java b/Essentials/src/net/ess3/settings/commands/SocialSpy.java index 9cb572689..4460c0cfd 100644 --- a/Essentials/src/net/ess3/settings/commands/SocialSpy.java +++ b/Essentials/src/net/ess3/settings/commands/SocialSpy.java @@ -21,6 +21,7 @@ public class SocialSpy implements StorageObject socialspyCommands.addAll(Arrays.asList("msg", "r", "mail", "m", "t", "emsg", "tell", "er", "reply", "ereply", "email")); } } + @ListType @Comment("Commands to listen for in socialspy") private List<String> socialspyCommands = new ArrayList<String>(); diff --git a/Essentials/src/net/ess3/settings/commands/Speed.java b/Essentials/src/net/ess3/settings/commands/Speed.java index b9e7a8988..295a6a1b3 100644 --- a/Essentials/src/net/ess3/settings/commands/Speed.java +++ b/Essentials/src/net/ess3/settings/commands/Speed.java @@ -10,14 +10,9 @@ import net.ess3.storage.StorageObject; @EqualsAndHashCode(callSuper = false) public class Speed implements StorageObject { - @Comment( - { - "Set the max fly speed, values range from 0.2 to 1.0" - }) + @Comment({"Set the max fly speed, values range from 0.2 to 1.0"}) private double maxFlySpeed = 1.0f; - @Comment( - { - "Set the max walk speed, values range from 0.1 to 1.0" - }) + + @Comment({"Set the max walk speed, values range from 0.1 to 1.0"}) private double maxWalkSpeed = 0.8f; } diff --git a/Essentials/src/net/ess3/settings/commands/Teleport.java b/Essentials/src/net/ess3/settings/commands/Teleport.java index 71b41028d..ffa576410 100644 --- a/Essentials/src/net/ess3/settings/commands/Teleport.java +++ b/Essentials/src/net/ess3/settings/commands/Teleport.java @@ -11,20 +11,17 @@ import net.ess3.storage.StorageObject; public class Teleport implements StorageObject { @Comment( - { - "Set timeout in seconds for players to accept tpa before request is cancelled.", "Set to 0 for no timeout." - }) + { + "Set timeout in seconds for players to accept tpa before request is cancelled.", "Set to 0 for no timeout." + }) private int requestTimeout = 120; - @Comment( - { - "Cancels a request made by tpa / tphere on world change to prevent cross world tp" - }) + @Comment({"Cancels a request made by tpa / tphere on world change to prevent cross world tp"}) private boolean cancelRequestsOnWorldChange = false; @Comment( - { - "The delay, in seconds, a player can't be attacked by other players after he has been teleported by a command", - "This will also prevent that the player can attack other players" - }) + { + "The delay, in seconds, a player can't be attacked by other players after he has been teleported by a command", + "This will also prevent that the player can attack other players" + }) private long invulnerability = 0; public long getInvulnerability() diff --git a/Essentials/src/net/ess3/settings/protect/Prevent.java b/Essentials/src/net/ess3/settings/protect/Prevent.java index 524afe6f2..553776c9d 100644 --- a/Essentials/src/net/ess3/settings/protect/Prevent.java +++ b/Essentials/src/net/ess3/settings/protect/Prevent.java @@ -10,6 +10,7 @@ import net.ess3.storage.StorageObject; @EqualsAndHashCode(callSuper = false) public class Prevent implements StorageObject { + private boolean lavaFlow = false; private boolean waterFlow = false; // private boolean waterbucketFlow = false; TODO: Test if this still works @@ -29,8 +30,8 @@ public class Prevent implements StorageObject private boolean endermanPickup = false; private boolean villagerDeath = false; @Comment( - { - "Monsters won't follow players", "permission essentials.protect.entitytarget.bypass disables this" - }) + { + "Monsters won't follow players", "permission essentials.protect.entitytarget.bypass disables this" + }) private boolean entitytarget = false; }
\ No newline at end of file diff --git a/Essentials/src/net/ess3/settings/protect/Protect.java b/Essentials/src/net/ess3/settings/protect/Protect.java index 420c5028e..ff4af10ff 100644 --- a/Essentials/src/net/ess3/settings/protect/Protect.java +++ b/Essentials/src/net/ess3/settings/protect/Protect.java @@ -13,13 +13,15 @@ public class Protect implements StorageObject @Comment("General physics/behavior modifications") private Prevent prevent = new Prevent(); @Comment( - { - "Maximum height the creeper should explode. -1 allows them to explode everywhere.", - "Set prevent.creeper-explosion to true, if you want to disable creeper explosions." - }) + { + "Maximum height the creeper should explode. -1 allows them to explode everywhere.", + "Set prevent.creeper-explosion to true, if you want to disable creeper explosions." + }) private int creeperMaxHeight = -1; + @Comment("Disable weather options") private boolean disableStorm = false; private boolean disableThunder = false; private boolean disableLighting = false; + } diff --git a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java index 714138349..b38f5750b 100644 --- a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java +++ b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java @@ -11,8 +11,8 @@ import org.bukkit.Bukkit; public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> implements Runnable { - private final Class<T> clazz; - private final IEssentials ess; + private final transient Class<T> clazz; + private final transient IEssentials ess; public AbstractDelayedYamlFileReader(final IEssentials ess, final Class<T> clazz) { diff --git a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java index ade8eeb93..2a74c4cd5 100644 --- a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java +++ b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java @@ -11,8 +11,8 @@ import org.bukkit.Bukkit; public abstract class AbstractDelayedYamlFileWriter implements Runnable { - private final IEssentials ess; - private final ReentrantLock lock = new ReentrantLock(); // TODO: Needed? + private final transient IEssentials ess; + private final transient ReentrantLock lock = new ReentrantLock(); // TODO: Needed? public AbstractDelayedYamlFileWriter(final IEssentials ess) { diff --git a/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java b/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java index b4a82b2bc..d4239db8e 100644 --- a/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java +++ b/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java @@ -10,14 +10,14 @@ import org.bukkit.Bukkit; public abstract class AsyncStorageObjectHolder<T extends StorageObject> implements IStorageObjectHolder<T> { - private T data; - private final Class<T> clazz; - protected final IEssentials ess; - private final StorageObjectDataWriter writer; - private final StorageObjectDataReader reader; - private final AtomicBoolean loaded = new AtomicBoolean(false); + private transient T data; + private final transient Class<T> clazz; + protected final transient IEssentials ess; + private final transient StorageObjectDataWriter writer; + private final transient StorageObjectDataReader reader; + private final transient AtomicBoolean loaded = new AtomicBoolean(false); private volatile long savetime = 0; - private final File file; + private final transient File file; public AsyncStorageObjectHolder(final IEssentials ess, final Class<T> clazz, final File file) { diff --git a/Essentials/src/net/ess3/storage/BukkitConstructor.java b/Essentials/src/net/ess3/storage/BukkitConstructor.java index 666c07931..89f20cdf8 100644 --- a/Essentials/src/net/ess3/storage/BukkitConstructor.java +++ b/Essentials/src/net/ess3/storage/BukkitConstructor.java @@ -21,9 +21,9 @@ import org.yaml.snakeyaml.nodes.*; public class BukkitConstructor extends Constructor { - private final Pattern DATAPATTERN = Pattern.compile("[:+',;.]"); - private final Pattern WORD = Pattern.compile("\\W"); - private final IPlugin plugin; + private final transient Pattern DATAPATTERN = Pattern.compile("[:+',;.]"); + private final transient Pattern WORD = Pattern.compile("\\W"); + private final transient IPlugin plugin; public BukkitConstructor(final Class<?> clazz, final IPlugin plugin) { diff --git a/Essentials/src/net/ess3/storage/ManagedFile.java b/Essentials/src/net/ess3/storage/ManagedFile.java index 90429968a..0c3def687 100644 --- a/Essentials/src/net/ess3/storage/ManagedFile.java +++ b/Essentials/src/net/ess3/storage/ManagedFile.java @@ -18,7 +18,7 @@ import org.bukkit.Bukkit; public class ManagedFile { private final static int BUFFERSIZE = 1024 * 8; - private final File file; + private final transient File file; public ManagedFile(final String filename, final IEssentials ess) { diff --git a/Essentials/src/net/ess3/storage/StorageObjectMap.java b/Essentials/src/net/ess3/storage/StorageObjectMap.java index aeaf14892..bb7894b51 100644 --- a/Essentials/src/net/ess3/storage/StorageObjectMap.java +++ b/Essentials/src/net/ess3/storage/StorageObjectMap.java @@ -26,11 +26,11 @@ import org.apache.commons.io.IOUtils; public abstract class StorageObjectMap<I> extends CacheLoader<String, I> implements IStorageObjectMap<I> { - protected final IEssentials ess; - private final File folder; - protected final Cache<String, I> cache = CacheBuilder.newBuilder().softValues().build(this); - protected final ConcurrentSkipListSet<String> keys = new ConcurrentSkipListSet<String>(); - protected final ConcurrentSkipListMap<String, File> zippedfiles = new ConcurrentSkipListMap<String, File>(); + protected final transient IEssentials ess; + private final transient File folder; + protected final transient Cache<String, I> cache = CacheBuilder.newBuilder().softValues().build(this); + protected final transient ConcurrentSkipListSet<String> keys = new ConcurrentSkipListSet<String>(); + protected final transient ConcurrentSkipListMap<String, File> zippedfiles = new ConcurrentSkipListMap<String, File>(); private final Pattern zipCheck = Pattern.compile("^[a-zA-Z0-9]*-?[a-zA-Z0-9]+\\.yml$"); public StorageObjectMap(final IEssentials ess, final String folderName) diff --git a/Essentials/src/net/ess3/storage/StorageQueue.java b/Essentials/src/net/ess3/storage/StorageQueue.java index d602ad84e..5084ba82f 100644 --- a/Essentials/src/net/ess3/storage/StorageQueue.java +++ b/Essentials/src/net/ess3/storage/StorageQueue.java @@ -15,7 +15,7 @@ public class StorageQueue implements Runnable private DelayQueue<WriteRequest> queue = new DelayQueue<WriteRequest>(); public final static long DELAY = TimeUnit.NANOSECONDS.convert(1, TimeUnit.SECONDS); private final AtomicBoolean enabled = new AtomicBoolean(false); - private final Object lock = new Object(); + private final transient Object lock = new Object(); private final IPlugin plugin; public StorageQueue(IPlugin plugin) diff --git a/Essentials/src/net/ess3/storage/YamlStorageReader.java b/Essentials/src/net/ess3/storage/YamlStorageReader.java index 0cb0197b0..f49a0b5a2 100644 --- a/Essentials/src/net/ess3/storage/YamlStorageReader.java +++ b/Essentials/src/net/ess3/storage/YamlStorageReader.java @@ -13,10 +13,10 @@ import org.yaml.snakeyaml.introspector.BeanAccess; public class YamlStorageReader implements IStorageReader { - private static final Map<Class<?>, Yaml> PREPARED_YAMLS = Collections.synchronizedMap(new HashMap<Class<?>, Yaml>()); - private static final Map<Class<?>, ReentrantLock> LOCKS = new HashMap<Class<?>, ReentrantLock>(); - private final Reader reader; - private final IPlugin plugin; + private transient static final Map<Class<?>, Yaml> PREPARED_YAMLS = Collections.synchronizedMap(new HashMap<Class<?>, Yaml>()); + private transient static final Map<Class<?>, ReentrantLock> LOCKS = new HashMap<Class<?>, ReentrantLock>(); + private transient final Reader reader; + private transient final IPlugin plugin; public YamlStorageReader(final Reader reader, final IPlugin plugin) { diff --git a/Essentials/src/net/ess3/storage/YamlStorageWriter.java b/Essentials/src/net/ess3/storage/YamlStorageWriter.java index 2591af79c..e5de1460b 100644 --- a/Essentials/src/net/ess3/storage/YamlStorageWriter.java +++ b/Essentials/src/net/ess3/storage/YamlStorageWriter.java @@ -20,9 +20,9 @@ import org.yaml.snakeyaml.Yaml; public class YamlStorageWriter implements IStorageWriter { - private static final Pattern NON_WORD_PATTERN = Pattern.compile("\\W"); - private final PrintWriter writer; - private static final Yaml YAML = new Yaml(); + private transient static final Pattern NON_WORD_PATTERN = Pattern.compile("\\W"); + private transient final PrintWriter writer; + private transient static final Yaml YAML = new Yaml(); public YamlStorageWriter(final PrintWriter writer) { @@ -51,7 +51,7 @@ public class YamlStorageWriter implements IStorageWriter for (Field field : clazz.getDeclaredFields()) { final int modifier = field.getModifiers(); - if (Modifier.isPrivate(modifier) && !Modifier.isStatic(modifier)) + if (Modifier.isPrivate(modifier) && !Modifier.isTransient(modifier) && !Modifier.isStatic(modifier)) { field.setAccessible(true); diff --git a/Essentials/src/net/ess3/user/CooldownException.java b/Essentials/src/net/ess3/user/CooldownException.java index 2cd9ac543..08e163522 100644 --- a/Essentials/src/net/ess3/user/CooldownException.java +++ b/Essentials/src/net/ess3/user/CooldownException.java @@ -3,10 +3,12 @@ package net.ess3.user; public class CooldownException extends Exception { + private static final long serialVersionUID = 913632836257457319L; public CooldownException(String timeLeft) { super(timeLeft); } + } diff --git a/Essentials/src/net/ess3/user/IOfflinePlayer.java b/Essentials/src/net/ess3/user/IOfflinePlayer.java index 97a9ade5a..d520ce833 100644 --- a/Essentials/src/net/ess3/user/IOfflinePlayer.java +++ b/Essentials/src/net/ess3/user/IOfflinePlayer.java @@ -10,6 +10,7 @@ public interface IOfflinePlayer String getDisplayName(); //Location getBedSpawnLocation(); + void setBanned(boolean bln); boolean hasPermission(Permission perm); diff --git a/Essentials/src/net/ess3/user/IOfflineUser.java b/Essentials/src/net/ess3/user/IOfflineUser.java index 237569825..b5361da4f 100644 --- a/Essentials/src/net/ess3/user/IOfflineUser.java +++ b/Essentials/src/net/ess3/user/IOfflineUser.java @@ -5,4 +5,5 @@ import net.ess3.storage.IStorageObjectHolder; public interface IOfflineUser extends IStorageObjectHolder<UserData>//, IOfflinePlayer { + } diff --git a/Essentials/src/net/ess3/user/PlayerNotFoundException.java b/Essentials/src/net/ess3/user/PlayerNotFoundException.java index 6817a7847..2c3c741c1 100644 --- a/Essentials/src/net/ess3/user/PlayerNotFoundException.java +++ b/Essentials/src/net/ess3/user/PlayerNotFoundException.java @@ -5,6 +5,7 @@ import static net.ess3.I18n._; public class PlayerNotFoundException extends Exception { + private static final long serialVersionUID = -510752839980332640L; public PlayerNotFoundException() diff --git a/Essentials/src/net/ess3/user/User.java b/Essentials/src/net/ess3/user/User.java index 7a3aba0af..4fce959bf 100644 --- a/Essentials/src/net/ess3/user/User.java +++ b/Essentials/src/net/ess3/user/User.java @@ -31,22 +31,22 @@ public class User extends UserBase implements IUser { private CommandSender replyTo = null; @Getter - private IUser teleportRequester; + private transient IUser teleportRequester; @Getter - private boolean tpRequestHere; + private transient boolean tpRequestHere; @Getter - private final ITeleport teleport; + private transient final ITeleport teleport; @Getter - private long teleportRequestTime; + private transient long teleportRequestTime; @Getter @Setter - private long lastOnlineActivity; - private long lastActivity = System.currentTimeMillis(); + private transient long lastOnlineActivity; + private transient long lastActivity = System.currentTimeMillis(); /*@Getter @Setter private boolean hidden = false;*/ @Getter - private boolean vanished; + private transient boolean vanished; @Getter @Setter private boolean invSee = false; @@ -54,7 +54,7 @@ public class User extends UserBase implements IUser @Setter private boolean enderSee = false; private long lastThrottledAction; - private Location afkPosition; + private transient Location afkPosition; private AtomicBoolean gotMailInfo = new AtomicBoolean(false); private WeakReference<Player> playerCache; @Getter @@ -592,7 +592,8 @@ public class User extends UserBase implements IUser { return true; } - private long teleportInvulnerabilityTimestamp = 0; + + private transient long teleportInvulnerabilityTimestamp = 0; public void enableInvulnerabilityAfterTeleport() { @@ -634,7 +635,7 @@ public class User extends UserBase implements IUser } } ess.getVanishedPlayers().add(getName()); - if (Permissions.VANISH_EFFECT.isAuthorized(this)) + if(Permissions.VANISH_EFFECT.isAuthorized(this)) { getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false)); } @@ -646,7 +647,7 @@ public class User extends UserBase implements IUser p.showPlayer(getPlayer()); } ess.getVanishedPlayers().remove(getName()); - if (Permissions.VANISH_EFFECT.isAuthorized(this)) + if(Permissions.VANISH_EFFECT.isAuthorized(this)) { getPlayer().removePotionEffect(PotionEffectType.INVISIBILITY); } diff --git a/Essentials/src/net/ess3/user/UserData.java b/Essentials/src/net/ess3/user/UserData.java index 9b63fab2f..b9d684930 100644 --- a/Essentials/src/net/ess3/user/UserData.java +++ b/Essentials/src/net/ess3/user/UserData.java @@ -6,7 +6,6 @@ import net.ess3.storage.*; import org.bukkit.Location; import org.bukkit.Material; - @Data @EqualsAndHashCode(callSuper = false) public class UserData implements StorageObject @@ -15,6 +14,8 @@ public class UserData implements StorageObject { JAIL, MUTE, LASTHEAL, LASTTELEPORT, LOGIN, LOGOUT, KIT, COMMAND } + + private String nickname; private Double money; @MapValueType(StoredLocation.class) @@ -26,6 +27,7 @@ public class UserData implements StorageObject { return homes == null ? Collections.<String, StoredLocation>emptyMap() : Collections.unmodifiableMap(homes); } + @ListType(Material.class) @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) @@ -35,6 +37,7 @@ public class UserData implements StorageObject { return unlimited == null ? Collections.<Material>emptySet() : Collections.unmodifiableSet(unlimited); } + @MapValueType(List.class) @MapKeyType(Material.class) @Getter(AccessLevel.NONE) @@ -45,6 +48,7 @@ public class UserData implements StorageObject { return powerTools == null ? Collections.<Material, List<String>>emptyMap() : Collections.unmodifiableMap(powerTools); } + private StoredLocation lastLocation; @MapKeyType(String.class) @MapValueType(Long.class) @@ -56,6 +60,7 @@ public class UserData implements StorageObject { return timestamps == null ? Collections.<String, Long>emptyMap() : Collections.unmodifiableMap(timestamps); } + private String jail; @ListType @Getter(AccessLevel.NONE) @@ -66,6 +71,7 @@ public class UserData implements StorageObject { return mails == null ? Collections.<String>emptyList() : Collections.unmodifiableList(mails); } + private Inventory inventory; private boolean teleportEnabled; @ListType @@ -77,6 +83,7 @@ public class UserData implements StorageObject { return ignore == null ? Collections.<String>emptySet() : Collections.unmodifiableSet(ignore); } + private boolean godmode; private boolean muted; private boolean jailed; diff --git a/Essentials/src/net/ess3/user/UserMap.java b/Essentials/src/net/ess3/user/UserMap.java index 9df31e543..c83047f0c 100644 --- a/Essentials/src/net/ess3/user/UserMap.java +++ b/Essentials/src/net/ess3/user/UserMap.java @@ -141,6 +141,7 @@ public class UserMap extends StorageObjectMap<IUser> implements IUserMap { return matchUsers(name, false, false, requester); } + private final Pattern comma = Pattern.compile(","); public Set<IUser> matchUsers(final String name, final boolean includeHidden, final boolean includeOffline, final Player requester) diff --git a/Essentials/src/net/ess3/utils/DateUtil.java b/Essentials/src/net/ess3/utils/DateUtil.java index baf850034..2a38fd7a4 100644 --- a/Essentials/src/net/ess3/utils/DateUtil.java +++ b/Essentials/src/net/ess3/utils/DateUtil.java @@ -30,13 +30,11 @@ public class DateUtil } StringBuilder sb = new StringBuilder(); - int[] types = new int[] - { - Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND + int[] types = new int[]{ + Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND }; - String[] names = new String[] - { - _("year"), _("years"), _("month"), _("months"), _("day"), _("days"), _("hour"), _("hours"), _("minute"), _("minutes"), _("second"), _("seconds") + String[] names = new String[]{ + _("year"), _("years"), _("month"), _("months"), _("day"), _("days"), _("hour"), _("hours"), _("minute"), _("minutes"), _("second"), _("seconds") }; for (int i = 0; i < types.length; i++) { diff --git a/Essentials/src/net/ess3/utils/ExecuteTimer.java b/Essentials/src/net/ess3/utils/ExecuteTimer.java index 97b4174d9..012ab9296 100644 --- a/Essentials/src/net/ess3/utils/ExecuteTimer.java +++ b/Essentials/src/net/ess3/utils/ExecuteTimer.java @@ -9,8 +9,9 @@ import java.util.Locale; public class ExecuteTimer { - private final List<ExecuteRecord> times; - private final DecimalFormat decimalFormat = new DecimalFormat("#0.000", DecimalFormatSymbols.getInstance(Locale.US)); + private final transient List<ExecuteRecord> times; + private final transient DecimalFormat decimalFormat = new DecimalFormat("#0.000", DecimalFormatSymbols.getInstance(Locale.US)); + public ExecuteTimer() { diff --git a/Essentials/src/net/ess3/utils/FormatUtil.java b/Essentials/src/net/ess3/utils/FormatUtil.java index bbc690e79..4cba2a71b 100644 --- a/Essentials/src/net/ess3/utils/FormatUtil.java +++ b/Essentials/src/net/ess3/utils/FormatUtil.java @@ -13,15 +13,15 @@ import net.ess3.permissions.DotStarPermission; public class FormatUtil { - static final Pattern REPLACE_COLOR_PATTERN = Pattern.compile("&([0-9a-f])"); - static final Pattern REPLACE_MAGIC_PATTERN = Pattern.compile("&(k)"); - static final Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])"); - static final Pattern VANILLA_PATTERN = Pattern.compile("\u00a7+[0-9A-FK-ORa-fk-or]"); - static final Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00a7+[0-9A-Fa-f]"); - static final Pattern REPLACE_FORMAT_PATTERN = Pattern.compile("&([l-or])"); - static final Pattern VANILLA_FORMAT_PATTERN = Pattern.compile("\u00a7+[L-ORl-or]"); - static final Pattern VANILLA_MAGIC_PATTERN = Pattern.compile("\u00a7+[Kk]"); - static final Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)"); + static final transient Pattern REPLACE_COLOR_PATTERN = Pattern.compile("&([0-9a-f])"); + static final transient Pattern REPLACE_MAGIC_PATTERN = Pattern.compile("&(k)"); + static final transient Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])"); + static final transient Pattern VANILLA_PATTERN = Pattern.compile("\u00a7+[0-9A-FK-ORa-fk-or]"); + static final transient Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00a7+[0-9A-Fa-f]"); + static final transient Pattern REPLACE_FORMAT_PATTERN = Pattern.compile("&([l-or])"); + static final transient Pattern VANILLA_FORMAT_PATTERN = Pattern.compile("\u00a7+[L-ORl-or]"); + static final transient Pattern VANILLA_MAGIC_PATTERN = Pattern.compile("\u00a7+[Kk]"); + static final transient Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)"); static DecimalFormat dFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US)); static String stripColor(final String input, final Pattern pattern) diff --git a/Essentials/src/net/ess3/utils/LocationUtil.java b/Essentials/src/net/ess3/utils/LocationUtil.java index 64fa71f78..5d2af4000 100644 --- a/Essentials/src/net/ess3/utils/LocationUtil.java +++ b/Essentials/src/net/ess3/utils/LocationUtil.java @@ -69,6 +69,7 @@ public class LocationUtil } return block.getLocation(); } + public final static int RADIUS = 3; public final static Vector3D[] VOLUME; @@ -81,11 +82,13 @@ public class LocationUtil this.y = y; this.z = z; } + public int x; public int y; public int z; } + static { List<Vector3D> pos = new ArrayList<Vector3D>(); @@ -210,7 +213,7 @@ public class LocationUtil } if ((!AIR_MATERIALS.contains(world.getBlockAt(x, y, z).getType().getId())) || (!AIR_MATERIALS.contains( - world.getBlockAt(x, y + 1, z).getType().getId()))) + world.getBlockAt(x, y + 1, z).getType().getId()))) { return true; } diff --git a/Essentials/src/net/ess3/utils/Target.java b/Essentials/src/net/ess3/utils/Target.java index 04fa17e1f..6e871a051 100644 --- a/Essentials/src/net/ess3/utils/Target.java +++ b/Essentials/src/net/ess3/utils/Target.java @@ -30,3 +30,4 @@ public class Target return location; } } + diff --git a/Essentials/src/net/ess3/utils/Util.java b/Essentials/src/net/ess3/utils/Util.java index 6f93b0909..0817448bd 100644 --- a/Essentials/src/net/ess3/utils/Util.java +++ b/Essentials/src/net/ess3/utils/Util.java @@ -16,6 +16,7 @@ public final class Util private Util() { } + private final static Pattern INVALIDFILECHARS = Pattern.compile("[^\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]"); private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]"); @@ -81,7 +82,7 @@ public final class Util public static ItemStack convertBlockToItem(final Block block) { final ItemStack is = new ItemStack(block.getType(), 1, block.getData()); - + final short durability = 0; switch (is.getType()) @@ -214,4 +215,5 @@ public final class Util } return buf.toString(); } + } diff --git a/Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java b/Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java index c1946c84f..ee72d36df 100644 --- a/Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java +++ b/Essentials/src/net/ess3/utils/gnu/inet/encoding/Punycode.java @@ -2,26 +2,38 @@ package net.ess3.utils.gnu.inet.encoding; /** - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software + * Foundation, Inc. * * Author: Oliver Hitz * * This file is part of GNU Libidn. * - * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General - * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - * details. + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA */ + + /** - * This class offers static methods for encoding/decoding strings using the Punycode algorithm. <ul> <li>RFC3492 - * Punycode </ul> Note that this implementation only supports 16-bit Unicode code points. + * This class offers static methods for encoding/decoding strings + * using the Punycode algorithm. + * <ul> + * <li>RFC3492 Punycode + * </ul> + * Note that this implementation only supports 16-bit Unicode code + * points. */ /* * Changes by snowleo: @@ -112,7 +124,7 @@ public class Punycode { int q = delta; - for (int k = BASE;; k += BASE) + for (int k = BASE; ; k += BASE) { int t; if (k <= bias) @@ -191,7 +203,7 @@ public class Punycode int oldi = i; int w = 1; - for (int k = BASE;; k += BASE) + for (int k = BASE; ; k += BASE) { if (d == input.length()) { diff --git a/Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java b/Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java index fb1f3d0ce..7e4da7d79 100644 --- a/Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java +++ b/Essentials/src/net/ess3/utils/gnu/inet/encoding/PunycodeException.java @@ -2,23 +2,30 @@ package net.ess3.utils.gnu.inet.encoding; /** - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software + * Foundation, Inc. * * Author: Oliver Hitz * * This file is part of GNU Libidn. * - * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General - * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more - * details. + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA */ + + /** * Exception handling for Punycode class. */ diff --git a/Essentials/src/net/ess3/utils/textreader/ArrayListInput.java b/Essentials/src/net/ess3/utils/textreader/ArrayListInput.java index 31b1ac991..9fdc87c9b 100644 --- a/Essentials/src/net/ess3/utils/textreader/ArrayListInput.java +++ b/Essentials/src/net/ess3/utils/textreader/ArrayListInput.java @@ -8,7 +8,7 @@ import java.util.Map; public class ArrayListInput implements IText { - private final List<String> lines = new ArrayList<String>(); + private final transient List<String> lines = new ArrayList<String>(); @Override public List<String> getLines() @@ -27,4 +27,5 @@ public class ArrayListInput implements IText { return Collections.emptyMap(); } + } diff --git a/Essentials/src/net/ess3/utils/textreader/HelpInput.java b/Essentials/src/net/ess3/utils/textreader/HelpInput.java index 44215c17f..e6510a2e3 100644 --- a/Essentials/src/net/ess3/utils/textreader/HelpInput.java +++ b/Essentials/src/net/ess3/utils/textreader/HelpInput.java @@ -18,9 +18,9 @@ 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 List<String> lines = new ArrayList<String>(); - private final List<String> chapters = new ArrayList<String>(); - private final Map<String, Integer> bookmarks = new HashMap<String, Integer>(); + 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 IUser user, final String match, final IEssentials ess) throws IOException @@ -56,8 +56,8 @@ public class HelpInput implements IText try { if (!match.equalsIgnoreCase("") && (!pluginNameLow.contains(match)) && (!k.getKey().toLowerCase(Locale.ENGLISH).contains( - match)) && (!(k.getValue().get(DESCRIPTION) instanceof String && ((String)k.getValue().get(DESCRIPTION)).toLowerCase( - Locale.ENGLISH).contains(match)))) + match)) && (!(k.getValue().get(DESCRIPTION) instanceof String && ((String)k.getValue().get(DESCRIPTION)).toLowerCase( + Locale.ENGLISH).contains(match)))) { continue; } diff --git a/Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java b/Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java index 1194aa266..22466e0ac 100644 --- a/Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java +++ b/Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java @@ -17,9 +17,9 @@ import org.bukkit.plugin.Plugin; public class KeywordReplacer implements IText { - private final IText input; - private final List<String> replaced; - private final IEssentials ess; + private final transient IText input; + private final transient List<String> replaced; + private final transient IEssentials ess; public KeywordReplacer(final IText input, final CommandSender sender, final IEssentials ess) { @@ -34,15 +34,15 @@ public class KeywordReplacer implements IText String displayName, ipAddress, balance, mails, world; String worlds, online, unique, playerlist, date, time; String worldTime12, worldTime24, worldDate, plugins; - String version; + String userName, address, version; //TODO: unused? if (sender instanceof IUser) { final IUser user = (IUser)sender; final Player player = user.getPlayer(); displayName = player.getDisplayName(); - String userName = player.getName(); //TODO: unused + userName = player.getName(); ipAddress = player.getAddress() == null || player.getAddress().getAddress() == null ? "" : player.getAddress().getAddress().toString(); - String address = player.getAddress() == null ? "" : player.getAddress().toString(); // TODO: unused + address = player.getAddress() == null ? "" : player.getAddress().toString(); balance = FormatUtil.displayCurrency(user.getMoney(), ess); mails = Integer.toString(user.getData().getMails() == null ? 0 : user.getData().getMails().size()); world = player.getLocation() == null || player.getLocation().getWorld() == null ? "" : player.getLocation().getWorld().getName(); diff --git a/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java b/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java index 6ef3731c1..03405df29 100644 --- a/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java +++ b/Essentials/src/net/ess3/utils/textreader/SimpleTextInput.java @@ -8,7 +8,7 @@ import java.util.Map; public class SimpleTextInput implements IText { - private final List<String> lines = new ArrayList<String>(); + private final transient List<String> lines = new ArrayList<String>(); public SimpleTextInput(final String input) { @@ -32,4 +32,5 @@ public class SimpleTextInput implements IText { return Collections.emptyMap(); } + } diff --git a/Essentials/src/net/ess3/utils/textreader/SimpleTextPager.java b/Essentials/src/net/ess3/utils/textreader/SimpleTextPager.java index 0b850b509..ea70010b6 100644 --- a/Essentials/src/net/ess3/utils/textreader/SimpleTextPager.java +++ b/Essentials/src/net/ess3/utils/textreader/SimpleTextPager.java @@ -5,7 +5,7 @@ import org.bukkit.command.CommandSender; public class SimpleTextPager { - private final IText text; + private final transient IText text; public SimpleTextPager(final IText text) { diff --git a/Essentials/src/net/ess3/utils/textreader/TextInput.java b/Essentials/src/net/ess3/utils/textreader/TextInput.java index 090afd948..ca38cd528 100644 --- a/Essentials/src/net/ess3/utils/textreader/TextInput.java +++ b/Essentials/src/net/ess3/utils/textreader/TextInput.java @@ -13,10 +13,10 @@ import org.bukkit.command.CommandSender; public class TextInput implements IText { - private final List<String> lines; - private final List<String> chapters; - private final Map<String, Integer> bookmarks; - private final long lastChange; + 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 CommandSender sender, final String filename, final boolean createFile, final IEssentials ess) throws IOException diff --git a/Essentials/src/net/ess3/utils/textreader/TextPager.java b/Essentials/src/net/ess3/utils/textreader/TextPager.java index 965bb0d2f..88f00125c 100644 --- a/Essentials/src/net/ess3/utils/textreader/TextPager.java +++ b/Essentials/src/net/ess3/utils/textreader/TextPager.java @@ -10,8 +10,8 @@ import org.bukkit.command.CommandSender; public class TextPager { - private final IText text; - private final boolean onePage; + private final transient IText text; + private final transient boolean onePage; public TextPager(final IText text) { diff --git a/Essentials/test/net/ess3/EssentialsTest.java b/Essentials/test/net/ess3/EssentialsTest.java index cedfa3cb6..0daa06abf 100644 --- a/Essentials/test/net/ess3/EssentialsTest.java +++ b/Essentials/test/net/ess3/EssentialsTest.java @@ -23,12 +23,12 @@ import org.mockito.stubbing.Answer; public abstract class EssentialsTest extends TestCase { - protected final Server server; - protected final IPlugin plugin; - protected final World world; - protected final Logger logger; - protected final Essentials ess; - protected final List<Player> playerList; + protected final transient Server server; + protected final transient IPlugin plugin; + protected final transient World world; + protected final transient Logger logger; + protected final transient Essentials ess; + protected final transient List<Player> playerList; public EssentialsTest(final String testName) { diff --git a/Essentials/test/net/ess3/StorageTest.java b/Essentials/test/net/ess3/StorageTest.java index 4c96a165b..4ca05d9a8 100644 --- a/Essentials/test/net/ess3/StorageTest.java +++ b/Essentials/test/net/ess3/StorageTest.java @@ -155,28 +155,28 @@ public class StorageTest extends EssentialsTest } /*@Test - public void testOldUserdata() - { - ExecuteTimer ext = new ExecuteTimer(); - ext.start(); - OfflinePlayer base1 = server.createPlayer("testPlayer1", ess); - server.addPlayer(base1); - ext.mark("fake user created"); - UserData user = (UserData)ess.getUserMap().getUser(base1); - ext.mark("load empty user"); - for (int j = 0; j < 1; j++) - { - user.setHome("home", new Location(world, j, j, j)); - } - ext.mark("change home 1 times"); - user.save(); - ext.mark("write user"); - user.save(); - ext.mark("write user (cached)"); - user.reloadConfig(); - ext.mark("reloaded file"); - user.reloadConfig(); - ext.mark("reloaded file (cached)"); - System.out.println(ext.end()); - }*/ + public void testOldUserdata() + { + ExecuteTimer ext = new ExecuteTimer(); + ext.start(); + OfflinePlayer base1 = server.createPlayer("testPlayer1", ess); + server.addPlayer(base1); + ext.mark("fake user created"); + UserData user = (UserData)ess.getUserMap().getUser(base1); + ext.mark("load empty user"); + for (int j = 0; j < 1; j++) + { + user.setHome("home", new Location(world, j, j, j)); + } + ext.mark("change home 1 times"); + user.save(); + ext.mark("write user"); + user.save(); + ext.mark("write user (cached)"); + user.reloadConfig(); + ext.mark("reloaded file"); + user.reloadConfig(); + ext.mark("reloaded file (cached)"); + System.out.println(ext.end()); + }*/ } diff --git a/Essentials/test/net/ess3/UserTest.java b/Essentials/test/net/ess3/UserTest.java index f4c58ad44..ba26e1c6e 100644 --- a/Essentials/test/net/ess3/UserTest.java +++ b/Essentials/test/net/ess3/UserTest.java @@ -21,48 +21,49 @@ public class UserTest extends EssentialsTest } /*public void testUpdate() - { - OfflinePlayer base1alt = server.createPlayer(base1.getName(), ess); - assertEquals(base1alt, ess.getUserMap().getUser(base1alt).getBase()); - } + { + OfflinePlayer base1alt = server.createPlayer(base1.getName(), ess); + assertEquals(base1alt, ess.getUserMap().getUser(base1alt).getBase()); + } - public void testHome() - { - IUser user = ess.getUserMap().getUser(base1); - Location loc = base1.getLocation(); - user.setHome(); - OfflinePlayer base2 = server.createPlayer(base1.getName(), ess); - IUser user2 = ess.getUserMap().getUser(base2); + public void testHome() + { + IUser user = ess.getUserMap().getUser(base1); + Location loc = base1.getLocation(); + user.setHome(); + OfflinePlayer base2 = server.createPlayer(base1.getName(), ess); + IUser user2 = ess.getUserMap().getUser(base2); - Location home = user2.getHome(loc); - assertNotNull(home); - assertEquals(loc.getWorld().getName(), home.getWorld().getName()); - assertEquals(loc.getX(), home.getX()); - assertEquals(loc.getY(), home.getY()); - assertEquals(loc.getZ(), home.getZ()); - assertEquals(loc.getYaw(), home.getYaw()); - assertEquals(loc.getPitch(), home.getPitch()); - }*/ + Location home = user2.getHome(loc); + assertNotNull(home); + assertEquals(loc.getWorld().getName(), home.getWorld().getName()); + assertEquals(loc.getX(), home.getX()); + assertEquals(loc.getY(), home.getY()); + assertEquals(loc.getZ(), home.getZ()); + assertEquals(loc.getYaw(), home.getYaw()); + assertEquals(loc.getPitch(), home.getPitch()); + }*/ /*public void testMoney() - { - should("properly set, take, give, and get money"); - IUser user = ess.getUserMap().getUser(base1); - double i; - user.setMoney(i = 100.5); - user.takeMoney(50); - i -= 50; - user.giveMoney(25); - i += 25; - assertEquals(user.getMoney(), i); - }*/ + { + should("properly set, take, give, and get money"); + IUser user = ess.getUserMap().getUser(base1); + double i; + user.setMoney(i = 100.5); + user.takeMoney(50); + i -= 50; + user.giveMoney(25); + i += 25; + assertEquals(user.getMoney(), i); + }*/ /*public void testGetGroup() - { - should("return the default group"); - IUser user = ess.getUserMap().getUser(base1); - //assertEquals(user.getGroup(), "default"); - }*/ + { + should("return the default group"); + IUser user = ess.getUserMap().getUser(base1); + //assertEquals(user.getGroup(), "default"); + }*/ + public void testNoop() { assertTrue(true); diff --git a/Essentials/test/net/ess3/UtilTest.java b/Essentials/test/net/ess3/UtilTest.java index bfa3f1e51..0364b68aa 100644 --- a/Essentials/test/net/ess3/UtilTest.java +++ b/Essentials/test/net/ess3/UtilTest.java @@ -11,6 +11,7 @@ import net.ess3.utils.Util; public class UtilTest extends EssentialsTest { + public UtilTest(String name) { super(name); diff --git a/Essentials2Compat/pom.xml b/Essentials2Compat/pom.xml index 74222b99e..81dc96ac8 100644 --- a/Essentials2Compat/pom.xml +++ b/Essentials2Compat/pom.xml @@ -1,20 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> + <parent> + <groupId>net.essentials3</groupId> + <artifactId>BuildAll</artifactId> + <version>3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <artifactId>Essentials2Compat</artifactId> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>Essentials</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> + <artifactId>Essentials2Compat</artifactId> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>Essentials</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> </project> diff --git a/Essentials2Compat/src/com/earth2me/essentials/Economy.java b/Essentials2Compat/src/com/earth2me/essentials/Economy.java index 2943fcf67..15f0045ac 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/Economy.java +++ b/Essentials2Compat/src/com/earth2me/essentials/Economy.java @@ -14,6 +14,7 @@ public final class Economy private Economy() { } + private static IEssentials ess; private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded."; @@ -37,10 +38,11 @@ public final class Economy /** * Sets the balance of a user * - * @param name Name of the user + * @param name Name of the user * @param balance The balance you want to set * @throws UserDoesNotExistException If a user by that name does not exists - * @throws net.ess3.api.NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws net.ess3.api.NoLoanPermittedException + * If the user is not allowed to have a negative balance */ public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException { @@ -54,10 +56,10 @@ public final class Economy /** * Adds money to the balance of a user * - * @param name Name of the user + * @param name Name of the user * @param amount The money you want to add * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException { @@ -68,10 +70,10 @@ public final class Economy /** * Substracts money from the balance of a user * - * @param name Name of the user + * @param name Name of the user * @param amount The money you want to substract * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException { @@ -82,10 +84,10 @@ public final class Economy /** * Divides the balance of a user by a value * - * @param name Name of the user + * @param name Name of the user * @param value The balance is divided by this value * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException { @@ -96,10 +98,10 @@ public final class Economy /** * Multiplies the balance of a user by a value * - * @param name Name of the user + * @param name Name of the user * @param value The balance is multiplied by this value * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException { @@ -112,7 +114,7 @@ public final class Economy * * @param name Name of the user * @throws UserDoesNotExistException If a user by that name does not exists - * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance */ public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException { @@ -124,7 +126,7 @@ public final class Economy } /** - * @param name Name of the user + * @param name Name of the user * @param amount The amount of money the user should have * @return true, if the user has more or an equal amount of money * @throws UserDoesNotExistException If a user by that name does not exists @@ -135,7 +137,7 @@ public final class Economy } /** - * @param name Name of the user + * @param name Name of the user * @param amount The amount of money the user should have * @return true, if the user has more money * @throws UserDoesNotExistException If a user by that name does not exists @@ -146,7 +148,7 @@ public final class Economy } /** - * @param name Name of the user + * @param name Name of the user * @param amount The amount of money the user should not have * @return true, if the user has less money * @throws UserDoesNotExistException If a user by that name does not exists diff --git a/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java b/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java index a76ebbe6c..073f45bf5 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java @@ -29,9 +29,9 @@ import net.ess3.storage.StoredLocation; public class EssentialsConf extends YamlConfiguration { private static final Logger LOGGER = Logger.getLogger("Minecraft"); - private File configFile; - private String templateName = null; - private Class<?> resourceClass = EssentialsConf.class; + private transient File configFile; + private transient String templateName = null; + private transient Class<?> resourceClass = EssentialsConf.class; private static final Charset UTF8 = Charset.forName("UTF-8"); public EssentialsConf(final File configFile) diff --git a/Essentials2Compat/src/com/earth2me/essentials/ISettings.java b/Essentials2Compat/src/com/earth2me/essentials/ISettings.java index dfd68f467..93fbd20b3 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/ISettings.java +++ b/Essentials2Compat/src/com/earth2me/essentials/ISettings.java @@ -1,5 +1,6 @@ package com.earth2me.essentials; + import java.util.List; import java.util.Map; import java.util.Set; @@ -23,6 +24,7 @@ public interface ISettings long getBackupInterval(); //MessageFormat getChatFormat(String group); + int getChatRadius(); double getCommandCost(String label); diff --git a/Essentials2Compat/src/com/earth2me/essentials/Settings.java b/Essentials2Compat/src/com/earth2me/essentials/Settings.java index bd8671c7b..a5f454916 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/Settings.java +++ b/Essentials2Compat/src/com/earth2me/essentials/Settings.java @@ -16,9 +16,9 @@ import org.bukkit.inventory.ItemStack; public final class Settings implements ISettings { - private final EssentialsConf config; + private final transient EssentialsConf config; private final static Logger logger = Logger.getLogger("Minecraft"); - private final IEssentials ess; + private final transient IEssentials ess; private boolean metricsEnabled = true; public Settings(IEssentials ess, File file) @@ -52,6 +52,7 @@ public final class Settings implements ISettings { return config.getInt("sethome-multiple." + set, config.getInt("sethome-multiple.default", 3)); } + private int chatRadius = 0; private int _getChatRadius() @@ -88,6 +89,7 @@ public final class Settings implements ISettings { return config.getInt("starting-balance", 0); } + private Set<String> disabledCommands = new HashSet<String>(); @Override @@ -140,8 +142,10 @@ public final class Settings implements ISettings } return config.getBoolean("override-" + name.toLowerCase(Locale.ENGLISH), false); } + private ConfigurationSection commandCosts; + public ConfigurationSection _getCommandCosts() { if (config.isConfigurationSection("command-costs")) @@ -174,6 +178,7 @@ public final class Settings implements ISettings } return 0.0; } + private String nicknamePrefix = "~"; private String _getNicknamePrefix() @@ -198,6 +203,7 @@ public final class Settings implements ISettings { return config.getDouble("heal-cooldown", 0); } + private ConfigurationSection kits; public ConfigurationSection _getKits() @@ -238,6 +244,7 @@ public final class Settings implements ISettings } return null; } + private ChatColor operatorColor = null; @Override @@ -311,29 +318,31 @@ public final class Settings implements ISettings { return config.getString("backup.command", null); } + private Map<String, MessageFormat> chatFormats = Collections.synchronizedMap(new HashMap<String, MessageFormat>()); /*@Override //TODO: implement this - public MessageFormat getChatFormat(String group) - { - MessageFormat mFormat = chatFormats.get(group); - if (mFormat == null) - { - String format = config.getString("chat.group-formats." + (group == null ? "Default" : group), - config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}")); - format = Util.replaceFormat(format); - format = format.replace("{DISPLAYNAME}", "%1$s"); - format = format.replace("{GROUP}", "{0}"); - format = format.replace("{MESSAGE}", "%2$s"); - format = format.replace("{WORLDNAME}", "{1}"); - format = format.replace("{SHORTWORLDNAME}", "{2}"); - format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]"); - format = "§r".concat(format); - mFormat = new MessageFormat(format); - chatFormats.put(group, mFormat); - } - return mFormat; - }*/ + public MessageFormat getChatFormat(String group) + { + MessageFormat mFormat = chatFormats.get(group); + if (mFormat == null) + { + String format = config.getString("chat.group-formats." + (group == null ? "Default" : group), + config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}")); + format = Util.replaceFormat(format); + format = format.replace("{DISPLAYNAME}", "%1$s"); + format = format.replace("{GROUP}", "{0}"); + format = format.replace("{MESSAGE}", "%2$s"); + format = format.replace("{WORLDNAME}", "{1}"); + format = format.replace("{SHORTWORLDNAME}", "{2}"); + format = format.replaceAll("\\{(\\D*?)\\}", "\\[$1\\]"); + format = "§r".concat(format); + mFormat = new MessageFormat(format); + chatFormats.put(group, mFormat); + } + return mFormat; + }*/ + public String getDefaultChatformat() { return config.getString("chat.format", "&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}"); @@ -375,6 +384,7 @@ public final class Settings implements ISettings return config.getBoolean("sort-list-by-groups", true); } + public void reloadConfig() { config.load(); @@ -405,6 +415,7 @@ public final class Settings implements ISettings warnOnBuildDisallow = _warnOnBuildDisallow(); mailsPerMinute = _getMailsPerMinute(); } + private List<Integer> itemSpawnBl = new ArrayList<Integer>(); @Override @@ -440,6 +451,7 @@ public final class Settings implements ISettings } return epItemSpwn; } + private List<String> enabledSigns = new ArrayList<String>(); private boolean signsEnabled = false; @@ -478,6 +490,7 @@ public final class Settings implements ISettings } return newSigns; } + private boolean warnOnBuildDisallow; private boolean _warnOnBuildDisallow() @@ -490,6 +503,7 @@ public final class Settings implements ISettings { return warnOnBuildDisallow; } + private boolean debug = false; private boolean configDebug = false; @@ -582,6 +596,7 @@ public final class Settings implements ISettings { return config.getBoolean(configName, def); } + private final static double MAXMONEY = 10000000000000.0; @Override @@ -594,6 +609,7 @@ public final class Settings implements ISettings } return max; } + private final static double MINMONEY = -10000000000000.0; @Override @@ -628,6 +644,7 @@ public final class Settings implements ISettings { return config.getBoolean("remove-god-on-disconnect", false); } + private boolean changeDisplayName = true; private boolean _changeDisplayName() @@ -640,6 +657,7 @@ public final class Settings implements ISettings { return changeDisplayName; } + private boolean changePlayerListName = false; private boolean _changePlayerListName() @@ -658,6 +676,7 @@ public final class Settings implements ISettings { return config.getBoolean("use-bukkit-permissions", false); } + private boolean prefixsuffixconfigured = false; private boolean addprefixsuffix = false; private boolean essentialsChatActive = false; @@ -683,6 +702,7 @@ public final class Settings implements ISettings { return prefixsuffixconfigured ? addprefixsuffix : essentialsChatActive; } + private boolean disablePrefix = false; private boolean _disablePrefix() @@ -695,6 +715,7 @@ public final class Settings implements ISettings { return disablePrefix; } + private boolean disableSuffix = false; private boolean _disableSuffix() @@ -719,6 +740,7 @@ public final class Settings implements ISettings { return config.getLong("auto-afk-kick", -1); } + private boolean getFreezeAfkPlayers; @Override @@ -731,6 +753,7 @@ public final class Settings implements ISettings { return config.getBoolean("freeze-afk-players", false); } + private boolean cancelAfkOnMove; @Override @@ -749,6 +772,7 @@ public final class Settings implements ISettings { return config.getBoolean("death-messages", true); } + private Set<String> noGodWorlds = new HashSet<String>(); @Override @@ -780,6 +804,7 @@ public final class Settings implements ISettings { return config.getBoolean("world-home-permissions", false); } + private boolean registerBackInListener; @Override @@ -792,6 +817,7 @@ public final class Settings implements ISettings { return config.getBoolean("register-back-in-listener", false); } + private boolean disableItemPickupWhileAfk; @Override @@ -849,6 +875,7 @@ public final class Settings implements ISettings { this.metricsEnabled = metricsEnabled; } + private boolean teleportInvulnerability; @Override @@ -867,6 +894,7 @@ public final class Settings implements ISettings { return teleportInvulnerability; } + private long loginAttackDelay; private long _getLoginAttackDelay() @@ -879,6 +907,7 @@ public final class Settings implements ISettings { return loginAttackDelay; } + private int signUsePerSecond; private int _getSignUsePerSecond() @@ -908,6 +937,7 @@ public final class Settings implements ISettings double maxSpeed = config.getDouble("max-walk-speed", 0.8); return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed); } + private int mailsPerMinute; private int _getMailsPerMinute() diff --git a/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java b/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java index a34734cf9..040fdd875 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java +++ b/Essentials2Compat/src/com/earth2me/essentials/UpdateUserFiles.java @@ -134,6 +134,7 @@ class UpdateUserFiles String realname = getPlayer(name); return realname == null ? BROKENNAME : realname; } + private final Map<String, String> players = new HashMap<String, String>(); private String getPlayer(String check) diff --git a/Essentials2Compat/src/com/earth2me/essentials/UserData.java b/Essentials2Compat/src/com/earth2me/essentials/UserData.java index 2dc8d2cec..fdd16c495 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/UserData.java +++ b/Essentials2Compat/src/com/earth2me/essentials/UserData.java @@ -12,10 +12,11 @@ import org.bukkit.inventory.ItemStack; public class UserData { - protected final IEssentials ess; + protected final transient IEssentials ess; private EssentialsConf config; private final File folder; + protected UserData(IEssentials ess, File file) { this.ess = ess; @@ -58,6 +59,7 @@ public class UserData kitTimestamps = _getKitTimestamps(); nickname = _getNickname(); } + private double money; private double _getMoney() @@ -89,6 +91,7 @@ public class UserData config.setProperty("money", value); config.save(); } + private Map<String, Object> homes; private Map<String, Object> _getHomes() @@ -121,6 +124,7 @@ public class UserData return config.getLocation("homes." + search, ess.getServer()); } + public List<String> getHomes() { return new ArrayList<String>(homes.keySet()); @@ -162,6 +166,7 @@ public class UserData } return false; } + private String nickname; public String _getNickname() @@ -180,6 +185,7 @@ public class UserData config.setProperty("nickname", nick); config.save(); } + private List<Integer> unlimited; private List<Integer> _getUnlimited() @@ -210,6 +216,7 @@ public class UserData config.setProperty("unlimited", unlimited); config.save(); } + private Map<String, Object> powertools; private Map<String, Object> _getPowertools() @@ -263,6 +270,7 @@ public class UserData { return !powertools.isEmpty(); } + private StoredLocation lastLocation; private StoredLocation _getLastLocation() @@ -281,6 +289,8 @@ public class UserData { return lastLocation; } + + private long lastTeleportTimestamp; private long _getLastTeleportTimestamp() @@ -299,6 +309,7 @@ public class UserData config.setProperty("timestamps.lastteleport", time); config.save(); } + private long lastHealTimestamp; private long _getLastHealTimestamp() @@ -317,6 +328,7 @@ public class UserData config.setProperty("timestamps.lastheal", time); config.save(); } + private String jail; private String _getJail() @@ -343,6 +355,7 @@ public class UserData } config.save(); } + private List<String> mails; private List<String> _getMails() @@ -375,6 +388,7 @@ public class UserData mails.add(mail); setMails(mails); } + private boolean teleportEnabled; private boolean getTeleportEnabled() @@ -407,6 +421,7 @@ public class UserData setSocialSpyEnabled(ret); return ret; } + private List<String> ignoredPlayers; public List<String> getIgnoredPlayers() @@ -428,6 +443,8 @@ public class UserData } config.save(); } + + private boolean godmode; private boolean _getGodModeEnabled() @@ -446,6 +463,7 @@ public class UserData config.setProperty("godmode", set); config.save(); } + private boolean muted; public boolean getMuted() @@ -464,6 +482,7 @@ public class UserData config.setProperty("muted", set); config.save(); } + private long muteTimeout; private long _getMuteTimeout() @@ -482,6 +501,7 @@ public class UserData config.setProperty("timestamps.mute", time); config.save(); } + private boolean jailed; private boolean getJailed() @@ -507,6 +527,7 @@ public class UserData setJailed(ret); return ret; } + private long jailTimeout; private long _getJailTimeout() @@ -547,6 +568,7 @@ public class UserData config.setProperty("ban.timeout", time); config.save(); } + private long lastLogin; private long _getLastLogin() @@ -564,6 +586,8 @@ public class UserData lastLogin = time; config.setProperty("timestamps.login", time); } + + private long lastLogout; private long _getLastLogout() @@ -582,6 +606,7 @@ public class UserData config.setProperty("timestamps.logout", time); config.save(); } + private String lastLoginAddress; private String _getLastLoginAddress() @@ -599,6 +624,7 @@ public class UserData lastLoginAddress = address; config.setProperty("ipAddress", address); } + private boolean afk; private boolean getAfk() @@ -624,6 +650,7 @@ public class UserData setAfk(ret); return ret; } + private boolean newplayer; //TODO: unused variable? private String geolocation; @@ -651,6 +678,7 @@ public class UserData } config.save(); } + private boolean isSocialSpyEnabled; private boolean _isSocialSpyEnabled() @@ -669,6 +697,7 @@ public class UserData config.setProperty("socialspy", status); config.save(); } + private boolean isNPC; private boolean _isNPC() @@ -687,6 +716,7 @@ public class UserData config.setProperty("npc", set); config.save(); } + private boolean arePowerToolsEnabled; public boolean arePowerToolsEnabled() @@ -712,6 +742,7 @@ public class UserData { return config.getBoolean("powertoolsenabled", true); } + private ConfigurationSection kitTimestamps; private ConfigurationSection _getKitTimestamps() diff --git a/Essentials2Compat/src/com/earth2me/essentials/Util.java b/Essentials2Compat/src/com/earth2me/essentials/Util.java index b6f051328..0500df536 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/Util.java +++ b/Essentials2Compat/src/com/earth2me/essentials/Util.java @@ -12,6 +12,7 @@ public class Util private Util() { } + private final static Pattern INVALIDFILECHARS = Pattern.compile("[^a-z0-9]"); private final static Pattern INVALIDCHARS = Pattern.compile("[^\t\n\r\u0020-\u007E\u0085\u00A0-\uD7FF\uE000-\uFFFC]"); @@ -32,6 +33,8 @@ public class Util { return INVALIDCHARS.matcher(string).replaceAll(""); } + + private static DecimalFormat dFormat = new DecimalFormat("#0.00", DecimalFormatSymbols.getInstance(Locale.US)); public static String formatAsCurrency(final double value) diff --git a/EssentialsAntiBuild/pom.xml b/EssentialsAntiBuild/pom.xml index b99f53c5d..0db30ef3b 100644 --- a/EssentialsAntiBuild/pom.xml +++ b/EssentialsAntiBuild/pom.xml @@ -1,20 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> + <parent> + <groupId>net.essentials3</groupId> + <artifactId>BuildAll</artifactId> + <version>3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <artifactId>EssentialsAntiBuild</artifactId> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>Essentials</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> + <artifactId>EssentialsAntiBuild</artifactId> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>Essentials</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> </project> diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java index 1e54f114a..2edb98da0 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuild.java @@ -7,8 +7,8 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsAntiBuild extends JavaPlugin implements IAntiBuild { - private EssentialsConnect ess = null; - private AntiBuildHolder settings = null; + private transient EssentialsConnect ess = null; + private transient AntiBuildHolder settings = null; @Override public void onEnable() diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java index 6c5c30b81..52d34c47a 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsAntiBuildListener.java @@ -26,8 +26,8 @@ import org.bukkit.inventory.ItemStack; public class EssentialsAntiBuildListener implements Listener { - final private IAntiBuild antib; - final private IEssentials ess; + final private transient IAntiBuild antib; + final private transient IEssentials ess; public EssentialsAntiBuildListener(final IAntiBuild parent) { diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java index a58f18dcc..40d760b66 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/EssentialsConnect.java @@ -13,8 +13,8 @@ import org.bukkit.plugin.Plugin; public class EssentialsConnect { private static final Logger LOGGER = Logger.getLogger("Minecraft"); - private final IEssentials ess; - private final IAntiBuild antib; + private final transient IEssentials ess; + private final transient IAntiBuild antib; public EssentialsConnect(Plugin essPlugin, Plugin essProtect) { diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java b/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java index 1cbd4df6e..51e49c463 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/IAntiBuild.java @@ -1,5 +1,6 @@ package net.ess3.antibuild; + import org.bukkit.plugin.Plugin; diff --git a/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java b/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java index eb980a2b2..96cdf63ac 100644 --- a/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java +++ b/EssentialsAntiBuild/src/net/ess3/antibuild/Permissions.java @@ -19,7 +19,7 @@ public enum Permissions implements IPermission private static final String defaultBase = "essentials.build."; private final String permission; private final PermissionDefault defaultPerm; - private String parent = null; + private transient String parent = null; private Permissions() { @@ -67,10 +67,12 @@ public enum Permissions implements IPermission { return PermissionFactory.checkPermission(sender, this); } + public static MaterialDotStarPermission PLACEMENT = new MaterialDotStarPermission("essentials.build.place"); public static MaterialDotStarPermission BREAK = new MaterialDotStarPermission("essentials.build.break"); public static MaterialDotStarPermission INTERACT = new MaterialDotStarPermission("essentials.build.interact"); public static MaterialDotStarPermission CRAFT = new MaterialDotStarPermission("essentials.build.craft"); public static MaterialDotStarPermission PICKUP = new MaterialDotStarPermission("essentials.build.pickup"); public static MaterialDotStarPermission DROP = new MaterialDotStarPermission("essentials.build.drop"); + } diff --git a/EssentialsChat/pom.xml b/EssentialsChat/pom.xml index 6be18a14c..e59886710 100644 --- a/EssentialsChat/pom.xml +++ b/EssentialsChat/pom.xml @@ -1,20 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> + <parent> + <groupId>net.essentials3</groupId> + <artifactId>BuildAll</artifactId> + <version>3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <artifactId>EssentialsChat</artifactId> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>Essentials</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> + <artifactId>EssentialsChat</artifactId> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>Essentials</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> </project> diff --git a/EssentialsChat/src/net/ess3/chat/ChatStore.java b/EssentialsChat/src/net/ess3/chat/ChatStore.java index d099a3e04..4d696fb36 100644 --- a/EssentialsChat/src/net/ess3/chat/ChatStore.java +++ b/EssentialsChat/src/net/ess3/chat/ChatStore.java @@ -7,9 +7,9 @@ import net.ess3.economy.Trade; public class ChatStore { - private final IUser user; - private final String type; - private final Trade charge; + private final transient IUser user; + private final transient String type; + private final transient Trade charge; public ChatStore(final IEssentials ess, final IUser user, final String type) { diff --git a/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java b/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java index 15e2d3b8b..e358cf9e1 100644 --- a/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java @@ -17,10 +17,10 @@ import org.bukkit.event.player.AsyncPlayerChatEvent; public abstract class EssentialsChatPlayer implements Listener { - protected IEssentials ess; + protected transient IEssentials ess; protected final static Logger LOGGER = Logger.getLogger("Minecraft"); - protected final Server server; - protected final Map<AsyncPlayerChatEvent, ChatStore> chatStorage; + protected final transient Server server; + protected final transient Map<AsyncPlayerChatEvent, ChatStore> chatStorage; public EssentialsChatPlayer( final Server server, final IEssentials ess, final Map<AsyncPlayerChatEvent, ChatStore> chatStorage) @@ -83,10 +83,9 @@ public abstract class EssentialsChatPlayer implements Listener { event.setFormat( format.format( - new Object[] - { - group, world, world.substring(0, 1).toUpperCase(Locale.ENGLISH) - })); + new Object[]{ + group, world, world.substring(0, 1).toUpperCase(Locale.ENGLISH) + })); } } diff --git a/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java b/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java index 568657907..b6b93c0bf 100644 --- a/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java +++ b/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java @@ -14,8 +14,8 @@ import org.bukkit.event.Listener; public class EssentialsLocalChatEventListener implements Listener { - protected IEssentials ess; - protected final Server server; + protected transient IEssentials ess; + protected final transient Server server; public EssentialsLocalChatEventListener(final Server server, final IEssentials ess) { diff --git a/EssentialsExtra/pom.xml b/EssentialsExtra/pom.xml index 0caa52250..fc2f8e23f 100644 --- a/EssentialsExtra/pom.xml +++ b/EssentialsExtra/pom.xml @@ -1,20 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> + <parent> + <groupId>net.essentials3</groupId> + <artifactId>BuildAll</artifactId> + <version>3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <artifactId>EssentialsExtra</artifactId> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>Essentials</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> + <artifactId>EssentialsExtra</artifactId> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>Essentials</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> </project> diff --git a/EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java b/EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java index 258b53bb5..05418e9d8 100644 --- a/EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java +++ b/EssentialsExtra/src/net/ess3/extra/AnnotatedCommand.java @@ -14,7 +14,6 @@ public @interface AnnotatedCommand String usage() default ""; - String[] aliases() default - { + String[] aliases() default { }; } diff --git a/EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java b/EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java index 90cfb85aa..4445dbd11 100644 --- a/EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java +++ b/EssentialsExtra/src/net/ess3/extra/EssentialsExtra.java @@ -68,9 +68,8 @@ public class EssentialsExtra extends JavaPlugin } } } - urls = new URL[] - { - commandDir.toURI().toURL() + urls = new URL[]{ + commandDir.toURI().toURL() }; } catch (Exception ex) diff --git a/EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java b/EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java index 36ee400e0..a6173a243 100644 --- a/EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java +++ b/EssentialsExtra/src/net/ess3/extra/commands/Commandkittycannon.java @@ -1,5 +1,6 @@ package net.ess3.extra.commands; + import java.util.Random; import net.ess3.api.IUser; import net.ess3.commands.EssentialsCommand; diff --git a/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java b/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java index 07e68c3ee..c535ed4a0 100644 --- a/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java +++ b/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java @@ -9,8 +9,8 @@ import org.bukkit.plugin.Plugin; public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP> { - private final Plugin geoip; - + private final transient Plugin geoip; + public ConfigHolder(final IEssentials ess, final Plugin geoip) { super(ess, GeoIP.class, new File(geoip.getDataFolder(), "config.yml")); diff --git a/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java index c305c024f..d899ed972 100644 --- a/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java +++ b/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java @@ -26,12 +26,12 @@ import org.bukkit.plugin.Plugin; public class EssentialsGeoIPPlayerListener implements Listener, IReload { - private LookupService ls = null; + private transient LookupService ls = null; private static final Logger LOGGER = Logger.getLogger("Minecraft"); - private File databaseFile; - private final ConfigHolder config; - private final IEssentials ess; - private final Plugin geoip; + private transient File databaseFile; + private final transient ConfigHolder config; + private final transient IEssentials ess; + private final transient Plugin geoip; public EssentialsGeoIPPlayerListener(final Plugin geoip, final IEssentials ess) { diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java b/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java index 7ccbd1f92..b91f6740e 100644 --- a/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java @@ -11,8 +11,8 @@ import org.bukkit.plugin.Plugin; public class EssentialsConnect { private static final Logger LOGGER = Logger.getLogger("Minecraft"); - private final IEssentials ess; - private final IProtect protect; + private final transient IEssentials ess; + private final transient IProtect protect; public EssentialsConnect(final Plugin essPlugin, final Plugin essProtect) { diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java index dec2ecd8f..98e0596f2 100644 --- a/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java @@ -11,8 +11,8 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsProtect extends JavaPlugin implements IProtect { private static final Logger LOGGER = Logger.getLogger("Minecraft"); - private EssentialsConnect ess = null; - private ProtectHolder settings = null; + private transient EssentialsConnect ess = null; + private transient ProtectHolder settings = null; @Override public void onEnable() diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectBlockListener.java index 01fc2651b..6446adc44 100644 --- a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectBlockListener.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectBlockListener.java @@ -13,7 +13,7 @@ import org.bukkit.event.block.BlockIgniteEvent; public class EssentialsProtectBlockListener implements Listener { - final private IProtect prot; + final private transient IProtect prot; public EssentialsProtectBlockListener(final IProtect parent) { diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java index f111c7b78..4fa71139b 100644 --- a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java @@ -11,7 +11,7 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason; //TODO: remove unnecessary return statements public class EssentialsProtectEntityListener implements Listener { - private final IProtect prot; + private final transient IProtect prot; public EssentialsProtectEntityListener(final IProtect prot) { @@ -47,7 +47,7 @@ public class EssentialsProtectEntityListener implements Listener return; } if (cause == DamageCause.BLOCK_EXPLOSION && (Permissions.PREVENTDAMAGE_TNT.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized( - user))) + user))) { event.setCancelled(true); return; @@ -69,21 +69,21 @@ public class EssentialsProtectEntityListener implements Listener //Creeper explode prevention if (eAttack instanceof Creeper && settings.getData().getPrevent().isCreeperExplosion() || (Permissions.PREVENTDAMAGE_CREEPER.isAuthorized( - user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) + user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) { event.setCancelled(true); return; } if ((event.getEntity() instanceof Fireball || event.getEntity() instanceof SmallFireball) && (Permissions.PREVENTDAMAGE_FIREBALL.isAuthorized( - user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) + user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) { event.setCancelled(true); return; } if ((event.getEntity() instanceof WitherSkull && Permissions.PREVENTDAMAGE_WITHERSKULL.isAuthorized( - user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) + user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) { event.setCancelled(true); return; @@ -96,9 +96,9 @@ public class EssentialsProtectEntityListener implements Listener } if (edEvent.getDamager() instanceof Projectile && ((Permissions.PREVENTDAMAGE_PROJECTILES.isAuthorized( - user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized( - user)) || (((Projectile)edEvent.getDamager()).getShooter() instanceof Player && (!Permissions.PVP.isAuthorized( - user) || !Permissions.PVP.isAuthorized((Player)((Projectile)edEvent.getDamager()).getShooter()))))) + user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized( + user)) || (((Projectile)edEvent.getDamager()).getShooter() instanceof Player && (!Permissions.PVP.isAuthorized( + user) || !Permissions.PVP.isAuthorized((Player)((Projectile)edEvent.getDamager()).getShooter()))))) { event.setCancelled(true); return; @@ -115,13 +115,13 @@ public class EssentialsProtectEntityListener implements Listener } if (cause == DamageCause.SUFFOCATION && (Permissions.PREVENTDAMAGE_SUFFOCATION.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized( - user))) + user))) { event.setCancelled(true); return; } if ((cause == DamageCause.FIRE || cause == DamageCause.FIRE_TICK) && (Permissions.PREVENTDAMAGE_FIRE.isAuthorized( - user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) + user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized(user))) { event.setCancelled(true); return; @@ -132,7 +132,7 @@ public class EssentialsProtectEntityListener implements Listener return; } if (cause == DamageCause.LIGHTNING && (Permissions.PREVENTDAMAGE_LIGHTNING.isAuthorized(user) && !Permissions.PREVENTDAMAGE_NONE.isAuthorized( - user))) + user))) { event.setCancelled(true); } @@ -143,8 +143,7 @@ public class EssentialsProtectEntityListener implements Listener } } } - // return statements are probably not needed here - + // return statements are probably not needed here @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onEntityExplode(final EntityExplodeEvent event) { diff --git a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectWeatherListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectWeatherListener.java index b20f7b17d..c12dc4a52 100644 --- a/EssentialsProtect/src/net/ess3/protect/EssentialsProtectWeatherListener.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectWeatherListener.java @@ -10,7 +10,7 @@ import org.bukkit.event.weather.WeatherChangeEvent; public class EssentialsProtectWeatherListener implements Listener { - private final IProtect prot; + private final transient IProtect prot; public EssentialsProtectWeatherListener(final IProtect prot) { diff --git a/EssentialsProtect/src/net/ess3/protect/Permissions.java b/EssentialsProtect/src/net/ess3/protect/Permissions.java index 3655924cd..7cacd741f 100644 --- a/EssentialsProtect/src/net/ess3/protect/Permissions.java +++ b/EssentialsProtect/src/net/ess3/protect/Permissions.java @@ -29,7 +29,7 @@ public enum Permissions implements IPermission private static final String base = "essentials.protect."; private final String permission; private final PermissionDefault defaultPerm; - private String parent = null; + private transient String parent = null; private Permissions() { @@ -72,5 +72,6 @@ public enum Permissions implements IPermission { return PermissionFactory.checkPermission(sender, this); } + public static DotStarPermission ENTITY_TARGET_BYPASS = new DotStarPermission("essentials.protect.entitytarget.bypass"); } diff --git a/EssentialsSigns/pom.xml b/EssentialsSigns/pom.xml index 781bd4512..85a47c60b 100644 --- a/EssentialsSigns/pom.xml +++ b/EssentialsSigns/pom.xml @@ -1,20 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> + <parent> + <groupId>net.essentials3</groupId> + <artifactId>BuildAll</artifactId> + <version>3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> - <artifactId>EssentialsSigns</artifactId> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>Essentials</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> + <artifactId>EssentialsSigns</artifactId> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>Essentials</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> </project> diff --git a/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java b/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java index cf1b44ef8..10ed1989d 100644 --- a/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java +++ b/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java @@ -22,7 +22,7 @@ import org.bukkit.inventory.ItemStack; public class EssentialsSign { private static final Set<Material> EMPTY_SET = new HashSet<Material>(); - protected final String signName; + protected transient final String signName; public EssentialsSign(final String signName) { @@ -212,9 +212,8 @@ public class EssentialsSign { return true; } - final BlockFace[] directions = new BlockFace[] - { - BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST + final BlockFace[] directions = new BlockFace[]{ + BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST }; for (BlockFace blockFace : directions) { @@ -255,7 +254,7 @@ public class EssentialsSign { return EMPTY_SET; } - + protected final void validateTrade(final ISign sign, final int index, final IEssentials ess) throws SignException { final String line = sign.getLine(index).trim(); @@ -431,8 +430,8 @@ public class EssentialsSign static class EventSign implements ISign { - private final SignChangeEvent event; - private final Block block; + private final transient SignChangeEvent event; + private final transient Block block; public EventSign(final SignChangeEvent event) { @@ -467,8 +466,8 @@ public class EssentialsSign public static class BlockSign implements ISign { - private final Sign sign; - private final Block block; + private final transient Sign sign; + private final transient Block block; public BlockSign(final Block block) { diff --git a/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java b/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java index 29e2edd59..cdd4494ea 100644 --- a/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java +++ b/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java @@ -15,8 +15,8 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsSignsPlugin extends JavaPlugin implements ISignsPlugin { - private static final Logger LOGGER = Bukkit.getLogger(); - private SignsConfigHolder config; + private static final transient Logger LOGGER = Bukkit.getLogger(); + private transient SignsConfigHolder config; @Override public void onEnable() diff --git a/EssentialsSigns/src/net/ess3/signs/SignConfig.java b/EssentialsSigns/src/net/ess3/signs/SignConfig.java index 34516dbc4..1b8bfddc3 100644 --- a/EssentialsSigns/src/net/ess3/signs/SignConfig.java +++ b/EssentialsSigns/src/net/ess3/signs/SignConfig.java @@ -23,12 +23,13 @@ public class SignConfig implements StorageObject { this.signs = signs; } + @Comment( - { - "How many times per second can Essentials signs be interacted with.", - "Values should be between 1-20, 20 being virtually no lag protection.", - "Lower numbers will reduce the possiblity of lag, but may annoy players." - }) + { + "How many times per second can Essentials signs be interacted with.", + "Values should be between 1-20, 20 being virtually no lag protection.", + "Lower numbers will reduce the possiblity of lag, but may annoy players." + }) private int signUsesPerSecond = 4; public int getSignUsePerSecond() diff --git a/EssentialsSigns/src/net/ess3/signs/SignsConfigHolder.java b/EssentialsSigns/src/net/ess3/signs/SignsConfigHolder.java index 613c2edee..9c62337c4 100644 --- a/EssentialsSigns/src/net/ess3/signs/SignsConfigHolder.java +++ b/EssentialsSigns/src/net/ess3/signs/SignsConfigHolder.java @@ -9,7 +9,7 @@ import org.bukkit.plugin.Plugin; public class SignsConfigHolder extends AsyncStorageObjectHolder<SignConfig> { - private final Plugin plugin; + private final transient Plugin plugin; private Set<EssentialsSign> enabledSigns = new HashSet<EssentialsSign>(); private boolean signsEnabled = false; diff --git a/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java b/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java index 69ca1b4c2..4aa8182b5 100644 --- a/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java +++ b/EssentialsSigns/src/net/ess3/signs/listeners/SignBlockListener.java @@ -21,8 +21,8 @@ import org.bukkit.event.block.*; public class SignBlockListener implements Listener { - private final IEssentials ess; - private final ISignsPlugin plugin; + private final transient IEssentials ess; + private final transient ISignsPlugin plugin; private final static Logger LOGGER = Logger.getLogger("Minecraft"); private final static int WALL_SIGN = Material.WALL_SIGN.getId(); private final static int SIGN_POST = Material.SIGN_POST.getId(); @@ -150,7 +150,7 @@ public class SignBlockListener implements Listener final Block block = event.getBlock(); if (((block.getTypeId() == WALL_SIGN || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign( - new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) + new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); return; @@ -175,7 +175,7 @@ public class SignBlockListener implements Listener final Block block = event.getBlock(); if (((block.getTypeId() == WALL_SIGN || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign( - new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) + new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); return; @@ -201,7 +201,7 @@ public class SignBlockListener implements Listener for (Block block : event.getBlocks()) { if (((block.getTypeId() == WALL_SIGN || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign( - new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) + new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); return; @@ -229,7 +229,7 @@ public class SignBlockListener implements Listener { final Block block = event.getBlock(); if (((block.getTypeId() == WALL_SIGN || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign( - new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) + new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); return; diff --git a/EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java b/EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java index be1e5398e..3c9d63977 100644 --- a/EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java +++ b/EssentialsSigns/src/net/ess3/signs/listeners/SignEntityListener.java @@ -14,8 +14,8 @@ import org.bukkit.event.entity.EntityExplodeEvent; public class SignEntityListener implements Listener { - private final IEssentials ess; - private final ISignsPlugin plugin; + private final transient IEssentials ess; + private final transient ISignsPlugin plugin; public SignEntityListener(final IEssentials ess, final ISignsPlugin plugin) { @@ -34,7 +34,7 @@ public class SignEntityListener implements Listener for (Block block : event.blockList()) { if (((block.getTypeId() == Material.WALL_SIGN.getId() || block.getTypeId() == Material.SIGN_POST.getId()) && EssentialsSign.isValidSign( - new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) + new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); return; @@ -60,7 +60,7 @@ public class SignEntityListener implements Listener final Block block = event.getBlock(); if (((block.getTypeId() == Material.WALL_SIGN.getId() || block.getTypeId() == Material.SIGN_POST.getId()) && EssentialsSign.isValidSign( - new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) + new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { event.setCancelled(true); return; diff --git a/EssentialsSigns/src/net/ess3/signs/listeners/SignPlayerListener.java b/EssentialsSigns/src/net/ess3/signs/listeners/SignPlayerListener.java index d6c6e3ece..6d6f14b93 100644 --- a/EssentialsSigns/src/net/ess3/signs/listeners/SignPlayerListener.java +++ b/EssentialsSigns/src/net/ess3/signs/listeners/SignPlayerListener.java @@ -15,8 +15,8 @@ import org.bukkit.event.player.PlayerInteractEvent; public class SignPlayerListener implements Listener { - private final IEssentials ess; - private final ISignsPlugin plugin; + private final transient IEssentials ess; + private final transient ISignsPlugin plugin; public SignPlayerListener(final IEssentials ess, final ISignsPlugin plugin) { diff --git a/EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java b/EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java index b05bc10f2..50e99a8d7 100644 --- a/EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java +++ b/EssentialsSigns/src/net/ess3/signs/signs/SignEnchant.java @@ -90,7 +90,7 @@ public class SignEnchant extends EssentialsSign final ItemStack playerHand = player.getPlayer().getItemInHand(); if (playerHand == null || playerHand.getAmount() != 1 || (playerHand.containsEnchantment(enchantment) && playerHand.getEnchantmentLevel( - enchantment) == level)) + enchantment) == level)) { throw new SignException(_("missingItems", 1, sign.getLine(1))); } diff --git a/EssentialsSigns/src/net/ess3/signs/signs/SignKit.java b/EssentialsSigns/src/net/ess3/signs/signs/SignKit.java index c962eae85..fc95f09d6 100644 --- a/EssentialsSigns/src/net/ess3/signs/signs/SignKit.java +++ b/EssentialsSigns/src/net/ess3/signs/signs/SignKit.java @@ -55,7 +55,7 @@ public class SignKit extends EssentialsSign final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH); final String group = sign.getLine(2); if ((!group.isEmpty() && ("§2Everyone".equals(group) || ess.getRanks().inGroup(player, group))) || (group.isEmpty() && Permissions.KITS.isAuthorized( - player, kitName))) + player, kitName))) { final Trade charge = getTrade(sign, 3, ess); charge.isAffordableFor(player); diff --git a/EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java b/EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java index 5b60c348c..cd3d9dc93 100644 --- a/EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java +++ b/EssentialsSigns/src/net/ess3/signs/signs/SignRepair.java @@ -40,9 +40,8 @@ public class SignRepair extends EssentialsSign Commandrepair command = new Commandrepair(); command.init(ess, "repair"); - String[] args = new String[] - { - sign.getLine(1) + String[] args = new String[]{ + sign.getLine(1) }; try { diff --git a/EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java b/EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java index 750e71ee7..43e4792aa 100644 --- a/EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java +++ b/EssentialsSigns/src/net/ess3/signs/signs/SignWarp.java @@ -53,7 +53,7 @@ public class SignWarp extends EssentialsSign final String group = sign.getLine(2); if ((!group.isEmpty() && ("§2Everyone".equals(group) || ess.getRanks().inGroup(player, group))) || (group.isEmpty() && Permissions.WARPS.isAuthorized( - player, warpName))) + player, warpName))) { final Trade charge = getTrade(sign, 3, ess); try diff --git a/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java b/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java index 6b39beb1a..e63508464 100644 --- a/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java +++ b/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java @@ -10,8 +10,9 @@ public abstract class AbstractWorkListener this.plugin = plugin; this.newVersionInfo = newVersionInfo; } - private final Plugin plugin; - private final VersionInfo newVersionInfo; + + private final transient Plugin plugin; + private final transient VersionInfo newVersionInfo; public final void onWorkAbort() { diff --git a/EssentialsUpdate/src/net/ess3/update/EssentialsHelp.java b/EssentialsUpdate/src/net/ess3/update/EssentialsHelp.java index 03d9bb937..a4629ce14 100644 --- a/EssentialsUpdate/src/net/ess3/update/EssentialsHelp.java +++ b/EssentialsUpdate/src/net/ess3/update/EssentialsHelp.java @@ -17,11 +17,11 @@ import org.bukkit.plugin.PluginManager; public class EssentialsHelp implements Listener { - private Player chatUser; - private final Server server; - private final Plugin plugin; - private IrcBot ircBot; - private final Map<String, Command> commands = new HashMap<String, Command>(); + private transient Player chatUser; + private final transient Server server; + private final transient Plugin plugin; + private transient IrcBot ircBot; + private final transient Map<String, Command> commands = new HashMap<String, Command>(); public EssentialsHelp(final Plugin plugin) { diff --git a/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java b/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java index 13aec2c00..33875423a 100644 --- a/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java +++ b/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java @@ -9,8 +9,8 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsUpdate extends JavaPlugin { - private EssentialsHelp essentialsHelp; - private UpdateProcess updateProcess; + private transient EssentialsHelp essentialsHelp; + private transient UpdateProcess updateProcess; @Override public void onEnable() diff --git a/EssentialsUpdate/src/net/ess3/update/GetFile.java b/EssentialsUpdate/src/net/ess3/update/GetFile.java index 4b8d67562..9636e3bd1 100644 --- a/EssentialsUpdate/src/net/ess3/update/GetFile.java +++ b/EssentialsUpdate/src/net/ess3/update/GetFile.java @@ -14,8 +14,8 @@ import org.bukkit.Bukkit; public class GetFile { - private URLConnection connection; - private MessageDigest digest; + private transient URLConnection connection; + private transient MessageDigest digest; public GetFile(final String urlString) throws MalformedURLException, IOException { diff --git a/EssentialsUpdate/src/net/ess3/update/ModuleInfo.java b/EssentialsUpdate/src/net/ess3/update/ModuleInfo.java index e0380cf14..993575cbf 100644 --- a/EssentialsUpdate/src/net/ess3/update/ModuleInfo.java +++ b/EssentialsUpdate/src/net/ess3/update/ModuleInfo.java @@ -7,9 +7,9 @@ import org.bukkit.configuration.Configuration; public class ModuleInfo { - private final String url; - private final String version; - private final String hash; + private final transient String url; + private final transient String version; + private final transient String hash; public ModuleInfo(final Configuration updateConfig, final String path) { diff --git a/EssentialsUpdate/src/net/ess3/update/PastieUpload.java b/EssentialsUpdate/src/net/ess3/update/PastieUpload.java index 0880960ea..fba475b70 100644 --- a/EssentialsUpdate/src/net/ess3/update/PastieUpload.java +++ b/EssentialsUpdate/src/net/ess3/update/PastieUpload.java @@ -11,7 +11,7 @@ import java.util.regex.Pattern; public class PastieUpload { - private final PostToUrl connection; + private final transient PostToUrl connection; private final Pattern pattern = Pattern.compile("(?s).*\\?key=([a-z0-9]+).*"); public PastieUpload() throws MalformedURLException diff --git a/EssentialsUpdate/src/net/ess3/update/PostToUrl.java b/EssentialsUpdate/src/net/ess3/update/PostToUrl.java index 5a1bddff9..28fc13c55 100644 --- a/EssentialsUpdate/src/net/ess3/update/PostToUrl.java +++ b/EssentialsUpdate/src/net/ess3/update/PostToUrl.java @@ -14,9 +14,9 @@ import java.util.Random; public class PostToUrl { - private final URL url; - private final String boundary; - private final Random random = new Random(); + private final transient URL url; + private final transient String boundary; + private final transient Random random = new Random(); private final static String CRLF = "\r\n"; private final static Charset UTF8 = Charset.forName("utf-8"); diff --git a/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java b/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java index bd3e6300e..8e8b3e7ed 100644 --- a/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java +++ b/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java @@ -12,14 +12,14 @@ import org.bukkit.plugin.PluginManager; public class UpdateCheck { - private CheckResult result = CheckResult.UNKNOWN; - private Version currentVersion; - private Version newVersion = null; - private int bukkitResult = 0; - private UpdateFile updateFile; + private transient CheckResult result = CheckResult.UNKNOWN; + private transient Version currentVersion; + private transient Version newVersion = null; + private transient int bukkitResult = 0; + private transient UpdateFile updateFile; private final static int CHECK_INTERVAL = 20 * 60 * 60 * 6; - private final Plugin plugin; - private boolean essentialsInstalled; + private final transient Plugin plugin; + private transient boolean essentialsInstalled; private final Pattern bukkitVersionPattern = Pattern.compile("git-Bukkit-(?:(?:[0-9]+)\\.)+[0-9]+-R[\\.0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*"); public UpdateCheck(final Plugin plugin) diff --git a/EssentialsUpdate/src/net/ess3/update/UpdateFile.java b/EssentialsUpdate/src/net/ess3/update/UpdateFile.java index 117daab8c..a369ad44e 100644 --- a/EssentialsUpdate/src/net/ess3/update/UpdateFile.java +++ b/EssentialsUpdate/src/net/ess3/update/UpdateFile.java @@ -24,9 +24,9 @@ public class UpdateFile private final static BigInteger PUBLIC_KEY = new BigInteger( "5ha6a2d4qdy17ttkg8evh74sl5a87djojwenu12k1lvy8ui6003e6l06rntczpoh99mhc3txj8mqlxw111oyy9yl7s7qpyluyzix3j1odxrxx4u52gxvyu6qiteapczkzvi7rxgeqsozz7b19rdx73a7quo9ybwpz1cr82r7x5k0pg2a73pjjsv2j1awr13azo7klrcxp9y5xxwf5qv1s3tw4zqftli18u0ek5qkbzfbgk1v5n2f11pkwwk6p0mibrn26wnjbv11vyiqgu95o7busmt6vf5q7grpcenl637w83mbin56s3asj1131b2mscj9xep3cbj7la9tgsxl5bj87vzy8sk2d34kzwqdqgh9nry43nqqus12l1stmiv184r8r3jcy8w43e8h1u1mzklldb5eytkuhayqik8l3ns04hwt8sgacvw534be8sx26qrn5s1", 36); - private final File file; - private final Plugin plugin; - private final TreeMap<Version, VersionInfo> versions = new TreeMap<Version, VersionInfo>(); + private final transient File file; + private final transient Plugin plugin; + private final transient TreeMap<Version, VersionInfo> versions = new TreeMap<Version, VersionInfo>(); public UpdateFile(final Plugin plugin) { diff --git a/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java b/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java index 9d09264e3..0e9f59283 100644 --- a/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java +++ b/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java @@ -18,10 +18,10 @@ import org.bukkit.plugin.Plugin; // TODO: This whole thing should make use of the conversations api public class UpdateProcess implements Listener { - private Player currentPlayer; - private final Plugin plugin; - private final UpdateCheck updateCheck; - private StateMachine stateMachine; + private transient Player currentPlayer; + private final transient Plugin plugin; + private final transient UpdateCheck updateCheck; + private transient StateMachine stateMachine; public UpdateProcess(final Plugin plugin, final UpdateCheck updateCheck) { @@ -96,8 +96,7 @@ public class UpdateProcess implements Listener { UpdateProcess.this.currentPlayer = null; } - //TODO: make sure this is threadsafe - + //TODO: make sure this is threadsafe @EventHandler(priority = EventPriority.LOWEST) public void onPlayerChat(final AsyncPlayerChatEvent event) { diff --git a/EssentialsUpdate/src/net/ess3/update/Version.java b/EssentialsUpdate/src/net/ess3/update/Version.java index 9910882c8..ee449186f 100644 --- a/EssentialsUpdate/src/net/ess3/update/Version.java +++ b/EssentialsUpdate/src/net/ess3/update/Version.java @@ -30,10 +30,11 @@ public class Version implements Comparable<Version> { return type; } - private final int major; - private final int minor; - private final int build; - private final Type type; + + private final transient int major; + private final transient int minor; + private final transient int build; + private final transient Type type; public Version(final String versionString) { diff --git a/EssentialsUpdate/src/net/ess3/update/VersionInfo.java b/EssentialsUpdate/src/net/ess3/update/VersionInfo.java index c9e0eb7ec..afbe87de8 100644 --- a/EssentialsUpdate/src/net/ess3/update/VersionInfo.java +++ b/EssentialsUpdate/src/net/ess3/update/VersionInfo.java @@ -9,10 +9,10 @@ import org.bukkit.configuration.Configuration; public class VersionInfo { - private final List<String> changelog; - private final int minBukkit; - private final int maxBukkit; - private final Map<String, ModuleInfo> modules; + private final transient List<String> changelog; + private final transient int minBukkit; + private final transient int maxBukkit; + private final transient Map<String, ModuleInfo> modules; public VersionInfo(final Configuration updateConfig, final String path) { diff --git a/EssentialsUpdate/src/net/ess3/update/chat/AbstractFileCommand.java b/EssentialsUpdate/src/net/ess3/update/chat/AbstractFileCommand.java index b6b83b0bb..fff363835 100644 --- a/EssentialsUpdate/src/net/ess3/update/chat/AbstractFileCommand.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/AbstractFileCommand.java @@ -8,7 +8,7 @@ import org.bukkit.plugin.Plugin; public abstract class AbstractFileCommand implements Command { - private final Plugin plugin; + private final transient Plugin plugin; private final static Charset UTF8 = Charset.forName("utf-8"); public AbstractFileCommand(final Plugin plugin) diff --git a/EssentialsUpdate/src/net/ess3/update/chat/ErrorsCommand.java b/EssentialsUpdate/src/net/ess3/update/chat/ErrorsCommand.java index 04832dbc0..6e3c29924 100644 --- a/EssentialsUpdate/src/net/ess3/update/chat/ErrorsCommand.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/ErrorsCommand.java @@ -11,7 +11,7 @@ import org.bukkit.plugin.Plugin; public class ErrorsCommand extends AbstractFileCommand implements Command { - private final Pattern pattern = Pattern.compile("^[0-9 :-]+\\[INFO\\].*"); + private final transient Pattern pattern = Pattern.compile("^[0-9 :-]+\\[INFO\\].*"); public ErrorsCommand(final Plugin plugin) { diff --git a/EssentialsUpdate/src/net/ess3/update/chat/IrcBot.java b/EssentialsUpdate/src/net/ess3/update/chat/IrcBot.java index b33ff9dd7..348a9ae44 100644 --- a/EssentialsUpdate/src/net/ess3/update/chat/IrcBot.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/IrcBot.java @@ -15,9 +15,9 @@ public class IrcBot extends PircBot private static final String CHANNEL = "#essentials"; private static final int PORT = 6667; private static final String SERVER = "irc.esper.net"; - private boolean reconnect = true; - private final Player player; - private boolean kicked = false; + private transient boolean reconnect = true; + private final transient Player player; + private transient boolean kicked = false; public IrcBot(final Player player, final String nickName, final String versionString) { diff --git a/EssentialsUpdate/src/net/ess3/update/chat/StartupCommand.java b/EssentialsUpdate/src/net/ess3/update/chat/StartupCommand.java index 1ac171e42..978da60c2 100644 --- a/EssentialsUpdate/src/net/ess3/update/chat/StartupCommand.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/StartupCommand.java @@ -11,8 +11,8 @@ import org.bukkit.plugin.Plugin; public class StartupCommand extends AbstractFileCommand implements Command { - private final Pattern patternStart = Pattern.compile("^[0-9 :-]+\\[INFO\\] Starting minecraft server version.*"); - private final Pattern patternEnd = Pattern.compile("^[0-9 :-]+\\[INFO\\] Done \\([0-9.,]+s\\)! For help, type \"help\".*"); + private final transient Pattern patternStart = Pattern.compile("^[0-9 :-]+\\[INFO\\] Starting minecraft server version.*"); + private final transient Pattern patternEnd = Pattern.compile("^[0-9 :-]+\\[INFO\\] Done \\([0-9.,]+s\\)! For help, type \"help\".*"); public StartupCommand(final Plugin plugin) { diff --git a/EssentialsUpdate/src/net/ess3/update/states/AbstractState.java b/EssentialsUpdate/src/net/ess3/update/states/AbstractState.java index ddcba9250..783ba19a1 100644 --- a/EssentialsUpdate/src/net/ess3/update/states/AbstractState.java +++ b/EssentialsUpdate/src/net/ess3/update/states/AbstractState.java @@ -6,8 +6,8 @@ import org.bukkit.entity.Player; public abstract class AbstractState { - private boolean abortion = false; - private final StateMap stateMap; + private transient boolean abortion = false; + private final transient StateMap stateMap; public AbstractState(final StateMap stateMap) { diff --git a/EssentialsUpdate/src/net/ess3/update/states/AbstractYesNoState.java b/EssentialsUpdate/src/net/ess3/update/states/AbstractYesNoState.java index 0747c188b..e84046224 100644 --- a/EssentialsUpdate/src/net/ess3/update/states/AbstractYesNoState.java +++ b/EssentialsUpdate/src/net/ess3/update/states/AbstractYesNoState.java @@ -4,8 +4,8 @@ package net.ess3.update.states; public abstract class AbstractYesNoState extends AbstractState { private boolean answer = false; - private final Class<? extends AbstractState> yesState; - private final Class<? extends AbstractState> noState; + private final transient Class<? extends AbstractState> yesState; + private final transient Class<? extends AbstractState> noState; public AbstractYesNoState(final StateMap states, final Class<? extends AbstractState> nextState) { diff --git a/EssentialsUpdate/src/net/ess3/update/states/Changelog.java b/EssentialsUpdate/src/net/ess3/update/states/Changelog.java index 9f6fc1a46..eccc4548a 100644 --- a/EssentialsUpdate/src/net/ess3/update/states/Changelog.java +++ b/EssentialsUpdate/src/net/ess3/update/states/Changelog.java @@ -9,10 +9,10 @@ import org.bukkit.entity.Player; public class Changelog extends AbstractState { private static final int CHANGES_PER_PAGE = 5; - private int page = 0; - private boolean confirmed = false; - private final List<String> changes; - private final int pages; + private transient int page = 0; + private transient boolean confirmed = false; + private transient final List<String> changes; + private transient final int pages; public Changelog(final StateMap stateMap) { diff --git a/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java b/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java index ae947e687..c9dbb1f6a 100644 --- a/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java +++ b/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java @@ -14,10 +14,12 @@ public class StateMachine extends AbstractWorkListener implements Runnable { ABORT, WAIT, DONE, NONE } - private final StateMap states = new StateMap(); - private AbstractState current; - private Player player; - private MachineResult result = MachineResult.NONE; + + + private final transient StateMap states = new StateMap(); + private transient AbstractState current; + private transient Player player; + private transient MachineResult result = MachineResult.NONE; public StateMachine(final Plugin plugin, final Player player, final UpdateCheck updateCheck) { @@ -82,7 +84,8 @@ public class StateMachine extends AbstractWorkListener implements Runnable } return result; } - private Iterator<AbstractState> iterator; + + private transient Iterator<AbstractState> iterator; public void startWork() { diff --git a/EssentialsUpdate/src/net/ess3/update/states/UpdateOrInstallation.java b/EssentialsUpdate/src/net/ess3/update/states/UpdateOrInstallation.java index e8495fe2c..bc043c6de 100644 --- a/EssentialsUpdate/src/net/ess3/update/states/UpdateOrInstallation.java +++ b/EssentialsUpdate/src/net/ess3/update/states/UpdateOrInstallation.java @@ -6,8 +6,8 @@ import org.bukkit.entity.Player; public class UpdateOrInstallation extends AbstractState { - private final UpdateCheck updateCheck; - private boolean update = false; + private final transient UpdateCheck updateCheck; + private transient boolean update = false; public UpdateOrInstallation(final StateMap stateMap, final UpdateCheck updateCheck) { diff --git a/EssentialsUpdate/src/net/ess3/update/tasks/InstallModule.java b/EssentialsUpdate/src/net/ess3/update/tasks/InstallModule.java index e24a69f2a..82e906d90 100644 --- a/EssentialsUpdate/src/net/ess3/update/tasks/InstallModule.java +++ b/EssentialsUpdate/src/net/ess3/update/tasks/InstallModule.java @@ -12,9 +12,9 @@ import org.bukkit.Bukkit; public class InstallModule implements Runnable, Task { - protected final AbstractWorkListener listener; - private final String moduleName; - private final String fileName; + protected final transient AbstractWorkListener listener; + private final transient String moduleName; + private final transient String fileName; public InstallModule(final AbstractWorkListener listener, final String moduleName) { diff --git a/EssentialsUpdate/src/net/ess3/update/tasks/SelfUpdate.java b/EssentialsUpdate/src/net/ess3/update/tasks/SelfUpdate.java index d4bc7b066..31d45e741 100644 --- a/EssentialsUpdate/src/net/ess3/update/tasks/SelfUpdate.java +++ b/EssentialsUpdate/src/net/ess3/update/tasks/SelfUpdate.java @@ -6,7 +6,7 @@ import org.bukkit.Bukkit; public class SelfUpdate extends AbstractWorkListener implements Task, Runnable { - private final AbstractWorkListener listener; + private final transient AbstractWorkListener listener; public SelfUpdate(final AbstractWorkListener listener) { diff --git a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java index baafb27f0..fbfbbf56a 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java @@ -20,10 +20,10 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP { private static final Logger LOGGER = Logger.getLogger("Minecraft"); private static EssentialsXMPP instance = null; - private UserManager users; - private XMPPManager xmpp; - private IEssentials ess; - private TabExecutor commandHandler; + private transient UserManager users; + private transient XMPPManager xmpp; + private transient IEssentials ess; + private transient TabExecutor commandHandler; public static IEssentialsXMPP getInstance() { diff --git a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java index 0f27c05c9..85676198c 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java @@ -11,7 +11,7 @@ import org.bukkit.event.player.PlayerQuitEvent; //TODO: port 2.9 changes and verify thread safety. class EssentialsXMPPPlayerListener implements Listener { - private final IEssentials ess; + private final transient IEssentials ess; EssentialsXMPPPlayerListener(final IEssentials ess) { diff --git a/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java b/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java index 0e0c48b4e..c80680445 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java @@ -11,9 +11,9 @@ import org.bukkit.configuration.file.YamlConfiguration; public class UserManager implements IReload { - private YamlConfiguration users; - private final File folder; - private final List<String> spyusers = new ArrayList<String>(); + private transient YamlConfiguration users; + private final transient File folder; + private final transient List<String> spyusers = new ArrayList<String>(); private final static String ADDRESS = "address"; private final static String SPY = "spy"; diff --git a/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java b/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java index 34d98cb11..a04ab25d9 100644 --- a/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java @@ -19,17 +19,17 @@ public final class XMPPManager extends Handler implements MessageListener, ChatM { private static final Logger LOGGER = Logger.getLogger("Minecraft"); private static final SimpleFormatter formatter = new SimpleFormatter(); - private YamlConfiguration config = null; - private XMPPConnection connection; - private ChatManager chatManager; - private final Map<String, Chat> chats = Collections.synchronizedMap(new HashMap<String, Chat>()); - private final Set<LogRecord> logrecords = Collections.synchronizedSet(new HashSet<LogRecord>()); - private final IEssentialsXMPP parent; - private List<String> logUsers; - private Level logLevel; - private boolean ignoreLagMessages = true; - private Thread loggerThread; - private boolean threadrunning = true; + private transient YamlConfiguration config = null; + private transient XMPPConnection connection; + private transient ChatManager chatManager; + private final transient Map<String, Chat> chats = Collections.synchronizedMap(new HashMap<String, Chat>()); + private final transient Set<LogRecord> logrecords = Collections.synchronizedSet(new HashSet<LogRecord>()); + private final transient IEssentialsXMPP parent; + private transient List<String> logUsers; + private transient Level logLevel; + private transient boolean ignoreLagMessages = true; + private transient Thread loggerThread; + private transient boolean threadrunning = true; public XMPPManager(final IEssentialsXMPP parent) { |