From 702618482da52173fa3f21ec62750c7b8a0a4da5 Mon Sep 17 00:00:00 2001 From: Axionize <154778082+Axionize@users.noreply.github.com> Date: Sat, 26 Oct 2024 01:02:51 -0400 Subject: [PATCH] Minor code cleanup, use only Java 8 features --- .../java/me/caseload/knockbacksync/BukkitBase.java | 1 - .../main/java/me/caseload/knockbacksync/Base.java | 14 ++++++-------- .../knockbacksync/stats/custom/BuildTypePie.java | 1 - 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/bukkit/src/main/java/me/caseload/knockbacksync/BukkitBase.java b/bukkit/src/main/java/me/caseload/knockbacksync/BukkitBase.java index f97dd22..331816f 100644 --- a/bukkit/src/main/java/me/caseload/knockbacksync/BukkitBase.java +++ b/bukkit/src/main/java/me/caseload/knockbacksync/BukkitBase.java @@ -20,7 +20,6 @@ import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; diff --git a/common/src/main/java/me/caseload/knockbacksync/Base.java b/common/src/main/java/me/caseload/knockbacksync/Base.java index 2fd1a9e..155d5c6 100644 --- a/common/src/main/java/me/caseload/knockbacksync/Base.java +++ b/common/src/main/java/me/caseload/knockbacksync/Base.java @@ -26,9 +26,7 @@ import java.io.File; import java.io.InputStream; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.logging.Logger; // Base class @@ -54,11 +52,11 @@ protected Base() { } private Platform getPlatform() { - final Map platforms = Map.of( - "io.papermc.paper.threadedregions.RegionizedServer", Platform.FOLIA, - "org.bukkit.Bukkit", Platform.BUKKIT, - "net.fabricmc.loader.api.FabricLoader", Platform.FABRIC - ); + final Map platforms = Collections.unmodifiableMap(new HashMap() {{ + put("io.papermc.paper.threadedregions.RegionizedServer", Platform.FOLIA); + put("org.bukkit.Bukkit", Platform.BUKKIT); + put("net.fabricmc.loader.api.FabricLoader", Platform.FABRIC); + }}); return platforms.entrySet().stream() .filter(entry -> isClassPresent(entry.getKey())) diff --git a/common/src/main/java/me/caseload/knockbacksync/stats/custom/BuildTypePie.java b/common/src/main/java/me/caseload/knockbacksync/stats/custom/BuildTypePie.java index 582565c..ed0e0d7 100644 --- a/common/src/main/java/me/caseload/knockbacksync/stats/custom/BuildTypePie.java +++ b/common/src/main/java/me/caseload/knockbacksync/stats/custom/BuildTypePie.java @@ -20,7 +20,6 @@ public class BuildTypePie extends SimplePie { private static final String RELEASES_FILE = "releases.txt"; private static final String DEV_BUILDS_FILE = "dev-builds.txt"; private static final File dataFolder = Base.INSTANCE.getDataFolder(); - public static URL jarUrl; private static String cachedBuildType = null; public BuildTypePie() {