From e9afbbe7b60801006dc02cf0bff2ce795b64009d Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Sun, 4 Jul 2021 16:03:21 +0200 Subject: [PATCH] Fix Java 16 dependency not for every modules (because WebAPI still run with Java 11) --- Bungee/pom.xml | 5 ++++ Core/.classpath | 2 +- Core/.settings/org.eclipse.jdt.core.prefs | 6 ++--- .../lib/core/chat/ChatColorUtil.java | 11 ++++++++- .../lib/core/db/ParameterizedSQLString.java | 11 +++++++-- .../lib/core/players/PlayerFinder.java | 23 +++++++++++++++++-- Paper/pom.xml | 5 ++++ pom.xml | 4 ++-- 8 files changed, 56 insertions(+), 11 deletions(-) diff --git a/Bungee/pom.xml b/Bungee/pom.xml index 8fb5861..d75fb9a 100644 --- a/Bungee/pom.xml +++ b/Bungee/pom.xml @@ -11,6 +11,11 @@ PandaLib-Bungee + + 16 + 16 + + papermc diff --git a/Core/.classpath b/Core/.classpath index d4e0e69..4559ca0 100644 --- a/Core/.classpath +++ b/Core/.classpath @@ -13,7 +13,7 @@ - + diff --git a/Core/.settings/org.eclipse.jdt.core.prefs b/Core/.settings/org.eclipse.jdt.core.prefs index 1b835cb..2af1e7b 100644 --- a/Core/.settings/org.eclipse.jdt.core.prefs +++ b/Core/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=16 -org.eclipse.jdt.core.compiler.compliance=16 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=16 +org.eclipse.jdt.core.compiler.source=11 diff --git a/Core/src/main/java/fr/pandacube/lib/core/chat/ChatColorUtil.java b/Core/src/main/java/fr/pandacube/lib/core/chat/ChatColorUtil.java index 8026064..ca09912 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/chat/ChatColorUtil.java +++ b/Core/src/main/java/fr/pandacube/lib/core/chat/ChatColorUtil.java @@ -255,7 +255,16 @@ public class ChatColorUtil { public static class ChatValueGradient { - private record GradientValueColor(float value, ChatColor color) { } + //private record GradientValueColor(float value, ChatColor color) { } // Java 16 + private static class GradientValueColor { + private final float value; + private final ChatColor color; + public GradientValueColor(float value, ChatColor color) { + this.value = value; this.color = color; + } + public float value() { return value; } + public ChatColor color() { return color; } + } List colors = new ArrayList<>(); diff --git a/Core/src/main/java/fr/pandacube/lib/core/db/ParameterizedSQLString.java b/Core/src/main/java/fr/pandacube/lib/core/db/ParameterizedSQLString.java index a5eb1d0..81b8a64 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/db/ParameterizedSQLString.java +++ b/Core/src/main/java/fr/pandacube/lib/core/db/ParameterizedSQLString.java @@ -2,6 +2,13 @@ package fr.pandacube.lib.core.db; import java.util.List; -public record ParameterizedSQLString(String sqlString, List parameters) { - +//public record ParameterizedSQLString(String sqlString, List parameters) { } // Java 16 +public class ParameterizedSQLString { + private final String sqlString; + private final List parameters; + public ParameterizedSQLString(String sqlString, List parameters) { + this.sqlString = sqlString; this.parameters = parameters; + } + public String sqlString() { return sqlString; } + public List parameters() { return parameters; } } diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/PlayerFinder.java b/Core/src/main/java/fr/pandacube/lib/core/players/PlayerFinder.java index 2f3e332..1e1f655 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/PlayerFinder.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/PlayerFinder.java @@ -37,7 +37,16 @@ public class PlayerFinder { .maximumSize(1000) .build(); - record PlayerIdCacheKey(String pName, boolean old) { } + //record PlayerIdCacheKey(String pName, boolean old) { } // Java 16 + static class PlayerIdCacheKey { + private final String pName; + private final boolean old; + public PlayerIdCacheKey(String pName, boolean old) { + this.pName = pName; this.old = old; + } + public String pName() { return pName; } + public boolean old() { return old; } + } private static Cache playerId = CacheBuilder.newBuilder() .expireAfterWrite(2, TimeUnit.MINUTES) .maximumSize(1000) @@ -203,7 +212,17 @@ public class PlayerFinder { return DIFF_CHAR_DISTANCE; }; - record NamesCacheResult(String name, UUID id) { } + // record NamesCacheResult(String name, UUID id) { } // Java 16 + static class NamesCacheResult { + private final String name; + private final UUID id; + public NamesCacheResult(String name, UUID id) { + this.name = name; this.id = id; + } + public String name() { return name; } + public UUID id() { return id; } + } + private static LoadingCache> namesCache = CacheBuilder.newBuilder() .expireAfterWrite(2, TimeUnit.MINUTES) .maximumSize(1) diff --git a/Paper/pom.xml b/Paper/pom.xml index 294adb9..f32a88f 100644 --- a/Paper/pom.xml +++ b/Paper/pom.xml @@ -11,6 +11,11 @@ PandaLib-Paper + + 16 + 16 + + papermc diff --git a/pom.xml b/pom.xml index 3a4162f..f53f101 100644 --- a/pom.xml +++ b/pom.xml @@ -37,8 +37,8 @@ unknown - 16 - 16 + 11 + 11 UTF-8 1.16-R0.4-SNAPSHOT