From ff954a39033c228c1967bd68ffe01b1e66a6a184 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Mon, 10 Apr 2023 19:17:18 +0200 Subject: [PATCH] Various code cleanup. --- .../java/fr/pandacube/lib/commands/SuggestionsSupplier.java | 2 +- .../main/java/fr/pandacube/lib/core/backup/BackupProcess.java | 4 +--- .../lib/paper/reflect/wrapper/minecraft/GameVersion.java | 4 ++-- .../paper/reflect/wrapper/minecraft/nbt/CollectionTag.java | 2 ++ .../src/main/java/fr/pandacube/lib/util/TimeUtil.java | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pandalib-commands/src/main/java/fr/pandacube/lib/commands/SuggestionsSupplier.java b/pandalib-commands/src/main/java/fr/pandacube/lib/commands/SuggestionsSupplier.java index 22f1ec9..d8aa706 100644 --- a/pandalib-commands/src/main/java/fr/pandacube/lib/commands/SuggestionsSupplier.java +++ b/pandalib-commands/src/main/java/fr/pandacube/lib/commands/SuggestionsSupplier.java @@ -336,7 +336,7 @@ public interface SuggestionsSupplier { /** * List of all possible duration unit symbols for suggestions. */ - public static final List DURATION_SUFFIXES = List.of("y", "mo", "w", "d", "h", "m", "s"); + List DURATION_SUFFIXES = List.of("y", "mo", "w", "d", "h", "m", "s"); private static void scanAndRemovePastSuffixes(List suffixes, String foundSuffix) { diff --git a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupProcess.java b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupProcess.java index bc5e0f1..a2be7f1 100644 --- a/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupProcess.java +++ b/pandalib-core/src/main/java/fr/pandacube/lib/core/backup/BackupProcess.java @@ -310,9 +310,7 @@ public abstract class BackupProcess implements Comparable, Runnab return false; if (!isDirty()) return false; - if (getNext() > System.currentTimeMillis()) - return false; - return true; + return getNext() <= System.currentTimeMillis(); } diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/GameVersion.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/GameVersion.java index 70b0b2b..06a6102 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/GameVersion.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/GameVersion.java @@ -12,8 +12,8 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx; @ConcreteWrapper(GameVersion.__concrete.class) public interface GameVersion extends ReflectWrapperI { - public static final ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("com.mojang.bridge.game.GameVersion")); - public static final ReflectMethod getWorldVersion = wrapEx(() -> REFLECT.method("getWorldVersion")); + ReflectClass REFLECT = wrapEx(() -> Reflect.ofClass("com.mojang.bridge.game.GameVersion")); + ReflectMethod getWorldVersion = wrapEx(() -> REFLECT.method("getWorldVersion")); default int getWorldVersion() { return (int) wrapReflectEx(() -> getWorldVersion.invoke(__getRuntimeInstance())); diff --git a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/CollectionTag.java b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/CollectionTag.java index 6c27f7e..e392535 100644 --- a/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/CollectionTag.java +++ b/pandalib-paper/src/main/java/fr/pandacube/lib/paper/reflect/wrapper/minecraft/nbt/CollectionTag.java @@ -20,10 +20,12 @@ public class CollectionTag extends ReflectWrapperTyped> implemen return wrap(__getRuntimeInstance().get(i), Tag.class); } + @SuppressWarnings("unchecked") public Tag set(int i, Tag t) { return wrap(((AbstractList)__getRuntimeInstance()).set(i, unwrap(t)), Tag.class); } + @SuppressWarnings("unchecked") public void add(int i, Tag t) { ((AbstractList)__getRuntimeInstance()).add(i, unwrap(t)); } diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/TimeUtil.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/TimeUtil.java index b7a07cb..60ada58 100644 --- a/pandalib-util/src/main/java/fr/pandacube/lib/util/TimeUtil.java +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/TimeUtil.java @@ -179,7 +179,7 @@ public class TimeUtil { /** * Seconds precision for relative display. */ - SECONDS; + SECONDS } /**