change Utils to static class.
This commit is contained in:
@@ -38,7 +38,6 @@ public class AsyncronousJoin {
|
||||
protected DataSource database;
|
||||
protected AuthMe plugin;
|
||||
protected String name;
|
||||
private Utils utils = Utils.getInstance();
|
||||
private Messages m = Messages.getInstance();
|
||||
private JsonCache playerBackup;
|
||||
|
||||
@@ -56,7 +55,7 @@ public class AsyncronousJoin {
|
||||
AuthMePlayerListener.gameMode.putIfAbsent(name, player.getGameMode());
|
||||
BukkitScheduler sched = plugin.getServer().getScheduler();
|
||||
|
||||
if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player)) {
|
||||
if (Utils.isNPC(player) || Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -163,7 +162,7 @@ public class AsyncronousJoin {
|
||||
});
|
||||
}
|
||||
if (!Settings.unRegisteredGroup.isEmpty()) {
|
||||
utils.setGroup(player, Utils.GroupType.UNREGISTERED);
|
||||
Utils.setGroup(player, Utils.GroupType.UNREGISTERED);
|
||||
}
|
||||
if (!Settings.isForcedRegistrationEnabled) {
|
||||
return;
|
||||
@@ -205,9 +204,9 @@ public class AsyncronousJoin {
|
||||
if (!LimboCache.getInstance().hasLimboPlayer(name))
|
||||
LimboCache.getInstance().addLimboPlayer(player);
|
||||
if (database.isAuthAvailable(name)) {
|
||||
utils.setGroup(player, GroupType.NOTLOGGEDIN);
|
||||
Utils.setGroup(player, GroupType.NOTLOGGEDIN);
|
||||
} else {
|
||||
utils.setGroup(player, GroupType.UNREGISTERED);
|
||||
Utils.setGroup(player, GroupType.UNREGISTERED);
|
||||
}
|
||||
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
}
|
||||
|
||||
protected void packQuitLocation() {
|
||||
Utils.getInstance().packCoords(auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), player);
|
||||
Utils.packCoords(auth.getQuitLocX(), auth.getQuitLocY(), auth.getQuitLocZ(), auth.getWorld(), player);
|
||||
}
|
||||
|
||||
protected void teleportBackFromSpawn() {
|
||||
@@ -166,7 +166,7 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
Utils.forceGM(player);
|
||||
|
||||
// Restore Permission Group
|
||||
Utils.getInstance().setGroup(player, GroupType.LOGGEDIN);
|
||||
Utils.setGroup(player, GroupType.LOGGEDIN);
|
||||
|
||||
// Cleanup no longer used temporary data
|
||||
LimboCache.getInstance().deleteLimboPlayer(name);
|
||||
|
||||
@@ -25,7 +25,6 @@ public class AsyncronousLogout {
|
||||
protected DataSource database;
|
||||
protected boolean canLogout = true;
|
||||
private Messages m = Messages.getInstance();
|
||||
private Utils utils = Utils.getInstance();
|
||||
private JsonCache playerBackup;
|
||||
|
||||
public AsyncronousLogout(Player player, AuthMe plugin,
|
||||
@@ -79,7 +78,7 @@ public class AsyncronousLogout {
|
||||
if (LimboCache.getInstance().hasLimboPlayer(name))
|
||||
LimboCache.getInstance().deleteLimboPlayer(name);
|
||||
LimboCache.getInstance().addLimboPlayer(player);
|
||||
utils.setGroup(player, GroupType.NOTLOGGEDIN);
|
||||
Utils.setGroup(player, GroupType.NOTLOGGEDIN);
|
||||
if (Settings.protectInventoryBeforeLogInEnabled) {
|
||||
player.getInventory().clear();
|
||||
// create cache file for handling lost of inventories on unlogged in
|
||||
|
||||
@@ -22,7 +22,6 @@ public class AsyncronousQuit {
|
||||
protected AuthMe plugin;
|
||||
protected DataSource database;
|
||||
protected Player player;
|
||||
protected Utils utils = Utils.getInstance();
|
||||
private String name;
|
||||
private ItemStack[] armor = null;
|
||||
private ItemStack[] inv = null;
|
||||
@@ -43,7 +42,7 @@ public class AsyncronousQuit {
|
||||
public void process() {
|
||||
if (player == null)
|
||||
return;
|
||||
if (utils.isNPC(player) || Utils.getInstance().isUnrestricted(player)) {
|
||||
if (Utils.isNPC(player) || Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -66,7 +65,7 @@ public class AsyncronousQuit {
|
||||
armor = limbo.getArmour();
|
||||
}
|
||||
if (limbo.getGroup() != null && !limbo.getGroup().equals(""))
|
||||
utils.addNormal(player, limbo.getGroup());
|
||||
Utils.addNormal(player, limbo.getGroup());
|
||||
needToChange = true;
|
||||
isOp = limbo.getOperator();
|
||||
isFlying = limbo.isFlying();
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ProcessSyncronousEmailRegister implements Runnable {
|
||||
public void run() {
|
||||
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(name);
|
||||
if (!Settings.getRegisteredGroup.isEmpty()) {
|
||||
Utils.getInstance().setGroup(player, Utils.GroupType.REGISTERED);
|
||||
Utils.setGroup(player, Utils.GroupType.REGISTERED);
|
||||
}
|
||||
m.send(player, "vb_nonActiv");
|
||||
int time = Settings.getRegistrationTimeout * 20;
|
||||
|
||||
+11
-14
@@ -1,13 +1,5 @@
|
||||
package fr.xephi.authme.process.register;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.Utils;
|
||||
@@ -21,6 +13,13 @@ 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.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
|
||||
@@ -39,7 +38,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
for (String command : Settings.forceRegisterCommands) {
|
||||
try {
|
||||
player.performCommand(command.replace("%p", player.getName()));
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
for (String command : Settings.forceRegisterCommandsAsConsole) {
|
||||
@@ -71,10 +70,8 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
}
|
||||
BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval));
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(msgT);
|
||||
try {
|
||||
if (player.isInsideVehicle())
|
||||
player.getVehicle().eject();
|
||||
} catch (NullPointerException npe) {
|
||||
if (player.isInsideVehicle() && player.getVehicle() != null) {
|
||||
player.getVehicle().eject();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +105,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
}
|
||||
|
||||
if (!Settings.getRegisteredGroup.isEmpty()) {
|
||||
Utils.getInstance().setGroup(player, Utils.GroupType.REGISTERED);
|
||||
Utils.setGroup(player, Utils.GroupType.REGISTERED);
|
||||
}
|
||||
m.send(player, "registered");
|
||||
if (!Settings.getmailAccount.isEmpty())
|
||||
|
||||
Reference in New Issue
Block a user