3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Some code cleanup (#3698)

Dieser Commit ist enthalten in:
EnZaXD 2024-02-14 22:53:50 +01:00 committet von GitHub
Ursprung 35578372a1
Commit c7baa27fd0
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
5 geänderte Dateien mit 5 neuen und 4 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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