diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java b/paper-server/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java index d6b17e3645..2d3642b1fa 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java @@ -4,6 +4,7 @@ import java.util.Collection; import java.util.Collections; import net.minecraft.advancements.Advancement; import org.bukkit.NamespacedKey; +import org.bukkit.advancement.AdvancementDisplay; import org.bukkit.craftbukkit.util.CraftNamespacedKey; public class CraftAdvancement implements org.bukkit.advancement.Advancement { @@ -27,4 +28,13 @@ public class CraftAdvancement implements org.bukkit.advancement.Advancement { public Collection getCriteria() { return Collections.unmodifiableCollection(handle.getCriteria().keySet()); } + + @Override + public AdvancementDisplay getDisplay() { + if (handle.getDisplay() == null) { + return null; + } + + return new CraftAdvancementDisplay(handle.getDisplay()); + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancementDisplay.java b/paper-server/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancementDisplay.java new file mode 100644 index 0000000000..f597f1caa2 --- /dev/null +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancementDisplay.java @@ -0,0 +1,65 @@ +package org.bukkit.craftbukkit.advancement; + +import net.minecraft.advancements.AdvancementDisplay; +import org.bukkit.advancement.AdvancementDisplayType; +import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.craftbukkit.util.CraftChatMessage; +import org.bukkit.inventory.ItemStack; + +public class CraftAdvancementDisplay implements org.bukkit.advancement.AdvancementDisplay { + + private final AdvancementDisplay handle; + + public CraftAdvancementDisplay(AdvancementDisplay handle) { + this.handle = handle; + } + + public AdvancementDisplay getHandle() { + return handle; + } + + @Override + public String getTitle() { + return CraftChatMessage.fromComponent(handle.getTitle()); + } + + @Override + public String getDescription() { + return CraftChatMessage.fromComponent(handle.getDescription()); + } + + @Override + public ItemStack getIcon() { + return CraftItemStack.asBukkitCopy(handle.getIcon()); + } + + @Override + public boolean shouldShowToast() { + return handle.shouldShowToast(); + } + + @Override + public boolean shouldAnnounceChat() { + return handle.shouldAnnounceChat(); + } + + @Override + public boolean isHidden() { + return handle.isHidden(); + } + + @Override + public float getX() { + return handle.getX(); + } + + @Override + public float getY() { + return handle.getY(); + } + + @Override + public AdvancementDisplayType getType() { + return AdvancementDisplayType.values()[handle.getFrame().ordinal()]; + } +}