Merge pull request #169 from Gerrygames/abstraction

use isSuppressConversionWarnings
This commit is contained in:
Myles 2019-12-09 11:24:18 +00:00 committed by GitHub
commit 449d45da9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 12 deletions

View File

@ -46,7 +46,7 @@ public class VBMappingDataLoader {
diffValue = diffIdentifiers.getAsJsonPrimitive(key.substring(0, key.indexOf('[')));
}
if (diffValue == null) {
if (warnOnMissing && !Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
if (warnOnMissing && !Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("No diff key for " + entry.getValue() + " :( ");
}
continue;
@ -54,7 +54,7 @@ public class VBMappingDataLoader {
value = MappingDataLoader.findValue(newIdentifiers, diffValue.getAsString());
}
if (value == null) {
if (warnOnMissing && !Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
if (warnOnMissing && !Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("No key for " + entry.getValue() + " :( ");
}
continue;
@ -75,7 +75,7 @@ public class VBMappingDataLoader {
if (diffIdentifiers != null) {
JsonPrimitive diffValue = diffIdentifiers.getAsJsonPrimitive(key);
if (diffValue == null) {
if (warnOnMissing && !Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
if (warnOnMissing && !Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("No diff key for " + key + " :( ");
}
continue;
@ -86,7 +86,7 @@ public class VBMappingDataLoader {
index = MappingDataLoader.findIndex(newIdentifiers, mappedName);
}
if (index == null) {
if (warnOnMissing && !Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
if (warnOnMissing && !Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("No key for " + key + " :( ");
}
continue;

View File

@ -69,7 +69,7 @@ public class BackwardsMappings {
}
}
if (value == null) {
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
if (replacement != null) {
ViaBackwards.getPlatform().getLogger().warning("No key for " + entry.getValue() + "/" + replacement.getAsString() + " :( ");
} else {

View File

@ -651,7 +651,7 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
}
if (rawId == null) {
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("Failed to get 1.12 item for " + item.getIdentifier());
}
rawId = 0x10000; // Stone
@ -975,7 +975,7 @@ public class BlockItemPackets1_13 extends BlockItemRewriter<Protocol1_12_2To1_13
} else if (MappingData.oldToNewItems.containsKey(rawId & ~0xF)) {
rawId &= ~0xF; // Remove data
} else {
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("Failed to get 1.13 item for " + item.getIdentifier());
}
rawId = 16; // Stone

View File

@ -85,7 +85,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
} else {
String oldChannel = InventoryPackets.getOldPluginChannelId(channel);
if (oldChannel == null) {
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("Ignoring outgoing plugin message with channel: " + channel);
}
wrapper.cancel();
@ -100,7 +100,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
String rewritten = InventoryPackets.getOldPluginChannelId(channels[i]);
if (rewritten != null) {
rewrittenChannels.add(rewritten);
} else if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("Ignoring plugin channel in outgoing REGISTER: " + channels[i]);
}
}
@ -449,7 +449,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
} else {
String newChannel = InventoryPackets.getNewPluginChannelId(channel);
if (newChannel == null) {
if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("Ignoring incoming plugin message with channel: " + channel);
}
wrapper.cancel();
@ -464,7 +464,7 @@ public class PlayerPacket1_13 extends Rewriter<Protocol1_12_2To1_13> {
String rewritten = InventoryPackets.getNewPluginChannelId(channels[i]);
if (rewritten != null) {
rewrittenChannels.add(rewritten);
} else if (!Via.getConfig().isSuppress1_13ConversionErrors() || Via.getManager().isDebug()) {
} else if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaBackwards.getPlatform().getLogger().warning("Ignoring plugin channel in incoming REGISTER: " + channels[i]);
}
}

View File

@ -30,7 +30,7 @@ public class SoundPackets1_13 extends Rewriter<Protocol1_12_2To1_13> {
String oldSound = NamedSoundMapping.getOldId(newSound);
if (oldSound != null) {
wrapper.set(Type.STRING, 0, oldSound);
} else if (!Via.getConfig().isSuppress1_13ConversionErrors()) {
} else if (!Via.getConfig().isSuppressConversionWarnings()) {
ViaBackwards.getPlatform().getLogger().warning("Unknown named sound in 1.13->1.12 protocol: " + newSound);
}
}