mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-12-29 15:49:09 +01:00
Remove usage of translation strings for code-related errors
These should never ever be seen by a normal user, and if so, developers need to see the proper error message
This commit is contained in:
parent
c29a1ab3af
commit
fc4f2b7890
5 changed files with 16 additions and 10 deletions
|
@ -68,10 +68,10 @@ public class PacketTranslatorRegistry<T> {
|
|||
|
||||
BEDROCK_TRANSLATOR.translators.put(targetPacket, translator);
|
||||
} else {
|
||||
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.invalid_target", clazz.getCanonicalName()));
|
||||
GeyserConnector.getInstance().getLogger().error("Class " + clazz.getCanonicalName() + " is annotated as a translator but has an invalid target packet.");
|
||||
}
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.failed", clazz.getCanonicalName()));
|
||||
GeyserConnector.getInstance().getLogger().error("Could not instantiate annotated translator " + clazz.getCanonicalName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.geysermc.connector.network.session.GeyserSession;
|
|||
import org.geysermc.connector.network.translators.ItemRemapper;
|
||||
import org.geysermc.connector.network.translators.chat.MessageTranslator;
|
||||
import org.geysermc.connector.utils.FileUtils;
|
||||
import org.geysermc.connector.utils.LanguageUtils;
|
||||
import org.geysermc.connector.utils.LocaleUtils;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
|
@ -78,13 +77,15 @@ public abstract class ItemTranslator {
|
|||
for (ItemEntry item : appliedItems) {
|
||||
ItemTranslator registered = ITEM_STACK_TRANSLATORS.get(item.getJavaId());
|
||||
if (registered != null) {
|
||||
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.item.already_registered", clazz.getCanonicalName(), registered.getClass().getCanonicalName(), item.getJavaIdentifier()));
|
||||
GeyserConnector.getInstance().getLogger().error("Could not instantiate annotated item translator " +
|
||||
clazz.getCanonicalName() + ". Item translator " + registered.getClass().getCanonicalName() +
|
||||
" is already registered for the item " + item.getJavaIdentifier());
|
||||
continue;
|
||||
}
|
||||
ITEM_STACK_TRANSLATORS.put(item.getJavaId(), itemStackTranslator);
|
||||
}
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.item.failed", clazz.getCanonicalName()));
|
||||
GeyserConnector.getInstance().getLogger().error("Could not instantiate annotated item translator " + clazz.getCanonicalName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -151,6 +151,13 @@ public abstract class BlockTranslator {
|
|||
builder.pickItem(pickItemNode.textValue());
|
||||
}
|
||||
|
||||
boolean waterlogged = entry.getKey().contains("waterlogged=true")
|
||||
|| javaId.contains("minecraft:bubble_column") || javaId.contains("minecraft:kelp") || javaId.contains("seagrass");
|
||||
|
||||
if (waterlogged) {
|
||||
WATERLOGGED.add(javaRuntimeId);
|
||||
}
|
||||
|
||||
JAVA_ID_BLOCK_MAP.put(javaId, javaRuntimeId);
|
||||
|
||||
BlockStateValues.storeBlockStateValues(entry.getKey(), javaRuntimeId, entry.getValue());
|
||||
|
@ -286,7 +293,6 @@ public abstract class BlockTranslator {
|
|||
|
||||
if (waterlogged) {
|
||||
bedrockToJavaBlockMap.putIfAbsent(bedrockRuntimeId | 1 << 31, javaRuntimeId);
|
||||
WATERLOGGED.add(javaRuntimeId);
|
||||
} else {
|
||||
bedrockToJavaBlockMap.putIfAbsent(bedrockRuntimeId, javaRuntimeId);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
|||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.utils.BlockEntityUtils;
|
||||
import org.geysermc.connector.utils.FileUtils;
|
||||
import org.geysermc.connector.utils.LanguageUtils;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -80,7 +79,7 @@ public abstract class BlockEntityTranslator {
|
|||
try {
|
||||
BLOCK_ENTITY_TRANSLATORS.put(clazz.getAnnotation(BlockEntity.class).name(), (BlockEntityTranslator) clazz.newInstance());
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.block_entity.failed", clazz.getCanonicalName()));
|
||||
GeyserConnector.getInstance().getLogger().error("Could not instantiate annotated block entity" + clazz.getCanonicalName());
|
||||
}
|
||||
}
|
||||
for (Class<?> clazz : ref.getSubTypesOf(BedrockOnlyBlockEntity.class)) {
|
||||
|
@ -90,7 +89,7 @@ public abstract class BlockEntityTranslator {
|
|||
BedrockOnlyBlockEntity bedrockOnlyBlockEntity = (BedrockOnlyBlockEntity) clazz.newInstance();
|
||||
BEDROCK_ONLY_BLOCK_ENTITIES.add(bedrockOnlyBlockEntity);
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.block_state.failed", clazz.getCanonicalName()));
|
||||
GeyserConnector.getInstance().getLogger().error("Could not instantiate annotated block state " + clazz.getCanonicalName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e1e8fd6c2b8abf366e60085c23a55a2c943806ae
|
||||
Subproject commit bf4bf0554bd9705f33fe4ccf4aab0ec0075350d4
|
Loading…
Reference in a new issue