refactor: make IntelliJ just a bit happier

This commit is contained in:
Maya Winters
2026-12-04 23:40:03 +08:00
parent 98a33ec8ce
commit 162463d492
10 changed files with 22 additions and 62 deletions
@@ -1,22 +1,21 @@
package land.chipmunk.parker2991.nitoribot.nightofnights.chatattestation;
import static land.chipmunk.parker2991.nitoribot.nightofnights.chatattestation.crypto.Payload.withAdditionalData;
import static land.chipmunk.parker2991.nitoribot.nightofnights.chatattestation.util.Constants.LOGGER;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collection;
import land.chipmunk.parker2991.nitoribot.nightofnights.chatattestation.crypto.Payload;
import land.chipmunk.parker2991.nitoribot.nightofnights.chatattestation.crypto.SigningManager;
import land.chipmunk.parker2991.nitoribot.nightofnights.chatattestation.enums.SigningStatus;
import land.chipmunk.parker2991.nitoribot.nightofnights.chatattestation.util.SigningResult;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Collection;
public class Signing {
import static land.chipmunk.parker2991.nitoribot.nightofnights.chatattestation.crypto.Payload.withAdditionalData;
import static land.chipmunk.parker2991.nitoribot.nightofnights.chatattestation.util.Constants.LOGGER;
public final class Signing {
public static SigningResult getSigningStatus (
String nick,
String msg,
@@ -55,9 +54,9 @@ public class Signing {
);
return switch (response) {
case SigningManager.Response.InvalidSignature __ -> SigningResult.of(SigningStatus.INVALID_SIGNATURE);
case SigningManager.Response.NoSuchKey __ -> SigningResult.of(SigningStatus.NO_SUCH_KEY);
case SigningManager.Response.ReusedSignature __ -> SigningResult.of(SigningStatus.REUSED_SIGNATURE);
case SigningManager.Response.InvalidSignature _ -> SigningResult.of(SigningStatus.INVALID_SIGNATURE);
case SigningManager.Response.NoSuchKey _ -> SigningResult.of(SigningStatus.NO_SUCH_KEY);
case SigningManager.Response.ReusedSignature _ -> SigningResult.of(SigningStatus.REUSED_SIGNATURE);
case SigningManager.Response.SignatureValid valid -> {
final boolean authenticated = valid
.key()
@@ -3,16 +3,10 @@ package land.chipmunk.parker2991.nitoribot.nightofnights.data;
import net.kyori.adventure.text.Component;
public record PingServerData(
//String ip,
//int port,
String versionName,
long protocolVersion,
int playersOnline,
int maxPlayers,
Component description
//long latency
) {
public void latency (long pingTime) {
System.out.println(versionName);
}
}
@@ -9,7 +9,7 @@ import org.geysermc.mcprotocollib.protocol.data.game.entity.player.GameMode;
import java.util.UUID;
public class PlayerProfileData {
public final class PlayerProfileData {
public UUID uuid;
public String entityUUID;
public GameProfile profile;
@@ -3,7 +3,7 @@ package land.chipmunk.parker2991.nitoribot.nightofnights.data.chat;
import java.util.ArrayList;
import java.util.List;
public class ChatTranslationsData {
public final class ChatTranslationsData {
public static class Narration {
public String translation_key;
public List<String> parameters = new ArrayList<>();
@@ -1,9 +1,9 @@
package land.chipmunk.parker2991.nitoribot.nightofnights.data.https;
public class WeatherData {
public final class WeatherData {
public final Location location = new Location();
public final Current current = new Current();
public final class Location {
public static final class Location {
public String name;
public String region;
public String country;
@@ -12,11 +12,11 @@ public class WeatherData {
public String tz_id;
}
public final class Condition {
public static final class Condition {
public String text;
}
public final class Current {
public static final class Current {
public String temp_c;
public String temp_f;
public final Condition condition = new Condition();
@@ -1,10 +0,0 @@
package land.chipmunk.parker2991.nitoribot.nightofnights.data.world;
import java.util.List;
public record BlockData(
String block,
int id,
List<Integer> stateIds
) {
}
@@ -1,9 +0,0 @@
package land.chipmunk.parker2991.nitoribot.nightofnights.data.world;
public record ChunkData(
ChunkPosData chunkPos,
byte[] data,
int maxHeight,
int minY
) {
}
@@ -1,6 +1,6 @@
package land.chipmunk.parker2991.nitoribot.nightofnights.data.world;
public class DimensionData {
public final class DimensionData {
public int min_y;
public int height;
}
@@ -1,7 +1,6 @@
package land.chipmunk.parker2991.nitoribot.nightofnights.modules;
import land.chipmunk.parker2991.nitoribot.nightofnights.NitoriBot;
import land.chipmunk.parker2991.nitoribot.nightofnights.chatattestation.MessagingEntrypointImpl;
import land.chipmunk.parker2991.nitoribot.nightofnights.chatparsers.kaboom.ChipmunkModChatParser;
import land.chipmunk.parker2991.nitoribot.nightofnights.chatparsers.kaboom.KaboomChatParser;
import land.chipmunk.parker2991.nitoribot.nightofnights.data.chat.ChatTranslationsData;
@@ -46,13 +45,9 @@ public final class ChatModule implements Listener {
@Override
public void packetReceived (Packet packet) {
MessagingEntrypointImpl messagingEntrypoint = new MessagingEntrypointImpl();
switch (packet) {
case ClientboundSystemChatPacket p -> systemChat(p);
case ClientboundPlayerChatPacket p -> playerChat(
messagingEntrypoint,
p
);
case ClientboundPlayerChatPacket p -> playerChat(p);
case ClientboundDisguisedChatPacket p -> disguisedChat(p);
default -> {
}
@@ -162,20 +157,11 @@ public final class ChatModule implements Listener {
}
public void playerChat (
MessagingEntrypointImpl messagingEntrypoint,
ClientboundPlayerChatPacket packet
) {
final Component unsignedContent = packet.getUnsignedContent();
final Component content = Component.text(packet.getContent());
/*SigningResult result = ChatAttestation.getSigningStatus(
packet.getContent(),
packet.getSender(),
ComponentUtil.componentToString(packet.getName())
);*/
//bot.chat.tellraw("@a", Component.text(result.toString()));
for (Listener listener : bot.listenerManager.listeners()) {
listener.chatMessageReceived(
ChatType.PLAYER,
@@ -136,7 +136,7 @@ public final class DiscordModule extends ListenerAdapter implements Listener {
@Override
public void packetReceived (Packet packet) {
if (packet instanceof final ClientboundLoginFinishedPacket p) {
if (packet instanceof ClientboundLoginFinishedPacket) {
if (!bot.config.discord.enabled) return;
bot.scheduler.scheduleAtFixedRate(
() -> {