diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 437a2b1a0..f8e3f28e0 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -88,10 +88,10 @@ public class AuthMe extends JavaPlugin { public AuthMeInventoryPacketAdapter inventoryProtector; // Random data maps and stuff // TODO: Create Manager for this - public ConcurrentHashMap sessions = new ConcurrentHashMap<>(); - public ConcurrentHashMap captcha = new ConcurrentHashMap<>(); - public ConcurrentHashMap cap = new ConcurrentHashMap<>(); - public ConcurrentHashMap realIp = new ConcurrentHashMap<>(); + public final ConcurrentHashMap sessions = new ConcurrentHashMap<>(); + public final ConcurrentHashMap captcha = new ConcurrentHashMap<>(); + public final ConcurrentHashMap cap = new ConcurrentHashMap<>(); + public final ConcurrentHashMap realIp = new ConcurrentHashMap<>(); // AntiBot Status // TODO: Create Manager for this public boolean antiBotMod = false; diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index 5da1209d8..c3847f3b6 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -18,7 +18,7 @@ import java.util.concurrent.Future; */ public class DataManager { - public AuthMe plugin; + public final AuthMe plugin; /** * Constructor for DataManager. @@ -29,9 +29,6 @@ public class DataManager { this.plugin = plugin; } - public void run() { - } - /** * Method getOfflinePlayer. * diff --git a/src/main/java/fr/xephi/authme/ImageGenerator.java b/src/main/java/fr/xephi/authme/ImageGenerator.java index bdcefa44a..e529efabd 100644 --- a/src/main/java/fr/xephi/authme/ImageGenerator.java +++ b/src/main/java/fr/xephi/authme/ImageGenerator.java @@ -1,40 +1,40 @@ -package fr.xephi.authme; - -import java.awt.*; -import java.awt.image.BufferedImage; - -/** - */ -public class ImageGenerator { - - private String pass; - - /** - * Constructor for ImageGenerator. - * - * @param pass String - */ - public ImageGenerator(String pass) { - this.pass = pass; - } - - /** - * Method generateImage. - * - * @return BufferedImage - */ - public BufferedImage generateImage() { - BufferedImage image = new BufferedImage(200, 60, BufferedImage.TYPE_BYTE_INDEXED); - Graphics2D graphics = image.createGraphics(); - graphics.setColor(Color.BLACK); - graphics.fillRect(0, 0, 200, 40); - GradientPaint gradientPaint = new GradientPaint(10, 5, Color.WHITE, 20, 10, Color.WHITE, true); - graphics.setPaint(gradientPaint); - Font font = new Font("Comic Sans MS", Font.BOLD, 30); - graphics.setFont(font); - graphics.drawString(pass, 5, 30); - graphics.dispose(); - image.flush(); - return image; - } -} +package fr.xephi.authme; + +import java.awt.*; +import java.awt.image.BufferedImage; + +/** + */ +public class ImageGenerator { + + private final String pass; + + /** + * Constructor for ImageGenerator. + * + * @param pass String + */ + public ImageGenerator(String pass) { + this.pass = pass; + } + + /** + * Method generateImage. + * + * @return BufferedImage + */ + public BufferedImage generateImage() { + BufferedImage image = new BufferedImage(200, 60, BufferedImage.TYPE_BYTE_INDEXED); + Graphics2D graphics = image.createGraphics(); + graphics.setColor(Color.BLACK); + graphics.fillRect(0, 0, 200, 40); + GradientPaint gradientPaint = new GradientPaint(10, 5, Color.WHITE, 20, 10, Color.WHITE, true); + graphics.setPaint(gradientPaint); + Font font = new Font("Comic Sans MS", Font.BOLD, 30); + graphics.setFont(font); + graphics.drawString(pass, 5, 30); + graphics.dispose(); + image.flush(); + return image; + } +} diff --git a/src/main/java/fr/xephi/authme/PerformBackup.java b/src/main/java/fr/xephi/authme/PerformBackup.java index 29f59c284..6dbb7e4f9 100644 --- a/src/main/java/fr/xephi/authme/PerformBackup.java +++ b/src/main/java/fr/xephi/authme/PerformBackup.java @@ -14,13 +14,13 @@ import java.util.Date; */ public class PerformBackup { - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_HH-mm"); - String dateString = format.format(new Date()); - private String dbName = Settings.getMySQLDatabase; - private String dbUserName = Settings.getMySQLUsername; - private String dbPassword = Settings.getMySQLPassword; - private String tblname = Settings.getMySQLTablename; - private String path = AuthMe.getInstance().getDataFolder() + File.separator + "backups" + File.separator + "backup" + dateString; + final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_HH-mm"); + final String dateString = format.format(new Date()); + private final String dbName = Settings.getMySQLDatabase; + private final String dbUserName = Settings.getMySQLUsername; + private final String dbPassword = Settings.getMySQLPassword; + private final String tblname = Settings.getMySQLTablename; + private final String path = AuthMe.getInstance().getDataFolder() + File.separator + "backups" + File.separator + "backup" + dateString; private AuthMe instance; /** diff --git a/src/main/java/fr/xephi/authme/SendMailSSL.java b/src/main/java/fr/xephi/authme/SendMailSSL.java index 621b403bb..397ddac91 100644 --- a/src/main/java/fr/xephi/authme/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/SendMailSSL.java @@ -16,7 +16,7 @@ import java.io.File; */ public class SendMailSSL { - public AuthMe plugin; + public final AuthMe plugin; /** * Constructor for SendMailSSL. diff --git a/src/main/java/fr/xephi/authme/api/NewAPI.java b/src/main/java/fr/xephi/authme/api/NewAPI.java index 220879f40..cfe4508f0 100644 --- a/src/main/java/fr/xephi/authme/api/NewAPI.java +++ b/src/main/java/fr/xephi/authme/api/NewAPI.java @@ -19,7 +19,7 @@ import java.security.NoSuchAlgorithmException; public class NewAPI { public static NewAPI singleton; - public AuthMe plugin; + public final AuthMe plugin; /** * Constructor for NewAPI. diff --git a/src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java b/src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java index 846fd1ef5..8bf22fb63 100644 --- a/src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java +++ b/src/main/java/fr/xephi/authme/cache/auth/PlayerAuth.java @@ -16,7 +16,7 @@ public class PlayerAuth { private double z; private String world; private String salt; - private int groupId; + private final int groupId; private String email; private String realName; diff --git a/src/main/java/fr/xephi/authme/cache/auth/PlayerCache.java b/src/main/java/fr/xephi/authme/cache/auth/PlayerCache.java index dcaef24ea..4f9d21878 100644 --- a/src/main/java/fr/xephi/authme/cache/auth/PlayerCache.java +++ b/src/main/java/fr/xephi/authme/cache/auth/PlayerCache.java @@ -7,7 +7,7 @@ import java.util.concurrent.ConcurrentHashMap; public class PlayerCache { private volatile static PlayerCache singleton; - private ConcurrentHashMap cache; + private final ConcurrentHashMap cache; private PlayerCache() { cache = new ConcurrentHashMap<>(); diff --git a/src/main/java/fr/xephi/authme/cache/backup/DataFileCache.java b/src/main/java/fr/xephi/authme/cache/backup/DataFileCache.java index c40cab961..e567229d9 100644 --- a/src/main/java/fr/xephi/authme/cache/backup/DataFileCache.java +++ b/src/main/java/fr/xephi/authme/cache/backup/DataFileCache.java @@ -4,9 +4,9 @@ package fr.xephi.authme.cache.backup; */ public class DataFileCache { - private String group; - private boolean operator; - private boolean flying; + private final String group; + private final boolean operator; + private final boolean flying; /** * Constructor for DataFileCache. diff --git a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java index 814fd8a7f..69774e221 100644 --- a/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java +++ b/src/main/java/fr/xephi/authme/cache/limbo/LimboCache.java @@ -19,9 +19,9 @@ import java.util.concurrent.ConcurrentHashMap; public class LimboCache { private volatile static LimboCache singleton; - public ConcurrentHashMap cache; - public AuthMe plugin; - private JsonCache playerData; + public final ConcurrentHashMap cache; + public final AuthMe plugin; + private final JsonCache playerData; /** * Constructor for LimboCache. diff --git a/src/main/java/fr/xephi/authme/cache/limbo/LimboPlayer.java b/src/main/java/fr/xephi/authme/cache/limbo/LimboPlayer.java index 64e65dc55..96c5a9ee9 100644 --- a/src/main/java/fr/xephi/authme/cache/limbo/LimboPlayer.java +++ b/src/main/java/fr/xephi/authme/cache/limbo/LimboPlayer.java @@ -8,7 +8,7 @@ import org.bukkit.scheduler.BukkitTask; */ public class LimboPlayer { - private String name; + private final String name; private Location loc = null; private BukkitTask timeoutTaskId = null; private BukkitTask messageTaskId = null; diff --git a/src/main/java/fr/xephi/authme/command/CommandManager.java b/src/main/java/fr/xephi/authme/command/CommandManager.java index 6382e27b4..2a23cb682 100644 --- a/src/main/java/fr/xephi/authme/command/CommandManager.java +++ b/src/main/java/fr/xephi/authme/command/CommandManager.java @@ -20,7 +20,7 @@ public class CommandManager { /** * The list of commandDescriptions. */ - private List commandDescriptions = new ArrayList<>(); + private final List commandDescriptions = new ArrayList<>(); /** * Constructor. diff --git a/src/main/java/fr/xephi/authme/command/CommandParts.java b/src/main/java/fr/xephi/authme/command/CommandParts.java index 9c261fc49..1c677f225 100644 --- a/src/main/java/fr/xephi/authme/command/CommandParts.java +++ b/src/main/java/fr/xephi/authme/command/CommandParts.java @@ -12,7 +12,7 @@ public class CommandParts { /** * The list of parts for this command. */ - private List parts = new ArrayList<>(); + private final List parts = new ArrayList<>(); /** * Constructor. diff --git a/src/main/java/fr/xephi/authme/command/FoundCommandResult.java b/src/main/java/fr/xephi/authme/command/FoundCommandResult.java index cde2da746..b236f09a1 100644 --- a/src/main/java/fr/xephi/authme/command/FoundCommandResult.java +++ b/src/main/java/fr/xephi/authme/command/FoundCommandResult.java @@ -13,15 +13,15 @@ public class FoundCommandResult { /** * The command reference. */ - private CommandParts commandReference; + private final CommandParts commandReference; /** * The command arguments. */ - private CommandParts commandArguments; + private final CommandParts commandArguments; /** * The original search query reference. */ - private CommandParts queryReference; + private final CommandParts queryReference; /** * Constructor. diff --git a/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java b/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java index c3c7a0e3c..cf8dd9dfa 100644 --- a/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/converter/ConverterCommand.java @@ -90,7 +90,7 @@ public class ConverterCommand extends ExecutableCommand { vauth("vauth"), sqltoflat("sqltoflat"); - String name; + final String name; /** * Constructor for ConvertType. diff --git a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java index e0a02c887..88a105d54 100644 --- a/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java +++ b/src/main/java/fr/xephi/authme/converter/CrazyLoginConverter.java @@ -18,9 +18,9 @@ import java.io.IOException; */ public class CrazyLoginConverter implements Converter { - public AuthMe instance; - public DataSource database; - public CommandSender sender; + public final AuthMe instance; + public final DataSource database; + public final CommandSender sender; /** * Constructor for CrazyLoginConverter. diff --git a/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java b/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java index 6bd9a7343..3a67cf06a 100644 --- a/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java +++ b/src/main/java/fr/xephi/authme/converter/FlatToSqlite.java @@ -14,7 +14,7 @@ import java.sql.*; */ public class FlatToSqlite implements Converter { - public CommandSender sender; + public final CommandSender sender; private String tableName; private String columnName; private String columnPassword; diff --git a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java index 436a61a2c..8e2872119 100644 --- a/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java +++ b/src/main/java/fr/xephi/authme/converter/ForceFlatToSqlite.java @@ -11,7 +11,7 @@ import fr.xephi.authme.settings.Settings; */ public class ForceFlatToSqlite implements Converter { - private DataSource data; + private final DataSource data; /** * Constructor for ForceFlatToSqlite. diff --git a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java index 9948f133b..8e2fc6b59 100644 --- a/src/main/java/fr/xephi/authme/converter/RakamakConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RakamakConverter.java @@ -23,9 +23,9 @@ import java.util.Map.Entry; */ public class RakamakConverter implements Converter { - public AuthMe instance; - public DataSource database; - public CommandSender sender; + public final AuthMe instance; + public final DataSource database; + public final CommandSender sender; /** * Constructor for RakamakConverter. diff --git a/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java b/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java index dd1733126..6906815dc 100644 --- a/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/RoyalAuthConverter.java @@ -12,8 +12,8 @@ import java.io.File; */ public class RoyalAuthConverter implements Converter { - public AuthMe plugin; - private DataSource data; + public final AuthMe plugin; + private final DataSource data; /** * Constructor for RoyalAuthConverter. diff --git a/src/main/java/fr/xephi/authme/converter/SqlToFlat.java b/src/main/java/fr/xephi/authme/converter/SqlToFlat.java index efd6071ce..189cb8cf5 100644 --- a/src/main/java/fr/xephi/authme/converter/SqlToFlat.java +++ b/src/main/java/fr/xephi/authme/converter/SqlToFlat.java @@ -14,9 +14,9 @@ import java.util.List; */ public class SqlToFlat implements Converter { - public AuthMe plugin; - public DataSource database; - public CommandSender sender; + public final AuthMe plugin; + public final DataSource database; + public final CommandSender sender; /** * Constructor for SqlToFlat. diff --git a/src/main/java/fr/xephi/authme/converter/vAuthConverter.java b/src/main/java/fr/xephi/authme/converter/vAuthConverter.java index 955f2179b..5db924d00 100644 --- a/src/main/java/fr/xephi/authme/converter/vAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/vAuthConverter.java @@ -9,9 +9,9 @@ import org.bukkit.command.CommandSender; */ public class vAuthConverter implements Converter { - public AuthMe plugin; - public DataSource database; - public CommandSender sender; + public final AuthMe plugin; + public final DataSource database; + public final CommandSender sender; /** * Constructor for vAuthConverter. diff --git a/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java b/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java index 6736000b4..1ab969ea5 100644 --- a/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java +++ b/src/main/java/fr/xephi/authme/converter/vAuthFileReader.java @@ -17,9 +17,9 @@ import java.util.UUID; */ public class vAuthFileReader { - public AuthMe plugin; - public DataSource database; - public CommandSender sender; + public final AuthMe plugin; + public final DataSource database; + public final CommandSender sender; /** * Constructor for vAuthFileReader. @@ -38,7 +38,7 @@ public class vAuthFileReader { * * @throws IOException */ - public void convert() throws IOException { + public void convert() { final File file = new File(plugin.getDataFolder().getParent() + "" + File.separator + "vAuth" + File.separator + "passwords.yml"); Scanner scanner; try { diff --git a/src/main/java/fr/xephi/authme/converter/xAuthConverter.java b/src/main/java/fr/xephi/authme/converter/xAuthConverter.java index 6800689f2..4da2c4020 100644 --- a/src/main/java/fr/xephi/authme/converter/xAuthConverter.java +++ b/src/main/java/fr/xephi/authme/converter/xAuthConverter.java @@ -7,8 +7,8 @@ import org.bukkit.command.CommandSender; */ public class xAuthConverter implements Converter { - public AuthMe plugin; - public CommandSender sender; + public final AuthMe plugin; + public final CommandSender sender; /** * Constructor for xAuthConverter. diff --git a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java index 50c2f0302..44980654b 100644 --- a/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java +++ b/src/main/java/fr/xephi/authme/converter/xAuthToFlat.java @@ -20,9 +20,9 @@ import java.util.List; */ public class xAuthToFlat { - public AuthMe instance; - public DataSource database; - public CommandSender sender; + public final AuthMe instance; + public final DataSource database; + public final CommandSender sender; /** * Constructor for xAuthToFlat. diff --git a/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java b/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java index fbf4e1b32..ebd133e07 100644 --- a/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java +++ b/src/main/java/fr/xephi/authme/datasource/DatabaseCalls.java @@ -13,7 +13,7 @@ import java.util.concurrent.Executors; public class DatabaseCalls implements DataSource { private final ExecutorService exec; - private DataSource database; + private final DataSource database; /** * Constructor for DatabaseCalls. diff --git a/src/main/java/fr/xephi/authme/datasource/FlatFile.java b/src/main/java/fr/xephi/authme/datasource/FlatFile.java index 2f0b3c47c..9901a0fa3 100644 --- a/src/main/java/fr/xephi/authme/datasource/FlatFile.java +++ b/src/main/java/fr/xephi/authme/datasource/FlatFile.java @@ -25,7 +25,7 @@ public class FlatFile implements DataSource { * :LASTPOSZ:LASTPOSWORLD PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS * PLAYERNAME:HASHSUM:IP PLAYERNAME:HASHSUM */ - private File source; + private final File source; public FlatFile() { source = Settings.AUTH_FILE; diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 8a06902c5..455361a49 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -17,29 +17,29 @@ import java.util.List; */ public class MySQL implements DataSource { - private String host; - private String port; - private String username; - private String password; - private String database; - private String tableName; - private String columnName; - private String columnPassword; - private String columnIp; - private String columnLastLogin; - private String columnSalt; - private String columnGroup; - private String lastlocX; - private String lastlocY; - private String lastlocZ; - private String lastlocWorld; - private String columnEmail; - private String columnID; - private String columnLogged; - private List columnOthers; + private final String host; + private final String port; + private final String username; + private final String password; + private final String database; + private final String tableName; + private final String columnName; + private final String columnPassword; + private final String columnIp; + private final String columnLastLogin; + private final String columnSalt; + private final String columnGroup; + private final String lastlocX; + private final String lastlocY; + private final String lastlocZ; + private final String lastlocWorld; + private final String columnEmail; + private final String columnID; + private final String columnLogged; + private final List columnOthers; private HikariDataSource ds; - private String columnRealName; - private int maxConnections; + private final String columnRealName; + private final int maxConnections; /** * Constructor for MySQL. @@ -105,7 +105,7 @@ public class MySQL implements DataSource { * @throws ClassNotFoundException * @throws IllegalArgumentException */ private synchronized void setConnectionArguments() - throws ClassNotFoundException, IllegalArgumentException { + throws IllegalArgumentException { HikariConfig config = new HikariConfig(); config.setPoolName("AuthMeMYSQLPool"); config.setDriverClassName("com.mysql.jdbc.Driver"); diff --git a/src/main/java/fr/xephi/authme/datasource/SQLite.java b/src/main/java/fr/xephi/authme/datasource/SQLite.java index 4488963cd..9c4301ae4 100644 --- a/src/main/java/fr/xephi/authme/datasource/SQLite.java +++ b/src/main/java/fr/xephi/authme/datasource/SQLite.java @@ -12,23 +12,23 @@ import java.util.List; */ public class SQLite implements DataSource { - private String database; - private String tableName; - private String columnName; - private String columnPassword; - private String columnIp; - private String columnLastLogin; - private String columnSalt; - private String columnGroup; - private String lastlocX; - private String lastlocY; - private String lastlocZ; - private String lastlocWorld; - private String columnEmail; - private String columnID; + private final String database; + private final String tableName; + private final String columnName; + private final String columnPassword; + private final String columnIp; + private final String columnLastLogin; + private final String columnSalt; + private final String columnGroup; + private final String lastlocX; + private final String lastlocY; + private final String lastlocZ; + private final String lastlocWorld; + private final String columnEmail; + private final String columnID; private Connection con; - private String columnLogged; - private String columnRealName; + private final String columnLogged; + private final String columnRealName; /** * Constructor for SQLite. diff --git a/src/main/java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java b/src/main/java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java index 6c602669a..bd1cb1c0c 100644 --- a/src/main/java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java +++ b/src/main/java/fr/xephi/authme/events/AuthMeAsyncPreLoginEvent.java @@ -13,7 +13,7 @@ import org.bukkit.event.HandlerList; public class AuthMeAsyncPreLoginEvent extends Event { private static final HandlerList handlers = new HandlerList(); - private Player player; + private final Player player; private boolean canLogin = true; /** diff --git a/src/main/java/fr/xephi/authme/events/AuthMeTeleportEvent.java b/src/main/java/fr/xephi/authme/events/AuthMeTeleportEvent.java index 367fd3c23..305efa466 100644 --- a/src/main/java/fr/xephi/authme/events/AuthMeTeleportEvent.java +++ b/src/main/java/fr/xephi/authme/events/AuthMeTeleportEvent.java @@ -11,9 +11,9 @@ import org.bukkit.entity.Player; */ public class AuthMeTeleportEvent extends CustomEvent { - private Player player; + private final Player player; private Location to; - private Location from; + private final Location from; /** * Constructor for AuthMeTeleportEvent. diff --git a/src/main/java/fr/xephi/authme/events/FirstSpawnTeleportEvent.java b/src/main/java/fr/xephi/authme/events/FirstSpawnTeleportEvent.java index 4cb01bfa6..136a4d45d 100644 --- a/src/main/java/fr/xephi/authme/events/FirstSpawnTeleportEvent.java +++ b/src/main/java/fr/xephi/authme/events/FirstSpawnTeleportEvent.java @@ -11,9 +11,9 @@ import org.bukkit.entity.Player; */ public class FirstSpawnTeleportEvent extends CustomEvent { - private Player player; + private final Player player; private Location to; - private Location from; + private final Location from; /** * Constructor for FirstSpawnTeleportEvent. diff --git a/src/main/java/fr/xephi/authme/events/ProtectInventoryEvent.java b/src/main/java/fr/xephi/authme/events/ProtectInventoryEvent.java index 38531a2b4..dea3a4609 100644 --- a/src/main/java/fr/xephi/authme/events/ProtectInventoryEvent.java +++ b/src/main/java/fr/xephi/authme/events/ProtectInventoryEvent.java @@ -12,11 +12,11 @@ import org.bukkit.inventory.ItemStack; */ public class ProtectInventoryEvent extends CustomEvent { - private ItemStack[] storedinventory; - private ItemStack[] storedarmor; + private final ItemStack[] storedinventory; + private final ItemStack[] storedarmor; private ItemStack[] emptyInventory = null; private ItemStack[] emptyArmor = null; - private Player player; + private final Player player; /** * Constructor for ProtectInventoryEvent. diff --git a/src/main/java/fr/xephi/authme/events/RegisterTeleportEvent.java b/src/main/java/fr/xephi/authme/events/RegisterTeleportEvent.java index 2d3273401..a4fef0b6d 100644 --- a/src/main/java/fr/xephi/authme/events/RegisterTeleportEvent.java +++ b/src/main/java/fr/xephi/authme/events/RegisterTeleportEvent.java @@ -12,9 +12,9 @@ import org.bukkit.entity.Player; */ public class RegisterTeleportEvent extends CustomEvent { - private Player player; + private final Player player; private Location to; - private Location from; + private final Location from; /** * Constructor for RegisterTeleportEvent. diff --git a/src/main/java/fr/xephi/authme/events/SpawnTeleportEvent.java b/src/main/java/fr/xephi/authme/events/SpawnTeleportEvent.java index e83b1de96..c971f572b 100644 --- a/src/main/java/fr/xephi/authme/events/SpawnTeleportEvent.java +++ b/src/main/java/fr/xephi/authme/events/SpawnTeleportEvent.java @@ -11,10 +11,10 @@ import org.bukkit.entity.Player; */ public class SpawnTeleportEvent extends CustomEvent { - private Player player; + private final Player player; private Location to; - private Location from; - private boolean isAuthenticated; + private final Location from; + private final boolean isAuthenticated; /** * Constructor for SpawnTeleportEvent. diff --git a/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java b/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java index 3a63078d5..148773fc8 100644 --- a/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java +++ b/src/main/java/fr/xephi/authme/hooks/BungeeCordMessage.java @@ -10,7 +10,7 @@ import org.bukkit.plugin.messaging.PluginMessageListener; */ public class BungeeCordMessage implements PluginMessageListener { - public AuthMe plugin; + public final AuthMe plugin; /** * Constructor for BungeeCordMessage. diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java index c025c5622..497b9e336 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeBlockListener.java @@ -12,7 +12,7 @@ import org.bukkit.event.block.BlockPlaceEvent; */ public class AuthMeBlockListener implements Listener { - public AuthMe instance; + public final AuthMe instance; /** * Constructor for AuthMeBlockListener. diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java index dfba44ecf..02c94e83e 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeEntityListener.java @@ -20,7 +20,7 @@ public class AuthMeEntityListener implements Listener { private static Method getShooter; private static boolean shooterIsProjectileSource; - public AuthMe instance; + public final AuthMe instance; /** * Constructor for AuthMeEntityListener. diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java index 3543acbff..aa0e24a67 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener.java @@ -37,12 +37,12 @@ import java.util.regex.PatternSyntaxException; */ public class AuthMePlayerListener implements Listener { - public static ConcurrentHashMap gameMode = new ConcurrentHashMap<>(); - public static ConcurrentHashMap joinMessage = new ConcurrentHashMap<>(); - public static ConcurrentHashMap causeByAuthMe = new ConcurrentHashMap<>(); - public AuthMe plugin; - private Messages m = Messages.getInstance(); - private List antibot = new ArrayList<>(); + public static final ConcurrentHashMap gameMode = new ConcurrentHashMap<>(); + public static final ConcurrentHashMap joinMessage = new ConcurrentHashMap<>(); + public static final ConcurrentHashMap causeByAuthMe = new ConcurrentHashMap<>(); + public final AuthMe plugin; + private final Messages m = Messages.getInstance(); + private final List antibot = new ArrayList<>(); /** * Constructor for AuthMePlayerListener. diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java index 0dd34daec..d06780c28 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener16.java @@ -12,7 +12,7 @@ import org.bukkit.event.player.PlayerEditBookEvent; */ public class AuthMePlayerListener16 implements Listener { - public AuthMe plugin; + public final AuthMe plugin; /** * Constructor for AuthMePlayerListener16. diff --git a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java index ac1dc42b7..ef5e27dd9 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMePlayerListener18.java @@ -12,7 +12,7 @@ import org.bukkit.event.player.PlayerInteractAtEntityEvent; */ public class AuthMePlayerListener18 implements Listener { - public AuthMe plugin; + public final AuthMe plugin; /** * Constructor for AuthMePlayerListener18. diff --git a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java index 51670d37b..7495edf80 100644 --- a/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java +++ b/src/main/java/fr/xephi/authme/listener/AuthMeServerListener.java @@ -17,8 +17,8 @@ import org.bukkit.plugin.Plugin; */ public class AuthMeServerListener implements Listener { - public AuthMe plugin; - private Messages m = Messages.getInstance(); + public final AuthMe plugin; + private final Messages m = Messages.getInstance(); /** * Constructor for AuthMeServerListener. diff --git a/src/main/java/fr/xephi/authme/modules/ModuleManager.java b/src/main/java/fr/xephi/authme/modules/ModuleManager.java index b6a718b66..23aa37a88 100644 --- a/src/main/java/fr/xephi/authme/modules/ModuleManager.java +++ b/src/main/java/fr/xephi/authme/modules/ModuleManager.java @@ -19,7 +19,7 @@ import java.util.jar.JarFile; */ public class ModuleManager { - private List modules = new ArrayList<>(); + private final List modules = new ArrayList<>(); /** * Constructor for ModuleManager. diff --git a/src/main/java/fr/xephi/authme/permission/PermissionsManager.java b/src/main/java/fr/xephi/authme/permission/PermissionsManager.java index 6614deaa4..fc6e3014c 100644 --- a/src/main/java/fr/xephi/authme/permission/PermissionsManager.java +++ b/src/main/java/fr/xephi/authme/permission/PermissionsManager.java @@ -47,11 +47,11 @@ public class PermissionsManager { /** * Server instance. */ - private Server server; + private final Server server; /** * Plugin instance. */ - private Plugin plugin; + private final Plugin plugin; /** * Logger instance. */ @@ -907,7 +907,7 @@ public class PermissionsManager { VAULT("Vault"), PERMISSIONS("Permissions"); - public String name; + public final String name; /** * Constructor for PermissionsSystemType. diff --git a/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java b/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java index 05a57dcd7..63d192a08 100644 --- a/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/AsynchronousLogin.java @@ -25,15 +25,15 @@ import java.util.List; */ public class AsynchronousLogin { - private static RandomString rdm = new RandomString(Settings.captchaLength); - protected Player player; - protected String name; - protected String realName; - protected String password; - protected boolean forceLogin; - private AuthMe plugin; - private DataSource database; - private Messages m = Messages.getInstance(); + private static final RandomString rdm = new RandomString(Settings.captchaLength); + protected final Player player; + protected final String name; + protected final String realName; + protected final String password; + protected final boolean forceLogin; + private final AuthMe plugin; + private final DataSource database; + private final Messages m = Messages.getInstance(); /** * Constructor for AsynchronousLogin. diff --git a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java index 9577a7958..1b705d8aa 100644 --- a/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java +++ b/src/main/java/fr/xephi/authme/process/login/ProcessSyncronousPlayerLogin.java @@ -24,14 +24,14 @@ import org.bukkit.potion.PotionEffectType; */ public class ProcessSyncronousPlayerLogin implements Runnable { - private LimboPlayer limbo; - private Player player; - private String name; - private PlayerAuth auth; - private AuthMe plugin; - private DataSource database; - private PluginManager pm; - private JsonCache playerCache; + private final LimboPlayer limbo; + private final Player player; + private final String name; + private final PlayerAuth auth; + private final AuthMe plugin; + private final DataSource database; + private final PluginManager pm; + private final JsonCache playerCache; /** * Constructor for ProcessSyncronousPlayerLogin. diff --git a/src/main/java/fr/xephi/authme/process/logout/AsynchronousLogout.java b/src/main/java/fr/xephi/authme/process/logout/AsynchronousLogout.java index 6edcc6229..d4f35331d 100644 --- a/src/main/java/fr/xephi/authme/process/logout/AsynchronousLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/AsynchronousLogout.java @@ -15,12 +15,12 @@ import org.bukkit.scheduler.BukkitScheduler; */ public class AsynchronousLogout { - protected Player player; - protected String name; - protected AuthMe plugin; - protected DataSource database; + protected final Player player; + protected final String name; + protected final AuthMe plugin; + protected final DataSource database; protected boolean canLogout = true; - private Messages m = Messages.getInstance(); + private final Messages m = Messages.getInstance(); /** * Constructor for AsynchronousLogout. diff --git a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java index 850a14d2b..b23ce6e82 100644 --- a/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java +++ b/src/main/java/fr/xephi/authme/process/logout/ProcessSyncronousPlayerLogout.java @@ -1,77 +1,77 @@ -package fr.xephi.authme.process.logout; - -import fr.xephi.authme.AuthMe; -import fr.xephi.authme.ConsoleLogger; -import fr.xephi.authme.cache.limbo.LimboCache; -import fr.xephi.authme.events.LogoutEvent; -import fr.xephi.authme.settings.Messages; -import fr.xephi.authme.settings.Settings; -import fr.xephi.authme.task.MessageTask; -import fr.xephi.authme.task.TimeoutTask; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; - -/** - */ -public class ProcessSyncronousPlayerLogout implements Runnable { - - protected Player player; - protected AuthMe plugin; - protected String name; - private Messages m = Messages.getInstance(); - - /** - * Constructor for ProcessSyncronousPlayerLogout. - * - * @param player Player - * @param plugin AuthMe - */ - public ProcessSyncronousPlayerLogout(Player player, AuthMe plugin) { - this.player = player; - this.plugin = plugin; - this.name = player.getName().toLowerCase(); - } - - /** - * Method run. - * - * @see java.lang.Runnable#run() - */ - @Override - public void run() { - if (plugin.sessions.containsKey(name)) - plugin.sessions.get(name).cancel(); - plugin.sessions.remove(name); - int delay = Settings.getRegistrationTimeout * 20; - int interval = Settings.getWarnMessageInterval; - BukkitScheduler sched = player.getServer().getScheduler(); - if (delay != 0) { - BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay); - LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); - } - BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval)); - LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT); - if (player.isInsideVehicle() && player.getVehicle() != null) - player.getVehicle().eject(); - if (Settings.applyBlindEffect) - player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); - player.setOp(false); - if (!Settings.isMovementAllowed) { - player.setAllowFlight(true); - player.setFlying(true); - if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { - player.setFlySpeed(0.0f); - player.setWalkSpeed(0.0f); - } - } - // Player is now logout... Time to fire event ! - Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player)); - m.send(player, "logout"); - ConsoleLogger.info(player.getName() + " logged out"); - } - -} +package fr.xephi.authme.process.logout; + +import fr.xephi.authme.AuthMe; +import fr.xephi.authme.ConsoleLogger; +import fr.xephi.authme.cache.limbo.LimboCache; +import fr.xephi.authme.events.LogoutEvent; +import fr.xephi.authme.settings.Messages; +import fr.xephi.authme.settings.Settings; +import fr.xephi.authme.task.MessageTask; +import fr.xephi.authme.task.TimeoutTask; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; +import org.bukkit.scheduler.BukkitScheduler; +import org.bukkit.scheduler.BukkitTask; + +/** + */ +public class ProcessSyncronousPlayerLogout implements Runnable { + + protected final Player player; + protected final AuthMe plugin; + protected final String name; + private final Messages m = Messages.getInstance(); + + /** + * Constructor for ProcessSyncronousPlayerLogout. + * + * @param player Player + * @param plugin AuthMe + */ + public ProcessSyncronousPlayerLogout(Player player, AuthMe plugin) { + this.player = player; + this.plugin = plugin; + this.name = player.getName().toLowerCase(); + } + + /** + * Method run. + * + * @see java.lang.Runnable#run() + */ + @Override + public void run() { + if (plugin.sessions.containsKey(name)) + plugin.sessions.get(name).cancel(); + plugin.sessions.remove(name); + int delay = Settings.getRegistrationTimeout * 20; + int interval = Settings.getWarnMessageInterval; + BukkitScheduler sched = player.getServer().getScheduler(); + if (delay != 0) { + BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay); + LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); + } + BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval)); + LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT); + if (player.isInsideVehicle() && player.getVehicle() != null) + player.getVehicle().eject(); + if (Settings.applyBlindEffect) + player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); + player.setOp(false); + if (!Settings.isMovementAllowed) { + player.setAllowFlight(true); + player.setFlying(true); + if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { + player.setFlySpeed(0.0f); + player.setWalkSpeed(0.0f); + } + } + // Player is now logout... Time to fire event ! + Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player)); + m.send(player, "logout"); + ConsoleLogger.info(player.getName() + " logged out"); + } + +} diff --git a/src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java b/src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java index 983f33db3..540730f52 100644 --- a/src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java @@ -18,10 +18,10 @@ import org.bukkit.scheduler.BukkitTask; */ public class AsynchronousQuit { - protected AuthMe plugin; - protected DataSource database; - protected Player player; - private String name; + protected final AuthMe plugin; + protected final DataSource database; + protected final Player player; + private final String name; private boolean isOp = false; private boolean isFlying = false; private boolean needToChange = false; diff --git a/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java b/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java index 5628c201c..5b31b2ff9 100644 --- a/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java +++ b/src/main/java/fr/xephi/authme/process/quit/ProcessSyncronousPlayerQuit.java @@ -9,11 +9,11 @@ import org.bukkit.entity.Player; */ public class ProcessSyncronousPlayerQuit implements Runnable { - protected AuthMe plugin; - protected Player player; - protected boolean isOp; - protected boolean isFlying; - protected boolean needToChange; + protected final AuthMe plugin; + protected final Player player; + protected final boolean isOp; + protected final boolean isFlying; + protected final boolean needToChange; /** * Constructor for ProcessSyncronousPlayerQuit. diff --git a/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java index 36013c349..d66e1ca2e 100644 --- a/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/AsyncRegister.java @@ -17,13 +17,13 @@ import java.util.Date; */ public class AsyncRegister { - protected Player player; - protected String name; - protected String password; + protected final Player player; + protected final String name; + protected final String password; protected String email = ""; - private AuthMe plugin; - private DataSource database; - private Messages m = Messages.getInstance(); + private final AuthMe plugin; + private final DataSource database; + private final Messages m = Messages.getInstance(); /** * Constructor for AsyncRegister. diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncEmailRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncEmailRegister.java index eb7f5f209..fc80d41c6 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncEmailRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncEmailRegister.java @@ -17,10 +17,10 @@ import org.bukkit.scheduler.BukkitTask; */ public class ProcessSyncEmailRegister implements Runnable { - protected Player player; - protected String name; - private AuthMe plugin; - private Messages m = Messages.getInstance(); + protected final Player player; + protected final String name; + private final AuthMe plugin; + private final Messages m = Messages.getInstance(); /** * Constructor for ProcessSyncEmailRegister. diff --git a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java index 90095a12d..d215ea003 100644 --- a/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java +++ b/src/main/java/fr/xephi/authme/process/register/ProcessSyncronousPasswordRegister.java @@ -22,10 +22,10 @@ import org.bukkit.scheduler.BukkitTask; */ public class ProcessSyncronousPasswordRegister implements Runnable { - protected Player player; - protected String name; - private AuthMe plugin; - private Messages m = Messages.getInstance(); + protected final Player player; + protected final String name; + private final AuthMe plugin; + private final Messages m = Messages.getInstance(); /** * Constructor for ProcessSyncronousPasswordRegister. diff --git a/src/main/java/fr/xephi/authme/process/unregister/AsynchronousUnregister.java b/src/main/java/fr/xephi/authme/process/unregister/AsynchronousUnregister.java index 38e55c7c3..907333273 100644 --- a/src/main/java/fr/xephi/authme/process/unregister/AsynchronousUnregister.java +++ b/src/main/java/fr/xephi/authme/process/unregister/AsynchronousUnregister.java @@ -24,13 +24,13 @@ import java.security.NoSuchAlgorithmException; */ public class AsynchronousUnregister { - protected Player player; - protected String name; - protected String password; - protected boolean force; - private AuthMe plugin; - private Messages m = Messages.getInstance(); - private JsonCache playerCache; + protected final Player player; + protected final String name; + protected final String password; + protected final boolean force; + private final AuthMe plugin; + private final Messages m = Messages.getInstance(); + private final JsonCache playerCache; /** * Constructor for AsynchronousUnregister. diff --git a/src/main/java/fr/xephi/authme/security/HashAlgorithm.java b/src/main/java/fr/xephi/authme/security/HashAlgorithm.java index dc22a2aa5..999991c29 100644 --- a/src/main/java/fr/xephi/authme/security/HashAlgorithm.java +++ b/src/main/java/fr/xephi/authme/security/HashAlgorithm.java @@ -35,7 +35,7 @@ public enum HashAlgorithm { SALTEDSHA512(fr.xephi.authme.security.crypts.SALTEDSHA512.class), CUSTOM(Null.class); - Class classe; + final Class classe; /** * Constructor for HashAlgorithm. diff --git a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java index 723026d97..571c83fb8 100644 --- a/src/main/java/fr/xephi/authme/security/PasswordSecurity.java +++ b/src/main/java/fr/xephi/authme/security/PasswordSecurity.java @@ -18,8 +18,8 @@ import java.util.HashMap; */ public class PasswordSecurity { - public static HashMap userSalt = new HashMap<>(); - private static SecureRandom rnd = new SecureRandom(); + public static final HashMap userSalt = new HashMap<>(); + private static final SecureRandom rnd = new SecureRandom(); /** * Method createSalt. @@ -191,7 +191,7 @@ public class PasswordSecurity { * @return boolean * @throws NoSuchAlgorithmException */ private static boolean compareWithAllEncryptionMethod(String password, - String hash, String playerName) throws NoSuchAlgorithmException { + String hash, String playerName) { for (HashAlgorithm algo : HashAlgorithm.values()) { if (algo != HashAlgorithm.CUSTOM) { try { diff --git a/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java b/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java index e7e9e50cf..e852dd6d1 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java +++ b/src/main/java/fr/xephi/authme/security/crypts/PHPBB.java @@ -15,7 +15,7 @@ import java.security.NoSuchAlgorithmException; */ public class PHPBB implements EncryptionMethod { - private String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + private final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; /** * Method md5. diff --git a/src/main/java/fr/xephi/authme/security/crypts/WHIRLPOOL.java b/src/main/java/fr/xephi/authme/security/crypts/WHIRLPOOL.java index 03682f2dd..6bf5d9f3b 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/WHIRLPOOL.java +++ b/src/main/java/fr/xephi/authme/security/crypts/WHIRLPOOL.java @@ -86,8 +86,8 @@ public class WHIRLPOOL implements EncryptionMethod { */ private static final String sbox = "\u1823\uc6E8\u87B8\u014F\u36A6\ud2F5\u796F\u9152" + "\u60Bc\u9B8E\uA30c\u7B35\u1dE0\ud7c2\u2E4B\uFE57" + "\u1577\u37E5\u9FF0\u4AdA\u58c9\u290A\uB1A0\u6B85" + "\uBd5d\u10F4\ucB3E\u0567\uE427\u418B\uA77d\u95d8" + "\uFBEE\u7c66\udd17\u479E\ucA2d\uBF07\uAd5A\u8333" + "\u6302\uAA71\uc819\u49d9\uF2E3\u5B88\u9A26\u32B0" + "\uE90F\ud580\uBEcd\u3448\uFF7A\u905F\u2068\u1AAE" + "\uB454\u9322\u64F1\u7312\u4008\uc3Ec\udBA1\u8d3d" + "\u9700\ucF2B\u7682\ud61B\uB5AF\u6A50\u45F3\u30EF" + "\u3F55\uA2EA\u65BA\u2Fc0\udE1c\uFd4d\u9275\u068A" + "\uB2E6\u0E1F\u62d4\uA896\uF9c5\u2559\u8472\u394c" + "\u5E78\u388c\ud1A5\uE261\uB321\u9c1E\u43c7\uFc04" + "\u5199\u6d0d\uFAdF\u7E24\u3BAB\ucE11\u8F4E\uB7EB" + "\u3c81\u94F7\uB913\u2cd3\uE76E\uc403\u5644\u7FA9" + "\u2ABB\uc153\udc0B\u9d6c\u3174\uF646\uAc89\u14E1" + "\u163A\u6909\u70B6\ud0Ed\ucc42\u98A4\u285c\uF886"; - private static long[][] C = new long[8][256]; - private static long[] rc = new long[R + 1]; + private static final long[][] C = new long[8][256]; + private static final long[] rc = new long[R + 1]; static { for (int x = 0; x < 256; x++) { @@ -135,12 +135,12 @@ public class WHIRLPOOL implements EncryptionMethod { /** * Global number of hashed bits (256-bit counter). */ - protected byte[] bitLength = new byte[32]; + protected final byte[] bitLength = new byte[32]; /** * Buffer of data to hash. */ - protected byte[] buffer = new byte[64]; + protected final byte[] buffer = new byte[64]; /** * Current number of bits on the buffer. @@ -155,11 +155,11 @@ public class WHIRLPOOL implements EncryptionMethod { /** * The hashing state. */ - protected long[] hash = new long[8]; - protected long[] K = new long[8]; - protected long[] L = new long[8]; - protected long[] block = new long[8]; - protected long[] state = new long[8]; + protected final long[] hash = new long[8]; + protected final long[] K = new long[8]; + protected final long[] L = new long[8]; + protected final long[] block = new long[8]; + protected final long[] state = new long[8]; public WHIRLPOOL() { } diff --git a/src/main/java/fr/xephi/authme/security/crypts/WORDPRESS.java b/src/main/java/fr/xephi/authme/security/crypts/WORDPRESS.java index 8ef6f6a19..c3e79627d 100644 --- a/src/main/java/fr/xephi/authme/security/crypts/WORDPRESS.java +++ b/src/main/java/fr/xephi/authme/security/crypts/WORDPRESS.java @@ -11,7 +11,7 @@ import java.util.Arrays; public class WORDPRESS implements EncryptionMethod { private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - private SecureRandom randomGen = new SecureRandom(); + private final SecureRandom randomGen = new SecureRandom(); /** * Method encode64. diff --git a/src/main/java/fr/xephi/authme/security/pbkdf2/MacBasedPRF.java b/src/main/java/fr/xephi/authme/security/pbkdf2/MacBasedPRF.java index 2ba32cfe8..95651c02e 100644 --- a/src/main/java/fr/xephi/authme/security/pbkdf2/MacBasedPRF.java +++ b/src/main/java/fr/xephi/authme/security/pbkdf2/MacBasedPRF.java @@ -46,7 +46,7 @@ public class MacBasedPRF implements PRF { protected int hLen; - protected String macAlgorithm; + protected final String macAlgorithm; /** * Create Mac-based Pseudo Random Function. diff --git a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java index 757bfe332..cb1719cb1 100644 --- a/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java +++ b/src/main/java/fr/xephi/authme/settings/CustomConfiguration.java @@ -16,7 +16,7 @@ import java.nio.file.StandardCopyOption; */ public abstract class CustomConfiguration extends YamlConfiguration { - private File configFile; + private final File configFile; /** * Constructor for CustomConfiguration. diff --git a/src/main/java/fr/xephi/authme/task/MessageTask.java b/src/main/java/fr/xephi/authme/task/MessageTask.java index 1540e1dc2..cfaa7d4a4 100644 --- a/src/main/java/fr/xephi/authme/task/MessageTask.java +++ b/src/main/java/fr/xephi/authme/task/MessageTask.java @@ -11,10 +11,10 @@ import org.bukkit.scheduler.BukkitTask; */ public class MessageTask implements Runnable { - private AuthMe plugin; - private String name; - private String[] msg; - private int interval; + private final AuthMe plugin; + private final String name; + private final String[] msg; + private final int interval; /** * Constructor for MessageTask. diff --git a/src/main/java/fr/xephi/authme/task/TimeoutTask.java b/src/main/java/fr/xephi/authme/task/TimeoutTask.java index 8cbad2903..50b9f3540 100644 --- a/src/main/java/fr/xephi/authme/task/TimeoutTask.java +++ b/src/main/java/fr/xephi/authme/task/TimeoutTask.java @@ -10,10 +10,10 @@ import org.bukkit.entity.Player; */ public class TimeoutTask implements Runnable { - private AuthMe plugin; - private String name; - private Messages m = Messages.getInstance(); - private Player player; + private final AuthMe plugin; + private final String name; + private final Messages m = Messages.getInstance(); + private final Player player; /** * Constructor for TimeoutTask. diff --git a/src/main/java/fr/xephi/authme/util/Utils.java b/src/main/java/fr/xephi/authme/util/Utils.java index d0d6734cc..1a83b570e 100644 --- a/src/main/java/fr/xephi/authme/util/Utils.java +++ b/src/main/java/fr/xephi/authme/util/Utils.java @@ -31,7 +31,7 @@ import java.util.zip.GZIPInputStream; */ public final class Utils { - public static AuthMe plugin; + public static final AuthMe plugin; private static boolean getOnlinePlayersIsCollection = false; private static Method getOnlinePlayers;