mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
JavaOpenWindowTranslator: Use MessageUtils for inventory name (#1416)
* JavaOpenWindowTranslator: Use MessageUtils for inventory name * Remove important messaging
This commit is contained in:
parent
64f2233581
commit
ae70dbeece
1 changed files with 4 additions and 15 deletions
|
@ -25,11 +25,9 @@
|
|||
|
||||
package org.geysermc.connector.network.translators.java.window;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.message.MessageSerializer;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientCloseWindowPacket;
|
||||
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerOpenWindowPacket;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import org.geysermc.connector.GeyserConnector;
|
||||
import org.geysermc.connector.inventory.Inventory;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
|
@ -37,6 +35,7 @@ import org.geysermc.connector.network.translators.Translator;
|
|||
import org.geysermc.connector.network.translators.inventory.InventoryTranslator;
|
||||
import org.geysermc.connector.utils.InventoryUtils;
|
||||
import org.geysermc.connector.utils.LocaleUtils;
|
||||
import org.geysermc.connector.utils.MessageUtils;
|
||||
|
||||
@Translator(packet = ServerOpenWindowPacket.class)
|
||||
public class JavaOpenWindowTranslator extends PacketTranslator<ServerOpenWindowPacket> {
|
||||
|
@ -58,18 +57,8 @@ public class JavaOpenWindowTranslator extends PacketTranslator<ServerOpenWindowP
|
|||
return;
|
||||
}
|
||||
|
||||
String name = packet.getName();
|
||||
try {
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonObject jsonObject = parser.parse(packet.getName()).getAsJsonObject();
|
||||
if (jsonObject.has("text")) {
|
||||
name = jsonObject.get("text").getAsString();
|
||||
} else if (jsonObject.has("translate")) {
|
||||
name = jsonObject.get("translate").getAsString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
GeyserConnector.getInstance().getLogger().debug("JavaOpenWindowTranslator: " + e.toString());
|
||||
}
|
||||
String name = MessageUtils.getTranslatedBedrockMessage(MessageSerializer.fromString(packet.getName()),
|
||||
session.getClientData().getLanguageCode());
|
||||
|
||||
name = LocaleUtils.getLocaleString(name, session.getClientData().getLanguageCode());
|
||||
|
||||
|
|
Loading…
Reference in a new issue