Update Adventure-Legacy dependency (#996)

This commit is contained in:
Camotoy 2020-07-22 14:52:12 -04:00 committed by GitHub
parent b211b9da2e
commit ad9184ad13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 9 deletions

View File

@ -26,8 +26,6 @@
package org.geysermc.connector.network.translators.inventory;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.mc.protocol.data.message.MessageSerializer;
import com.github.steveice10.mc.protocol.data.message.TextMessage;
import com.github.steveice10.mc.protocol.packet.ingame.client.window.ClientRenameItemPacket;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.nukkitx.nbt.NbtMap;
@ -111,7 +109,7 @@ public class AnvilInventoryTranslator extends BlockInventoryTranslator {
if (tag != null) {
String name = tag.getCompound("display").getString("Name");
Component component = GsonComponentSerializer.gson().deserialize(name);
rename = LegacyComponentSerializer.legacy().serialize(component);
rename = LegacyComponentSerializer.legacySection().serialize(component);
} else {
rename = "";
}
@ -144,7 +142,7 @@ public class AnvilInventoryTranslator extends BlockInventoryTranslator {
if (displayTag != null && displayTag.contains("Name")) {
String itemName = displayTag.get("Name").getValue().toString();
Component component = GsonComponentSerializer.gson().deserialize(itemName);
rename = LegacyComponentSerializer.legacy().serialize(component);
rename = LegacyComponentSerializer.legacySection().serialize(component);
} else {
rename = "";
}

View File

@ -162,7 +162,7 @@ public abstract class ItemTranslator {
// If its not a message convert it
if (!MessageUtils.isMessage(name)) {
TextComponent component = LegacyComponentSerializer.legacy().deserialize(name);
TextComponent component = LegacyComponentSerializer.legacySection().deserialize(name);
name = GsonComponentSerializer.gson().serialize(component);
}

View File

@ -108,8 +108,8 @@ public class BasicItemTranslator extends NbtItemStackTranslator {
String message = tag.getValue();
if (message == null) return null;
TextComponent component = (TextComponent) MessageUtils.phraseJavaMessage(message);
String legacy = LegacyComponentSerializer.legacy().serialize(component);
if (hasFormatting(LegacyComponentSerializer.legacy().deserialize(legacy))) {
String legacy = LegacyComponentSerializer.legacySection().serialize(component);
if (hasFormatting(LegacyComponentSerializer.legacySection().deserialize(legacy))) {
return "§r" + legacy;
}
return legacy;

View File

@ -259,7 +259,7 @@ public class MessageUtils {
public static String getBedrockMessage(String message) {
Component component = phraseJavaMessage(message);
return LegacyComponentSerializer.legacy().serialize(component);
return LegacyComponentSerializer.legacySection().serialize(component);
}
public static Component phraseJavaMessage(String message) {
@ -267,7 +267,7 @@ public class MessageUtils {
}
public static String getJavaMessage(String message) {
Component component = LegacyComponentSerializer.legacy().deserialize(message);
Component component = LegacyComponentSerializer.legacySection().deserialize(message);
return GsonComponentSerializer.gson().serialize(component);
}