mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-26 18:47:37 +01:00
change Utils to static class.
This commit is contained in:
parent
e1893ce85b
commit
4e275eeb1d
@ -57,7 +57,6 @@ public class AuthMe extends JavaPlugin {
|
||||
private final Logger authmeLogger = Logger.getLogger("AuthMe");
|
||||
public Management management;
|
||||
public NewAPI api;
|
||||
private Utils utils = Utils.getInstance();
|
||||
public SendMailSSL mail;
|
||||
private Settings settings;
|
||||
private Messages m;
|
||||
@ -535,7 +534,7 @@ public class AuthMe extends JavaPlugin {
|
||||
|
||||
// Save Player Data
|
||||
public void savePlayer(Player player) {
|
||||
if ((utils.isNPC(player)) || (Utils.getInstance().isUnrestricted(player))) {
|
||||
if ((Utils.isNPC(player)) || (Utils.isUnrestricted(player))) {
|
||||
return;
|
||||
}
|
||||
String name = player.getName().toLowerCase();
|
||||
@ -552,7 +551,7 @@ public class AuthMe extends JavaPlugin {
|
||||
if (!Settings.noTeleport) {
|
||||
player.teleport(limbo.getLoc());
|
||||
}
|
||||
this.utils.addNormal(player, limbo.getGroup());
|
||||
Utils.addNormal(player, limbo.getGroup());
|
||||
player.setOp(limbo.getOperator());
|
||||
limbo.getTimeoutTaskId().cancel();
|
||||
LimboCache.getInstance().deleteLimboPlayer(name);
|
||||
|
@ -21,16 +21,12 @@ import java.util.Iterator;
|
||||
public class Utils {
|
||||
|
||||
private static boolean getOnlinePlayersIsCollection;
|
||||
private String currentGroup;
|
||||
private static Utils singleton;
|
||||
private static Method getOnlinePlayers;
|
||||
public final AuthMe plugin;
|
||||
|
||||
public Utils(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
public static AuthMe plugin;
|
||||
|
||||
static {
|
||||
plugin = AuthMe.getInstance();
|
||||
try {
|
||||
Method m = Bukkit.class.getDeclaredMethod("getOnlinePlayers");
|
||||
getOnlinePlayersIsCollection = m.getReturnType() == Collection.class;
|
||||
@ -38,17 +34,18 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
public void setGroup(Player player, GroupType group) {
|
||||
public static void setGroup(Player player, GroupType group) {
|
||||
setGroup(player.getName(), group);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setGroup(String player, GroupType group) {
|
||||
public static void setGroup(String player, GroupType group) {
|
||||
if (!Settings.isPermissionCheckEnabled)
|
||||
return;
|
||||
if (plugin.permission == null)
|
||||
return;
|
||||
String name = player;
|
||||
String currentGroup;
|
||||
try {
|
||||
World world = null;
|
||||
currentGroup = plugin.permission.getPrimaryGroup(world, name);
|
||||
@ -88,11 +85,10 @@ public class Utils {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean addNormal(Player player, String group) {
|
||||
public static boolean addNormal(Player player, String group) {
|
||||
if (!useGroupSystem()) {
|
||||
return false;
|
||||
}
|
||||
@ -123,20 +119,15 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isUnrestricted(Player player) {
|
||||
public static boolean isUnrestricted(Player player) {
|
||||
return Settings.isAllowRestrictedIp && !(Settings.getUnrestrictedName == null || Settings.getUnrestrictedName.isEmpty()) && (Settings.getUnrestrictedName.contains(player.getName()));
|
||||
}
|
||||
|
||||
public static Utils getInstance() {
|
||||
singleton = new Utils(AuthMe.getInstance());
|
||||
return singleton;
|
||||
}
|
||||
|
||||
private boolean useGroupSystem() {
|
||||
private static boolean useGroupSystem() {
|
||||
return Settings.isPermissionCheckEnabled && !Settings.getUnloggedinGroup.isEmpty();
|
||||
}
|
||||
|
||||
public void packCoords(double x, double y, double z, String w,
|
||||
public static void packCoords(double x, double y, double z, String w,
|
||||
final Player pl) {
|
||||
World theWorld;
|
||||
if (w.equals("unavailableworld")) {
|
||||
@ -216,7 +207,7 @@ public class Utils {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public boolean isNPC(final Entity player) {
|
||||
public static boolean isNPC(final Entity player) {
|
||||
try {
|
||||
if (player.hasMetadata("NPC")) {
|
||||
return true;
|
||||
|
@ -19,7 +19,6 @@ public class API {
|
||||
|
||||
public static final String newline = System.getProperty("line.separator");
|
||||
public static AuthMe instance;
|
||||
private Utils utils = Utils.getInstance();
|
||||
|
||||
@Deprecated
|
||||
public API(AuthMe instance) {
|
||||
@ -65,7 +64,7 @@ public class API {
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isaNPC(Player player) {
|
||||
return utils.isNPC(player);
|
||||
return Utils.isNPC(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,7 +74,7 @@ public class API {
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean isNPC(Player player) {
|
||||
return utils.isNPC(player);
|
||||
return Utils.isNPC(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,7 +84,7 @@ public class API {
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isUnrestricted(Player player) {
|
||||
return Utils.getInstance().isUnrestricted(player);
|
||||
return Utils.isUnrestricted(player);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -22,7 +22,6 @@ public class NewAPI {
|
||||
public static final String newline = System.getProperty("line.separator");
|
||||
public static NewAPI singleton;
|
||||
public AuthMe plugin;
|
||||
private Utils utils = Utils.getInstance();
|
||||
|
||||
public NewAPI(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
@ -68,7 +67,7 @@ public class NewAPI {
|
||||
* @return true if player is a npc
|
||||
*/
|
||||
public boolean isNPC(Player player) {
|
||||
return utils.isNPC(player);
|
||||
return Utils.isNPC(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,7 +76,7 @@ public class NewAPI {
|
||||
* @return true if the player is unrestricted
|
||||
*/
|
||||
public boolean isUnrestricted(Player player) {
|
||||
return Utils.getInstance().isUnrestricted(player);
|
||||
return Utils.isUnrestricted(player);
|
||||
}
|
||||
|
||||
public Location getLastLocation(Player player) {
|
||||
|
@ -464,7 +464,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
@SuppressWarnings("deprecation")
|
||||
Player target = Bukkit.getPlayer(name);
|
||||
PlayerCache.getInstance().removePlayer(name);
|
||||
Utils.getInstance().setGroup(name, GroupType.UNREGISTERED);
|
||||
Utils.setGroup(name, GroupType.UNREGISTERED);
|
||||
if (target != null) {
|
||||
if (target.isOnline()) {
|
||||
if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) {
|
||||
|
@ -84,7 +84,7 @@ public class UnregisterCommand implements CommandExecutor {
|
||||
player.saveData();
|
||||
PlayerCache.getInstance().removePlayer(player.getName().toLowerCase());
|
||||
if (!Settings.getRegisteredGroup.isEmpty())
|
||||
Utils.getInstance().setGroup(player, GroupType.UNREGISTERED);
|
||||
Utils.setGroup(player, GroupType.UNREGISTERED);
|
||||
LimboCache.getInstance().addLimboPlayer(player);
|
||||
int delay = Settings.getRegistrationTimeout * 20;
|
||||
int interval = Settings.getWarnMessageInterval;
|
||||
@ -99,7 +99,7 @@ public class UnregisterCommand implements CommandExecutor {
|
||||
return;
|
||||
}
|
||||
if (!Settings.unRegisteredGroup.isEmpty()) {
|
||||
Utils.getInstance().setGroup(player, Utils.GroupType.UNREGISTERED);
|
||||
Utils.setGroup(player, Utils.GroupType.UNREGISTERED);
|
||||
}
|
||||
PlayerCache.getInstance().removePlayer(player.getName().toLowerCase());
|
||||
// check if Player cache File Exist and delete it, preventing
|
||||
|
@ -28,7 +28,7 @@ public class AuthMeBlockListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (Utils.getInstance().isUnrestricted(player)) {
|
||||
if (Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ public class AuthMeBlockListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (Utils.getInstance().isUnrestricted(player)) {
|
||||
if (Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class AuthMeChestShopListener implements Listener {
|
||||
Player player = event.getClient();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (Utils.getInstance().isUnrestricted(player)) {
|
||||
if (Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@ import org.bukkit.event.entity.*;
|
||||
public class AuthMeEntityListener implements Listener {
|
||||
|
||||
public AuthMe instance;
|
||||
private Utils utils = Utils.getInstance();
|
||||
|
||||
public AuthMeEntityListener(AuthMe instance) {
|
||||
this.instance = instance;
|
||||
@ -28,11 +27,11 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Utils.getInstance().isUnrestricted((Player) entity)) {
|
||||
if (Utils.isUnrestricted((Player) entity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (utils.isNPC(entity))
|
||||
if (Utils.isNPC(entity))
|
||||
return;
|
||||
|
||||
Player player = (Player) entity;
|
||||
@ -61,7 +60,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (utils.isNPC(entity))
|
||||
if (Utils.isNPC(entity))
|
||||
return;
|
||||
|
||||
Player player = (Player) entity;
|
||||
@ -111,7 +110,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (utils.isNPC(entity))
|
||||
if (Utils.isNPC(entity))
|
||||
return;
|
||||
|
||||
Player player = (Player) entity;
|
||||
@ -138,7 +137,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (utils.isNPC(entity))
|
||||
if (Utils.isNPC(entity))
|
||||
return;
|
||||
|
||||
Player player = (Player) entity;
|
||||
@ -167,7 +166,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
Player player = (Player) event.getEntity();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (Utils.getInstance().isUnrestricted(player) || utils.isNPC(player))
|
||||
if (Utils.isUnrestricted(player) || Utils.isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName())) {
|
||||
@ -191,7 +190,7 @@ public class AuthMeEntityListener implements Listener {
|
||||
Player player = (Player) event.getEntity();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (Utils.getInstance().isUnrestricted(player) || utils.isNPC(player))
|
||||
if (Utils.isUnrestricted(player) || Utils.isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName())) {
|
||||
|
@ -39,7 +39,6 @@ public class AuthMePlayerListener implements Listener {
|
||||
public static ConcurrentHashMap<String, String> joinMessage = new ConcurrentHashMap<>();
|
||||
private Messages m = Messages.getInstance();
|
||||
public AuthMe plugin;
|
||||
private Utils utils = Utils.getInstance();
|
||||
public static ConcurrentHashMap<String, Boolean> causeByAuthMe = new ConcurrentHashMap<>();
|
||||
private List<String> antibot = new ArrayList<>();
|
||||
|
||||
@ -55,7 +54,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player))
|
||||
if (Utils.isUnrestricted(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
@ -89,7 +88,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
final Player player = event.getPlayer();
|
||||
final String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player))
|
||||
if (Utils.isUnrestricted(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
@ -125,7 +124,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
final Player player = event.getPlayer();
|
||||
final String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player))
|
||||
if (Utils.isUnrestricted(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
@ -161,7 +160,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
final Player player = event.getPlayer();
|
||||
final String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player))
|
||||
if (Utils.isUnrestricted(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
@ -197,7 +196,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
final Player player = event.getPlayer();
|
||||
final String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player))
|
||||
if (Utils.isUnrestricted(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
@ -233,7 +232,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
final Player player = event.getPlayer();
|
||||
final String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player))
|
||||
if (Utils.isUnrestricted(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
@ -270,7 +269,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
final Player player = event.getPlayer();
|
||||
final String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player))
|
||||
if (Utils.isUnrestricted(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
@ -305,7 +304,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isNPC(player) || utils.isUnrestricted(player)) {
|
||||
if (Utils.isNPC(player) || Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -423,7 +422,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
public void run() {
|
||||
LimboPlayer limbo = LimboCache.getInstance().getLimboPlayer(player.getName().toLowerCase());
|
||||
if (limbo != null && PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
|
||||
utils.addNormal(player, limbo.getGroup());
|
||||
Utils.addNormal(player, limbo.getGroup());
|
||||
LimboCache.getInstance().deleteLimboPlayer(player.getName().toLowerCase());
|
||||
}
|
||||
}
|
||||
@ -440,7 +439,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
final String name = player.getName().toLowerCase();
|
||||
boolean isAuthAvailable = plugin.database.isAuthAvailable(name);
|
||||
|
||||
if (utils.isNPC(player) || utils.isUnrestricted(player)) {
|
||||
if (Utils.isNPC(player) || Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -604,11 +603,11 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player)) {
|
||||
if (Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (utils.isNPC(player))
|
||||
if (Utils.isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
@ -632,11 +631,11 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player)) {
|
||||
if (Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (utils.isNPC(player))
|
||||
if (Utils.isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
|
||||
@ -663,11 +662,11 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player)) {
|
||||
if (Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (utils.isNPC(player)) {
|
||||
if (Utils.isNPC(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -690,10 +689,10 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
final Player player = (Player) event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
if (utils.isUnrestricted(player)) {
|
||||
if (Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
if (utils.isNPC(player))
|
||||
if (Utils.isNPC(player))
|
||||
return;
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
|
||||
return;
|
||||
@ -728,11 +727,11 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player)) {
|
||||
if (Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (utils.isNPC(player))
|
||||
if (Utils.isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
|
||||
@ -758,11 +757,11 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = (Player) damager;
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player)) {
|
||||
if (Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (utils.isNPC(player)) {
|
||||
if (Utils.isNPC(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -786,7 +785,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isNPC(player) || utils.isUnrestricted(player)) {
|
||||
if (Utils.isNPC(player) || Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -810,7 +809,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player) || utils.isNPC(player))
|
||||
if (Utils.isUnrestricted(player) || Utils.isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(player.getName().toLowerCase())) {
|
||||
@ -833,7 +832,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player)) {
|
||||
if (Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -856,7 +855,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
if (utils.isUnrestricted(player)) {
|
||||
if (Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
if (PlayerCache.getInstance().isAuthenticated(name)) {
|
||||
@ -879,7 +878,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player) || utils.isNPC(player))
|
||||
if (Utils.isUnrestricted(player) || Utils.isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
@ -911,7 +910,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
|
||||
String name = player.getName().toLowerCase();
|
||||
|
||||
if (utils.isUnrestricted(player) || utils.isNPC(player))
|
||||
if (Utils.isUnrestricted(player) || Utils.isNPC(player))
|
||||
return;
|
||||
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
|
@ -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;
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user