mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-10-06 02:17:42 +02: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
|
@Override
|
||||||
public void refreshCache(String playerName) {
|
public void refreshCache(String playerName) {
|
||||||
if (cachedAuths.getIfPresent(playerName) == null) {
|
if (cachedAuths.getIfPresent(playerName) != null) {
|
||||||
return;
|
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.VerificationCodeManager;
|
||||||
import fr.xephi.authme.data.auth.PlayerAuth;
|
import fr.xephi.authme.data.auth.PlayerAuth;
|
||||||
import fr.xephi.authme.data.auth.PlayerCache;
|
import fr.xephi.authme.data.auth.PlayerCache;
|
||||||
import fr.xephi.authme.datasource.CacheDataSource;
|
|
||||||
import fr.xephi.authme.datasource.DataSource;
|
import fr.xephi.authme.datasource.DataSource;
|
||||||
import fr.xephi.authme.process.AsynchronousProcess;
|
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.process.SyncProcessManager;
|
||||||
|
import fr.xephi.authme.service.CommonService;
|
||||||
import fr.xephi.authme.service.SessionService;
|
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.service.bungeecord.MessageType;
|
||||||
import fr.xephi.authme.settings.SpawnLoader;
|
import fr.xephi.authme.settings.SpawnLoader;
|
||||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
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.PlayerUtils;
|
import fr.xephi.authme.util.PlayerUtils;
|
||||||
import fr.xephi.authme.service.ValidationService;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -109,9 +108,7 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove player from cache
|
// remove player from cache
|
||||||
if (database instanceof CacheDataSource) {
|
database.invalidateCache(name);
|
||||||
((CacheDataSource) database).getCachedAuths().invalidate(name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,13 +21,13 @@ import javax.inject.Inject;
|
|||||||
*/
|
*/
|
||||||
public class BungeeService implements SettingsDependent, PluginMessageListener {
|
public class BungeeService implements SettingsDependent, PluginMessageListener {
|
||||||
|
|
||||||
private AuthMe plugin;
|
private final AuthMe plugin;
|
||||||
private BukkitService service;
|
private final BukkitService service;
|
||||||
|
private final DataSource dataSource;
|
||||||
|
|
||||||
private boolean isEnabled;
|
private boolean isEnabled;
|
||||||
private String destinationServerOnLogin;
|
private String destinationServerOnLogin;
|
||||||
|
|
||||||
private DataSource dataSource;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -58,7 +58,7 @@ public class BungeeService implements SettingsDependent, PluginMessageListener {
|
|||||||
|
|
||||||
private void sendBungeecordMessage(String... data) {
|
private void sendBungeecordMessage(String... data) {
|
||||||
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||||
for(String element : data) {
|
for (String element : data) {
|
||||||
out.writeUTF(element);
|
out.writeUTF(element);
|
||||||
}
|
}
|
||||||
service.sendPluginMessage("BungeeCord", out.toByteArray());
|
service.sendPluginMessage("BungeeCord", out.toByteArray());
|
||||||
@ -86,7 +86,7 @@ public class BungeeService implements SettingsDependent, PluginMessageListener {
|
|||||||
* @param playerName the player related to the message
|
* @param playerName the player related to the message
|
||||||
*/
|
*/
|
||||||
public void sendAuthMeBungeecordMessage(String type, String playerName) {
|
public void sendAuthMeBungeecordMessage(String type, String playerName) {
|
||||||
if(!isEnabled) {
|
if (isEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,13 +95,13 @@ public class BungeeService implements SettingsDependent, PluginMessageListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPluginMessageReceived(String channel, Player player, byte[] data) {
|
public void onPluginMessageReceived(String channel, Player player, byte[] data) {
|
||||||
if(!isEnabled) {
|
if (!isEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArrayDataInput in = ByteStreams.newDataInput(data);
|
ByteArrayDataInput in = ByteStreams.newDataInput(data);
|
||||||
String subchannel = in.readUTF();
|
String subchannel = in.readUTF();
|
||||||
if(!"Authme".equals(subchannel)) {
|
if (!"Authme".equals(subchannel)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ public class BungeeService implements SettingsDependent, PluginMessageListener {
|
|||||||
dataSource.refreshCache(name);
|
dataSource.refreshCache(name);
|
||||||
break;
|
break;
|
||||||
default:
|
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() {
|
private static List<Method> getDataSourceMethods() {
|
||||||
List<Method> publicMethods = new ArrayList<>();
|
List<Method> publicMethods = new ArrayList<>();
|
||||||
for (Method method : DataSource.class.getDeclaredMethods()) {
|
for (Method method : DataSource.class.getDeclaredMethods()) {
|
||||||
if (!IGNORED_METHODS.contains(method.getName())) {
|
if (!IGNORED_METHODS.contains(method.getName()) && !method.isSynthetic()) {
|
||||||
publicMethods.add(method);
|
publicMethods.add(method);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,12 +117,9 @@ public final class ListenerConsistencyTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isTestableMethod(Method method) {
|
private static boolean isTestableMethod(Method method) {
|
||||||
// Exclude any methods with "$" in it: jacoco creates a "$jacocoInit" method we want to ignore, and
|
// Exclude getters and synthetic methods
|
||||||
// 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
|
|
||||||
String methodName = method.getName();
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
// Skip reload() method (implementation of Reloadable interface)
|
// Skip reload() method (implementation of Reloadable interface)
|
||||||
|
Loading…
Reference in New Issue
Block a user