Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 00:00:41 +01:00
JavaOpenWindowTranslator: Use MessageUtils for inventory name (#1416)
* JavaOpenWindowTranslator: Use MessageUtils for inventory name * Remove important messaging
Dieser Commit ist enthalten in:
Ursprung
64f2233581
Commit
ae70dbeece
@ -25,11 +25,9 @@
|
|||||||
|
|
||||||
package org.geysermc.connector.network.translators.java.window;
|
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.client.window.ClientCloseWindowPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.window.ServerOpenWindowPacket;
|
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.inventory.Inventory;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
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.network.translators.inventory.InventoryTranslator;
|
||||||
import org.geysermc.connector.utils.InventoryUtils;
|
import org.geysermc.connector.utils.InventoryUtils;
|
||||||
import org.geysermc.connector.utils.LocaleUtils;
|
import org.geysermc.connector.utils.LocaleUtils;
|
||||||
|
import org.geysermc.connector.utils.MessageUtils;
|
||||||
|
|
||||||
@Translator(packet = ServerOpenWindowPacket.class)
|
@Translator(packet = ServerOpenWindowPacket.class)
|
||||||
public class JavaOpenWindowTranslator extends PacketTranslator<ServerOpenWindowPacket> {
|
public class JavaOpenWindowTranslator extends PacketTranslator<ServerOpenWindowPacket> {
|
||||||
@ -58,18 +57,8 @@ public class JavaOpenWindowTranslator extends PacketTranslator<ServerOpenWindowP
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = packet.getName();
|
String name = MessageUtils.getTranslatedBedrockMessage(MessageSerializer.fromString(packet.getName()),
|
||||||
try {
|
session.getClientData().getLanguageCode());
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
name = LocaleUtils.getLocaleString(name, session.getClientData().getLanguageCode());
|
name = LocaleUtils.getLocaleString(name, session.getClientData().getLanguageCode());
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren