mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-03 06:57:58 +01:00
Unstable commit
This commit is contained in:
parent
d1c7a169e6
commit
3be78b47c6
@ -1335,21 +1335,59 @@ public class Quests extends JavaPlugin {
|
|||||||
if(config.contains("quests." + s + ".redo-delay")){
|
if(config.contains("quests." + s + ".redo-delay")){
|
||||||
quest.redoDelay = config.getInt("quests." + s + ".redo-delay");
|
quest.redoDelay = config.getInt("quests." + s + ".redo-delay");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(config.contains("quests." + s + ".name"))
|
||||||
quest.name = parseString(config.getString("quests." + s + ".name"), quest);
|
quest.name = parseString(config.getString("quests." + s + ".name"), quest);
|
||||||
|
else{
|
||||||
|
log.severe(ChatColor.GOLD + "[Quests] Quest block \'" + ChatColor.DARK_PURPLE + s + ChatColor.GOLD + "\' is missing " + ChatColor.RED + "name:");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(config.contains("quests." + s + ".ask-message"))
|
||||||
quest.description = parseString(config.getString("quests." + s + ".ask-message"), quest);
|
quest.description = parseString(config.getString("quests." + s + ".ask-message"), quest);
|
||||||
|
else{
|
||||||
|
log.severe(ChatColor.GOLD + "[Quests] Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "ask-message:");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(config.contains("quests." + s + ".finish-message"))
|
||||||
quest.finished = parseString(config.getString("quests." + s + ".finish-message"), quest);
|
quest.finished = parseString(config.getString("quests." + s + ".finish-message"), quest);
|
||||||
|
else{
|
||||||
|
log.severe(ChatColor.GOLD + "[Quests] Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "finish-message:");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (config.contains("quests." + s + ".requirements")) {
|
if (config.contains("quests." + s + ".requirements")) {
|
||||||
|
|
||||||
|
if(config.contains("quests." + s + ".requirements.fail-requirement-message"))
|
||||||
quest.failRequirements = parseString(config.getString("quests." + s + ".requirements.fail-requirement-message"), quest);
|
quest.failRequirements = parseString(config.getString("quests." + s + ".requirements.fail-requirement-message"), quest);
|
||||||
|
else{
|
||||||
|
log.severe(ChatColor.GOLD + "[Quests] " + ChatColor.YELLOW + "Requirements " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "fail-requirement-message:");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (config.contains("quests." + s + ".requirements.item-ids")) {
|
if (config.contains("quests." + s + ".requirements.item-ids")) {
|
||||||
quest.itemIds = config.getIntegerList("quests." + s + ".requirements.item-ids");
|
|
||||||
|
|
||||||
if(config.getIntegerList("quests." + s + ".requirements.item-amounts") == null)
|
if(Quests.checkList(config.getList("quests." + s + ".requirements.item-ids"), Integer.class))
|
||||||
failedToLoad = true;
|
quest.itemIds = config.getIntegerList("quests." + s + ".requirements.item-ids");
|
||||||
else
|
else{
|
||||||
|
log.severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "item-ids: " + ChatColor.YELLOW + "Requirement " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(config.contains("quests." + s + ".requirements.item-amounts")){
|
||||||
|
|
||||||
|
if(Quests.checkList(config.getList("quests." + s + ".requirements.item-amounts"), Integer.class))
|
||||||
quest.itemAmounts = config.getIntegerList("quests." + s + ".requirements.item-amounts");
|
quest.itemAmounts = config.getIntegerList("quests." + s + ".requirements.item-amounts");
|
||||||
|
else{
|
||||||
|
log.severe(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "item-amounts: " + ChatColor.YELLOW + "Requirement " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
log.severe(ChatColor.GOLD + "[Quests] " + ChatColor.YELLOW + "Requirements " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "item-amounts:");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(config.getBooleanList("quests." + s + ".requirements.remove-items").isEmpty())
|
if(config.getBooleanList("quests." + s + ".requirements.remove-items").isEmpty())
|
||||||
failedToLoad = true;
|
failedToLoad = true;
|
||||||
@ -2722,4 +2760,21 @@ public class Quests extends JavaPlugin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean checkList(List<?> list, Class c){
|
||||||
|
|
||||||
|
if(list == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for(Object o : list){
|
||||||
|
|
||||||
|
if(c.isAssignableFrom(o.getClass()) == false)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user