mirror of
https://github.com/FalsePattern/FalsePatternLib.git
synced 2026-11-16 09:34:51 +00:00
externalize log
This commit is contained in:
20 files changed
+78
-52
No files matched your search
+6
-4
@@ -26,6 +26,7 @@ import com.falsepattern.lib.config.event.AllConfigSyncEvent;
|
||||
import com.falsepattern.lib.config.event.ConfigSyncEvent;
|
||||
import com.falsepattern.lib.config.event.ConfigValidationFailureEvent;
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
import com.falsepattern.lib.internal.config.LibraryConfig;
|
||||
import com.falsepattern.lib.internal.impl.config.net.SyncRequest;
|
||||
import com.falsepattern.lib.text.FormattedText;
|
||||
@@ -182,7 +183,7 @@ public class ConfigurationManagerImpl {
|
||||
|
||||
public static void receiveReply(DataInput input) throws IOException {
|
||||
if (!AllConfigSyncEvent.postStart()) {
|
||||
FalsePatternLib.getLog().warn("Config synchronization was cancelled by event.");
|
||||
Share.LOG.warn("Config synchronization was cancelled by event.");
|
||||
}
|
||||
int count = input.readInt();
|
||||
for (int i = 0; i < count; i++) {
|
||||
@@ -191,7 +192,7 @@ public class ConfigurationManagerImpl {
|
||||
val opt = serializedNames.keySet().stream().filter((key) -> key.equals(serializedName)).findFirst();
|
||||
if (!opt.isPresent()) {
|
||||
input.skipBytes(dataSize);
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("Server tried to sync config not registered on our side: " + serializedName);
|
||||
continue;
|
||||
}
|
||||
@@ -199,14 +200,15 @@ public class ConfigurationManagerImpl {
|
||||
val config = parsedConfigMap.get(clazz);
|
||||
if (!config.sync) {
|
||||
input.skipBytes(dataSize);
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("Server tried to sync config without @Synchronize annotation on our side: " +
|
||||
serializedName);
|
||||
continue;
|
||||
}
|
||||
if (!ConfigSyncEvent.postStart(clazz)) {
|
||||
input.skipBytes(dataSize);
|
||||
FalsePatternLib.getLog().warn("Config synchronization was cancelled by event for: " + serializedName);
|
||||
Share.LOG.warn(
|
||||
"Config synchronization was cancelled by event for: " + serializedName);
|
||||
continue;
|
||||
}
|
||||
val bytes = new byte[dataSize];
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ package com.falsepattern.lib.internal.impl.config.fields;
|
||||
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.event.ConfigValidationFailureEvent;
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
@@ -44,7 +44,7 @@ public class BooleanConfigField extends AConfigField<Boolean> {
|
||||
defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultBoolean.class))
|
||||
.map(Config.DefaultBoolean::value)
|
||||
.orElseGet(() -> {
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("The field " + field.getName() + " in class " +
|
||||
field.getDeclaringClass().getName() +
|
||||
" has no DefaultBoolean annotation!\nThis will be a crash in FalsePatternLib 0.11, update your code!");
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ package com.falsepattern.lib.internal.impl.config.fields;
|
||||
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.ConfigException;
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
import lombok.val;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
@@ -43,7 +43,7 @@ public class BooleanListConfigField extends AListConfigField<boolean[]> {
|
||||
defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultBooleanList.class))
|
||||
.map(Config.DefaultBooleanList::value)
|
||||
.orElseGet(() -> {
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("The field " + field.getName() + " in class " +
|
||||
field.getDeclaringClass().getName() +
|
||||
" has no DefaultBooleanList annotation!\nThis will be a crash in FalsePatternLib 0.11, update your code!");
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ package com.falsepattern.lib.internal.impl.config.fields;
|
||||
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.event.ConfigValidationFailureEvent;
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.val;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DoubleConfigField extends AConfigField<Double> {
|
||||
defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultDouble.class))
|
||||
.map(Config.DefaultDouble::value)
|
||||
.orElseGet(() -> {
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("The field " + field.getName() + " in class " +
|
||||
field.getDeclaringClass().getName() +
|
||||
" has no DefaultDouble annotation!\nThis will be a crash in FalsePatternLib 0.11, update your code!");
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ package com.falsepattern.lib.internal.impl.config.fields;
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.ConfigException;
|
||||
import com.falsepattern.lib.config.event.ConfigValidationFailureEvent;
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
import lombok.val;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
@@ -49,7 +49,7 @@ public class DoubleListConfigField extends AListConfigField<double[]> {
|
||||
defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultDoubleList.class))
|
||||
.map(Config.DefaultDoubleList::value)
|
||||
.orElseGet(() -> {
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("The field " + field.getName() + " in class " +
|
||||
field.getDeclaringClass().getName() +
|
||||
" has no DefaultDoubleList annotation!\nThis will be a crash in FalsePatternLib 0.11, update your code!");
|
||||
|
||||
@@ -22,7 +22,7 @@ package com.falsepattern.lib.internal.impl.config.fields;
|
||||
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.event.ConfigValidationFailureEvent;
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import lombok.SneakyThrows;
|
||||
@@ -61,7 +61,7 @@ public class EnumConfigField<T extends Enum<T>> extends AConfigField<T> {
|
||||
"Default value \"" + defName +
|
||||
"\" was not found in enum " + enumClass.getName())))
|
||||
.orElseGet(() -> {
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("The field " + field.getName() + " in class " +
|
||||
field.getDeclaringClass().getName() +
|
||||
" has no DefaultEnum annotation!\nThis will be a crash in FalsePatternLib 0.11, update your code!");
|
||||
@@ -103,7 +103,7 @@ public class EnumConfigField<T extends Enum<T>> extends AConfigField<T> {
|
||||
|
||||
private T getEnumByName(String name) {
|
||||
if (!enumNameMap.containsKey(name)) {
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("Invalid value " + name + " for enum configuration field " + field.getName() +
|
||||
" of type " + enumClass.getName() + " in config class " +
|
||||
field.getDeclaringClass().getName() + "! Using default value of " +
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ package com.falsepattern.lib.internal.impl.config.fields;
|
||||
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.event.ConfigValidationFailureEvent;
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
import com.falsepattern.lib.util.MathUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.val;
|
||||
@@ -47,7 +47,7 @@ public class FloatConfigField extends AConfigField<Float> {
|
||||
|
||||
public FloatConfigField(Field field, Configuration configuration, String category) {
|
||||
super(field, configuration, category, Property.Type.STRING);
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("Warning: float configuration properties are DEPRECATED! Use doubles instead!\n" +
|
||||
"Field name: " + field.getName() + ", location: " + field.getDeclaringClass().getName());
|
||||
primitive = field.getType().isPrimitive();
|
||||
|
||||
@@ -22,7 +22,7 @@ package com.falsepattern.lib.internal.impl.config.fields;
|
||||
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.event.ConfigValidationFailureEvent;
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.val;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class IntConfigField extends AConfigField<Integer> {
|
||||
defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultInt.class))
|
||||
.map(Config.DefaultInt::value)
|
||||
.orElseGet(() -> {
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("The field " + field.getName() + " in class " +
|
||||
field.getDeclaringClass().getName() +
|
||||
" has no DefaultInt annotation!\nThis will be a crash in FalsePatternLib 0.11, update your code!");
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ package com.falsepattern.lib.internal.impl.config.fields;
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.ConfigException;
|
||||
import com.falsepattern.lib.config.event.ConfigValidationFailureEvent;
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
import lombok.val;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
@@ -49,7 +49,7 @@ public class IntListConfigField extends AListConfigField<int[]> {
|
||||
defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultIntList.class))
|
||||
.map(Config.DefaultIntList::value)
|
||||
.orElseGet(() -> {
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("The field " + field.getName() + " in class " +
|
||||
field.getDeclaringClass().getName() +
|
||||
" has no DefaultIntList annotation!\nThis will be a crash in FalsePatternLib 0.11, update your code!");
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ package com.falsepattern.lib.internal.impl.config.fields;
|
||||
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.event.ConfigValidationFailureEvent;
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.val;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class StringConfigField extends AConfigField<String> {
|
||||
defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultString.class))
|
||||
.map(Config.DefaultString::value)
|
||||
.orElseGet(() -> {
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("The field " + field.getName() + " in class " +
|
||||
field.getDeclaringClass().getName() +
|
||||
" has no DefaultDouble annotation!\nThis will be a crash in FalsePatternLib 0.11, update your code!");
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ package com.falsepattern.lib.internal.impl.config.fields;
|
||||
|
||||
import com.falsepattern.lib.config.Config;
|
||||
import com.falsepattern.lib.config.ConfigException;
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
import lombok.val;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
@@ -49,7 +49,7 @@ public class StringListConfigField extends AListConfigField<String[]> {
|
||||
defaultValue = Optional.ofNullable(field.getAnnotation(Config.DefaultStringList.class))
|
||||
.map(Config.DefaultStringList::value)
|
||||
.orElseGet(() -> {
|
||||
FalsePatternLib.getLog()
|
||||
Share.LOG
|
||||
.warn("The field " + field.getName() + " in class " +
|
||||
field.getDeclaringClass().getName() +
|
||||
" has no DefaultStringList annotation!\nThis will be a crash in FalsePatternLib 0.11, update your code!");
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
package com.falsepattern.lib.internal.impl.config.net;
|
||||
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
@@ -40,7 +40,7 @@ public class SyncReplyHandler implements IMessageHandler<SyncReply, IMessage> {
|
||||
try {
|
||||
message.receive();
|
||||
} catch (IOException e) {
|
||||
FalsePatternLib.getLog().error("Failed to sync config", e);
|
||||
Share.LOG.error("Failed to sync config", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
package com.falsepattern.lib.internal.impl.config.net;
|
||||
|
||||
import com.falsepattern.lib.internal.FalsePatternLib;
|
||||
import com.falsepattern.lib.internal.Share;
|
||||
import lombok.val;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
@@ -45,7 +46,7 @@ public class SyncRequestHandler implements IMessageHandler<SyncRequest, IMessage
|
||||
FalsePatternLib.NETWORK.sendTo(reply, ctx.getServerHandler().playerEntity);
|
||||
return null;
|
||||
} catch (IOException e) {
|
||||
FalsePatternLib.getLog().error("Failed to sync config", e);
|
||||
Share.LOG.error("Failed to sync config", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user