mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-24 01:27:35 +01:00
Merge remote-tracking branch 'origin/master' into jsoncache-fix
Conflicts: src/main/java/fr/xephi/authme/AuthMe.java src/main/java/fr/xephi/authme/process/quit/AsynchronousQuit.java
This commit is contained in:
commit
98c8e00f5a
25
.github/ISSUE_TEMPLATE.MD
vendored
Normal file
25
.github/ISSUE_TEMPLATE.MD
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
####Before reporting an issue make sure you are running the latest build of the plugin!
|
||||
|
||||
### What behaviour is observed:
|
||||
What happened?
|
||||
|
||||
### What behaviour is expected:
|
||||
What did you expect?
|
||||
|
||||
### Steps/models to reproduce:
|
||||
The actions that cause the issue
|
||||
|
||||
### Plugin list:
|
||||
This can be found by running `/pl`
|
||||
|
||||
### Environment description
|
||||
Standalone server/Bungeecord network, SQLite/MYSql, ...
|
||||
|
||||
### AuthMe build number:
|
||||
This can be found by running `/authme version`
|
||||
|
||||
### Error Log:
|
||||
Pastebin/Hastebin/Gist link of the error logo or stacktrace (if any)
|
||||
|
||||
### COnfiguration:
|
||||
Pastebin/Hastebin/Gist link of your config.yml file (remember to delete any sesible data)
|
@ -101,7 +101,6 @@ public class AuthMe extends JavaPlugin {
|
||||
// Plugin instance
|
||||
private static AuthMe plugin;
|
||||
|
||||
private NewAPI api;
|
||||
private Management management;
|
||||
private CommandHandler commandHandler;
|
||||
private PermissionsManager permsMan;
|
||||
@ -294,16 +293,16 @@ public class AuthMe extends JavaPlugin {
|
||||
// Some statically injected things
|
||||
initializer.register(PlayerCache.class, PlayerCache.getInstance());
|
||||
|
||||
messages = initializer.get(Messages.class);
|
||||
permsMan = initializer.get(PermissionsManager.class);
|
||||
bukkitService = initializer.get(BukkitService.class);
|
||||
pluginHooks = initializer.get(PluginHooks.class);
|
||||
messages = initializer.get(Messages.class);
|
||||
permsMan = initializer.get(PermissionsManager.class);
|
||||
bukkitService = initializer.get(BukkitService.class);
|
||||
pluginHooks = initializer.get(PluginHooks.class);
|
||||
passwordSecurity = initializer.get(PasswordSecurity.class);
|
||||
spawnLoader = initializer.get(SpawnLoader.class);
|
||||
commandHandler = initializer.get(CommandHandler.class);
|
||||
api = initializer.get(NewAPI.class);
|
||||
management = initializer.get(Management.class);
|
||||
geoLiteApi = initializer.get(GeoLiteAPI.class);
|
||||
spawnLoader = initializer.get(SpawnLoader.class);
|
||||
commandHandler = initializer.get(CommandHandler.class);
|
||||
management = initializer.get(Management.class);
|
||||
geoLiteApi = initializer.get(GeoLiteAPI.class);
|
||||
initializer.get(NewAPI.class);
|
||||
initializer.get(API.class);
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@ import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -22,7 +21,6 @@ public final class ConsoleLogger {
|
||||
private static final String NEW_LINE = System.getProperty("line.separator");
|
||||
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("[MM-dd HH:mm:ss]");
|
||||
private static Logger logger;
|
||||
private static boolean enableDebug = false;
|
||||
private static boolean useLogging = false;
|
||||
private static File logFile;
|
||||
private static FileWriter fileWriter;
|
||||
@ -40,7 +38,6 @@ public final class ConsoleLogger {
|
||||
|
||||
public static void setLoggingOptions(NewSetting settings) {
|
||||
ConsoleLogger.useLogging = settings.getProperty(SecuritySettings.USE_LOGGING);
|
||||
ConsoleLogger.enableDebug = !settings.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE);
|
||||
if (useLogging) {
|
||||
if (fileWriter == null) {
|
||||
try {
|
||||
@ -67,19 +64,6 @@ public final class ConsoleLogger {
|
||||
|
||||
}
|
||||
|
||||
public static void debug(String message) {
|
||||
if (enableDebug) {
|
||||
//creating and filling an exception is a expensive call
|
||||
//TODO #419 20160601: ->so it should be removed as soon #419 is fixed
|
||||
//logger.isLoggable does not work because the plugin logger is always ALL
|
||||
logger.log(Level.FINE, message + ' ' + Thread.currentThread().getName(), new Exception());
|
||||
|
||||
if (useLogging) {
|
||||
writeLog("Debug: " + Thread.currentThread().getName() + ':' + message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print an error message.
|
||||
*
|
||||
|
@ -51,10 +51,9 @@ public class SessionManager implements SettingsDependent {
|
||||
* @param name The name of the player who's session to cancel.
|
||||
*/
|
||||
public void cancelSession(String name) {
|
||||
BukkitTask task = sessions.get(name);
|
||||
BukkitTask task = sessions.remove(name);
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
removeSession(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package fr.xephi.authme.cache.auth;
|
||||
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@ -34,7 +33,6 @@ public class PlayerCache {
|
||||
* @param auth PlayerAuth
|
||||
*/
|
||||
public void addPlayer(PlayerAuth auth) {
|
||||
ConsoleLogger.debug("ADDED PLAYER TO CACHE " + auth.getNickname());
|
||||
cache.put(auth.getNickname().toLowerCase(), auth);
|
||||
}
|
||||
|
||||
@ -44,7 +42,6 @@ public class PlayerCache {
|
||||
* @param auth PlayerAuth
|
||||
*/
|
||||
public void updatePlayer(PlayerAuth auth) {
|
||||
ConsoleLogger.debug("UPDATE PLAYER " + auth.getNickname());
|
||||
cache.put(auth.getNickname(), auth);
|
||||
}
|
||||
|
||||
@ -54,7 +51,6 @@ public class PlayerCache {
|
||||
* @param user String
|
||||
*/
|
||||
public void removePlayer(String user) {
|
||||
ConsoleLogger.debug("REMOVE PLAYER " + user);
|
||||
cache.remove(user.toLowerCase());
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,6 @@ public class CacheDataSource implements DataSource {
|
||||
return executorService.submit(new Callable<Optional<PlayerAuth>>() {
|
||||
@Override
|
||||
public Optional<PlayerAuth> call() {
|
||||
ConsoleLogger.debug("REFRESH " + key);
|
||||
return load(key);
|
||||
}
|
||||
});
|
||||
|
@ -3,7 +3,6 @@ package fr.xephi.authme.hooks;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.SessionManager;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
@ -29,12 +28,6 @@ public class BungeeCordMessage implements PluginMessageListener {
|
||||
|
||||
@Inject
|
||||
private PlayerCache playerCache;
|
||||
|
||||
@Inject
|
||||
private SessionManager sessionManager;
|
||||
|
||||
@Inject
|
||||
private AuthMe plugin;
|
||||
|
||||
@Inject
|
||||
private NewSetting settings;
|
||||
@ -64,11 +57,6 @@ public class BungeeCordMessage implements PluginMessageListener {
|
||||
if ("login".equals(act)) {
|
||||
playerCache.updatePlayer(auth);
|
||||
dataSource.setLogged(name);
|
||||
//START 03062016 sgdc3: should fix #731 but we need to recode this mess
|
||||
if (sessionManager.hasSession(name)) {
|
||||
sessionManager.cancelSession(name);
|
||||
}
|
||||
//END
|
||||
|
||||
if (!settings.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
|
||||
ConsoleLogger.info("Player " + auth.getNickname() + " has logged in from one of your server!");
|
||||
@ -76,6 +64,7 @@ public class BungeeCordMessage implements PluginMessageListener {
|
||||
} else if ("logout".equals(act)) {
|
||||
playerCache.removePlayer(name);
|
||||
dataSource.setUnlogged(name);
|
||||
|
||||
if (!settings.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
|
||||
ConsoleLogger.info("Player " + auth.getNickname() + " has logged out from one of your server!");
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package fr.xephi.authme.listener;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.hooks.PluginHooks;
|
||||
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
|
||||
@ -24,8 +23,6 @@ import javax.inject.Inject;
|
||||
*/
|
||||
public class AuthMeServerListener implements Listener {
|
||||
|
||||
@Inject
|
||||
private AuthMe plugin;
|
||||
@Inject
|
||||
private Messages messages;
|
||||
@Inject
|
||||
|
@ -25,12 +25,9 @@ import com.comphenix.protocol.events.PacketEvent;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import org.apache.commons.lang.reflect.MethodUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
@ -44,10 +41,6 @@ public class AuthMeInventoryPacketAdapter extends PacketAdapter {
|
||||
private static final int ARMOR_SIZE = 4;
|
||||
private static final int MAIN_SIZE = 27;
|
||||
private static final int HOTBAR_SIZE = 9;
|
||||
private static final int OFF_HAND_POSITION = 45;
|
||||
|
||||
private final boolean offHandSupported = MethodUtils
|
||||
.getAccessibleMethod(PlayerInventory.class, "getItemInOffHand", new Class[]{}) != null;
|
||||
|
||||
public AuthMeInventoryPacketAdapter(AuthMe plugin) {
|
||||
super(plugin, PacketType.Play.Server.SET_SLOT, PacketType.Play.Server.WINDOW_ITEMS);
|
||||
|
@ -3,6 +3,7 @@ package fr.xephi.authme.permission.handlers;
|
||||
/**
|
||||
* Exception during the instantiation of a {@link PermissionHandler}.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PermissionHandlerException extends Exception {
|
||||
|
||||
public PermissionHandlerException(String message) {
|
||||
|
@ -142,10 +142,9 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
}
|
||||
|
||||
// Session logic
|
||||
if (service.getProperty(PluginSettings.SESSIONS_ENABLED) && (playerCache.isAuthenticated(name) || database.isLogged(name))) {
|
||||
if (sessionManager.hasSession(name)) {
|
||||
sessionManager.cancelSession(name);
|
||||
}
|
||||
if (service.getProperty(PluginSettings.SESSIONS_ENABLED) && (sessionManager.hasSession(name) || database.isLogged(name))) {
|
||||
sessionManager.cancelSession(name);
|
||||
|
||||
PlayerAuth auth = database.getAuth(name);
|
||||
database.setUnlogged(name);
|
||||
playerCache.removePlayer(name);
|
||||
|
@ -10,7 +10,7 @@ import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.process.AsynchronousProcess;
|
||||
import fr.xephi.authme.process.ProcessService;
|
||||
import fr.xephi.authme.process.SyncProcessManager;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import org.bukkit.Location;
|
||||
@ -76,23 +76,22 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
||||
if (plugin.isEnabled()) {
|
||||
BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
postLogout(name);
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
postLogout(name);
|
||||
}
|
||||
|
||||
}, Settings.getSessionTimeout * TICKS_PER_MINUTE);
|
||||
}, service.getProperty(PluginSettings.SESSIONS_TIMEOUT) * TICKS_PER_MINUTE);
|
||||
|
||||
sessionManager.addSession(name, task);
|
||||
} else {
|
||||
//plugin is disabled; we cannot schedule more tasks so run it directly here
|
||||
postLogout(name);
|
||||
}
|
||||
sessionManager.addSession(name, task);
|
||||
} else {
|
||||
playerCache.removePlayer(name);
|
||||
database.setUnlogged(name);
|
||||
//plugin is disabled; we cannot schedule more tasks so run it directly here
|
||||
postLogout(name);
|
||||
}
|
||||
|
||||
//always update the database when the player quit the game
|
||||
database.setUnlogged(name);
|
||||
|
||||
if (plugin.isEnabled()) {
|
||||
syncProcessManager.processSyncPlayerQuit(player);
|
||||
}
|
||||
@ -103,8 +102,6 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
||||
}
|
||||
|
||||
private void postLogout(String name) {
|
||||
PlayerCache.getInstance().removePlayer(name);
|
||||
database.setUnlogged(name);
|
||||
sessionManager.removeSession(name);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ authors: [${bukkitplugin.authors}]
|
||||
website: ${project.url}
|
||||
description: ${project.description}
|
||||
main: ${bukkitplugin.main}
|
||||
version: ${bukkitplugin.versionCode}
|
||||
version: ${bukkitplugin.version}
|
||||
softdepend:
|
||||
- Vault
|
||||
- PermissionsBukkit
|
||||
|
Loading…
Reference in New Issue
Block a user