forked from TuxCoding/FastLogin
Minor code recommendations
This commit is contained in:
@ -60,13 +60,13 @@ Possible values: `Premium`, `Cracked`, `Unknown`
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
* Java 17+
|
* Java 17+ (Recommended)
|
||||||
* Server software in offlinemode:
|
* Server software in offlinemode:
|
||||||
* Spigot (or a fork e.g. Paper) 1.8.8+
|
* Spigot (or a fork e.g. Paper) 1.8.8+
|
||||||
* Protocol plugin:
|
* Protocol plugin:
|
||||||
* [ProtocolLib 5.0+](https://www.spigotmc.org/resources/protocollib.1997/) or
|
* [ProtocolLib 5.1+](https://www.spigotmc.org/resources/protocollib.1997/) or
|
||||||
* [ProtocolSupport](https://www.spigotmc.org/resources/protocolsupport.7201/)
|
* [ProtocolSupport](https://www.spigotmc.org/resources/protocolsupport.7201/)
|
||||||
* Latest BungeeCord (or a fork e.g. Waterfall)
|
* Latest BungeeCord (or a fork e.g. Waterfall) or Velocity
|
||||||
* An auth plugin.
|
* An auth plugin.
|
||||||
|
|
||||||
### Supported auth plugins
|
### Supported auth plugins
|
||||||
|
@ -39,7 +39,7 @@ public class BukkitScheduler extends AsyncScheduler {
|
|||||||
public BukkitScheduler(Plugin plugin, Logger logger) {
|
public BukkitScheduler(Plugin plugin, Logger logger) {
|
||||||
super(logger, command -> Bukkit.getScheduler().runTaskAsynchronously(plugin, command));
|
super(logger, command -> Bukkit.getScheduler().runTaskAsynchronously(plugin, command));
|
||||||
|
|
||||||
syncExecutor = r -> Bukkit.getScheduler().runTask(plugin, r);
|
syncExecutor = task -> Bukkit.getScheduler().runTask(plugin, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Executor getSyncExecutor() {
|
public Executor getSyncExecutor() {
|
||||||
|
@ -177,7 +177,7 @@ public class ProtocolLibListener extends PacketAdapter {
|
|||||||
ClientPublicKey clientPublicKey, byte[] expectedToken) {
|
ClientPublicKey clientPublicKey, byte[] expectedToken) {
|
||||||
try {
|
try {
|
||||||
if (new MinecraftVersion(1, 19, 0).atOrAbove()
|
if (new MinecraftVersion(1, 19, 0).atOrAbove()
|
||||||
&& !(new MinecraftVersion(1, 19, 3).atOrAbove())) {
|
&& !new MinecraftVersion(1, 19, 3).atOrAbove()) {
|
||||||
Either<byte[], ?> either = packet.getSpecificModifier(Either.class).read(0);
|
Either<byte[], ?> either = packet.getSpecificModifier(Either.class).read(0);
|
||||||
if (clientPublicKey == null) {
|
if (clientPublicKey == null) {
|
||||||
Optional<byte[]> left = either.left();
|
Optional<byte[]> left = either.left();
|
||||||
|
@ -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 firstMinuteRecord;
|
||||||
private final long expireTime;
|
private final long expireTime;
|
||||||
@ -131,9 +131,9 @@ public class TickingRateLimiter implements RateLimiter {
|
|||||||
return firstMinuteRecord + expireTime <= now;
|
return firstMinuteRecord + expireTime <= now;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public int compareTo(long other) {
|
||||||
public int compareTo(Long other) {
|
|
||||||
if (other < firstMinuteRecord) {
|
if (other < firstMinuteRecord) {
|
||||||
|
// other is earlier
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,5 +143,10 @@ public class TickingRateLimiter implements RateLimiter {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(TimeRecord other) {
|
||||||
|
return compareTo(other.firstMinuteRecord);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -61,9 +62,9 @@ public abstract class FloodgateManagement<P extends C, C, L extends LoginSession
|
|||||||
this.username = getName(player);
|
this.username = getName(player);
|
||||||
|
|
||||||
//load values from config.yml
|
//load values from config.yml
|
||||||
autoLoginFloodgate = core.getConfig().get("autoLoginFloodgate").toString().toLowerCase();
|
autoLoginFloodgate = core.getConfig().getString("autoLoginFloodgate").toLowerCase(Locale.ROOT);
|
||||||
autoRegisterFloodgate = core.getConfig().get("autoRegisterFloodgate").toString().toLowerCase();
|
autoRegisterFloodgate = core.getConfig().getString("autoRegisterFloodgate").toLowerCase(Locale.ROOT);
|
||||||
allowNameConflict = core.getConfig().get("allowFloodgateNameConflict").toString().toLowerCase();
|
allowNameConflict = core.getConfig().getString("allowFloodgateNameConflict").toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
* @return This value is always false if we authenticate the player with a cracked authentication
|
||||||
*/
|
*/
|
||||||
public synchronized boolean needsRegistration() {
|
public synchronized boolean needsRegistration() {
|
||||||
|
Reference in New Issue
Block a user