Commits
Nothixal authored and md_5 committed 066a74e744a
1 1 | package org.bukkit.craftbukkit.advancement; |
2 2 | |
3 3 | import java.util.Collection; |
4 4 | import java.util.Collections; |
5 5 | import net.minecraft.advancements.AdvancementHolder; |
6 6 | import org.bukkit.NamespacedKey; |
7 7 | import org.bukkit.advancement.AdvancementDisplay; |
8 + | import org.bukkit.advancement.AdvancementRequirements; |
8 9 | import org.bukkit.craftbukkit.util.CraftNamespacedKey; |
9 10 | |
10 11 | public class CraftAdvancement implements org.bukkit.advancement.Advancement { |
11 12 | |
12 13 | private final AdvancementHolder handle; |
13 14 | |
14 15 | public CraftAdvancement(AdvancementHolder handle) { |
15 16 | this.handle = handle; |
16 17 | } |
17 18 | |
22 23 | |
23 24 | public NamespacedKey getKey() { |
24 25 | return CraftNamespacedKey.fromMinecraft(handle.id()); |
25 26 | } |
26 27 | |
27 28 | |
28 29 | public Collection<String> getCriteria() { |
29 30 | return Collections.unmodifiableCollection(handle.value().criteria().keySet()); |
30 31 | } |
31 32 | |
33 + | |
34 + | public AdvancementRequirements getRequirements() { |
35 + | return new CraftAdvancementRequirements(handle.value().requirements()); |
36 + | } |
37 + | |
32 38 | |
33 39 | public AdvancementDisplay getDisplay() { |
34 40 | if (handle.value().display().isEmpty()) { |
35 41 | return null; |
36 42 | } |
37 43 | |
38 44 | return new CraftAdvancementDisplay(handle.value().display().get()); |
39 45 | } |
40 46 | } |