Revert "Optimize imports and update to java 17"

This reverts commit 3dfa56e1c53e770891ef07dd24bdcbfb8334b71e.
This commit is contained in:
MiGoYAm 2021-12-11 17:48:50 +01:00
parent 63ebb4e4af
commit eea304767e
5 changed files with 28 additions and 12 deletions

View File

@ -2,6 +2,7 @@ package ru.nanit.limbo.configuration;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.configurate.ConfigurationNode; import org.spongepowered.configurate.ConfigurationNode;
import org.spongepowered.configurate.serialize.SerializationException;
import org.spongepowered.configurate.serialize.TypeSerializer; import org.spongepowered.configurate.serialize.TypeSerializer;
import java.lang.reflect.Type; import java.lang.reflect.Type;

View File

@ -112,7 +112,8 @@ public class ClientConnection extends ChannelInboundHandlerAdapter {
} }
public void handlePacket(Object packet) { public void handlePacket(Object packet) {
if (packet instanceof PacketHandshake handshake) { if (packet instanceof PacketHandshake) {
PacketHandshake handshake = (PacketHandshake) packet;
clientVersion = handshake.getVersion(); clientVersion = handshake.getVersion();
updateStateAndVersion(handshake.getNextState(), clientVersion); updateStateAndVersion(handshake.getNextState(), clientVersion);
@ -177,7 +178,8 @@ public class ClientConnection extends ChannelInboundHandlerAdapter {
return; return;
} }
if (packet instanceof PacketLoginPluginResponse response) { if (packet instanceof PacketLoginPluginResponse) {
PacketLoginPluginResponse response = (PacketLoginPluginResponse) packet;
if (server.getConfig().getInfoForwarding().isModern() if (server.getConfig().getInfoForwarding().isModern()
&& response.getMessageId() == velocityLoginMessageId) { && response.getMessageId() == velocityLoginMessageId) {
@ -319,7 +321,8 @@ public class ClientConnection extends ChannelInboundHandlerAdapter {
String token = null; String token = null;
for (Object obj : arr) { for (Object obj : arr) {
if (obj instanceof JsonObject prop) { if (obj instanceof JsonObject) {
JsonObject prop = (JsonObject) obj;
if (prop.getString("name").equals("bungeeguard-token")) { if (prop.getString("name").equals("bungeeguard-token")) {
token = prop.getString("value"); token = prop.getString("value");
break; break;

View File

@ -35,9 +35,15 @@ public class PacketTitleLegacy implements PacketOut {
msg.writeVarInt(action.getId(version)); msg.writeVarInt(action.getId(version));
switch (action) { switch (action) {
case SET_TITLE -> title.encode(msg, version); case SET_TITLE:
case SET_SUBTITLE -> subtitle.encode(msg, version); title.encode(msg, version);
case SET_TIMES_AND_DISPLAY -> times.encode(msg, version); break;
case SET_SUBTITLE:
subtitle.encode(msg, version);
break;
case SET_TIMES_AND_DISPLAY:
times.encode(msg, version);
break;
} }
} }

View File

@ -44,7 +44,7 @@ public final class Logger {
public static void print(Level level, Object msg, Throwable t, Object... args) { public static void print(Level level, Object msg, Throwable t, Object... args) {
if (debugLevel >= level.getIndex()) { if (debugLevel >= level.getIndex()) {
System.out.printf("%s: %s%n", getPrefix(level), String.format(msg.toString(), args)); System.out.println(String.format("%s: %s", getPrefix(level), String.format(msg.toString(), args)));
if (t != null) t.printStackTrace(); if (t != null) t.printStackTrace();
} }
} }

View File

@ -47,13 +47,19 @@ public final class DimensionRegistry {
CompoundBinaryTag theEnd = (CompoundBinaryTag) ((CompoundBinaryTag) dimensions.get(3)).get("element"); CompoundBinaryTag theEnd = (CompoundBinaryTag) ((CompoundBinaryTag) dimensions.get(3)).get("element");
switch (def.toLowerCase()) { switch (def.toLowerCase()) {
case "overworld" -> defaultDimension = new Dimension(0, "minecraft:overworld", overWorld); case "overworld":
case "nether" -> defaultDimension = new Dimension(-1, "minecraft:nether", nether); defaultDimension = new Dimension(0, "minecraft:overworld", overWorld);
case "the_end" -> defaultDimension = new Dimension(1, "minecraft:the_end", theEnd); break;
default -> { case "nether":
defaultDimension = new Dimension(-1, "minecraft:nether", nether);
break;
case "the_end":
defaultDimension = new Dimension(1, "minecraft:the_end", theEnd);
break;
default:
defaultDimension = new Dimension(1, "minecraft:the_end", theEnd); defaultDimension = new Dimension(1, "minecraft:the_end", theEnd);
Logger.warning("Undefined dimension type: '%s'. Using THE_END as default", def); Logger.warning("Undefined dimension type: '%s'. Using THE_END as default", def);
} break;
} }
} }