mirror of
https://github.com/Zrips/Jobs.git
synced 2025-02-27 09:43:22 +01:00
Added option to quests to use more items in one quest
This commit is contained in:
parent
1f2219b3cb
commit
12b2419f88
@ -378,7 +378,7 @@ public class ConfigManager {
|
|||||||
type = myKey;
|
type = myKey;
|
||||||
PotionType potion = PotionType.valueOf(myKey);
|
PotionType potion = PotionType.valueOf(myKey);
|
||||||
if (potion != null)
|
if (potion != null)
|
||||||
type = potion.name().toUpperCase().replace("_", "").toLowerCase();
|
type = potion.name().toString().replace("_", "").toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
@ -620,18 +620,17 @@ public class ConfigManager {
|
|||||||
GUIitem = material.newItemStack();
|
GUIitem = material.newItemStack();
|
||||||
if (guiSection.contains("Enchantments")) {
|
if (guiSection.contains("Enchantments")) {
|
||||||
List<String> enchants = guiSection.getStringList("Enchantments");
|
List<String> enchants = guiSection.getStringList("Enchantments");
|
||||||
if (enchants.size() > 0) {
|
if (!enchants.isEmpty()) {
|
||||||
for (String str4 : enchants) {
|
for (String str4 : enchants) {
|
||||||
String[] enchantid = str4.split(":");
|
String[] enchantid = str4.split(":");
|
||||||
if ((GUIitem.getItemMeta() instanceof EnchantmentStorageMeta)) {
|
if ((GUIitem.getItemMeta() instanceof EnchantmentStorageMeta)) {
|
||||||
EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) GUIitem.getItemMeta();
|
EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) GUIitem.getItemMeta();
|
||||||
enchantMeta.addStoredEnchant(Enchantment.getByName(enchantid[0]), Integer.parseInt(enchantid[1]), true);
|
enchantMeta.addStoredEnchant(Enchantment.getByName(enchantid[0]), Integer.parseInt(enchantid[1]), true);
|
||||||
GUIitem.setItemMeta(enchantMeta);
|
GUIitem.setItemMeta(enchantMeta);
|
||||||
} else {
|
} else
|
||||||
GUIitem.addUnsafeEnchantment(Enchantment.getByName(enchantid[0]), Integer.parseInt(enchantid[1]));
|
GUIitem.addUnsafeEnchantment(Enchantment.getByName(enchantid[0]), Integer.parseInt(enchantid[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (guiSection.contains("CustomSkull")) {
|
} else if (guiSection.contains("CustomSkull")) {
|
||||||
String skullOwner = guiSection.getString("CustomSkull");
|
String skullOwner = guiSection.getString("CustomSkull");
|
||||||
GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack();
|
GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack();
|
||||||
@ -657,11 +656,10 @@ public class ConfigManager {
|
|||||||
EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) GUIitem.getItemMeta();
|
EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) GUIitem.getItemMeta();
|
||||||
enchantMeta.addStoredEnchant(Enchantment.getByName(id[0]), Integer.parseInt(id[1]), true);
|
enchantMeta.addStoredEnchant(Enchantment.getByName(id[0]), Integer.parseInt(id[1]), true);
|
||||||
GUIitem.setItemMeta(enchantMeta);
|
GUIitem.setItemMeta(enchantMeta);
|
||||||
} else {
|
} else
|
||||||
GUIitem.addUnsafeEnchantment(Enchantment.getByName(id[0]), Integer.parseInt(id[1]));
|
GUIitem.addUnsafeEnchantment(Enchantment.getByName(id[0]), Integer.parseInt(id[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (guiSection.contains("CustomSkull")) {
|
} else if (guiSection.contains("CustomSkull")) {
|
||||||
String skullOwner = guiSection.getString("CustomSkull");
|
String skullOwner = guiSection.getString("CustomSkull");
|
||||||
GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack();
|
GUIitem = CMIMaterial.PLAYER_HEAD.newItemStack();
|
||||||
@ -723,15 +721,13 @@ public class ConfigManager {
|
|||||||
|
|
||||||
// Command on leave
|
// Command on leave
|
||||||
List<String> JobsCommandOnLeave = new ArrayList<>();
|
List<String> JobsCommandOnLeave = new ArrayList<>();
|
||||||
if (jobSection.isList("cmd-on-leave")) {
|
if (jobSection.isList("cmd-on-leave"))
|
||||||
JobsCommandOnLeave = jobSection.getStringList("cmd-on-leave");
|
JobsCommandOnLeave = jobSection.getStringList("cmd-on-leave");
|
||||||
}
|
|
||||||
|
|
||||||
// Command on join
|
// Command on join
|
||||||
List<String> JobsCommandOnJoin = new ArrayList<>();
|
List<String> JobsCommandOnJoin = new ArrayList<>();
|
||||||
if (jobSection.isList("cmd-on-join")) {
|
if (jobSection.isList("cmd-on-join"))
|
||||||
JobsCommandOnJoin = jobSection.getStringList("cmd-on-join");
|
JobsCommandOnJoin = jobSection.getStringList("cmd-on-join");
|
||||||
}
|
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
ArrayList<JobCommands> jobCommand = new ArrayList<>();
|
ArrayList<JobCommands> jobCommand = new ArrayList<>();
|
||||||
@ -883,7 +879,15 @@ public class ConfigManager {
|
|||||||
String name = sqsection.getString("Name", one);
|
String name = sqsection.getString("Name", one);
|
||||||
|
|
||||||
ActionType actionType = ActionType.getByName(sqsection.getString("Action"));
|
ActionType actionType = ActionType.getByName(sqsection.getString("Action"));
|
||||||
KeyValues kv = getKeyValue(sqsection.getString("Target"), actionType, jobName);
|
KeyValues kv = null;
|
||||||
|
if (sqsection.isString("Target"))
|
||||||
|
kv = getKeyValue(sqsection.getString("Target"), actionType, jobName);
|
||||||
|
else if (sqsection.isList("Target")) {
|
||||||
|
for (int i = 0; i < sqsection.getStringList("Target").size(); i++) {
|
||||||
|
kv = getKeyValue(sqsection.getStringList("Target").get(i), actionType, jobName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (kv == null)
|
if (kv == null)
|
||||||
continue;
|
continue;
|
||||||
int amount = sqsection.getInt("Amount");
|
int amount = sqsection.getInt("Amount");
|
||||||
@ -894,13 +898,11 @@ public class ConfigManager {
|
|||||||
|
|
||||||
Quest quest = new Quest(name, job, actionType);
|
Quest quest = new Quest(name, job, actionType);
|
||||||
|
|
||||||
if (sqsection.contains("fromLevel") && sqsection.isInt("fromLevel")) {
|
if (sqsection.contains("fromLevel") && sqsection.isInt("fromLevel"))
|
||||||
quest.setMinLvl(sqsection.getInt("fromLevel"));
|
quest.setMinLvl(sqsection.getInt("fromLevel"));
|
||||||
}
|
|
||||||
|
|
||||||
if (sqsection.contains("toLevel") && sqsection.isInt("toLevel")) {
|
if (sqsection.contains("toLevel") && sqsection.isInt("toLevel"))
|
||||||
quest.setMaxLvl(sqsection.getInt("toLevel"));
|
quest.setMaxLvl(sqsection.getInt("toLevel"));
|
||||||
}
|
|
||||||
|
|
||||||
quest.setConfigName(one);
|
quest.setConfigName(one);
|
||||||
quest.setAmount(amount);
|
quest.setAmount(amount);
|
||||||
@ -1137,8 +1139,17 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
Jobs.getExplore().setExploreEnabled();
|
Jobs.getExplore().setExploreEnabled();
|
||||||
Jobs.getExplore().setPlayerAmount(amount + 1);
|
Jobs.getExplore().setPlayerAmount(amount + 1);
|
||||||
} else if (actionType == ActionType.CRAFT && myKey.startsWith("!")) {
|
} else if (actionType == ActionType.CRAFT && myKey.startsWith("!"))
|
||||||
type = myKey.substring(1, myKey.length());
|
type = myKey.substring(1, myKey.length());
|
||||||
|
else if (actionType == ActionType.DRINK) {
|
||||||
|
type = myKey;
|
||||||
|
try {
|
||||||
|
PotionType potion = PotionType.valueOf(myKey);
|
||||||
|
if (potion != null)
|
||||||
|
type = potion.name().toString().replace("_", "").toLowerCase();
|
||||||
|
} catch (IllegalArgumentException i) {
|
||||||
|
Jobs.getPluginLogger().warning("Job" + jobKey + " has an invalid potion " + myKey + "!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
@ -1178,17 +1189,16 @@ public class ConfigManager {
|
|||||||
job.setJobInfo(actionType, jobInfo);
|
job.setJobInfo(actionType, jobInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jobKey.equalsIgnoreCase("none")) {
|
if (jobKey.equalsIgnoreCase("none"))
|
||||||
Jobs.setNoneJob(job);
|
Jobs.setNoneJob(job);
|
||||||
} else {
|
else
|
||||||
jobs.add(job);
|
jobs.add(job);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Jobs.consoleMsg("&e[Jobs] Loaded " + Jobs.getJobs().size() + " jobs!");
|
Jobs.consoleMsg("&e[Jobs] Loaded " + Jobs.getJobs().size() + " jobs!");
|
||||||
if (!Jobs.getExplore().isExploreEnabled()) {
|
if (!Jobs.getExplore().isExploreEnabled())
|
||||||
Jobs.consoleMsg("&6[Jobs] Explorer jobs manager are not enabled!");
|
Jobs.consoleMsg("&6[Jobs] Explorer jobs manager are not enabled!");
|
||||||
} else
|
else
|
||||||
Jobs.consoleMsg("&e[Jobs] Explorer job manager registered!");
|
Jobs.consoleMsg("&e[Jobs] Explorer job manager registered!");
|
||||||
|
|
||||||
// Lets load item boosts
|
// Lets load item boosts
|
||||||
|
@ -15,9 +15,6 @@ public class TitleManager {
|
|||||||
|
|
||||||
protected List<Title> titles = new ArrayList<>();
|
protected List<Title> titles = new ArrayList<>();
|
||||||
|
|
||||||
public TitleManager() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to return the title for a given level
|
* Function to return the title for a given level
|
||||||
* @return the correct title
|
* @return the correct title
|
||||||
@ -27,15 +24,13 @@ public class TitleManager {
|
|||||||
Title title = null;
|
Title title = null;
|
||||||
for (Title t : titles) {
|
for (Title t : titles) {
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
if (t.getLevelReq() <= level && (t.getJobName() == null || t.getJobName().equalsIgnoreCase(jobName))) {
|
if (t.getLevelReq() <= level && (t.getJobName() == null || t.getJobName().equalsIgnoreCase(jobName)))
|
||||||
title = t;
|
title = t;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (t.getLevelReq() <= level && t.getLevelReq() > title.getLevelReq() && (t.getJobName() == null || t.getJobName().equalsIgnoreCase(jobName))) {
|
if (t.getLevelReq() <= level && t.getLevelReq() > title.getLevelReq() && (t.getJobName() == null || t.getJobName().equalsIgnoreCase(jobName)))
|
||||||
title = t;
|
title = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +40,7 @@ public class TitleManager {
|
|||||||
* loads from Jobs/titleConfig.yml
|
* loads from Jobs/titleConfig.yml
|
||||||
*/
|
*/
|
||||||
synchronized void load() {
|
synchronized void load() {
|
||||||
this.titles.clear();
|
titles.clear();
|
||||||
|
|
||||||
ConfigReader c = null;
|
ConfigReader c = null;
|
||||||
try {
|
try {
|
||||||
@ -72,56 +67,56 @@ public class TitleManager {
|
|||||||
if (titleSection == null) {
|
if (titleSection == null) {
|
||||||
titleSection = c.getC().createSection("Titles");
|
titleSection = c.getC().createSection("Titles");
|
||||||
|
|
||||||
this.titles.add(new Title(
|
titles.add(new Title(
|
||||||
c.get("Titles.Novice.Name", "N"),
|
c.get("Titles.Novice.Name", "N"),
|
||||||
c.get("Titles.Novice.ShortName", "N"),
|
c.get("Titles.Novice.ShortName", "N"),
|
||||||
ChatColor.matchColor(c.get("Titles.Novice.ChatColour", "YELLOW")),
|
ChatColor.matchColor(c.get("Titles.Novice.ChatColour", "YELLOW")),
|
||||||
c.get("Titles.Novice.levelReq", 0),
|
c.get("Titles.Novice.levelReq", 0),
|
||||||
null));
|
null));
|
||||||
|
|
||||||
this.titles.add(new Title(
|
titles.add(new Title(
|
||||||
c.get("Titles.Apprentice.Name", "A"),
|
c.get("Titles.Apprentice.Name", "A"),
|
||||||
c.get("Titles.Apprentice.ShortName", "A"),
|
c.get("Titles.Apprentice.ShortName", "A"),
|
||||||
ChatColor.matchColor(c.get("Titles.Apprentice.ChatColour", "WHITE")),
|
ChatColor.matchColor(c.get("Titles.Apprentice.ChatColour", "WHITE")),
|
||||||
c.get("Titles.Apprentice.levelReq", 25),
|
c.get("Titles.Apprentice.levelReq", 25),
|
||||||
null));
|
null));
|
||||||
|
|
||||||
this.titles.add(new Title(
|
titles.add(new Title(
|
||||||
c.get("Titles.Initiate.Name", "I"),
|
c.get("Titles.Initiate.Name", "I"),
|
||||||
c.get("Titles.Initiate.ShortName", "I"),
|
c.get("Titles.Initiate.ShortName", "I"),
|
||||||
ChatColor.matchColor(c.get("Titles.Initiate.ChatColour", "GOLD")),
|
ChatColor.matchColor(c.get("Titles.Initiate.ChatColour", "GOLD")),
|
||||||
c.get("Titles.Initiate.levelReq", 50),
|
c.get("Titles.Initiate.levelReq", 50),
|
||||||
null));
|
null));
|
||||||
|
|
||||||
this.titles.add(new Title(
|
titles.add(new Title(
|
||||||
c.get("Titles.Journeyman.Name", "J"),
|
c.get("Titles.Journeyman.Name", "J"),
|
||||||
c.get("Titles.Journeyman.ShortName", "J"),
|
c.get("Titles.Journeyman.ShortName", "J"),
|
||||||
ChatColor.matchColor(c.get("Titles.Journeyman.ChatColour", "DARK_GREEN")),
|
ChatColor.matchColor(c.get("Titles.Journeyman.ChatColour", "DARK_GREEN")),
|
||||||
c.get("Titles.Journeyman.levelReq", 75),
|
c.get("Titles.Journeyman.levelReq", 75),
|
||||||
null));
|
null));
|
||||||
|
|
||||||
this.titles.add(new Title(
|
titles.add(new Title(
|
||||||
c.get("Titles.Adept.Name", "Ad"),
|
c.get("Titles.Adept.Name", "Ad"),
|
||||||
c.get("Titles.Adept.ShortName", "Ad"),
|
c.get("Titles.Adept.ShortName", "Ad"),
|
||||||
ChatColor.matchColor(c.get("Titles.Adept.ChatColour", "DARK_PURPLE")),
|
ChatColor.matchColor(c.get("Titles.Adept.ChatColour", "DARK_PURPLE")),
|
||||||
c.get("Titles.Adept.levelReq", 100),
|
c.get("Titles.Adept.levelReq", 100),
|
||||||
null));
|
null));
|
||||||
|
|
||||||
this.titles.add(new Title(
|
titles.add(new Title(
|
||||||
c.get("Titles.Master.Name", "M"),
|
c.get("Titles.Master.Name", "M"),
|
||||||
c.get("Titles.Master.ShortName", "M"),
|
c.get("Titles.Master.ShortName", "M"),
|
||||||
ChatColor.matchColor(c.get("Titles.Master.ChatColour", "GRAY")),
|
ChatColor.matchColor(c.get("Titles.Master.ChatColour", "GRAY")),
|
||||||
c.get("Titles.Master.levelReq", 125),
|
c.get("Titles.Master.levelReq", 125),
|
||||||
null));
|
null));
|
||||||
|
|
||||||
this.titles.add(new Title(
|
titles.add(new Title(
|
||||||
c.get("Titles.Grandmaster.Name", "GM"),
|
c.get("Titles.Grandmaster.Name", "GM"),
|
||||||
c.get("Titles.Grandmaster.ShortName", "GM"),
|
c.get("Titles.Grandmaster.ShortName", "GM"),
|
||||||
ChatColor.matchColor(c.get("Titles.Grandmaster.ChatColour", "DARK_GRAY")),
|
ChatColor.matchColor(c.get("Titles.Grandmaster.ChatColour", "DARK_GRAY")),
|
||||||
c.get("Titles.Grandmaster.levelReq", 150),
|
c.get("Titles.Grandmaster.levelReq", 150),
|
||||||
null));
|
null));
|
||||||
|
|
||||||
this.titles.add(new Title(
|
titles.add(new Title(
|
||||||
c.get("Titles.Legendary.Name", "L"),
|
c.get("Titles.Legendary.Name", "L"),
|
||||||
c.get("Titles.Legendary.ShortName", "L"),
|
c.get("Titles.Legendary.ShortName", "L"),
|
||||||
ChatColor.matchColor(c.get("Titles.Legendary.ChatColour", "BLACK")),
|
ChatColor.matchColor(c.get("Titles.Legendary.ChatColour", "BLACK")),
|
||||||
@ -136,9 +131,8 @@ public class TitleManager {
|
|||||||
ChatColor titleColor = ChatColor.matchColor(titleSection.getString(titleKey + ".ChatColour", ""));
|
ChatColor titleColor = ChatColor.matchColor(titleSection.getString(titleKey + ".ChatColour", ""));
|
||||||
int levelReq = titleSection.getInt(titleKey + ".levelReq", -1);
|
int levelReq = titleSection.getInt(titleKey + ".levelReq", -1);
|
||||||
|
|
||||||
if (titleSection.isString(titleKey + ".JobName")) {
|
if (titleSection.isString(titleKey + ".JobName"))
|
||||||
jobName = titleSection.getString(titleKey + ".JobName");
|
jobName = titleSection.getString(titleKey + ".JobName");
|
||||||
}
|
|
||||||
|
|
||||||
if (titleName == null) {
|
if (titleName == null) {
|
||||||
Jobs.getPluginLogger().severe("Title " + titleKey + " has an invalid Name property. Skipping!");
|
Jobs.getPluginLogger().severe("Title " + titleKey + " has an invalid Name property. Skipping!");
|
||||||
@ -158,9 +152,9 @@ public class TitleManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.titles.add(new Title(titleName, titleShortName, titleColor, levelReq, jobName));
|
titles.add(new Title(titleName, titleShortName, titleColor, levelReq, jobName));
|
||||||
}
|
}
|
||||||
if (titles.size() != 0)
|
if (titles.size() > 0)
|
||||||
Jobs.consoleMsg("&e[Jobs] Loaded " + titles.size() + " titles!");
|
Jobs.consoleMsg("&e[Jobs] Loaded " + titles.size() + " titles!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,11 @@ Jobs:
|
|||||||
# Quest action can be any valid job action. Look at lower for all possible action types
|
# Quest action can be any valid job action. Look at lower for all possible action types
|
||||||
Action: Break
|
Action: Break
|
||||||
# Target id or name. Comes in same format as it is for regular job action
|
# Target id or name. Comes in same format as it is for regular job action
|
||||||
|
# You can use only string or list to add more items in one quest
|
||||||
Target: "17-0"
|
Target: "17-0"
|
||||||
|
# Target:
|
||||||
|
# - "17-0"
|
||||||
|
# - stone
|
||||||
# Amount of actions players should perform to complete this quest
|
# Amount of actions players should perform to complete this quest
|
||||||
Amount: 300
|
Amount: 300
|
||||||
# Command list to be performed after quest is finished.
|
# Command list to be performed after quest is finished.
|
||||||
@ -150,6 +154,17 @@ Jobs:
|
|||||||
RewardDesc:
|
RewardDesc:
|
||||||
- "Cook some chicken breasts"
|
- "Cook some chicken breasts"
|
||||||
- "Get 300 for this!"
|
- "Get 300 for this!"
|
||||||
|
4:
|
||||||
|
Name: "Strip logs"
|
||||||
|
Action: StripLogs
|
||||||
|
Target:
|
||||||
|
- stripped_birch_log
|
||||||
|
- stripped_acacia_log
|
||||||
|
Amount: 50
|
||||||
|
RewardCommands:
|
||||||
|
- "msg [playerName] Completed quest!"
|
||||||
|
RewardDesc:
|
||||||
|
- "Strip 50 birch and acacia logs!"
|
||||||
########################################################################
|
########################################################################
|
||||||
# Section used to configure what items the job gets paid for, how much
|
# Section used to configure what items the job gets paid for, how much
|
||||||
# they get paid and how much experience they gain.
|
# they get paid and how much experience they gain.
|
||||||
|
Loading…
Reference in New Issue
Block a user