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;
// Random data maps and stuff
// TODO: Create Manager for this
public ConcurrentHashMap<String, BukkitTask> sessions = new ConcurrentHashMap<>();
public ConcurrentHashMap<String, Integer> captcha = new ConcurrentHashMap<>();
public ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<>();
public ConcurrentHashMap<String, String> realIp = new ConcurrentHashMap<>();
public final ConcurrentHashMap<String, BukkitTask> sessions = new ConcurrentHashMap<>();
public final ConcurrentHashMap<String, Integer> captcha = new ConcurrentHashMap<>();
public final ConcurrentHashMap<String, String> cap = new ConcurrentHashMap<>();
public final ConcurrentHashMap<String, String> realIp = new ConcurrentHashMap<>();
// AntiBot Status
// TODO: Create Manager for this
public boolean antiBotMod = false;

View File

@ -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.
*

View File

@ -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;
}
}

View File

@ -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;
/**

View File

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

View File

@ -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.

View File

@ -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;

View File

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

View File

@ -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.

View File

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

View File

@ -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;

View File

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

View File

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

View File

@ -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.

View File

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

View File

@ -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.

View File

@ -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;

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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 {

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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;

View File

@ -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<String> 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<String> 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");

View File

@ -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.

View File

@ -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;
/**

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

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

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

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

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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");
}
}

View File

@ -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;

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -18,8 +18,8 @@ import java.util.HashMap;
*/
public class PasswordSecurity {
public static HashMap<String, String> userSalt = new HashMap<>();
private static SecureRandom rnd = new SecureRandom();
public static final HashMap<String, String> 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 {

View File

@ -15,7 +15,7 @@ import java.security.NoSuchAlgorithmException;
*/
public class PHPBB implements EncryptionMethod {
private String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
private final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
/**
* 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 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() {
}

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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;