Clean up methods names and documentation

This commit is contained in:
games647
2024-05-21 14:41:41 +02:00
parent e9643ee3e2
commit be2ec1e5a8
26 changed files with 97 additions and 109 deletions
@@ -66,8 +66,4 @@ public class VelocityLoginSource implements LoginSource {
public InetSocketAddress getAddress() {
return connection.getRemoteAddress();
}
public InboundConnection getConnection() {
return connection;
}
}
@@ -82,7 +82,7 @@ public class AsyncPremiumCheck extends JoinManagement<Player, CommandSource, Vel
String username, boolean registered) {
source.enableOnlinemode();
VelocityLoginSession session = new VelocityLoginSession(username, registered, profile);
plugin.getSession().put(source.getConnection().getRemoteAddress(), session);
plugin.getSession().put(source.getAddress(), session);
String ip = source.getAddress().getAddress().getHostAddress();
plugin.getCore().addLoginAttempt(ip, username);
@@ -91,6 +91,6 @@ public class AsyncPremiumCheck extends JoinManagement<Player, CommandSource, Vel
@Override
public void startCrackedSession(VelocityLoginSource source, StoredProfile profile, String username) {
VelocityLoginSession session = new VelocityLoginSession(username, false, profile);
plugin.getSession().put(source.getConnection().getRemoteAddress(), session);
plugin.getSession().put(source.getAddress(), session);
}
}
@@ -51,8 +51,8 @@ public class AsyncToggleMessage implements Runnable {
this.targetPlayer = playerName;
this.toPremium = toPremium;
this.isPlayerSender = playerSender;
if (sender instanceof Player) {
senderName = ((Player) sender).getUsername();
if (sender instanceof Player playSender) {
senderName = playSender.getUsername();
} else {
senderName = "";
}
@@ -70,7 +70,7 @@ public class AsyncToggleMessage implements Runnable {
private void turnOffPremium() {
StoredProfile playerProfile = core.getStorage().loadProfile(targetPlayer);
//existing player is already cracked
if (playerProfile.isSaved() && !playerProfile.isOnlinemodePreferred()) {
if (playerProfile.isExistingPlayer() && !playerProfile.isOnlinemodePreferred()) {
sendMessage("not-premium");
return;
}