From 5fe79b92327c082384068fa45c3b1d2691800e3d Mon Sep 17 00:00:00 2001 From: mdxd44 Date: Thu, 23 Dec 2021 12:15:10 +0900 Subject: Titles, auth time, bossbar, max and min auth time, unsafe passwords. (Closes LimboAPI#8) --- src/main/java/net/elytrium/limboauth/config/Config.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/main/java/net/elytrium/limboauth/config') diff --git a/src/main/java/net/elytrium/limboauth/config/Config.java b/src/main/java/net/elytrium/limboauth/config/Config.java index ed5b007..1cb9803 100644 --- a/src/main/java/net/elytrium/limboauth/config/Config.java +++ b/src/main/java/net/elytrium/limboauth/config/Config.java @@ -208,7 +208,7 @@ public class Config { } } - private void save(PrintWriter writer, Class clazz, final Object instance, int indent) { + private void save(PrintWriter writer, Class clazz, Object instance, int indent) { try { String lineSeparator = System.lineSeparator(); String spacing = this.repeat(" ", indent); @@ -356,9 +356,14 @@ public class Config { private void setAccessible(Field field) throws NoSuchFieldException, IllegalAccessException { field.setAccessible(true); if (Modifier.isFinal(field.getModifiers())) { - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); + if (Runtime.version().feature() < 12) { + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); + } else { + // TODO: Maybe use sun.misc.Unsafe?... + throw new UnsupportedOperationException(); + } } } @@ -377,7 +382,7 @@ public class Config { return array[0].toString(); } default: { - final StringBuilder result = new StringBuilder(); + StringBuilder result = new StringBuilder(); for (int i = 0, j = array.length; i < j; ++i) { if (i > 0) { result.append(delimiter); -- cgit