Made the book more configurable
This commit is contained in:
parent
c0cb9cae98
commit
696bc20c7e
|
|
@ -24,13 +24,13 @@ public final class Config extends AbstractConfig {
|
|||
public static List<String> QUEST_PAGES = List.of("""
|
||||
<bold><gold>Hey <player></gold></bold>
|
||||
|
||||
Here is a quick summary of your quest progress so far!
|
||||
Active quest summary:
|
||||
* Quest: <quest>
|
||||
* Variant: <variant>
|
||||
* Items obtained: <step_1_progress>/<step_1_total>
|
||||
* Items turned in: <step_2_progress>/<step_2_total>
|
||||
* Type: <variant>
|
||||
* <step_1>: <step_1_progress>/<step_1_total>
|
||||
* <step_2>: <step_2_progress>/<step_2_total>
|
||||
|
||||
<click:run_command:/aquest turnin><gold>Click here to turn in more items</gold></click>
|
||||
<click:run_command:/aquest turnin><turn_in_text></click>
|
||||
""");
|
||||
private static void loadBook() {
|
||||
QUEST_BOOK_AUTHOR = config.getString("book.author", QUEST_BOOK_AUTHOR);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.alttd.altitudequests.config;;
|
||||
|
||||
import com.alttd.altitudequests.objects.quests.CollectDropsQuest;
|
||||
import com.alttd.altitudequests.objects.variants.BreedMobsQuestObject;
|
||||
import com.alttd.altitudequests.objects.variants.CollectDropsQuestObject;
|
||||
import com.alttd.altitudequests.objects.variants.KillMobsQuestObject;
|
||||
|
|
@ -29,7 +28,10 @@ public class QuestsConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
public static List<MineQuestObject> MINE_QUESTS = new ArrayList<>();
|
||||
public static String MINE_QUEST_NAME = "<green>Mine quest</green>";
|
||||
public static String MINE_QUEST_NAME = "<green>Mining</green>";
|
||||
public static String MINE_STEP_1 = "Mined";
|
||||
public static String MINE_STEP_2 = "Turned in";
|
||||
public static String MINE_TURN_IN = "<gold>Click here to turn in your <block></gold>";
|
||||
|
||||
private static void loadMineQuests() {
|
||||
MINE_QUESTS.clear();
|
||||
|
|
@ -54,10 +56,16 @@ public class QuestsConfig extends AbstractConfig {
|
|||
}
|
||||
}
|
||||
MINE_QUEST_NAME = config.getString("mining.name", MINE_QUEST_NAME);
|
||||
MINE_STEP_1 = config.getString("mining.step-1", MINE_STEP_1);
|
||||
MINE_STEP_2 = config.getString("mining.step-2", MINE_STEP_2);
|
||||
MINE_TURN_IN = config.getString("mining.turn-in", MINE_TURN_IN);
|
||||
}
|
||||
|
||||
public static List<KillMobsQuestObject> KILL_MOB_QUEST = new ArrayList<>();
|
||||
public static String KILL_MOB_QUEST_NAME = "<green>Kill mobs quest</green>";
|
||||
public static String KILL_MOB_QUEST_NAME = "<green>Kill mobs</green>";
|
||||
public static String KILL_MOB_STEP_1 = "Killed";
|
||||
public static String KILL_MOB_STEP_2 = "Confirmed";
|
||||
public static String KILL_MOB_TURN_IN = "<gold>Click here to confirm the killed <mob>s</gold>";
|
||||
private static void loadKillMobQuests() {
|
||||
KILL_MOB_QUEST.clear();
|
||||
ConfigurationSection configurationSection = config.getConfigurationSection("kill_mobs.possible_tasks");
|
||||
|
|
@ -81,10 +89,16 @@ public class QuestsConfig extends AbstractConfig {
|
|||
}
|
||||
}
|
||||
KILL_MOB_QUEST_NAME = config.getString("kill_mobs.name", KILL_MOB_QUEST_NAME);
|
||||
KILL_MOB_STEP_1 = config.getString("kill_mobs.step-1", KILL_MOB_STEP_1);
|
||||
KILL_MOB_STEP_2 = config.getString("kill_mobs.step-2", KILL_MOB_STEP_2);
|
||||
KILL_MOB_TURN_IN = config.getString("kill_mobs.turn-in", KILL_MOB_TURN_IN);
|
||||
}
|
||||
|
||||
public static List<CollectDropsQuestObject> COLLECT_DROPS_QUEST = new ArrayList<>();
|
||||
public static String COLLECT_DROPS_QUEST_NAME = "<green>Collect drops quest</green>";
|
||||
public static String COLLECT_DROPS_STEP_1 = "Obtained";
|
||||
public static String COLLECT_DROPS_STEP_2 = "Turned in";
|
||||
public static String COLLECT_DROPS_TURN_IN = "<gold>Click here to turn in your <item></gold>";
|
||||
private static void loadCollectQuests() {
|
||||
COLLECT_DROPS_QUEST.clear();
|
||||
ConfigurationSection configurationSection = config.getConfigurationSection("collect_drops.possible_tasks");
|
||||
|
|
@ -108,10 +122,16 @@ public class QuestsConfig extends AbstractConfig {
|
|||
}
|
||||
}
|
||||
COLLECT_DROPS_QUEST_NAME = config.getString("collect_drops.name", COLLECT_DROPS_QUEST_NAME);
|
||||
COLLECT_DROPS_STEP_1 = config.getString("collect_drops.step-1", COLLECT_DROPS_STEP_1);
|
||||
COLLECT_DROPS_STEP_2 = config.getString("collect_drops.step-2", COLLECT_DROPS_STEP_2);
|
||||
COLLECT_DROPS_TURN_IN = config.getString("collect_drops.turn-in", COLLECT_DROPS_TURN_IN);
|
||||
}
|
||||
|
||||
public static List<BreedMobsQuestObject> BREED_MOB_QUEST = new ArrayList<>();
|
||||
public static String BREED_MOB_QUEST_NAME = "<green>Breed mobs quest</green>";
|
||||
public static String BREED_STEP_1 = "Bred";
|
||||
public static String BREED_STEP_2 = "Confirmed";
|
||||
public static String BREED_TURN_IN = "<gold>Click here to confirm the baby <mob>s</gold>";
|
||||
private static void loadBreedMobQuests() {
|
||||
BREED_MOB_QUEST.clear();
|
||||
ConfigurationSection configurationSection = config.getConfigurationSection("breed_mobs.possible_tasks");
|
||||
|
|
@ -135,5 +155,8 @@ public class QuestsConfig extends AbstractConfig {
|
|||
}
|
||||
}
|
||||
BREED_MOB_QUEST_NAME = config.getString("breed_mobs.name", BREED_MOB_QUEST_NAME);
|
||||
BREED_STEP_1 = config.getString("breed_mobs.step-1", BREED_STEP_1);
|
||||
BREED_STEP_2 = config.getString("breed_mobs.step-2", BREED_STEP_2);
|
||||
BREED_TURN_IN = config.getString("breed_mobs.turn-in", BREED_TURN_IN);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public class Database {
|
|||
"quest_variant VARCHAR(36) NOT NULL, " +
|
||||
"step_1_progress INT NOT NULL, " +
|
||||
"step_2_progress INT NOT NULL, " +
|
||||
"PRIMARY KEY (UUID, quest)" +
|
||||
"PRIMARY KEY (UUID)" +
|
||||
")";
|
||||
getDatabase().getConnection().prepareStatement(sql).executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
|
|
|
|||
|
|
@ -81,14 +81,21 @@ public class BreedMobsQuest extends Quest {
|
|||
|
||||
@Override
|
||||
public TagResolver getTagResolvers() {
|
||||
return TagResolver.resolver(
|
||||
TagResolver resolver = TagResolver.resolver(
|
||||
Placeholder.unparsed("mob", breedMobsQuestObject.getEntityType().name()),
|
||||
Placeholder.parsed("step_1_progress", getStep1() == breedMobsQuestObject.getAmount() ?
|
||||
"<green>" + getStep1() + "</green>" : "<red>" + getStep1() + "</red>"),
|
||||
Placeholder.parsed("step_1_total", String.valueOf(breedMobsQuestObject.getAmount())),
|
||||
Placeholder.parsed("step_2_progress", getStep2() == breedMobsQuestObject.getAmount() ?
|
||||
"<green>" + getStep2() + "</green>" : "<red>" + getStep2() + "</red>"),
|
||||
Placeholder.parsed("step_2_total", String.valueOf(breedMobsQuestObject.getAmount()))
|
||||
Placeholder.parsed("step_2_total", String.valueOf(breedMobsQuestObject.getAmount())),
|
||||
Placeholder.unparsed("step_1", QuestsConfig.BREED_STEP_1),
|
||||
Placeholder.unparsed("step_2", QuestsConfig.BREED_STEP_2)
|
||||
);
|
||||
Component turnInText = MiniMessage.miniMessage().deserialize(QuestsConfig.BREED_TURN_IN, resolver);
|
||||
return TagResolver.resolver(
|
||||
resolver,
|
||||
Placeholder.component("turn_in_text", turnInText)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,14 +85,22 @@ public class CollectDropsQuest extends Quest {
|
|||
|
||||
@Override
|
||||
public TagResolver getTagResolvers() {
|
||||
return TagResolver.resolver(
|
||||
TagResolver resolver = TagResolver.resolver(
|
||||
Placeholder.unparsed("item", collectDropsQuestObject.getMaterial().name()),
|
||||
Placeholder.parsed("step_1_progress", getStep1() == collectDropsQuestObject.getAmount() ?
|
||||
"<green>" + getStep1() + "</green>" : "<red>" + getStep1() + "</red>"),
|
||||
Placeholder.parsed("step_1_total", String.valueOf(collectDropsQuestObject.getAmount())),
|
||||
Placeholder.parsed("step_2_progress", getStep2() == collectDropsQuestObject.getAmount() ?
|
||||
"<green>" + getStep2() + "</green>" : "<red>" + getStep2() + "</red>"),
|
||||
Placeholder.parsed("step_2_total", String.valueOf(collectDropsQuestObject.getAmount()))
|
||||
Placeholder.parsed("step_2_total", String.valueOf(collectDropsQuestObject.getAmount())),
|
||||
Placeholder.unparsed("step_1", QuestsConfig.COLLECT_DROPS_STEP_1),
|
||||
Placeholder.unparsed("step_2", QuestsConfig.COLLECT_DROPS_STEP_2),
|
||||
Placeholder.unparsed("turn_in_text", QuestsConfig.COLLECT_DROPS_TURN_IN)
|
||||
);
|
||||
Component turnInText = MiniMessage.miniMessage().deserialize(QuestsConfig.COLLECT_DROPS_TURN_IN, resolver);
|
||||
return TagResolver.resolver(
|
||||
resolver,
|
||||
Placeholder.component("turn_in_text", turnInText)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,14 +81,21 @@ public class KillMobsQuest extends Quest {
|
|||
|
||||
@Override
|
||||
public TagResolver getTagResolvers() {
|
||||
return TagResolver.resolver(
|
||||
TagResolver resolver = TagResolver.resolver(
|
||||
Placeholder.unparsed("mob", killMobsQuestObject.getEntityType().name()),
|
||||
Placeholder.parsed("step_1_progress", getStep1() == killMobsQuestObject.getAmount() ?
|
||||
"<green>" + getStep1() + "</green>" : "<red>" + getStep1() + "</red>"),
|
||||
Placeholder.parsed("step_1_total", String.valueOf(killMobsQuestObject.getAmount())),
|
||||
Placeholder.parsed("step_2_progress", getStep2() == killMobsQuestObject.getAmount() ?
|
||||
"<green>" + getStep2() + "</green>" : "<red>" + getStep2() + "</red>"),
|
||||
Placeholder.parsed("step_2_total", String.valueOf(killMobsQuestObject.getAmount()))
|
||||
Placeholder.parsed("step_2_total", String.valueOf(killMobsQuestObject.getAmount())),
|
||||
Placeholder.unparsed("step_1", QuestsConfig.KILL_MOB_STEP_1),
|
||||
Placeholder.unparsed("step_2", QuestsConfig.KILL_MOB_STEP_2)
|
||||
);
|
||||
Component turnInText = MiniMessage.miniMessage().deserialize(QuestsConfig.KILL_MOB_TURN_IN, resolver);
|
||||
return TagResolver.resolver(
|
||||
resolver,
|
||||
Placeholder.component("turn_in_text", turnInText)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,15 +82,22 @@ public class MineQuest extends Quest {
|
|||
|
||||
@Override
|
||||
public TagResolver getTagResolvers() {
|
||||
return TagResolver.resolver(
|
||||
TagResolver resolver = TagResolver.resolver(
|
||||
Placeholder.unparsed("block", mineQuestObject.getMaterial().name()),
|
||||
Placeholder.parsed("step_1_progress", getStep1() == mineQuestObject.getAmount() ?
|
||||
"<green>" + getStep1() + "</green>" : "<red>" + getStep1() + "</red>"),
|
||||
Placeholder.parsed("step_1_total", String.valueOf(mineQuestObject.getAmount())),
|
||||
Placeholder.parsed("step_2_progress", getStep2() == mineQuestObject.getAmount() ?
|
||||
"<green>" + getStep2() + "</green>" : "<red>" + getStep2() + "</red>"),
|
||||
Placeholder.parsed("step_2_total", String.valueOf(mineQuestObject.getAmount()))
|
||||
);
|
||||
Placeholder.parsed("step_2_total", String.valueOf(mineQuestObject.getAmount())),
|
||||
Placeholder.unparsed("step_1", QuestsConfig.MINE_STEP_1),
|
||||
Placeholder.unparsed("step_2", QuestsConfig.MINE_STEP_2)
|
||||
);
|
||||
Component turnInText = MiniMessage.miniMessage().deserialize(QuestsConfig.MINE_TURN_IN, resolver);
|
||||
return TagResolver.resolver(
|
||||
resolver,
|
||||
Placeholder.component("turn_in_text", turnInText)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user