Nameable Banner API

This commit is contained in:
Owen1212055
2022-04-07 17:49:25 -04:00
parent 24d356944c
commit 1f68916ac9
2 changed files with 31 additions and 1 deletions

View File

@@ -112,4 +112,26 @@ public class CraftBanner extends CraftBlockEntityState<BannerBlockEntity> implem
public CraftBanner copy(Location location) {
return new CraftBanner(this, location);
}
// Paper start
@Override
public net.kyori.adventure.text.Component customName() {
return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getSnapshot().getCustomName());
}
@Override
public void customName(net.kyori.adventure.text.Component customName) {
this.getSnapshot().name = io.papermc.paper.adventure.PaperAdventure.asVanilla(customName);
}
@Override
public String getCustomName() {
return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serializeOrNull(this.customName());
}
@Override
public void setCustomName(String name) {
this.customName(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserializeOrNull(name));
}
// Paper end
}