Revert "Minor code recommendations"

This reverts commit d89d332273.
This commit is contained in:
games647
2024-05-21 11:01:38 +02:00
parent 896e250fa2
commit 9f5186a3ed
6 changed files with 11 additions and 18 deletions

View File

@ -60,13 +60,13 @@ Possible values: `Premium`, `Cracked`, `Unknown`
## Requirements ## Requirements
* Java 17+ (Recommended) * Java 17+
* 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.1+](https://www.spigotmc.org/resources/protocollib.1997/) or * [ProtocolLib 5.0+](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) or Velocity * Latest BungeeCord (or a fork e.g. Waterfall)
* An auth plugin. * An auth plugin.
### Supported auth plugins ### Supported auth plugins

View File

@ -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 = task -> Bukkit.getScheduler().runTask(plugin, task); syncExecutor = r -> Bukkit.getScheduler().runTask(plugin, r);
} }
public Executor getSyncExecutor() { public Executor getSyncExecutor() {

View File

@ -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();

View File

@ -107,7 +107,7 @@ public class TickingRateLimiter implements RateLimiter {
} }
} }
private static class TimeRecord implements Comparable<TimeRecord> { private static class TimeRecord implements Comparable<Long> {
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;
} }
public int compareTo(long other) { @Override
public int compareTo(Long other) {
if (other < firstMinuteRecord) { if (other < firstMinuteRecord) {
// other is earlier
return -1; return -1;
} }
@ -143,10 +143,5 @@ public class TickingRateLimiter implements RateLimiter {
return 0; return 0;
} }
@Override
public int compareTo(TimeRecord other) {
return compareTo(other.firstMinuteRecord);
}
} }
} }

View File

@ -33,7 +33,6 @@ 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;
@ -62,9 +61,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().getString("autoLoginFloodgate").toLowerCase(Locale.ROOT); autoLoginFloodgate = core.getConfig().get("autoLoginFloodgate").toString().toLowerCase();
autoRegisterFloodgate = core.getConfig().getString("autoRegisterFloodgate").toLowerCase(Locale.ROOT); autoRegisterFloodgate = core.getConfig().get("autoRegisterFloodgate").toString().toLowerCase();
allowNameConflict = core.getConfig().getString("allowFloodgateNameConflict").toLowerCase(Locale.ROOT); allowNameConflict = core.getConfig().get("allowFloodgateNameConflict").toString().toLowerCase();
} }
@Override @Override

View File

@ -61,7 +61,6 @@ 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() {