hasJoined(String username, String serverHash, InetAddress hostIp) throws IOException
- {
- String url = String.format(MOJANG_SESSIONSERVER_HASJOINED_CALL_URLFMT, username, serverHash);
+ private static final String HOST = "sessionserver.mojang.com";
- HttpURLConnection conn = this.getConnection(url);
- int responseCode = conn.getResponseCode();
+ /**
+ * A formatting string containing a URL used to call the {@code hasJoined} method on mojang session servers.
+ *
+ * Formatting parameters:
+ * 1. The username of the player in question
+ * 2. The serverId of this server
+ */
+ public static final String ENDPOINT = "https://" + HOST + "/session/minecraft/hasJoined?username=%s&serverId=%s";
- Verification verification = null;
+ @Override
+ public Optional hasJoined(String username, String serverHash, InetAddress hostIp)
+ throws IOException {
+ String url = String.format(ENDPOINT, username, serverHash);
- // Mojang session servers send HTTP 204 (NO CONTENT) when the authentication seems invalid
- // If that's not our case, the authentication is valid, and so we can parse the response.
- if(responseCode != HttpURLConnection.HTTP_NO_CONTENT)
- verification = this.parseRequest(conn, this::parseVerification);
+ HttpURLConnection conn = this.getConnection(url);
+ int responseCode = conn.getResponseCode();
- return Optional.ofNullable(verification);
- }
+ Verification verification = null;
- // Functional implementation of InputStreamAction, used in hasJoined method in parseRequest call
- protected Verification parseVerification(InputStream input) throws IOException
- {
- return this.readJson(input, Verification.class);
- }
+ // Mojang session servers send HTTP 204 (NO CONTENT) when the authentication seems invalid
+ // If that's not our case, the authentication is valid, and so we can parse the response.
+ if (responseCode != HttpURLConnection.HTTP_NO_CONTENT) {
+ verification = this.parseRequest(conn, this::parseVerification);
+ }
+
+ return Optional.ofNullable(verification);
+ }
+
+ // Functional implementation of InputStreamAction, used in hasJoined method in parseRequest call
+ protected Verification parseVerification(InputStream input) throws IOException {
+ return this.readJson(input, Verification.class);
+ }
}
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/antibot/TickingRateLimiter.java b/core/src/main/java/com/github/games647/fastlogin/core/antibot/TickingRateLimiter.java
index ced7da18..c8d57c59 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/antibot/TickingRateLimiter.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/antibot/TickingRateLimiter.java
@@ -113,7 +113,7 @@ public class TickingRateLimiter implements RateLimiter {
private final long expireTime;
private int count;
- public TimeRecord(long firstMinuteRecord, long expireTime) {
+ TimeRecord(long firstMinuteRecord, long expireTime) {
this.firstMinuteRecord = firstMinuteRecord;
this.expireTime = expireTime;
this.count = 1;
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/BedrockService.java b/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/BedrockService.java
index b182bf8b..63dc0af5 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/BedrockService.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/BedrockService.java
@@ -74,12 +74,12 @@ public abstract class BedrockService {
"Could not check whether Bedrock Player {}'s name conflicts a premium Java player's name.",
username);
- kickPlayer(source, username, "Could not check if your name conflicts an existing " +
- "premium Java account's name. This is usually a serverside error.");
+ kickPlayer(source, username, "Could not check if your name conflicts an existing "
+ + "premium Java account's name. This is usually a serverside error.");
} catch (RateLimitException rateLimitException) {
core.getPlugin().getLog().warn("Mojang API rate limit hit");
- kickPlayer(source, username, "Could not check if your name conflicts an existing premium " +
- "Java account's name. Try again in a few minutes");
+ kickPlayer(source, username, "Could not check if your name conflicts an existing premium "
+ + "Java account's name. Try again in a few minutes");
}
if (premiumUUID.isPresent()) {
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/FloodgateService.java b/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/FloodgateService.java
index 1b555f18..9ef8985c 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/FloodgateService.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/FloodgateService.java
@@ -60,12 +60,16 @@ public class FloodgateService extends BedrockService {
*/
public boolean isValidFloodgateConfigString(String key) {
String value = core.getConfig().get(key).toString().toLowerCase(Locale.ENGLISH);
- if (!"true".equals(value) && !"linked".equals(value) && !"false".equals(value) && !"no-conflict".equals(value)) {
- core.getPlugin().getLog().error("Invalid value detected for {} in FastLogin/config.yml.", key);
- return false;
+ switch (value) {
+ case "true":
+ case "linked":
+ case "false":
+ case "no-conflict":
+ return true;
+ default:
+ core.getPlugin().getLog().error("Invalid value detected for {} in FastLogin/config.yml.", key);
+ return false;
}
-
- return true;
}
@Override
@@ -82,7 +86,7 @@ public class FloodgateService extends BedrockService {
if ("false".equals(allowConflict)
|| "linked".equals(allowConflict) && !isLinked) {
- super.checkNameConflict(username, source);
+ super.checkNameConflict(username, source);
} else {
core.getPlugin().getLog().info("Skipping name conflict checking for player {}", username);
}
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/message/ChangePremiumMessage.java b/core/src/main/java/com/github/games647/fastlogin/core/message/ChangePremiumMessage.java
index 1b216ebd..d77aecf2 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/message/ChangePremiumMessage.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/message/ChangePremiumMessage.java
@@ -79,10 +79,10 @@ public class ChangePremiumMessage implements ChannelMessage {
@Override
public String toString() {
- return this.getClass().getSimpleName() + '{' +
- "playerName='" + playerName + '\'' +
- ", shouldEnable=" + willEnable +
- ", isSourceInvoker=" + isSourceInvoker +
- '}';
+ return this.getClass().getSimpleName() + '{'
+ + "playerName='" + playerName + '\''
+ + ", shouldEnable=" + willEnable
+ + ", isSourceInvoker=" + isSourceInvoker
+ + '}';
}
}
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/message/LoginActionMessage.java b/core/src/main/java/com/github/games647/fastlogin/core/message/LoginActionMessage.java
index cc533eed..a10d702d 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/message/LoginActionMessage.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/message/LoginActionMessage.java
@@ -92,11 +92,11 @@ public class LoginActionMessage implements ChannelMessage {
@Override
public String toString() {
- return this.getClass().getSimpleName() + '{' +
- "type='" + type + '\'' +
- ", playerName='" + playerName + '\'' +
- ", proxyId=" + proxyId +
- '}';
+ return this.getClass().getSimpleName() + '{'
+ + "type='" + type + '\''
+ + ", playerName='" + playerName + '\''
+ + ", proxyId=" + proxyId
+ + '}';
}
public enum Type {
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java
index 474a8e23..5e968199 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java
@@ -122,7 +122,8 @@ public class FastLoginCore> {
}
// Initialize the resolver based on the config parameter
- this.resolver = this.config.getBoolean("useProxyAgnosticResolver", false) ? new ProxyAgnosticMojangResolver() : new MojangResolver();
+ this.resolver = this.config.getBoolean("useProxyAgnosticResolver", false)
+ ? new ProxyAgnosticMojangResolver() : new MojangResolver();
antiBot = createAntiBotService(config.getSection("anti-bot"));
Set proxies = config.getStringList("proxies")
@@ -191,7 +192,7 @@ public class FastLoginCore> {
config = configProvider.load(reader, defaults);
}
- // explicitly add keys here, because Configuration.getKeys doesn't return the keys from the default configuration
+ // explicitly add keys here, because Configuration.getKeys doesn't return the keys from the default config
for (String key : defaults.getKeys()) {
config.set(key, config.get(key));
}
@@ -244,9 +245,13 @@ public class FastLoginCore
> {
boolean useSSL = config.get("useSSL", false);
if (useSSL) {
- databaseConfig.addDataSourceProperty("allowPublicKeyRetrieval", config.getBoolean("allowPublicKeyRetrieval", false));
- databaseConfig.addDataSourceProperty("serverRSAPublicKeyFile", config.getString("ServerRSAPublicKeyFile"));
- databaseConfig.addDataSourceProperty("sslMode", config.getString("sslMode", "Required"));
+ boolean publicKeyRetrieval = config.getBoolean("allowPublicKeyRetrieval", false);
+ String rsaPublicKeyFile = config.getString("ServerRSAPublicKeyFile");
+ String sslMode = config.getString("sslMode", "Required");
+
+ databaseConfig.addDataSourceProperty("allowPublicKeyRetrieval", publicKeyRetrieval);
+ databaseConfig.addDataSourceProperty("serverRSAPublicKeyFile", rsaPublicKeyFile);
+ databaseConfig.addDataSourceProperty("sslMode", sslMode);
}
databaseConfig.setUsername(config.get("username", ""));
@@ -270,8 +275,8 @@ public class FastLoginCore
> {
} catch (ClassNotFoundException notFoundEx) {
Logger log = plugin.getLog();
log.warn("This driver {} is not supported on this platform", className);
- log.warn("Please choose either MySQL (Spigot, BungeeCord), SQLite (Spigot, Sponge) or " +
- "MariaDB (Sponge, Velocity)", notFoundEx);
+ log.warn("Please choose either MySQL (Spigot, BungeeCord), SQLite (Spigot, Sponge) or "
+ + "MariaDB (Sponge, Velocity)", notFoundEx);
}
return false;
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
index 9ad39b90..fd3e5945 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
@@ -106,9 +106,9 @@ public abstract class JoinManagement
{
}
}
} catch (RateLimitException rateLimitEx) {
- core.getPlugin().getLog().error("Mojang's rate limit reached for {}. The public IPv4 address of this" +
- " server issued more than 600 Name -> UUID requests within 10 minutes. After those 10" +
- " minutes we can make requests again.", username);
+ core.getPlugin().getLog().error("Mojang's rate limit reached for {}. The public IPv4 address of this"
+ + " server issued more than 600 Name -> UUID requests within 10 minutes. After those 10"
+ + " minutes we can make requests again.", username);
} catch (Exception ex) {
core.getPlugin().getLog().error("Failed to check premium state for {}", username, ex);
core.getPlugin().getLog().error("Failed to check premium state of {}", username, ex);
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/storage/MySQLStorage.java b/core/src/main/java/com/github/games647/fastlogin/core/storage/MySQLStorage.java
index d3a3cd40..2bbae0b4 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/storage/MySQLStorage.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/storage/MySQLStorage.java
@@ -31,7 +31,7 @@ import com.zaxxer.hikari.HikariConfig;
public class MySQLStorage extends SQLStorage {
public MySQLStorage(FastLoginCore, ?, ?> core, String driver, String host, int port, String database,
- HikariConfig config,boolean useSSL) {
+ HikariConfig config, boolean useSSL) {
super(core,
buildJDBCUrl(driver, host, port, database),
setParams(config, useSSL));
diff --git a/pom.xml b/pom.xml
index 5bafba1e..c9bc4dea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -131,11 +131,17 @@
3.1.2
checkstyle.xml
- UTF-8
true
- true
+ false
false
+
+
+ com.puppycrawl.tools
+ checkstyle
+ 10.3.1
+
+
validate
diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java
index e15dd3ef..17934c94 100644
--- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java
+++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java
@@ -46,6 +46,7 @@ import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
+import com.velocitypowered.api.proxy.messages.ChannelRegistrar;
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
import com.velocitypowered.api.proxy.server.RegisteredServer;
@@ -73,7 +74,7 @@ public class FastLoginVelocity implements PlatformPlugin {
private final Path dataDirectory;
private final Logger logger;
private final ConcurrentMap session = new MapMaker().weakKeys().makeMap();
- private static final String PROXY_ID_fILE = "proxyId.txt";
+ private static final String PROXY_ID_FILE = "proxyId.txt";
private FastLoginCore core;
private AsyncScheduler scheduler;
@@ -98,8 +99,10 @@ public class FastLoginVelocity implements PlatformPlugin {
server.getEventManager().register(this, new ConnectListener(this, core.getAntiBot()));
server.getEventManager().register(this, new PluginMessageListener(this));
- server.getChannelRegistrar().register(MinecraftChannelIdentifier.create(getName(), ChangePremiumMessage.CHANGE_CHANNEL));
- server.getChannelRegistrar().register(MinecraftChannelIdentifier.create(getName(), SuccessMessage.SUCCESS_CHANNEL));
+
+ ChannelRegistrar channelRegistry = server.getChannelRegistrar();
+ channelRegistry.register(MinecraftChannelIdentifier.create(getName(), ChangePremiumMessage.CHANGE_CHANNEL));
+ channelRegistry.register(MinecraftChannelIdentifier.create(getName(), SuccessMessage.SUCCESS_CHANNEL));
}
@Subscribe
@@ -167,7 +170,7 @@ public class FastLoginVelocity implements PlatformPlugin {
}
private void loadOrGenerateProxyId() {
- Path idFile = dataDirectory.resolve(PROXY_ID_fILE);
+ Path idFile = dataDirectory.resolve(PROXY_ID_FILE);
boolean shouldGenerate = false;
if (Files.exists(idFile)) {
@@ -182,7 +185,8 @@ public class FastLoginVelocity implements PlatformPlugin {
logger.error("Unable to load proxy id from '{}'", idFile.toAbsolutePath());
logger.error("Detailed exception:", e);
} catch (IllegalArgumentException e) {
- logger.error("'{}' contains an invalid uuid! FastLogin will not work without a valid id.", idFile.toAbsolutePath());
+ Path filePath = idFile.toAbsolutePath();
+ logger.error("'{}' contains an invalid uuid! FastLogin will not work without a valid id.", filePath);
}
} else {
shouldGenerate = true;
diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/VelocityLoginSession.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/VelocityLoginSession.java
index 0a096db0..053c2ba2 100644
--- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/VelocityLoginSession.java
+++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/VelocityLoginSession.java
@@ -58,10 +58,10 @@ public class VelocityLoginSession extends LoginSession {
@Override
public synchronized String toString() {
- return this.getClass().getSimpleName() + '{' +
- "alreadySaved=" + alreadySaved +
- ", alreadyLogged=" + alreadyLogged +
- ", registered=" + registered +
- "} " + super.toString();
+ return this.getClass().getSimpleName() + '{'
+ + "alreadySaved=" + alreadySaved
+ + ", alreadyLogged=" + alreadyLogged
+ + ", registered=" + registered
+ + "} " + super.toString();
}
}
diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/event/VelocityFastLoginAutoLoginEvent.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/event/VelocityFastLoginAutoLoginEvent.java
index aabe153d..6049b694 100644
--- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/event/VelocityFastLoginAutoLoginEvent.java
+++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/event/VelocityFastLoginAutoLoginEvent.java
@@ -33,7 +33,7 @@ import com.velocitypowered.api.event.ResultedEvent;
import java.util.Objects;
public class VelocityFastLoginAutoLoginEvent
- implements FastLoginAutoLoginEvent, ResultedEvent {
+ implements FastLoginAutoLoginEvent, ResultedEvent {
private final LoginSession session;
private final StoredProfile profile;
@@ -67,11 +67,11 @@ public class VelocityFastLoginAutoLoginEvent
@Override
public GenericResult getResult() {
- return cancelled ? GenericResult.denied(): GenericResult.allowed();
+ return cancelled ? GenericResult.denied() : GenericResult.allowed();
}
@Override
public void setResult(GenericResult result) {
- cancelled = Objects.requireNonNull(result) != GenericResult.allowed();
+ cancelled = Objects.requireNonNull(result) != GenericResult.allowed();
}
}
diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java
index d0dcfd17..1010871f 100644
--- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java
+++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java
@@ -92,7 +92,9 @@ public class ConnectListener {
break;
case Continue:
default:
- Runnable asyncPremiumCheck = new AsyncPremiumCheck(plugin, connection, username, continuation, preLoginEvent);
+ Runnable asyncPremiumCheck = new AsyncPremiumCheck(
+ plugin, connection, username, continuation, preLoginEvent
+ );
plugin.getScheduler().runAsync(asyncPremiumCheck);
break;
}
@@ -118,8 +120,8 @@ public class ConnectListener {
}
if (!plugin.getCore().getConfig().get("forwardSkin", true)) {
- List skinFreeProp = removeSkin(event.getGameProfile().getProperties());
- event.setGameProfile(event.getGameProfile().withProperties(skinFreeProp));
+ List newProp = removeSkin(event.getGameProfile().getProperties());
+ event.setGameProfile(event.getGameProfile().withProperties(newProp));
}
}
}
@@ -127,8 +129,9 @@ public class ConnectListener {
private List removeSkin(Collection oldProperties) {
List newProperties = new ArrayList<>(oldProperties.size());
for (GameProfile.Property property : oldProperties) {
- if (!"textures".equals(property.getName()))
+ if (!"textures".equals(property.getName())) {
newProperties.add(property);
+ }
}
return newProperties;
diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/PluginMessageListener.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/PluginMessageListener.java
index cdef0c2b..4e6b1183 100644
--- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/PluginMessageListener.java
+++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/PluginMessageListener.java
@@ -55,8 +55,9 @@ public class PluginMessageListener {
public PluginMessageListener(FastLoginVelocity plugin) {
this.plugin = plugin;
- this.successChannel = MinecraftChannelIdentifier.create(plugin.getName(), SuccessMessage.SUCCESS_CHANNEL).getId();
- this.changeChannel = MinecraftChannelIdentifier.create(plugin.getName(), ChangePremiumMessage.CHANGE_CHANNEL).getId();
+ String prefix = plugin.getName();
+ this.successChannel = MinecraftChannelIdentifier.create(prefix, SuccessMessage.SUCCESS_CHANNEL).getId();
+ this.changeChannel = MinecraftChannelIdentifier.create(prefix, ChangePremiumMessage.CHANGE_CHANNEL).getId();
}
@Subscribe
@@ -95,8 +96,9 @@ public class PluginMessageListener {
String playerName = changeMessage.getPlayerName();
boolean isSourceInvoker = changeMessage.isSourceInvoker();
if (changeMessage.shouldEnable()) {
- if (playerName.equals(forPlayer.getUsername()) && plugin.getCore().getConfig().get("premium-warning", true)
- && !core.getPendingConfirms().contains(forPlayer.getUniqueId())) {
+ Boolean premiumWarning = plugin.getCore().getConfig().get("premium-warning", true);
+ if (playerName.equals(forPlayer.getUsername()) && premiumWarning
+ && !core.getPendingConfirms().contains(forPlayer.getUniqueId())) {
String message = core.getMessage("premium-warning");
forPlayer.sendMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(message));
core.getPendingConfirms().add(forPlayer.getUniqueId());
@@ -114,7 +116,7 @@ public class PluginMessageListener {
}
private void onSuccessMessage(Player forPlayer) {
- if (forPlayer.isOnlineMode()){
+ if (forPlayer.isOnlineMode()) {
//bukkit module successfully received and force logged in the user
//update only on success to prevent corrupt data
VelocityLoginSession loginSession = plugin.getSession().get(forPlayer.getRemoteAddress());
diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/AsyncPremiumCheck.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/AsyncPremiumCheck.java
index 20204028..46f64261 100644
--- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/AsyncPremiumCheck.java
+++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/AsyncPremiumCheck.java
@@ -49,7 +49,8 @@ public class AsyncPremiumCheck extends JoinManagement core,
- CommandSource sender, String playerName, boolean toPremium, boolean playerSender) {
+ CommandSource sender, String playerName, boolean toPremium, boolean playerSender) {
this.core = core;
this.sender = sender;
this.targetPlayer = playerName;
this.toPremium = toPremium;
this.isPlayerSender = playerSender;
- if (sender instanceof Player)
+ if (sender instanceof Player) {
senderName = ((Player) sender).getUsername();
- else
+ } else {
senderName = "";
+ }
}
@Override
@@ -77,10 +79,10 @@ public class AsyncToggleMessage implements Runnable {
playerProfile.setPremium(false);
playerProfile.setId(null);
core.getStorage().save(playerProfile);
- PremiumToggleReason reason = (!isPlayerSender || !senderName.equalsIgnoreCase(playerProfile.getName())) ?
- PremiumToggleReason.COMMAND_OTHER : PremiumToggleReason.COMMAND_SELF;
+ PremiumToggleReason reason = (!isPlayerSender || !senderName.equalsIgnoreCase(playerProfile.getName()))
+ ? PremiumToggleReason.COMMAND_OTHER : PremiumToggleReason.COMMAND_SELF;
core.getPlugin().getProxy().getEventManager().fire(
- new VelocityFastLoginPremiumToggleEvent(playerProfile, reason));
+ new VelocityFastLoginPremiumToggleEvent(playerProfile, reason));
sendMessage("remove-premium");
}
@@ -93,10 +95,11 @@ public class AsyncToggleMessage implements Runnable {
playerProfile.setPremium(true);
core.getStorage().save(playerProfile);
- PremiumToggleReason reason = (!isPlayerSender || !senderName.equalsIgnoreCase(playerProfile.getName())) ?
- PremiumToggleReason.COMMAND_OTHER : PremiumToggleReason.COMMAND_SELF;
+ PremiumToggleReason reason = (!isPlayerSender || !senderName.equalsIgnoreCase(playerProfile.getName()))
+ ?
+ PremiumToggleReason.COMMAND_OTHER : PremiumToggleReason.COMMAND_SELF;
core.getPlugin().getProxy().getEventManager().fire(
- new VelocityFastLoginPremiumToggleEvent(playerProfile, reason));
+ new VelocityFastLoginPremiumToggleEvent(playerProfile, reason));
sendMessage("add-premium");
}
@@ -105,7 +108,8 @@ public class AsyncToggleMessage implements Runnable {
if (isPlayerSender) {
sender.sendMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(message));
} else {
- core.getPlugin().getProxy().getConsoleCommandSource().sendMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(message));
+ ConsoleCommandSource console = core.getPlugin().getProxy().getConsoleCommandSource();
+ console.sendMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(message));
}
}
}
diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/ForceLoginTask.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/ForceLoginTask.java
index 849f53d4..da3ea231 100644
--- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/ForceLoginTask.java
+++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/task/ForceLoginTask.java
@@ -52,7 +52,8 @@ public class ForceLoginTask
private final boolean forcedOnlineMode;
public ForceLoginTask(FastLoginCore core,
- Player player, RegisteredServer server, VelocityLoginSession session, boolean forcedOnlineMode) {
+ Player player, RegisteredServer server, VelocityLoginSession session,
+ boolean forcedOnlineMode) {
super(core, player, session);
this.server = server;