diff --git a/README.md b/README.md
index 1c78253..2bcfe6a 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,8 @@ The configuration files can be found in your `plugins/SFAdvancements/` folder.
Each item in the yml represents an advancement group, where the key is the key of the group.
The key is used to refer to the group in `advancements.yml`.
Each group has a `display`, which is an item. It should be an item representation.
+You can optionally specify a `frame_type` for the frame type surrounding the display item in the vanilla GUI. (By default, groups will have a Goal frame type)
+The valid types for a frame are `GOAL`, `TASK`, and `CHALLENGER`
The item is used to display the group in the GUI.
You can optionally specify a `background` string for the group, which is used in the vanilla GUI. (By default, groups will have a bedrock texture)
It should be the name of a block texture file. These files can be found on https://mcasset.cloud/ in `assets/minecraft/textures/block/` for the specified version.
@@ -32,6 +34,7 @@ Examples of #1 in `groups.yml`
my_cool_group:
display: NETHER_STAR
background: glass
+ frame_type: CHALLENGER
my_other_group:
display: ELECTRIC_MOTOR
@@ -83,8 +86,8 @@ The group is the id defined in `groups.yml`.
The parent is the id of a different Advancement for this to be under. (For Advancement Trees)
The display is an item, represented as described in Item Representation. This is the item that is displayed in both the
-SFA GUI and the vanilla GUI. You can specify a placeholder line `%criteria%` in the lore, which will be replaced with the
-criteria of the advancement.
+SFA GUI and the vanilla GUI. You can specify a frame type that will appear in the vanilla gui. (GOAL, TASK, CHALLENGER).
+You can specify a placeholder line `%criteria%` in the lore, which will be replaced with the criteria of the advancement.
The name is what will appear in chat when someone completes the advancement.
diff --git a/pom.xml b/pom.xml
index 4227b5a..dce26a3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -147,7 +147,7 @@
com.github.Slimefun
Slimefun4
- b646e15974
+ RC-36
provided
@@ -195,7 +195,7 @@
com.github.baked-libs.dough
dough-api
- a6519e666c
+ 1108163a49
compile
diff --git a/src/main/java/me/char321/sfadvancements/SFAdvancements.java b/src/main/java/me/char321/sfadvancements/SFAdvancements.java
index f8247a0..421941e 100644
--- a/src/main/java/me/char321/sfadvancements/SFAdvancements.java
+++ b/src/main/java/me/char321/sfadvancements/SFAdvancements.java
@@ -152,7 +152,8 @@ public void loadGroups() {
for (String key : groupConfig.getKeys(false)) {
String background = groupConfig.getString(key + ".background", "BEDROCK");
ItemStack display = ConfigUtils.getItem(groupConfig, key + ".display");
- AdvancementGroup group = new AdvancementGroup(key, display, background);
+ String frameType = groupConfig.getString(key + ".frame_type", "GOAL");
+ AdvancementGroup group = new AdvancementGroup(key, display, frameType, background);
group.register();
}
}
diff --git a/src/main/java/me/char321/sfadvancements/api/Advancement.java b/src/main/java/me/char321/sfadvancements/api/Advancement.java
index 9981a25..0b74fbc 100644
--- a/src/main/java/me/char321/sfadvancements/api/Advancement.java
+++ b/src/main/java/me/char321/sfadvancements/api/Advancement.java
@@ -27,12 +27,17 @@ public class Advancement {
private final NamespacedKey parent;
private final AdvancementGroup group;
private final ItemStack display;
+ private final String frameType;
private final String name;
private final boolean hidden;
private final Criterion[] criteria;
private final Reward[] rewards;
public Advancement(NamespacedKey key, @Nullable NamespacedKey parent, AdvancementGroup group, ItemStack display, String name, boolean hidden, Criterion[] criteria, Reward[] rewards) {
+ this(key, parent, group, display, "GOAL", name, hidden, criteria, rewards);
+ }
+
+ public Advancement(NamespacedKey key, @Nullable NamespacedKey parent, AdvancementGroup group, ItemStack display, String frameType, String name, boolean hidden, Criterion[] criteria, Reward[] rewards) {
this.key = key;
if (parent == null) {
parent = Utils.keyOf(group.getId());
@@ -40,6 +45,7 @@ public Advancement(NamespacedKey key, @Nullable NamespacedKey parent, Advancemen
this.parent = parent;
this.group = group;
this.display = display;
+ this.frameType = frameType;
this.name = ChatColor.translateAlternateColorCodes('&', name);
this.hidden = hidden;
this.criteria = criteria;
@@ -62,6 +68,10 @@ public ItemStack getDisplay() {
return display;
}
+ public String getFrameType() {
+ return frameType;
+ }
+
public String getName() {
return name;
}
diff --git a/src/main/java/me/char321/sfadvancements/api/AdvancementBuilder.java b/src/main/java/me/char321/sfadvancements/api/AdvancementBuilder.java
index 3eb8d83..9656913 100644
--- a/src/main/java/me/char321/sfadvancements/api/AdvancementBuilder.java
+++ b/src/main/java/me/char321/sfadvancements/api/AdvancementBuilder.java
@@ -20,6 +20,7 @@ public class AdvancementBuilder {
private NamespacedKey parent;
private AdvancementGroup group;
private ItemStack display;
+ private String frame;
private String name;
private boolean hidden;
private List criteria = new ArrayList<>();
@@ -52,6 +53,12 @@ public static AdvancementBuilder loadFromConfig(String key, ConfigurationSection
}
builder.display(display);
+ String frame = config.getString("frame_type");
+ if (frame == null) {
+ frame = "GOAL";
+ }
+ builder.frame(frame);
+
String advname = config.getString("name");
if (advname == null) {
advname = key;
@@ -136,6 +143,11 @@ public AdvancementBuilder display(ItemStack display) {
return this;
}
+ public AdvancementBuilder frame(String frame) {
+ this.frame = frame;
+ return this;
+ }
+
public AdvancementBuilder name(String name) {
this.name = name;
return this;
@@ -161,7 +173,7 @@ public void register() {
criterion.setAdvancement(key);
criterion.register();
}
- Advancement adv = new Advancement(key, parent, group, display, name, hidden, criteria.toArray(new Criterion[0]), rewards.toArray(new Reward[0]));
+ Advancement adv = new Advancement(key, parent, group, display, name, frame, hidden, criteria.toArray(new Criterion[0]), rewards.toArray(new Reward[0]));
adv.register();
}
diff --git a/src/main/java/me/char321/sfadvancements/api/AdvancementGroup.java b/src/main/java/me/char321/sfadvancements/api/AdvancementGroup.java
index d56d577..5f0884f 100644
--- a/src/main/java/me/char321/sfadvancements/api/AdvancementGroup.java
+++ b/src/main/java/me/char321/sfadvancements/api/AdvancementGroup.java
@@ -11,6 +11,7 @@
public class AdvancementGroup {
private final ItemStack display;
+ private final String frameType;
private List advancements = new ArrayList<>();
private String id;
private String background;
@@ -20,9 +21,14 @@ public AdvancementGroup(String id, ItemStack display) {
}
public AdvancementGroup(String id, ItemStack display, String background) {
+ this(id, display, "GOAL", background);
+ }
+
+ public AdvancementGroup(String id, ItemStack display, String frameType, String background) {
this.id = id;
this.background = background;
this.display = display;
+ this.frameType = frameType;
}
public void register() {
@@ -33,6 +39,10 @@ public ItemStack getDisplayItem() {
return display;
}
+ public String getFrameType() {
+ return frameType;
+ }
+
/**
* gets an immutable view of the advancements
* @return list of all advancements in this group
diff --git a/src/main/java/me/char321/sfadvancements/vanilla/VanillaHook.java b/src/main/java/me/char321/sfadvancements/vanilla/VanillaHook.java
index f014082..af78d2f 100644
--- a/src/main/java/me/char321/sfadvancements/vanilla/VanillaHook.java
+++ b/src/main/java/me/char321/sfadvancements/vanilla/VanillaHook.java
@@ -8,6 +8,7 @@
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import net.roxeez.advancement.AdvancementManager;
+import net.roxeez.advancement.display.FrameType;
import net.roxeez.advancement.display.Icon;
import net.roxeez.advancement.trigger.TriggerType;
import org.bukkit.Bukkit;
@@ -67,6 +68,7 @@ private static void registerGroups(AdvancementManager manager) {
}
display.setDescription(String.join("\n", lore));
display.setIcon(new Icon(item));
+ display.setFrame(FrameType.valueOf(group.getFrameType()));
display.setBackground(NamespacedKey.minecraft("textures/block/" + background.toLowerCase() + ".png"));
display.setAnnounce(false);
});
@@ -116,6 +118,7 @@ private static void registerAdvancement(AdvancementManager manager, Advancement
display.setTitle(title);
display.setDescription(description);
display.setIcon(new Icon(item));
+ display.setFrame(FrameType.valueOf(advancement.getFrameType()));
display.setHidden(advancement.isHidden());
display.setAnnounce(false);
});
diff --git a/src/main/resources/advancements.yml b/src/main/resources/advancements.yml
index 31b3e61..df9884b 100644
--- a/src/main/resources/advancements.yml
+++ b/src/main/resources/advancements.yml
@@ -5,6 +5,7 @@ portable_workbench:
name: "&aPortable Crafting"
lore:
- "Use a portable crafting table"
+ frame_type: GOAL
name: "&a[Portable Crafting]"
criteria:
interact:
@@ -24,6 +25,7 @@ dust:
name: "&aInto dust it turns"
lore:
- "Crush an ore using an ore crusher"
+ frame_type: TASK
name: "&a[Into dust it turns]"
criteria:
inventory:
@@ -136,6 +138,7 @@ carbonado:
name: "&aShiny darkness"
lore:
- "Create a carbonado diamond"
+ frame_type: CHALLENGER
name: "&a[Shiny darkness]"
criteria:
carbonado: