Finalized some fields, removed redundant code, various other fixes
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
+4
-4
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user