fix: add boot warning to fabric

dependabot/gradle/org.junit.jupiter-junit-jupiter-engine-5.11.0
William 3 months ago
parent 0c5a42a344
commit fead3df0d8
No known key found for this signature in database

@ -79,12 +79,12 @@ import java.util.logging.Level;
@Getter @Getter
@NoArgsConstructor @NoArgsConstructor
public class FabricHuskSync implements DedicatedServerModInitializer, HuskSync, FabricTask.Supplier, public class FabricHuskSync implements DedicatedServerModInitializer, HuskSync, FabricTask.Supplier,
FabricEventDispatcher { FabricEventDispatcher {
private static final String PLATFORM_TYPE_ID = "fabric"; private static final String PLATFORM_TYPE_ID = "fabric";
private final TreeMap<Identifier, Serializer<? extends Data>> serializers = Maps.newTreeMap( private final TreeMap<Identifier, Serializer<? extends Data>> serializers = Maps.newTreeMap(
SerializerRegistry.DEPENDENCY_ORDER_COMPARATOR SerializerRegistry.DEPENDENCY_ORDER_COMPARATOR
); );
private final Map<UUID, Map<Identifier, Data>> playerCustomDataStore = Maps.newConcurrentMap(); private final Map<UUID, Map<Identifier, Data>> playerCustomDataStore = Maps.newConcurrentMap();
private final Map<String, Boolean> permissions = Maps.newHashMap(); private final Map<String, Boolean> permissions = Maps.newHashMap();
@ -208,6 +208,14 @@ public class FabricHuskSync implements DedicatedServerModInitializer, HuskSync,
// Check for updates // Check for updates
this.checkForUpdates(); this.checkForUpdates();
log(Level.WARNING, """
**************
WARNING:
HuskSync for Fabric is still in an alpha state and is
not considered production ready.
**************""");
ModLoadedCallback.EVENT.invoker().post(FabricHuskSyncAPI.getInstance()); ModLoadedCallback.EVENT.invoker().post(FabricHuskSyncAPI.getInstance());
} }
@ -267,15 +275,15 @@ public class FabricHuskSync implements DedicatedServerModInitializer, HuskSync,
@Nullable @Nullable
public InputStream getResource(@NotNull String name) { public InputStream getResource(@NotNull String name) {
return this.mod.findPath(name) return this.mod.findPath(name)
.map(path -> { .map(path -> {
try { try {
return Files.newInputStream(path); return Files.newInputStream(path);
} catch (IOException e) { } catch (IOException e) {
log(Level.WARNING, "Failed to load resource: " + name, e); log(Level.WARNING, "Failed to load resource: " + name, e);
} }
return null; return null;
}) })
.orElse(this.getClass().getClassLoader().getResourceAsStream(name)); .orElse(this.getClass().getClassLoader().getResourceAsStream(name));
} }
@Override @Override
@ -295,11 +303,11 @@ public class FabricHuskSync implements DedicatedServerModInitializer, HuskSync,
@Override @Override
public void log(@NotNull Level level, @NotNull String message, @NotNull Throwable... throwable) { public void log(@NotNull Level level, @NotNull String message, @NotNull Throwable... throwable) {
LoggingEventBuilder logEvent = logger.makeLoggingEventBuilder( LoggingEventBuilder logEvent = logger.makeLoggingEventBuilder(
switch (level.getName()) { switch (level.getName()) {
case "WARNING" -> org.slf4j.event.Level.WARN; case "WARNING" -> org.slf4j.event.Level.WARN;
case "SEVERE" -> org.slf4j.event.Level.ERROR; case "SEVERE" -> org.slf4j.event.Level.ERROR;
default -> org.slf4j.event.Level.INFO; default -> org.slf4j.event.Level.INFO;
} }
); );
if (throwable.length >= 1) { if (throwable.length >= 1) {
logEvent = logEvent.setCause(throwable[0]); logEvent = logEvent.setCause(throwable[0]);

Loading…
Cancel
Save