forked from TuxCoding/FastLogin
Minor code recommendations
This commit is contained in:
+8
-3
@@ -107,7 +107,7 @@ public class TickingRateLimiter implements RateLimiter {
|
||||
}
|
||||
}
|
||||
|
||||
private static class TimeRecord implements Comparable<Long> {
|
||||
private static class TimeRecord implements Comparable<TimeRecord> {
|
||||
|
||||
private final long firstMinuteRecord;
|
||||
private final long expireTime;
|
||||
@@ -131,9 +131,9 @@ public class TickingRateLimiter implements RateLimiter {
|
||||
return firstMinuteRecord + expireTime <= now;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Long other) {
|
||||
public int compareTo(long other) {
|
||||
if (other < firstMinuteRecord) {
|
||||
// other is earlier
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -143,5 +143,10 @@ public class TickingRateLimiter implements RateLimiter {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(TimeRecord other) {
|
||||
return compareTo(other.firstMinuteRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -33,6 +33,7 @@ import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -61,9 +62,9 @@ public abstract class FloodgateManagement<P extends C, C, L extends LoginSession
|
||||
this.username = getName(player);
|
||||
|
||||
//load values from config.yml
|
||||
autoLoginFloodgate = core.getConfig().get("autoLoginFloodgate").toString().toLowerCase();
|
||||
autoRegisterFloodgate = core.getConfig().get("autoRegisterFloodgate").toString().toLowerCase();
|
||||
allowNameConflict = core.getConfig().get("allowFloodgateNameConflict").toString().toLowerCase();
|
||||
autoLoginFloodgate = core.getConfig().getString("autoLoginFloodgate").toLowerCase(Locale.ROOT);
|
||||
autoRegisterFloodgate = core.getConfig().getString("autoRegisterFloodgate").toLowerCase(Locale.ROOT);
|
||||
allowNameConflict = core.getConfig().getString("allowFloodgateNameConflict").toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -61,6 +61,7 @@ public abstract class LoginSession {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user needs registration once login is successful
|
||||
* @return This value is always false if we authenticate the player with a cracked authentication
|
||||
*/
|
||||
public synchronized boolean needsRegistration() {
|
||||
|
||||
Reference in New Issue
Block a user