mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-01 21:47:35 +01:00
Remove PlayerLogs, so buggy
This commit is contained in:
parent
bcd31c5844
commit
a9dcf15759
@ -71,7 +71,6 @@ import fr.xephi.authme.plugin.manager.EssSpawn;
|
||||
import fr.xephi.authme.process.Management;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.OtherAccounts;
|
||||
import fr.xephi.authme.settings.PlayersLogs;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.Spawn;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
@ -253,8 +252,6 @@ public class AuthMe extends JavaPlugin {
|
||||
ConsoleLogger.showError("WARNING!!! By disabling ForceSingleSession, your server protection is inadequate!");
|
||||
}
|
||||
|
||||
PlayersLogs.getInstance();
|
||||
|
||||
if (Settings.reloadSupport)
|
||||
try {
|
||||
int playersOnline = 0;
|
||||
@ -269,7 +266,9 @@ public class AuthMe extends JavaPlugin {
|
||||
database.purgeLogged();
|
||||
} catch (NullPointerException npe) {
|
||||
}
|
||||
} else PlayersLogs.getInstance().loadPlayers();
|
||||
} else {
|
||||
// TODO: load logged players !
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.settings.PlayersLogs;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
public class FlatFile implements DataSource {
|
||||
@ -662,17 +661,14 @@ public class FlatFile implements DataSource {
|
||||
|
||||
@Override
|
||||
public void setLogged(String user) {
|
||||
PlayersLogs.getInstance().savePlayerLogs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUnlogged(String user) {
|
||||
PlayersLogs.getInstance().savePlayerLogs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void purgeLogged() {
|
||||
PlayersLogs.getInstance().clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,7 +12,6 @@ import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.security.PasswordSecurity;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.PlayersLogs;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
|
||||
public class AsyncronousRegister {
|
||||
@ -62,12 +61,12 @@ public class AsyncronousRegister {
|
||||
m.send(player, "password_error_nick");
|
||||
allowRegister = false;
|
||||
}
|
||||
|
||||
|
||||
else if (password.length() < Settings.getPasswordMinLen || password.length() > Settings.passwordMaxLength) {
|
||||
m.send(player, "pass_len");
|
||||
allowRegister = false;
|
||||
}
|
||||
|
||||
|
||||
else if (!Settings.unsafePasswords.isEmpty()) {
|
||||
if (Settings.unsafePasswords.contains(password.toLowerCase())) {
|
||||
m.send(player, "password_error_unsafe");
|
||||
@ -77,7 +76,6 @@ public class AsyncronousRegister {
|
||||
|
||||
else if (database.isAuthAvailable(name)) {
|
||||
m.send(player, "user_regged");
|
||||
PlayersLogs.getInstance().savePlayerLogs();
|
||||
allowRegister = false;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@ import fr.xephi.authme.events.LoginEvent;
|
||||
import fr.xephi.authme.events.RegisterTeleportEvent;
|
||||
import fr.xephi.authme.events.RestoreInventoryEvent;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
import fr.xephi.authme.settings.PlayersLogs;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import fr.xephi.authme.task.TimeoutTask;
|
||||
@ -73,7 +72,6 @@ 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 {
|
||||
PlayersLogs.getInstance().save();
|
||||
if (player.isInsideVehicle())
|
||||
player.getVehicle().eject();
|
||||
} catch (NullPointerException npe) {
|
||||
|
@ -1,64 +0,0 @@
|
||||
package fr.xephi.authme.settings;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Xephi59
|
||||
*/
|
||||
public class PlayersLogs extends CustomConfiguration {
|
||||
|
||||
private static PlayersLogs pllog = null;
|
||||
|
||||
public PlayersLogs() {
|
||||
super(new File("." + File.separator + "plugins" + File.separator + "AuthMe" + File.separator + "players.yml"));
|
||||
pllog = this;
|
||||
load();
|
||||
save();
|
||||
}
|
||||
|
||||
public void loadPlayers() {
|
||||
DataSource database = AuthMe.getInstance().database;
|
||||
List<String> list = this.getStringList("players");
|
||||
if (list == null || list.isEmpty())
|
||||
return;
|
||||
for (String s : list) {
|
||||
PlayerAuth auth = database.getAuth(s);
|
||||
if (auth == null)
|
||||
continue;
|
||||
auth.setLastLogin(new Date().getTime());
|
||||
database.updateSession(auth);
|
||||
PlayerCache.getInstance().addPlayer(auth);
|
||||
}
|
||||
}
|
||||
|
||||
public static PlayersLogs getInstance() {
|
||||
if (pllog == null) {
|
||||
pllog = new PlayersLogs();
|
||||
}
|
||||
return pllog;
|
||||
}
|
||||
|
||||
public void savePlayerLogs() {
|
||||
List<String> players = new ArrayList<String>();
|
||||
for (String s : PlayerCache.getInstance().getCache().keySet()) {
|
||||
players.add(s);
|
||||
}
|
||||
this.set("players", players);
|
||||
this.save();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.set("players", new ArrayList<String>());
|
||||
this.save();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user