mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-25 18:17:34 +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
|
// Plugin instance
|
||||||
private static AuthMe plugin;
|
private static AuthMe plugin;
|
||||||
|
|
||||||
private NewAPI api;
|
|
||||||
private Management management;
|
private Management management;
|
||||||
private CommandHandler commandHandler;
|
private CommandHandler commandHandler;
|
||||||
private PermissionsManager permsMan;
|
private PermissionsManager permsMan;
|
||||||
@ -301,9 +300,9 @@ public class AuthMe extends JavaPlugin {
|
|||||||
passwordSecurity = initializer.get(PasswordSecurity.class);
|
passwordSecurity = initializer.get(PasswordSecurity.class);
|
||||||
spawnLoader = initializer.get(SpawnLoader.class);
|
spawnLoader = initializer.get(SpawnLoader.class);
|
||||||
commandHandler = initializer.get(CommandHandler.class);
|
commandHandler = initializer.get(CommandHandler.class);
|
||||||
api = initializer.get(NewAPI.class);
|
|
||||||
management = initializer.get(Management.class);
|
management = initializer.get(Management.class);
|
||||||
geoLiteApi = initializer.get(GeoLiteAPI.class);
|
geoLiteApi = initializer.get(GeoLiteAPI.class);
|
||||||
|
initializer.get(NewAPI.class);
|
||||||
initializer.get(API.class);
|
initializer.get(API.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ import java.io.IOException;
|
|||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
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 String NEW_LINE = System.getProperty("line.separator");
|
||||||
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("[MM-dd HH:mm:ss]");
|
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("[MM-dd HH:mm:ss]");
|
||||||
private static Logger logger;
|
private static Logger logger;
|
||||||
private static boolean enableDebug = false;
|
|
||||||
private static boolean useLogging = false;
|
private static boolean useLogging = false;
|
||||||
private static File logFile;
|
private static File logFile;
|
||||||
private static FileWriter fileWriter;
|
private static FileWriter fileWriter;
|
||||||
@ -40,7 +38,6 @@ public final class ConsoleLogger {
|
|||||||
|
|
||||||
public static void setLoggingOptions(NewSetting settings) {
|
public static void setLoggingOptions(NewSetting settings) {
|
||||||
ConsoleLogger.useLogging = settings.getProperty(SecuritySettings.USE_LOGGING);
|
ConsoleLogger.useLogging = settings.getProperty(SecuritySettings.USE_LOGGING);
|
||||||
ConsoleLogger.enableDebug = !settings.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE);
|
|
||||||
if (useLogging) {
|
if (useLogging) {
|
||||||
if (fileWriter == null) {
|
if (fileWriter == null) {
|
||||||
try {
|
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.
|
* 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.
|
* @param name The name of the player who's session to cancel.
|
||||||
*/
|
*/
|
||||||
public void cancelSession(String name) {
|
public void cancelSession(String name) {
|
||||||
BukkitTask task = sessions.get(name);
|
BukkitTask task = sessions.remove(name);
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
task.cancel();
|
task.cancel();
|
||||||
removeSession(name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package fr.xephi.authme.cache.auth;
|
package fr.xephi.authme.cache.auth;
|
||||||
|
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@ -34,7 +33,6 @@ public class PlayerCache {
|
|||||||
* @param auth PlayerAuth
|
* @param auth PlayerAuth
|
||||||
*/
|
*/
|
||||||
public void addPlayer(PlayerAuth auth) {
|
public void addPlayer(PlayerAuth auth) {
|
||||||
ConsoleLogger.debug("ADDED PLAYER TO CACHE " + auth.getNickname());
|
|
||||||
cache.put(auth.getNickname().toLowerCase(), auth);
|
cache.put(auth.getNickname().toLowerCase(), auth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +42,6 @@ public class PlayerCache {
|
|||||||
* @param auth PlayerAuth
|
* @param auth PlayerAuth
|
||||||
*/
|
*/
|
||||||
public void updatePlayer(PlayerAuth auth) {
|
public void updatePlayer(PlayerAuth auth) {
|
||||||
ConsoleLogger.debug("UPDATE PLAYER " + auth.getNickname());
|
|
||||||
cache.put(auth.getNickname(), auth);
|
cache.put(auth.getNickname(), auth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +51,6 @@ public class PlayerCache {
|
|||||||
* @param user String
|
* @param user String
|
||||||
*/
|
*/
|
||||||
public void removePlayer(String user) {
|
public void removePlayer(String user) {
|
||||||
ConsoleLogger.debug("REMOVE PLAYER " + user);
|
|
||||||
cache.remove(user.toLowerCase());
|
cache.remove(user.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,6 @@ public class CacheDataSource implements DataSource {
|
|||||||
return executorService.submit(new Callable<Optional<PlayerAuth>>() {
|
return executorService.submit(new Callable<Optional<PlayerAuth>>() {
|
||||||
@Override
|
@Override
|
||||||
public Optional<PlayerAuth> call() {
|
public Optional<PlayerAuth> call() {
|
||||||
ConsoleLogger.debug("REFRESH " + key);
|
|
||||||
return load(key);
|
return load(key);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3,7 +3,6 @@ package fr.xephi.authme.hooks;
|
|||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.cache.SessionManager;
|
import fr.xephi.authme.cache.SessionManager;
|
||||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||||
@ -30,12 +29,6 @@ public class BungeeCordMessage implements PluginMessageListener {
|
|||||||
@Inject
|
@Inject
|
||||||
private PlayerCache playerCache;
|
private PlayerCache playerCache;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private SessionManager sessionManager;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private AuthMe plugin;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private NewSetting settings;
|
private NewSetting settings;
|
||||||
|
|
||||||
@ -64,11 +57,6 @@ public class BungeeCordMessage implements PluginMessageListener {
|
|||||||
if ("login".equals(act)) {
|
if ("login".equals(act)) {
|
||||||
playerCache.updatePlayer(auth);
|
playerCache.updatePlayer(auth);
|
||||||
dataSource.setLogged(name);
|
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)) {
|
if (!settings.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
|
||||||
ConsoleLogger.info("Player " + auth.getNickname() + " has logged in from one of your server!");
|
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)) {
|
} else if ("logout".equals(act)) {
|
||||||
playerCache.removePlayer(name);
|
playerCache.removePlayer(name);
|
||||||
dataSource.setUnlogged(name);
|
dataSource.setUnlogged(name);
|
||||||
|
|
||||||
if (!settings.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
|
if (!settings.getProperty(SecuritySettings.REMOVE_SPAM_FROM_CONSOLE)) {
|
||||||
ConsoleLogger.info("Player " + auth.getNickname() + " has logged out from one of your server!");
|
ConsoleLogger.info("Player " + auth.getNickname() + " has logged out from one of your server!");
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package fr.xephi.authme.listener;
|
package fr.xephi.authme.listener;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.hooks.PluginHooks;
|
import fr.xephi.authme.hooks.PluginHooks;
|
||||||
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
|
import fr.xephi.authme.listener.protocollib.ProtocolLibService;
|
||||||
@ -24,8 +23,6 @@ import javax.inject.Inject;
|
|||||||
*/
|
*/
|
||||||
public class AuthMeServerListener implements Listener {
|
public class AuthMeServerListener implements Listener {
|
||||||
|
|
||||||
@Inject
|
|
||||||
private AuthMe plugin;
|
|
||||||
@Inject
|
@Inject
|
||||||
private Messages messages;
|
private Messages messages;
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -25,12 +25,9 @@ import com.comphenix.protocol.events.PacketEvent;
|
|||||||
import fr.xephi.authme.AuthMe;
|
import fr.xephi.authme.AuthMe;
|
||||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import org.apache.commons.lang.reflect.MethodUtils;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.logging.Level;
|
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 ARMOR_SIZE = 4;
|
||||||
private static final int MAIN_SIZE = 27;
|
private static final int MAIN_SIZE = 27;
|
||||||
private static final int HOTBAR_SIZE = 9;
|
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) {
|
public AuthMeInventoryPacketAdapter(AuthMe plugin) {
|
||||||
super(plugin, PacketType.Play.Server.SET_SLOT, PacketType.Play.Server.WINDOW_ITEMS);
|
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}.
|
* Exception during the instantiation of a {@link PermissionHandler}.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public class PermissionHandlerException extends Exception {
|
public class PermissionHandlerException extends Exception {
|
||||||
|
|
||||||
public PermissionHandlerException(String message) {
|
public PermissionHandlerException(String message) {
|
||||||
|
@ -142,10 +142,9 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Session logic
|
// Session logic
|
||||||
if (service.getProperty(PluginSettings.SESSIONS_ENABLED) && (playerCache.isAuthenticated(name) || database.isLogged(name))) {
|
if (service.getProperty(PluginSettings.SESSIONS_ENABLED) && (sessionManager.hasSession(name) || database.isLogged(name))) {
|
||||||
if (sessionManager.hasSession(name)) {
|
|
||||||
sessionManager.cancelSession(name);
|
sessionManager.cancelSession(name);
|
||||||
}
|
|
||||||
PlayerAuth auth = database.getAuth(name);
|
PlayerAuth auth = database.getAuth(name);
|
||||||
database.setUnlogged(name);
|
database.setUnlogged(name);
|
||||||
playerCache.removePlayer(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.AsynchronousProcess;
|
||||||
import fr.xephi.authme.process.ProcessService;
|
import fr.xephi.authme.process.ProcessService;
|
||||||
import fr.xephi.authme.process.SyncProcessManager;
|
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.settings.properties.RestrictionSettings;
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -81,17 +81,16 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
|||||||
postLogout(name);
|
postLogout(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, Settings.getSessionTimeout * TICKS_PER_MINUTE);
|
}, service.getProperty(PluginSettings.SESSIONS_TIMEOUT) * TICKS_PER_MINUTE);
|
||||||
|
|
||||||
sessionManager.addSession(name, task);
|
sessionManager.addSession(name, task);
|
||||||
} else {
|
} else {
|
||||||
//plugin is disabled; we cannot schedule more tasks so run it directly here
|
//plugin is disabled; we cannot schedule more tasks so run it directly here
|
||||||
postLogout(name);
|
postLogout(name);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
playerCache.removePlayer(name);
|
//always update the database when the player quit the game
|
||||||
database.setUnlogged(name);
|
database.setUnlogged(name);
|
||||||
}
|
|
||||||
|
|
||||||
if (plugin.isEnabled()) {
|
if (plugin.isEnabled()) {
|
||||||
syncProcessManager.processSyncPlayerQuit(player);
|
syncProcessManager.processSyncPlayerQuit(player);
|
||||||
@ -103,8 +102,6 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void postLogout(String name) {
|
private void postLogout(String name) {
|
||||||
PlayerCache.getInstance().removePlayer(name);
|
|
||||||
database.setUnlogged(name);
|
|
||||||
sessionManager.removeSession(name);
|
sessionManager.removeSession(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ authors: [${bukkitplugin.authors}]
|
|||||||
website: ${project.url}
|
website: ${project.url}
|
||||||
description: ${project.description}
|
description: ${project.description}
|
||||||
main: ${bukkitplugin.main}
|
main: ${bukkitplugin.main}
|
||||||
version: ${bukkitplugin.versionCode}
|
version: ${bukkitplugin.version}
|
||||||
softdepend:
|
softdepend:
|
||||||
- Vault
|
- Vault
|
||||||
- PermissionsBukkit
|
- PermissionsBukkit
|
||||||
|
Loading…
Reference in New Issue
Block a user