mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-27 20:57:35 +01:00
Merge branch 'bungee-messaging-integration' of https://github.com/AuthMe/AuthMeReloaded into bungee-messaging-integration
This commit is contained in:
commit
4206efc791
@ -270,10 +270,9 @@ public class CacheDataSource implements DataSource {
|
||||
|
||||
@Override
|
||||
public void refreshCache(String playerName) {
|
||||
if (cachedAuths.getIfPresent(playerName) == null) {
|
||||
return;
|
||||
if (cachedAuths.getIfPresent(playerName) != null) {
|
||||
cachedAuths.refresh(playerName);
|
||||
}
|
||||
cachedAuths.refresh(playerName);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,19 +4,18 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.data.VerificationCodeManager;
|
||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||
import fr.xephi.authme.data.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.CacheDataSource;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.process.AsynchronousProcess;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeService;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.process.SyncProcessManager;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import fr.xephi.authme.service.SessionService;
|
||||
import fr.xephi.authme.service.ValidationService;
|
||||
import fr.xephi.authme.service.bungeecord.BungeeService;
|
||||
import fr.xephi.authme.service.bungeecord.MessageType;
|
||||
import fr.xephi.authme.settings.SpawnLoader;
|
||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||
import fr.xephi.authme.util.PlayerUtils;
|
||||
import fr.xephi.authme.service.ValidationService;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -109,9 +108,7 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
||||
}
|
||||
|
||||
// remove player from cache
|
||||
if (database instanceof CacheDataSource) {
|
||||
((CacheDataSource) database).getCachedAuths().invalidate(name);
|
||||
}
|
||||
database.invalidateCache(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,13 +21,13 @@ import javax.inject.Inject;
|
||||
*/
|
||||
public class BungeeService implements SettingsDependent, PluginMessageListener {
|
||||
|
||||
private AuthMe plugin;
|
||||
private BukkitService service;
|
||||
private final AuthMe plugin;
|
||||
private final BukkitService service;
|
||||
private final DataSource dataSource;
|
||||
|
||||
private boolean isEnabled;
|
||||
private String destinationServerOnLogin;
|
||||
|
||||
private DataSource dataSource;
|
||||
|
||||
/*
|
||||
* Constructor.
|
||||
@ -58,7 +58,7 @@ public class BungeeService implements SettingsDependent, PluginMessageListener {
|
||||
|
||||
private void sendBungeecordMessage(String... data) {
|
||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
for(String element : data) {
|
||||
for (String element : data) {
|
||||
out.writeUTF(element);
|
||||
}
|
||||
service.sendPluginMessage("BungeeCord", out.toByteArray());
|
||||
@ -86,7 +86,7 @@ public class BungeeService implements SettingsDependent, PluginMessageListener {
|
||||
* @param playerName the player related to the message
|
||||
*/
|
||||
public void sendAuthMeBungeecordMessage(String type, String playerName) {
|
||||
if(!isEnabled) {
|
||||
if (isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -95,13 +95,13 @@ public class BungeeService implements SettingsDependent, PluginMessageListener {
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] data) {
|
||||
if(!isEnabled) {
|
||||
if (!isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
ByteArrayDataInput in = ByteStreams.newDataInput(data);
|
||||
String subchannel = in.readUTF();
|
||||
if(!"Authme".equals(subchannel)) {
|
||||
if (!"Authme".equals(subchannel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ public class BungeeService implements SettingsDependent, PluginMessageListener {
|
||||
dataSource.refreshCache(name);
|
||||
break;
|
||||
default:
|
||||
ConsoleLogger.debug("Received unsupported bungeecord message type! (" + type + ")");
|
||||
ConsoleLogger.debug("Received unsupported bungeecord message type! ({0})", type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public abstract class AbstractSqlDataSourceResourceClosingTest extends AbstractR
|
||||
private static List<Method> getDataSourceMethods() {
|
||||
List<Method> publicMethods = new ArrayList<>();
|
||||
for (Method method : DataSource.class.getDeclaredMethods()) {
|
||||
if (!IGNORED_METHODS.contains(method.getName())) {
|
||||
if (!IGNORED_METHODS.contains(method.getName()) && !method.isSynthetic()) {
|
||||
publicMethods.add(method);
|
||||
}
|
||||
}
|
||||
|
@ -117,12 +117,9 @@ public final class ListenerConsistencyTest {
|
||||
}
|
||||
|
||||
private static boolean isTestableMethod(Method method) {
|
||||
// Exclude any methods with "$" in it: jacoco creates a "$jacocoInit" method we want to ignore, and
|
||||
// methods like "access$000" are created by the compiler when a private member is being accessed by an inner
|
||||
// class, which is not of interest for us
|
||||
// Also exclude getters
|
||||
// Exclude getters and synthetic methods
|
||||
String methodName = method.getName();
|
||||
if (Modifier.isPrivate(method.getModifiers()) || methodName.contains("$") || methodName.startsWith("get") || methodName.startsWith("is")) {
|
||||
if (Modifier.isPrivate(method.getModifiers()) || method.isSynthetic() || methodName.startsWith("get") || methodName.startsWith("is")) {
|
||||
return false;
|
||||
}
|
||||
// Skip reload() method (implementation of Reloadable interface)
|
||||
|
Loading…
Reference in New Issue
Block a user