Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-04 23:30:24 +01:00
Log the error by default, instead check suppression config
Dieser Commit ist enthalten in:
Ursprung
01f28a052c
Commit
1c6f8426f1
@ -23,9 +23,11 @@
|
||||
package com.viaversion.viaversion.api.debug;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.viaversion.viaversion.api.Via;
|
||||
import com.viaversion.viaversion.api.protocol.packet.Direction;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@Beta
|
||||
public interface DebugHandler {
|
||||
@ -102,4 +104,16 @@ public interface DebugHandler {
|
||||
addPacketTypeToLog(packetType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an error if debug mode is enabled or error suppression is disabled.
|
||||
*
|
||||
* @param error error message
|
||||
* @param t thrown exception
|
||||
*/
|
||||
default void error(final String error, final Throwable t) {
|
||||
if (!Via.getConfig().isSuppressConversionWarnings() || enabled()) {
|
||||
Via.getPlatform().getLogger().log(Level.SEVERE, error, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,9 +165,7 @@ public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter<Clientboun
|
||||
final JsonElement updatedComponent = ComponentUtil.convertJson(stringTag.getValue(), ComponentUtil.SerializerVersion.V1_19_4, ComponentUtil.SerializerVersion.V1_20_3);
|
||||
stringTag.setValue(updatedComponent.toString());
|
||||
} catch (final Exception e) {
|
||||
if (Via.getManager().isDebug()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Via.getManager().debugHandler().error("Error during book conversion", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren