Finalized some fields, removed redundant code, various other fixes

This commit is contained in:
Tim Visée 2015-11-23 22:14:03 +01:00
parent 83e5d726af
commit 82bf0f45ca
64 changed files with 320 additions and 323 deletions

View File

@ -88,10 +88,10 @@ public class AuthMe extends JavaPlugin {
public AuthMeInventoryPacketAdapter inventoryProtector; public AuthMeInventoryPacketAdapter inventoryProtector;
// Random data maps and stuff // Random data maps and stuff
// TODO: Create Manager for this // TODO: Create Manager for this
public ConcurrentHashMap<String, BukkitTask> sessions = new ConcurrentHashMap<>(); public final ConcurrentHashMap<String, BukkitTask> sessions = new ConcurrentHashMap<>();
public ConcurrentHashMap<String, Integer> captcha = new ConcurrentHashMap<>(); public final ConcurrentHashMap<String, Integer> captcha = new ConcurrentHashMap<>();
public ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<>(); public final ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<>();
public ConcurrentHashMap<String, String> realIp = new ConcurrentHashMap<>(); public final ConcurrentHashMap<String, String> realIp = new ConcurrentHashMap<>();
// AntiBot Status // AntiBot Status
// TODO: Create Manager for this // TODO: Create Manager for this
public boolean antiBotMod = false; public boolean antiBotMod = false;

View File

@ -18,7 +18,7 @@ import java.util.concurrent.Future;
*/ */
public class DataManager { public class DataManager {
public AuthMe plugin; public final AuthMe plugin;
/** /**
* Constructor for DataManager. * Constructor for DataManager.
@ -29,9 +29,6 @@ public class DataManager {
this.plugin = plugin; this.plugin = plugin;
} }
public void run() {
}
/** /**
* Method getOfflinePlayer. * Method getOfflinePlayer.
* *

View File

@ -1,40 +1,40 @@
package fr.xephi.authme; package fr.xephi.authme;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
/** /**
*/ */
public class ImageGenerator { public class ImageGenerator {
private String pass; private final String pass;
/** /**
* Constructor for ImageGenerator. * Constructor for ImageGenerator.
* *
* @param pass String * @param pass String
*/ */
public ImageGenerator(String pass) { public ImageGenerator(String pass) {
this.pass = pass; this.pass = pass;
} }
/** /**
* Method generateImage. * Method generateImage.
* *
* @return BufferedImage * @return BufferedImage
*/ */
public BufferedImage generateImage() { public BufferedImage generateImage() {
BufferedImage image = new BufferedImage(200, 60, BufferedImage.TYPE_BYTE_INDEXED); BufferedImage image = new BufferedImage(200, 60, BufferedImage.TYPE_BYTE_INDEXED);
Graphics2D graphics = image.createGraphics(); Graphics2D graphics = image.createGraphics();
graphics.setColor(Color.BLACK); graphics.setColor(Color.BLACK);
graphics.fillRect(0, 0, 200, 40); graphics.fillRect(0, 0, 200, 40);
GradientPaint gradientPaint = new GradientPaint(10, 5, Color.WHITE, 20, 10, Color.WHITE, true); GradientPaint gradientPaint = new GradientPaint(10, 5, Color.WHITE, 20, 10, Color.WHITE, true);
graphics.setPaint(gradientPaint); graphics.setPaint(gradientPaint);
Font font = new Font("Comic Sans MS", Font.BOLD, 30); Font font = new Font("Comic Sans MS", Font.BOLD, 30);
graphics.setFont(font); graphics.setFont(font);
graphics.drawString(pass, 5, 30); graphics.drawString(pass, 5, 30);
graphics.dispose(); graphics.dispose();
image.flush(); image.flush();
return image; return image;
} }
} }

View File

@ -14,13 +14,13 @@ import java.util.Date;
*/ */
public class PerformBackup { public class PerformBackup {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_HH-mm"); final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd_HH-mm");
String dateString = format.format(new Date()); final String dateString = format.format(new Date());
private String dbName = Settings.getMySQLDatabase; private final String dbName = Settings.getMySQLDatabase;
private String dbUserName = Settings.getMySQLUsername; private final String dbUserName = Settings.getMySQLUsername;
private String dbPassword = Settings.getMySQLPassword; private final String dbPassword = Settings.getMySQLPassword;
private String tblname = Settings.getMySQLTablename; private final String tblname = Settings.getMySQLTablename;
private String path = AuthMe.getInstance().getDataFolder() + File.separator + "backups" + File.separator + "backup" + dateString; private final String path = AuthMe.getInstance().getDataFolder() + File.separator + "backups" + File.separator + "backup" + dateString;
private AuthMe instance; private AuthMe instance;
/** /**

View File

@ -16,7 +16,7 @@ import java.io.File;
*/ */
public class SendMailSSL { public class SendMailSSL {
public AuthMe plugin; public final AuthMe plugin;
/** /**
* Constructor for SendMailSSL. * Constructor for SendMailSSL.

View File

@ -19,7 +19,7 @@ import java.security.NoSuchAlgorithmException;
public class NewAPI { public class NewAPI {
public static NewAPI singleton; public static NewAPI singleton;
public AuthMe plugin; public final AuthMe plugin;
/** /**
* Constructor for NewAPI. * Constructor for NewAPI.

View File

@ -16,7 +16,7 @@ public class PlayerAuth {
private double z; private double z;
private String world; private String world;
private String salt; private String salt;
private int groupId; private final int groupId;
private String email; private String email;
private String realName; private String realName;

View File

@ -7,7 +7,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class PlayerCache { public class PlayerCache {
private volatile static PlayerCache singleton; private volatile static PlayerCache singleton;
private ConcurrentHashMap<String, PlayerAuth> cache; private final ConcurrentHashMap<String, PlayerAuth> cache;
private PlayerCache() { private PlayerCache() {
cache = new ConcurrentHashMap<>(); cache = new ConcurrentHashMap<>();

View File

@ -4,9 +4,9 @@ package fr.xephi.authme.cache.backup;
*/ */
public class DataFileCache { public class DataFileCache {
private String group; private final String group;
private boolean operator; private final boolean operator;
private boolean flying; private final boolean flying;
/** /**
* Constructor for DataFileCache. * Constructor for DataFileCache.

View File

@ -19,9 +19,9 @@ import java.util.concurrent.ConcurrentHashMap;
public class LimboCache { public class LimboCache {
private volatile static LimboCache singleton; private volatile static LimboCache singleton;
public ConcurrentHashMap<String, LimboPlayer> cache; public final ConcurrentHashMap<String, LimboPlayer> cache;
public AuthMe plugin; public final AuthMe plugin;
private JsonCache playerData; private final JsonCache playerData;
/** /**
* Constructor for LimboCache. * Constructor for LimboCache.

View File

@ -8,7 +8,7 @@ import org.bukkit.scheduler.BukkitTask;
*/ */
public class LimboPlayer { public class LimboPlayer {
private String name; private final String name;
private Location loc = null; private Location loc = null;
private BukkitTask timeoutTaskId = null; private BukkitTask timeoutTaskId = null;
private BukkitTask messageTaskId = null; private BukkitTask messageTaskId = null;

View File

@ -20,7 +20,7 @@ public class CommandManager {
/** /**
* The list of commandDescriptions. * The list of commandDescriptions.
*/ */
private List<CommandDescription> commandDescriptions = new ArrayList<>(); private final List<CommandDescription> commandDescriptions = new ArrayList<>();
/** /**
* Constructor. * Constructor.

View File

@ -12,7 +12,7 @@ public class CommandParts {
/** /**
* The list of parts for this command. * The list of parts for this command.
*/ */
private List<String> parts = new ArrayList<>(); private final List<String> parts = new ArrayList<>();
/** /**
* Constructor. * Constructor.

View File

@ -13,15 +13,15 @@ public class FoundCommandResult {
/** /**
* The command reference. * The command reference.
*/ */
private CommandParts commandReference; private final CommandParts commandReference;
/** /**
* The command arguments. * The command arguments.
*/ */
private CommandParts commandArguments; private final CommandParts commandArguments;
/** /**
* The original search query reference. * The original search query reference.
*/ */
private CommandParts queryReference; private final CommandParts queryReference;
/** /**
* Constructor. * Constructor.

View File

@ -90,7 +90,7 @@ public class ConverterCommand extends ExecutableCommand {
vauth("vauth"), vauth("vauth"),
sqltoflat("sqltoflat"); sqltoflat("sqltoflat");
String name; final String name;
/** /**
* Constructor for ConvertType. * Constructor for ConvertType.

View File

@ -18,9 +18,9 @@ import java.io.IOException;
*/ */
public class CrazyLoginConverter implements Converter { public class CrazyLoginConverter implements Converter {
public AuthMe instance; public final AuthMe instance;
public DataSource database; public final DataSource database;
public CommandSender sender; public final CommandSender sender;
/** /**
* Constructor for CrazyLoginConverter. * Constructor for CrazyLoginConverter.

View File

@ -14,7 +14,7 @@ import java.sql.*;
*/ */
public class FlatToSqlite implements Converter { public class FlatToSqlite implements Converter {
public CommandSender sender; public final CommandSender sender;
private String tableName; private String tableName;
private String columnName; private String columnName;
private String columnPassword; private String columnPassword;

View File

@ -11,7 +11,7 @@ import fr.xephi.authme.settings.Settings;
*/ */
public class ForceFlatToSqlite implements Converter { public class ForceFlatToSqlite implements Converter {
private DataSource data; private final DataSource data;
/** /**
* Constructor for ForceFlatToSqlite. * Constructor for ForceFlatToSqlite.

View File

@ -23,9 +23,9 @@ import java.util.Map.Entry;
*/ */
public class RakamakConverter implements Converter { public class RakamakConverter implements Converter {
public AuthMe instance; public final AuthMe instance;
public DataSource database; public final DataSource database;
public CommandSender sender; public final CommandSender sender;
/** /**
* Constructor for RakamakConverter. * Constructor for RakamakConverter.

View File

@ -12,8 +12,8 @@ import java.io.File;
*/ */
public class RoyalAuthConverter implements Converter { public class RoyalAuthConverter implements Converter {
public AuthMe plugin; public final AuthMe plugin;
private DataSource data; private final DataSource data;
/** /**
* Constructor for RoyalAuthConverter. * Constructor for RoyalAuthConverter.

View File

@ -14,9 +14,9 @@ import java.util.List;
*/ */
public class SqlToFlat implements Converter { public class SqlToFlat implements Converter {
public AuthMe plugin; public final AuthMe plugin;
public DataSource database; public final DataSource database;
public CommandSender sender; public final CommandSender sender;
/** /**
* Constructor for SqlToFlat. * Constructor for SqlToFlat.

View File

@ -9,9 +9,9 @@ import org.bukkit.command.CommandSender;
*/ */
public class vAuthConverter implements Converter { public class vAuthConverter implements Converter {
public AuthMe plugin; public final AuthMe plugin;
public DataSource database; public final DataSource database;
public CommandSender sender; public final CommandSender sender;
/** /**
* Constructor for vAuthConverter. * Constructor for vAuthConverter.

View File

@ -17,9 +17,9 @@ import java.util.UUID;
*/ */
public class vAuthFileReader { public class vAuthFileReader {
public AuthMe plugin; public final AuthMe plugin;
public DataSource database; public final DataSource database;
public CommandSender sender; public final CommandSender sender;
/** /**
* Constructor for vAuthFileReader. * Constructor for vAuthFileReader.
@ -38,7 +38,7 @@ public class vAuthFileReader {
* *
* @throws IOException * @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"); final File file = new File(plugin.getDataFolder().getParent() + "" + File.separator + "vAuth" + File.separator + "passwords.yml");
Scanner scanner; Scanner scanner;
try { try {

View File

@ -7,8 +7,8 @@ import org.bukkit.command.CommandSender;
*/ */
public class xAuthConverter implements Converter { public class xAuthConverter implements Converter {
public AuthMe plugin; public final AuthMe plugin;
public CommandSender sender; public final CommandSender sender;
/** /**
* Constructor for xAuthConverter. * Constructor for xAuthConverter.

View File

@ -20,9 +20,9 @@ import java.util.List;
*/ */
public class xAuthToFlat { public class xAuthToFlat {
public AuthMe instance; public final AuthMe instance;
public DataSource database; public final DataSource database;
public CommandSender sender; public final CommandSender sender;
/** /**
* Constructor for xAuthToFlat. * Constructor for xAuthToFlat.

View File

@ -13,7 +13,7 @@ import java.util.concurrent.Executors;
public class DatabaseCalls implements DataSource { public class DatabaseCalls implements DataSource {
private final ExecutorService exec; private final ExecutorService exec;
private DataSource database; private final DataSource database;
/** /**
* Constructor for DatabaseCalls. * Constructor for DatabaseCalls.

View File

@ -25,7 +25,7 @@ public class FlatFile implements DataSource {
* :LASTPOSZ:LASTPOSWORLD PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS * :LASTPOSZ:LASTPOSWORLD PLAYERNAME:HASHSUM:IP:LOGININMILLIESECONDS
* PLAYERNAME:HASHSUM:IP PLAYERNAME:HASHSUM * PLAYERNAME:HASHSUM:IP PLAYERNAME:HASHSUM
*/ */
private File source; private final File source;
public FlatFile() { public FlatFile() {
source = Settings.AUTH_FILE; source = Settings.AUTH_FILE;

View File

@ -17,29 +17,29 @@ import java.util.List;
*/ */
public class MySQL implements DataSource { public class MySQL implements DataSource {
private String host; private final String host;
private String port; private final String port;
private String username; private final String username;
private String password; private final String password;
private String database; private final String database;
private String tableName; private final String tableName;
private String columnName; private final String columnName;
private String columnPassword; private final String columnPassword;
private String columnIp; private final String columnIp;
private String columnLastLogin; private final String columnLastLogin;
private String columnSalt; private final String columnSalt;
private String columnGroup; private final String columnGroup;
private String lastlocX; private final String lastlocX;
private String lastlocY; private final String lastlocY;
private String lastlocZ; private final String lastlocZ;
private String lastlocWorld; private final String lastlocWorld;
private String columnEmail; private final String columnEmail;
private String columnID; private final String columnID;
private String columnLogged; private final String columnLogged;
private List<String> columnOthers; private final List<String> columnOthers;
private HikariDataSource ds; private HikariDataSource ds;
private String columnRealName; private final String columnRealName;
private int maxConnections; private final int maxConnections;
/** /**
* Constructor for MySQL. * Constructor for MySQL.
@ -105,7 +105,7 @@ public class MySQL implements DataSource {
* @throws ClassNotFoundException * @throws IllegalArgumentException * @throws ClassNotFoundException * @throws IllegalArgumentException
*/ */
private synchronized void setConnectionArguments() private synchronized void setConnectionArguments()
throws ClassNotFoundException, IllegalArgumentException { throws IllegalArgumentException {
HikariConfig config = new HikariConfig(); HikariConfig config = new HikariConfig();
config.setPoolName("AuthMeMYSQLPool"); config.setPoolName("AuthMeMYSQLPool");
config.setDriverClassName("com.mysql.jdbc.Driver"); config.setDriverClassName("com.mysql.jdbc.Driver");

View File

@ -12,23 +12,23 @@ import java.util.List;
*/ */
public class SQLite implements DataSource { public class SQLite implements DataSource {
private String database; private final String database;
private String tableName; private final String tableName;
private String columnName; private final String columnName;
private String columnPassword; private final String columnPassword;
private String columnIp; private final String columnIp;
private String columnLastLogin; private final String columnLastLogin;
private String columnSalt; private final String columnSalt;
private String columnGroup; private final String columnGroup;
private String lastlocX; private final String lastlocX;
private String lastlocY; private final String lastlocY;
private String lastlocZ; private final String lastlocZ;
private String lastlocWorld; private final String lastlocWorld;
private String columnEmail; private final String columnEmail;
private String columnID; private final String columnID;
private Connection con; private Connection con;
private String columnLogged; private final String columnLogged;
private String columnRealName; private final String columnRealName;
/** /**
* Constructor for SQLite. * Constructor for SQLite.

View File

@ -13,7 +13,7 @@ import org.bukkit.event.HandlerList;
public class AuthMeAsyncPreLoginEvent extends Event { public class AuthMeAsyncPreLoginEvent extends Event {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Player player; private final Player player;
private boolean canLogin = true; private boolean canLogin = true;
/** /**

View File

@ -11,9 +11,9 @@ import org.bukkit.entity.Player;
*/ */
public class AuthMeTeleportEvent extends CustomEvent { public class AuthMeTeleportEvent extends CustomEvent {
private Player player; private final Player player;
private Location to; private Location to;
private Location from; private final Location from;
/** /**
* Constructor for AuthMeTeleportEvent. * Constructor for AuthMeTeleportEvent.

View File

@ -11,9 +11,9 @@ import org.bukkit.entity.Player;
*/ */
public class FirstSpawnTeleportEvent extends CustomEvent { public class FirstSpawnTeleportEvent extends CustomEvent {
private Player player; private final Player player;
private Location to; private Location to;
private Location from; private final Location from;
/** /**
* Constructor for FirstSpawnTeleportEvent. * Constructor for FirstSpawnTeleportEvent.

View File

@ -12,11 +12,11 @@ import org.bukkit.inventory.ItemStack;
*/ */
public class ProtectInventoryEvent extends CustomEvent { public class ProtectInventoryEvent extends CustomEvent {
private ItemStack[] storedinventory; private final ItemStack[] storedinventory;
private ItemStack[] storedarmor; private final ItemStack[] storedarmor;
private ItemStack[] emptyInventory = null; private ItemStack[] emptyInventory = null;
private ItemStack[] emptyArmor = null; private ItemStack[] emptyArmor = null;
private Player player; private final Player player;
/** /**
* Constructor for ProtectInventoryEvent. * Constructor for ProtectInventoryEvent.

View File

@ -12,9 +12,9 @@ import org.bukkit.entity.Player;
*/ */
public class RegisterTeleportEvent extends CustomEvent { public class RegisterTeleportEvent extends CustomEvent {
private Player player; private final Player player;
private Location to; private Location to;
private Location from; private final Location from;
/** /**
* Constructor for RegisterTeleportEvent. * Constructor for RegisterTeleportEvent.

View File

@ -11,10 +11,10 @@ import org.bukkit.entity.Player;
*/ */
public class SpawnTeleportEvent extends CustomEvent { public class SpawnTeleportEvent extends CustomEvent {
private Player player; private final Player player;
private Location to; private Location to;
private Location from; private final Location from;
private boolean isAuthenticated; private final boolean isAuthenticated;
/** /**
* Constructor for SpawnTeleportEvent. * Constructor for SpawnTeleportEvent.

View File

@ -10,7 +10,7 @@ import org.bukkit.plugin.messaging.PluginMessageListener;
*/ */
public class BungeeCordMessage implements PluginMessageListener { public class BungeeCordMessage implements PluginMessageListener {
public AuthMe plugin; public final AuthMe plugin;
/** /**
* Constructor for BungeeCordMessage. * Constructor for BungeeCordMessage.

View File

@ -12,7 +12,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
*/ */
public class AuthMeBlockListener implements Listener { public class AuthMeBlockListener implements Listener {
public AuthMe instance; public final AuthMe instance;
/** /**
* Constructor for AuthMeBlockListener. * Constructor for AuthMeBlockListener.

View File

@ -20,7 +20,7 @@ public class AuthMeEntityListener implements Listener {
private static Method getShooter; private static Method getShooter;
private static boolean shooterIsProjectileSource; private static boolean shooterIsProjectileSource;
public AuthMe instance; public final AuthMe instance;
/** /**
* Constructor for AuthMeEntityListener. * Constructor for AuthMeEntityListener.

View File

@ -37,12 +37,12 @@ import java.util.regex.PatternSyntaxException;
*/ */
public class AuthMePlayerListener implements Listener { public class AuthMePlayerListener implements Listener {
public static ConcurrentHashMap<String, GameMode> gameMode = new ConcurrentHashMap<>(); public static final ConcurrentHashMap<String, GameMode> gameMode = new ConcurrentHashMap<>();
public static ConcurrentHashMap<String, String> joinMessage = new ConcurrentHashMap<>(); public static final ConcurrentHashMap<String, String> joinMessage = new ConcurrentHashMap<>();
public static ConcurrentHashMap<String, Boolean> causeByAuthMe = new ConcurrentHashMap<>(); public static final ConcurrentHashMap<String, Boolean> causeByAuthMe = new ConcurrentHashMap<>();
public AuthMe plugin; public final AuthMe plugin;
private Messages m = Messages.getInstance(); private final Messages m = Messages.getInstance();
private List<String> antibot = new ArrayList<>(); private final List<String> antibot = new ArrayList<>();
/** /**
* Constructor for AuthMePlayerListener. * Constructor for AuthMePlayerListener.

View File

@ -12,7 +12,7 @@ import org.bukkit.event.player.PlayerEditBookEvent;
*/ */
public class AuthMePlayerListener16 implements Listener { public class AuthMePlayerListener16 implements Listener {
public AuthMe plugin; public final AuthMe plugin;
/** /**
* Constructor for AuthMePlayerListener16. * Constructor for AuthMePlayerListener16.

View File

@ -12,7 +12,7 @@ import org.bukkit.event.player.PlayerInteractAtEntityEvent;
*/ */
public class AuthMePlayerListener18 implements Listener { public class AuthMePlayerListener18 implements Listener {
public AuthMe plugin; public final AuthMe plugin;
/** /**
* Constructor for AuthMePlayerListener18. * Constructor for AuthMePlayerListener18.

View File

@ -17,8 +17,8 @@ import org.bukkit.plugin.Plugin;
*/ */
public class AuthMeServerListener implements Listener { public class AuthMeServerListener implements Listener {
public AuthMe plugin; public final AuthMe plugin;
private Messages m = Messages.getInstance(); private final Messages m = Messages.getInstance();
/** /**
* Constructor for AuthMeServerListener. * Constructor for AuthMeServerListener.

View File

@ -19,7 +19,7 @@ import java.util.jar.JarFile;
*/ */
public class ModuleManager { public class ModuleManager {
private List<Module> modules = new ArrayList<>(); private final List<Module> modules = new ArrayList<>();
/** /**
* Constructor for ModuleManager. * Constructor for ModuleManager.

View File

@ -47,11 +47,11 @@ public class PermissionsManager {
/** /**
* Server instance. * Server instance.
*/ */
private Server server; private final Server server;
/** /**
* Plugin instance. * Plugin instance.
*/ */
private Plugin plugin; private final Plugin plugin;
/** /**
* Logger instance. * Logger instance.
*/ */
@ -907,7 +907,7 @@ public class PermissionsManager {
VAULT("Vault"), VAULT("Vault"),
PERMISSIONS("Permissions"); PERMISSIONS("Permissions");
public String name; public final String name;
/** /**
* Constructor for PermissionsSystemType. * Constructor for PermissionsSystemType.

View File

@ -25,15 +25,15 @@ import java.util.List;
*/ */
public class AsynchronousLogin { public class AsynchronousLogin {
private static RandomString rdm = new RandomString(Settings.captchaLength); private static final RandomString rdm = new RandomString(Settings.captchaLength);
protected Player player; protected final Player player;
protected String name; protected final String name;
protected String realName; protected final String realName;
protected String password; protected final String password;
protected boolean forceLogin; protected final boolean forceLogin;
private AuthMe plugin; private final AuthMe plugin;
private DataSource database; private final DataSource database;
private Messages m = Messages.getInstance(); private final Messages m = Messages.getInstance();
/** /**
* Constructor for AsynchronousLogin. * Constructor for AsynchronousLogin.

View File

@ -24,14 +24,14 @@ import org.bukkit.potion.PotionEffectType;
*/ */
public class ProcessSyncronousPlayerLogin implements Runnable { public class ProcessSyncronousPlayerLogin implements Runnable {
private LimboPlayer limbo; private final LimboPlayer limbo;
private Player player; private final Player player;
private String name; private final String name;
private PlayerAuth auth; private final PlayerAuth auth;
private AuthMe plugin; private final AuthMe plugin;
private DataSource database; private final DataSource database;
private PluginManager pm; private final PluginManager pm;
private JsonCache playerCache; private final JsonCache playerCache;
/** /**
* Constructor for ProcessSyncronousPlayerLogin. * Constructor for ProcessSyncronousPlayerLogin.

View File

@ -15,12 +15,12 @@ import org.bukkit.scheduler.BukkitScheduler;
*/ */
public class AsynchronousLogout { public class AsynchronousLogout {
protected Player player; protected final Player player;
protected String name; protected final String name;
protected AuthMe plugin; protected final AuthMe plugin;
protected DataSource database; protected final DataSource database;
protected boolean canLogout = true; protected boolean canLogout = true;
private Messages m = Messages.getInstance(); private final Messages m = Messages.getInstance();
/** /**
* Constructor for AsynchronousLogout. * Constructor for AsynchronousLogout.

View File

@ -1,77 +1,77 @@
package fr.xephi.authme.process.logout; package fr.xephi.authme.process.logout;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.limbo.LimboCache; import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.events.LogoutEvent; import fr.xephi.authme.events.LogoutEvent;
import fr.xephi.authme.settings.Messages; import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.task.MessageTask; import fr.xephi.authme.task.MessageTask;
import fr.xephi.authme.task.TimeoutTask; import fr.xephi.authme.task.TimeoutTask;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
/** /**
*/ */
public class ProcessSyncronousPlayerLogout implements Runnable { public class ProcessSyncronousPlayerLogout implements Runnable {
protected Player player; protected final Player player;
protected AuthMe plugin; protected final AuthMe plugin;
protected String name; protected final String name;
private Messages m = Messages.getInstance(); private final Messages m = Messages.getInstance();
/** /**
* Constructor for ProcessSyncronousPlayerLogout. * Constructor for ProcessSyncronousPlayerLogout.
* *
* @param player Player * @param player Player
* @param plugin AuthMe * @param plugin AuthMe
*/ */
public ProcessSyncronousPlayerLogout(Player player, AuthMe plugin) { public ProcessSyncronousPlayerLogout(Player player, AuthMe plugin) {
this.player = player; this.player = player;
this.plugin = plugin; this.plugin = plugin;
this.name = player.getName().toLowerCase(); this.name = player.getName().toLowerCase();
} }
/** /**
* Method run. * Method run.
* *
* @see java.lang.Runnable#run() * @see java.lang.Runnable#run()
*/ */
@Override @Override
public void run() { public void run() {
if (plugin.sessions.containsKey(name)) if (plugin.sessions.containsKey(name))
plugin.sessions.get(name).cancel(); plugin.sessions.get(name).cancel();
plugin.sessions.remove(name); plugin.sessions.remove(name);
int delay = Settings.getRegistrationTimeout * 20; int delay = Settings.getRegistrationTimeout * 20;
int interval = Settings.getWarnMessageInterval; int interval = Settings.getWarnMessageInterval;
BukkitScheduler sched = player.getServer().getScheduler(); BukkitScheduler sched = player.getServer().getScheduler();
if (delay != 0) { if (delay != 0) {
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay); BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay);
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id); LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
} }
BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval)); BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval));
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT); LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
if (player.isInsideVehicle() && player.getVehicle() != null) if (player.isInsideVehicle() && player.getVehicle() != null)
player.getVehicle().eject(); player.getVehicle().eject();
if (Settings.applyBlindEffect) if (Settings.applyBlindEffect)
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2)); player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
player.setOp(false); player.setOp(false);
if (!Settings.isMovementAllowed) { if (!Settings.isMovementAllowed) {
player.setAllowFlight(true); player.setAllowFlight(true);
player.setFlying(true); player.setFlying(true);
if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) { if (!Settings.isMovementAllowed && Settings.isRemoveSpeedEnabled) {
player.setFlySpeed(0.0f); player.setFlySpeed(0.0f);
player.setWalkSpeed(0.0f); player.setWalkSpeed(0.0f);
} }
} }
// Player is now logout... Time to fire event ! // Player is now logout... Time to fire event !
Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player)); Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player));
m.send(player, "logout"); m.send(player, "logout");
ConsoleLogger.info(player.getName() + " logged out"); ConsoleLogger.info(player.getName() + " logged out");
} }
} }

View File

@ -18,10 +18,10 @@ import org.bukkit.scheduler.BukkitTask;
*/ */
public class AsynchronousQuit { public class AsynchronousQuit {
protected AuthMe plugin; protected final AuthMe plugin;
protected DataSource database; protected final DataSource database;
protected Player player; protected final Player player;
private String name; private final String name;
private boolean isOp = false; private boolean isOp = false;
private boolean isFlying = false; private boolean isFlying = false;
private boolean needToChange = false; private boolean needToChange = false;

View File

@ -9,11 +9,11 @@ import org.bukkit.entity.Player;
*/ */
public class ProcessSyncronousPlayerQuit implements Runnable { public class ProcessSyncronousPlayerQuit implements Runnable {
protected AuthMe plugin; protected final AuthMe plugin;
protected Player player; protected final Player player;
protected boolean isOp; protected final boolean isOp;
protected boolean isFlying; protected final boolean isFlying;
protected boolean needToChange; protected final boolean needToChange;
/** /**
* Constructor for ProcessSyncronousPlayerQuit. * Constructor for ProcessSyncronousPlayerQuit.

View File

@ -17,13 +17,13 @@ import java.util.Date;
*/ */
public class AsyncRegister { public class AsyncRegister {
protected Player player; protected final Player player;
protected String name; protected final String name;
protected String password; protected final String password;
protected String email = ""; protected String email = "";
private AuthMe plugin; private final AuthMe plugin;
private DataSource database; private final DataSource database;
private Messages m = Messages.getInstance(); private final Messages m = Messages.getInstance();
/** /**
* Constructor for AsyncRegister. * Constructor for AsyncRegister.

View File

@ -17,10 +17,10 @@ import org.bukkit.scheduler.BukkitTask;
*/ */
public class ProcessSyncEmailRegister implements Runnable { public class ProcessSyncEmailRegister implements Runnable {
protected Player player; protected final Player player;
protected String name; protected final String name;
private AuthMe plugin; private final AuthMe plugin;
private Messages m = Messages.getInstance(); private final Messages m = Messages.getInstance();
/** /**
* Constructor for ProcessSyncEmailRegister. * Constructor for ProcessSyncEmailRegister.

View File

@ -22,10 +22,10 @@ import org.bukkit.scheduler.BukkitTask;
*/ */
public class ProcessSyncronousPasswordRegister implements Runnable { public class ProcessSyncronousPasswordRegister implements Runnable {
protected Player player; protected final Player player;
protected String name; protected final String name;
private AuthMe plugin; private final AuthMe plugin;
private Messages m = Messages.getInstance(); private final Messages m = Messages.getInstance();
/** /**
* Constructor for ProcessSyncronousPasswordRegister. * Constructor for ProcessSyncronousPasswordRegister.

View File

@ -24,13 +24,13 @@ import java.security.NoSuchAlgorithmException;
*/ */
public class AsynchronousUnregister { public class AsynchronousUnregister {
protected Player player; protected final Player player;
protected String name; protected final String name;
protected String password; protected final String password;
protected boolean force; protected final boolean force;
private AuthMe plugin; private final AuthMe plugin;
private Messages m = Messages.getInstance(); private final Messages m = Messages.getInstance();
private JsonCache playerCache; private final JsonCache playerCache;
/** /**
* Constructor for AsynchronousUnregister. * Constructor for AsynchronousUnregister.

View File

@ -35,7 +35,7 @@ public enum HashAlgorithm {
SALTEDSHA512(fr.xephi.authme.security.crypts.SALTEDSHA512.class), SALTEDSHA512(fr.xephi.authme.security.crypts.SALTEDSHA512.class),
CUSTOM(Null.class); CUSTOM(Null.class);
Class<?> classe; final Class<?> classe;
/** /**
* Constructor for HashAlgorithm. * Constructor for HashAlgorithm.

View File

@ -18,8 +18,8 @@ import java.util.HashMap;
*/ */
public class PasswordSecurity { public class PasswordSecurity {
public static HashMap<String, String> userSalt = new HashMap<>(); public static final HashMap<String, String> userSalt = new HashMap<>();
private static SecureRandom rnd = new SecureRandom(); private static final SecureRandom rnd = new SecureRandom();
/** /**
* Method createSalt. * Method createSalt.
@ -191,7 +191,7 @@ public class PasswordSecurity {
* @return boolean * @throws NoSuchAlgorithmException * @return boolean * @throws NoSuchAlgorithmException
*/ */
private static boolean compareWithAllEncryptionMethod(String password, private static boolean compareWithAllEncryptionMethod(String password,
String hash, String playerName) throws NoSuchAlgorithmException { String hash, String playerName) {
for (HashAlgorithm algo : HashAlgorithm.values()) { for (HashAlgorithm algo : HashAlgorithm.values()) {
if (algo != HashAlgorithm.CUSTOM) { if (algo != HashAlgorithm.CUSTOM) {
try { try {

View File

@ -15,7 +15,7 @@ import java.security.NoSuchAlgorithmException;
*/ */
public class PHPBB implements EncryptionMethod { public class PHPBB implements EncryptionMethod {
private String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; private final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
/** /**
* Method md5. * Method md5.

View File

@ -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 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 final long[][] C = new long[8][256];
private static long[] rc = new long[R + 1]; private static final long[] rc = new long[R + 1];
static { static {
for (int x = 0; x < 256; x++) { for (int x = 0; x < 256; x++) {
@ -135,12 +135,12 @@ public class WHIRLPOOL implements EncryptionMethod {
/** /**
* Global number of hashed bits (256-bit counter). * 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. * 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. * Current number of bits on the buffer.
@ -155,11 +155,11 @@ public class WHIRLPOOL implements EncryptionMethod {
/** /**
* The hashing state. * The hashing state.
*/ */
protected long[] hash = new long[8]; protected final long[] hash = new long[8];
protected long[] K = new long[8]; protected final long[] K = new long[8];
protected long[] L = new long[8]; protected final long[] L = new long[8];
protected long[] block = new long[8]; protected final long[] block = new long[8];
protected long[] state = new long[8]; protected final long[] state = new long[8];
public WHIRLPOOL() { public WHIRLPOOL() {
} }

View File

@ -11,7 +11,7 @@ import java.util.Arrays;
public class WORDPRESS implements EncryptionMethod { public class WORDPRESS implements EncryptionMethod {
private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; private static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
private SecureRandom randomGen = new SecureRandom(); private final SecureRandom randomGen = new SecureRandom();
/** /**
* Method encode64. * Method encode64.

View File

@ -46,7 +46,7 @@ public class MacBasedPRF implements PRF {
protected int hLen; protected int hLen;
protected String macAlgorithm; protected final String macAlgorithm;
/** /**
* Create Mac-based Pseudo Random Function. * Create Mac-based Pseudo Random Function.

View File

@ -16,7 +16,7 @@ import java.nio.file.StandardCopyOption;
*/ */
public abstract class CustomConfiguration extends YamlConfiguration { public abstract class CustomConfiguration extends YamlConfiguration {
private File configFile; private final File configFile;
/** /**
* Constructor for CustomConfiguration. * Constructor for CustomConfiguration.

View File

@ -11,10 +11,10 @@ import org.bukkit.scheduler.BukkitTask;
*/ */
public class MessageTask implements Runnable { public class MessageTask implements Runnable {
private AuthMe plugin; private final AuthMe plugin;
private String name; private final String name;
private String[] msg; private final String[] msg;
private int interval; private final int interval;
/** /**
* Constructor for MessageTask. * Constructor for MessageTask.

View File

@ -10,10 +10,10 @@ import org.bukkit.entity.Player;
*/ */
public class TimeoutTask implements Runnable { public class TimeoutTask implements Runnable {
private AuthMe plugin; private final AuthMe plugin;
private String name; private final String name;
private Messages m = Messages.getInstance(); private final Messages m = Messages.getInstance();
private Player player; private final Player player;
/** /**
* Constructor for TimeoutTask. * Constructor for TimeoutTask.

View File

@ -31,7 +31,7 @@ import java.util.zip.GZIPInputStream;
*/ */
public final class Utils { public final class Utils {
public static AuthMe plugin; public static final AuthMe plugin;
private static boolean getOnlinePlayersIsCollection = false; private static boolean getOnlinePlayersIsCollection = false;
private static Method getOnlinePlayers; private static Method getOnlinePlayers;