13
0
geforkt von Mirrors/Paper

#1050: Expose more information about advancements

By: MartenM <marten.struijk@gmail.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2022-06-05 16:23:50 +10:00
Ursprung 462a5fddbf
Commit ed74e7e047
2 geänderte Dateien mit 75 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -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<String> getCriteria() {
return Collections.unmodifiableCollection(handle.getCriteria().keySet());
}
@Override
public AdvancementDisplay getDisplay() {
if (handle.getDisplay() == null) {
return null;
}
return new CraftAdvancementDisplay(handle.getDisplay());
}
}

Datei anzeigen

@ -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()];
}
}