mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-14 22:55:54 +01:00
New npc-effect settings in config.yml, per #92
This commit is contained in:
parent
5152f26bcf
commit
5f35f0fbec
@ -101,6 +101,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
public static int acceptTimeout = 20;
|
public static int acceptTimeout = 20;
|
||||||
public static int maxQuests = 0;
|
public static int maxQuests = 0;
|
||||||
public static String effect = "note";
|
public static String effect = "note";
|
||||||
|
public static String repeatEffect = "enchant";
|
||||||
public final Map<UUID, Quester> questers = new HashMap<UUID, Quester>();
|
public final Map<UUID, Quester> questers = new HashMap<UUID, Quester>();
|
||||||
public final List<String> questerBlacklist = new LinkedList<String>();
|
public final List<String> questerBlacklist = new LinkedList<String>();
|
||||||
public final List<CustomRequirement> customRequirements = new LinkedList<CustomRequirement>();
|
public final List<CustomRequirement> customRequirements = new LinkedList<CustomRequirement>();
|
||||||
@ -154,19 +155,25 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
questFactory = new QuestFactory(this);
|
questFactory = new QuestFactory(this);
|
||||||
eventFactory = new EventFactory(this);
|
eventFactory = new EventFactory(this);
|
||||||
linkOtherPlugins();
|
linkOtherPlugins();
|
||||||
saveDefaultConfig();
|
|
||||||
// defaultConfigFile();
|
// Save resources
|
||||||
saveResource("quests.yml", false);
|
saveResource("quests.yml", false);
|
||||||
saveResource("events.yml", false);
|
saveResource("events.yml", false);
|
||||||
saveResource("data.yml", false);
|
saveResource("data.yml", false);
|
||||||
|
|
||||||
|
// Save/load lang
|
||||||
defaultLangFile();
|
defaultLangFile();
|
||||||
// defaultQuestsFile();
|
|
||||||
// defaultEventsFile();
|
// Load files
|
||||||
// defaultDataFile();
|
|
||||||
loadConfig();
|
loadConfig();
|
||||||
loadModules();
|
loadModules();
|
||||||
loadData();
|
loadData();
|
||||||
loadCommands();
|
loadCommands();
|
||||||
|
|
||||||
|
// Save config with any new options
|
||||||
|
getConfig().options().copyDefaults(true);
|
||||||
|
saveConfig();
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(pListener, this);
|
getServer().getPluginManager().registerEvents(pListener, this);
|
||||||
if (npcEffects) {
|
if (npcEffects) {
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, effListener, 20, 20);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, effListener, 20, 20);
|
||||||
@ -177,7 +184,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
private void defaultLangFile() {
|
private void defaultLangFile() {
|
||||||
lang = new Lang(this);
|
lang = new Lang(this);
|
||||||
lang.initPhrases();
|
lang.initPhrases();
|
||||||
if (new File(this.getDataFolder(), "/lang/en.yml").exists() == false) {
|
if (new File(this.getDataFolder(), File.separator + "lang" + File.separator + "en.yml").exists() == false) {
|
||||||
getLogger().info("Translation data not found, writing defaults to file.");
|
getLogger().info("Translation data not found, writing defaults to file.");
|
||||||
lang.saveNewLang();
|
lang.saveNewLang();
|
||||||
} else {
|
} else {
|
||||||
@ -209,35 +216,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
}
|
}
|
||||||
}, 5L);
|
}, 5L);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* private void defaultDataFile() { if (new File(this.getDataFolder(), "data.yml").exists() == false) {
|
|
||||||
* getLogger().info("Data file not found, writing default to file."); FileConfiguration data = new YamlConfiguration();
|
|
||||||
* data.options().copyHeader(true); data.options().copyDefaults(true); try { data.save(new File(this.getDataFolder(), "data.yml")); } catch
|
|
||||||
* (IOException e) { e.printStackTrace(); } } else { loadData(); } }
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* private void defaultEventsFile() { if (new File(this.getDataFolder(), "events.yml").exists() == false) {
|
|
||||||
* getLogger().info("Events data not found, writing defaults to file."); FileConfiguration data = new YamlConfiguration();
|
|
||||||
* data.options().copyHeader(true); data.options().copyDefaults(true); try { data.load(this.getTextResource("events.yml")); data.save(new
|
|
||||||
* File(this.getDataFolder(), "events.yml")); } catch (IOException e) { e.printStackTrace(); } catch (InvalidConfigurationException e) {
|
|
||||||
* e.printStackTrace(); } } }
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* private void defaultQuestsFile() { if (new File(this.getDataFolder(), "quests.yml").exists() == false) {
|
|
||||||
*
|
|
||||||
* getLogger().info("Quest data not found, writing defaults to file."); FileConfiguration data = new YamlConfiguration(); try {
|
|
||||||
* data.load(this.getTextResource("quests.yml")); data.set("events", null); data.save(new File(this.getDataFolder(), "quests.yml")); } catch
|
|
||||||
* (IOException e) { e.printStackTrace(); } catch (InvalidConfigurationException e) { e.printStackTrace(); }
|
|
||||||
*
|
|
||||||
* } }
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* private void defaultConfigFile() { if (new File(this.getDataFolder(), "config.yml").exists() == false) {
|
|
||||||
* getLogger().info("Config not found, writing default to file."); FileConfiguration config = new YamlConfiguration(); try {
|
|
||||||
* config.load(this.getTextResource("config.yml")); config.save(new File(this.getDataFolder(), "config.yml")); } catch (IOException e) {
|
|
||||||
* e.printStackTrace(); } catch (InvalidConfigurationException e) { e.printStackTrace(); } } }
|
|
||||||
*/
|
|
||||||
public void loadCommands() {
|
public void loadCommands() {
|
||||||
// [] - required
|
// [] - required
|
||||||
// {} - optional
|
// {} - optional
|
||||||
@ -413,8 +392,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
allowQuitting = config.getBoolean("allow-quitting", true);
|
allowQuitting = config.getBoolean("allow-quitting", true);
|
||||||
useCompass = config.getBoolean("use-compass", true);
|
useCompass = config.getBoolean("use-compass", true);
|
||||||
genFilesOnJoin = config.getBoolean("generate-files-on-join", true);
|
genFilesOnJoin = config.getBoolean("generate-files-on-join", true);
|
||||||
npcEffects = config.getBoolean("show-npc-effects", true);
|
npcEffects = config.getBoolean("npc-effects.enabled", true);
|
||||||
effect = config.getString("npc-effect", "note");
|
effect = config.getString("npc-effects.new-quest", "note");
|
||||||
|
repeatEffect = config.getString("npc-effects.repeatable-quest", "note");
|
||||||
killDelay = config.getInt("kill-delay", 600);
|
killDelay = config.getInt("kill-delay", 600);
|
||||||
acceptTimeout = config.getInt("accept-timeout", 20);
|
acceptTimeout = config.getInt("accept-timeout", 20);
|
||||||
convertData = config.getBoolean("convert-data-on-startup", false);
|
convertData = config.getBoolean("convert-data-on-startup", false);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
language: "en"
|
# See https://github.com/FlyingPikachu/Quests/wiki/Configuration
|
||||||
|
language: en
|
||||||
allow-command-questing: true
|
allow-command-questing: true
|
||||||
allow-command-quests-with-npcs: false
|
allow-command-quests-with-npcs: false
|
||||||
show-requirements: true
|
show-requirements: true
|
||||||
@ -8,12 +9,13 @@ use-compass: true
|
|||||||
ignore-locked-quests: false
|
ignore-locked-quests: false
|
||||||
generate-files-on-join: true
|
generate-files-on-join: true
|
||||||
kill-delay: 600
|
kill-delay: 600
|
||||||
accept-timeout: 20
|
npc-effects:
|
||||||
show-npc-effects: true
|
enabled: true
|
||||||
npc-effect: "note"
|
new-quest: note
|
||||||
|
repeat-quest: enchant
|
||||||
max-quests: 0
|
max-quests: 0
|
||||||
convert-data-on-startup: false
|
convert-data-on-startup: false
|
||||||
quester-blacklist:
|
quester-blacklist:
|
||||||
- "UUID"
|
- UUID
|
||||||
- "UUID"
|
- UUID
|
||||||
- "UUID"
|
- UUID
|
Loading…
Reference in New Issue
Block a user