Skip to content

Commit

Permalink
Turns out Map.of is Java 9...
Browse files Browse the repository at this point in the history
  • Loading branch information
tr7zw committed Feb 12, 2024
1 parent e7f48c7 commit 330fb77
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.tr7zw.changeme.nbtapi.utils;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -42,8 +43,17 @@ public enum MinecraftVersion {
private final int versionId;
private final boolean mojangMapping;

private static final Map<String, MinecraftVersion> VERSION_TO_REVISION = Map.of("1.20", MC1_20_R1, "1.20.1",
MC1_20_R1, "1.20.2", MC1_20_R2, "1.20.3", MC1_20_R3, "1.20.4", MC1_20_R3);
// TODO: not nice
@SuppressWarnings("serial")
private static final Map<String, MinecraftVersion> VERSION_TO_REVISION = new HashMap<String, MinecraftVersion>() {
{
this.put("1.20", MC1_20_R1);
this.put("1.20.1", MC1_20_R1);
this.put("1.20.2", MC1_20_R2);
this.put("1.20.3", MC1_20_R3);
this.put("1.20.4", MC1_20_R3);
}
};

MinecraftVersion(int versionId) {
this(versionId, false);
Expand Down

0 comments on commit 330fb77

Please sign in to comment.