Some code cleanup (#3698)

This commit is contained in:
EnZaXD 2024-02-14 22:53:50 +01:00 committed by GitHub
parent 35578372a1
commit c7baa27fd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 5 additions and 4 deletions

View File

@ -47,6 +47,7 @@ public final class ProtocolSupportUtil {
try {
final Object version = PROTOCOL_VERSION_METHOD.invoke(null, player);
final int id = (int) GET_ID_METHOD.invoke(version);
// List of pre netty (<= 1.6.4) versions supported by ProtocolSupport, needs to be updated if ProtocolSupport adds support for new versions.
final boolean preNetty = id == 78 || id == 74 || id == 73 || id == 61 || id == 60 || id == 51;
return ProtocolVersion.getProtocol(preNetty ? VersionType.RELEASE_INITIAL : VersionType.RELEASE, id);

View File

@ -42,7 +42,7 @@ public class BungeeViaConfig extends AbstractViaConfig {
super.loadFields();
bungeePingInterval = getInt("bungee-ping-interval", 60);
bungeePingSave = getBoolean("bungee-ping-save", true);
bungeeServerProtocols = get("bungee-servers", Map.class, new HashMap<>());
bungeeServerProtocols = get("bungee-servers", new HashMap<>());
}
@Override

View File

@ -152,7 +152,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
ignoreLongChannelNames = getBoolean("ignore-long-1_16-channel-names", true);
forcedUse1_17ResourcePack = getBoolean("forced-use-1_17-resource-pack", false);
resourcePack1_17PromptMessage = getSerializedComponent("resource-pack-1_17-prompt");
Map<String, String> worlds = get("map-1_16-world-names", Map.class, new HashMap<String, String>());
Map<String, String> worlds = get("map-1_16-world-names", new HashMap<>());
map1_16WorldNames = new WorldIdentifiers(worlds.getOrDefault("overworld", WorldIdentifiers.OVERWORLD_DEFAULT),
worlds.getOrDefault("nether", WorldIdentifiers.NETHER_DEFAULT),
worlds.getOrDefault("end", WorldIdentifiers.END_DEFAULT));

View File

@ -165,7 +165,7 @@ public abstract class Config {
return this.config;
}
public @Nullable <T> T get(String key, Class<T> clazz, T def) {
public @Nullable <T> T get(String key, T def) {
Object o = this.config.get(key);
if (o != null) {
return (T) o;

View File

@ -41,7 +41,7 @@ public class VelocityViaConfig extends AbstractViaConfig {
super.loadFields();
velocityPingInterval = getInt("velocity-ping-interval", 60);
velocityPingSave = getBoolean("velocity-ping-save", true);
velocityServerProtocols = get("velocity-servers", Map.class, new HashMap<>());
velocityServerProtocols = get("velocity-servers", new HashMap<>());
}
@Override