Use suppress conversion config option for most warnings

This commit is contained in:
FlorianMichael 2024-04-16 22:13:06 +02:00
parent ff484e8f1c
commit eeb8ca5d8b
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
9 changed files with 42 additions and 13 deletions

View File

@ -103,7 +103,9 @@ public class Protocolc0_30toc0_30cpe extends StatelessProtocol<ClientboundPacket
if (extension != null) {
protocolMetadataStorage.addServerExtension(extension, extensionVersion);
} else {
ViaLegacy.getPlatform().getLogger().warning("Received unknown classic protocol extension: (" + extensionName + " v" + extensionVersion + ")");
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Received unknown classic protocol extension: (" + extensionName + " v" + extensionVersion + ")");
}
}
protocolMetadataStorage.incrementReceivedExtensions();

View File

@ -455,7 +455,9 @@ public class Protocol1_3_1_2to1_2_4_5 extends StatelessProtocol<ClientboundPacke
wrapper.user().get(ChestStateTracker.class).unload(chunk.getX(), chunk.getZ());
if (chunk.isFullChunk() && chunk.getBitmask() == 0) { // Remap to empty chunk
ViaLegacy.getPlatform().getLogger().warning("Received empty 1.2.5 chunk packet");
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Received empty 1.2.5 chunk packet");
}
chunk = ChunkUtil.createEmptyChunk(chunk.getX(), chunk.getZ());
if (dimension == Environment.NORMAL) {
ChunkUtil.setDummySkylight(chunk, true);

View File

@ -229,7 +229,9 @@ public class Protocol1_4_2to1_3_1_2 extends StatelessProtocol<ClientboundPackets
String newSound = SoundRewriter.map(oldSound);
if (oldSound.isEmpty()) newSound = "";
if (newSound == null) {
ViaLegacy.getPlatform().getLogger().warning("Unable to map 1.3.2 sound '" + oldSound + "'");
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Unable to map 1.3.2 sound '" + oldSound + "'");
}
newSound = "";
}
if (newSound.isEmpty()) {

View File

@ -252,7 +252,9 @@ public class Protocol1_6_1to1_5_2 extends StatelessProtocol<ClientboundPackets1_
String newSound = SoundRewriter.map(oldSound);
if (oldSound.isEmpty()) newSound = "";
if (newSound == null) {
ViaLegacy.getPlatform().getLogger().warning("Unable to map 1.5.2 sound '" + oldSound + "'");
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Unable to map 1.5.2 sound '" + oldSound + "'");
}
newSound = "";
}
if (newSound.isEmpty()) {

View File

@ -17,6 +17,7 @@
*/
package net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.metadata;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import net.raphimc.vialegacy.ViaLegacy;
@ -56,12 +57,16 @@ public class MetadataRewriter {
case Position:
break;
default:
ViaLegacy.getPlatform().getLogger().warning("1.5.2 MetaDataType: Unhandled Type: " + metaIndex.getNewType() + " " + entry);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("1.5.2 MetaDataType: Unhandled Type: " + metaIndex.getNewType() + " " + entry);
}
list.remove(entry);
break;
}
} catch (Throwable e) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error rewriting metadata entry for " + type.name() + ": " + entry, e);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error rewriting metadata entry for " + type.name() + ": " + entry, e);
}
list.remove(entry);
}
}

View File

@ -489,7 +489,9 @@ public class Protocol1_7_2_5to1_6_4 extends StatelessTransitionProtocol<Clientbo
String newSound = SoundRewriter.map(oldSound);
if (oldSound.isEmpty()) newSound = "";
if (newSound == null) {
ViaLegacy.getPlatform().getLogger().warning("Unable to map 1.6.4 sound '" + oldSound + "'");
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Unable to map 1.6.4 sound '" + oldSound + "'");
}
newSound = "";
}
if (newSound.isEmpty()) {

View File

@ -763,7 +763,9 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
Particle particle = Particle.find(parts[0]);
if (particle == null) {
particle = Particle.BARRIER;
ViaLegacy.getPlatform().getLogger().warning("Could not find 1.8 particle for " + Arrays.toString(parts));
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Could not find 1.8 particle for " + Arrays.toString(parts));
}
}
wrapper.write(Type.INT, particle.ordinal()); // particle id
wrapper.write(Type.BOOLEAN, false); // long distance
@ -1398,7 +1400,9 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
} else if (type == 1) {
wrapper.passthrough(Type.INT); // entity id
} else {
ViaLegacy.getPlatform().getLogger().warning("Unknown 1.8 command block type: " + type);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Unknown 1.8 command block type: " + type);
}
wrapper.cancel();
return;
}

View File

@ -17,6 +17,7 @@
*/
package net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.metadata;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
import com.viaversion.viaversion.api.minecraft.item.Item;
@ -43,7 +44,9 @@ public class MetadataRewriter {
final MetaIndex1_8to1_7_6 metaIndex = MetaIndex1_8to1_7_6.searchIndex(type, entry.id());
try {
if (metaIndex == null) {
ViaLegacy.getPlatform().getLogger().warning("Could not find valid metaindex entry for " + type.name() + ": " + entry);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Could not find valid metaindex entry for " + type.name() + ": " + entry);
}
list.remove(entry);
continue;
}
@ -103,12 +106,16 @@ public class MetadataRewriter {
case Rotation:
break;
default:
ViaLegacy.getPlatform().getLogger().warning("1.7.10 MetaDataType: Unhandled Type: " + metaIndex.getNewType() + " " + entry);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("1.7.10 MetaDataType: Unhandled Type: " + metaIndex.getNewType() + " " + entry);
}
list.remove(entry);
break;
}
} catch (Throwable e) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error rewriting metadata entry for " + type.name() + ": " + entry, e);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error rewriting metadata entry for " + type.name() + ": " + entry, e);
}
list.remove(entry);
}
}

View File

@ -18,6 +18,7 @@
package net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.rewriter;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.minecraft.item.DataItem;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.protocol.Protocol;
@ -470,7 +471,9 @@ public class ChatComponentRewriter {
c.getStyle().setHoverEvent(new TextHoverEvent(textHoverEvent.getAction(), new StringComponent(SNbtSerializer.V1_8.serialize(tag))));
} catch (Throwable e) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error remapping NBT in show_item:" + textHoverEvent.getText().asUnformattedString(), e);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error remapping NBT in show_item:" + textHoverEvent.getText().asUnformattedString(), e);
}
c.getStyle().setHoverEvent(new TextHoverEvent(textHoverEvent.getAction(), new StringComponent())); // Invalid item
}
}