Fix MagicSpells config loading issue.
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
# MobArena disabled MagicSpells spells
|
# MobArena disabled MagicSpells spells
|
||||||
|
#
|
||||||
# Use this file to disable the MagicSpells spells you don't want your players
|
# Use this file to disable the MagicSpells spells you don't want your players
|
||||||
# to use during arena sessions. Make sure to put a hyphen (-) before every
|
# to use during arena sessions. Make sure to put a hyphen (-) before every
|
||||||
# spell, and try to keep the indentation proper.
|
# spell, and try to keep the indentation proper.
|
||||||
|
#
|
||||||
# Spells that will be disabled for the entire arena session.
|
# Spells that will be disabled for the entire arena session.
|
||||||
disabled-spells:
|
disabled-spells:
|
||||||
- carpet
|
- carpet
|
||||||
@@ -174,6 +174,7 @@ public class MobArena extends JavaPlugin
|
|||||||
|
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
economy = e.getProvider();
|
economy = e.getProvider();
|
||||||
|
Messenger.info("Vault found; economy rewards enabled.");
|
||||||
} else {
|
} else {
|
||||||
Messenger.warning("Vault found, but no economy plugin detected. Economy rewards will not work!");
|
Messenger.warning("Vault found, but no economy plugin detected. Economy rewards will not work!");
|
||||||
}
|
}
|
||||||
@@ -183,6 +184,7 @@ public class MobArena extends JavaPlugin
|
|||||||
Plugin heroesPlugin = this.getServer().getPluginManager().getPlugin("Heroes");
|
Plugin heroesPlugin = this.getServer().getPluginManager().getPlugin("Heroes");
|
||||||
if (heroesPlugin == null) return;
|
if (heroesPlugin == null) return;
|
||||||
|
|
||||||
|
Messenger.info("Heroes found; using different health strategy.");
|
||||||
hasHeroes = true;
|
hasHeroes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,6 +192,7 @@ public class MobArena extends JavaPlugin
|
|||||||
Plugin spells = this.getServer().getPluginManager().getPlugin("MagicSpells");
|
Plugin spells = this.getServer().getPluginManager().getPlugin("MagicSpells");
|
||||||
if (spells == null) return;
|
if (spells == null) return;
|
||||||
|
|
||||||
|
Messenger.info("MagicSpells found, loading config-file.");
|
||||||
this.getServer().getPluginManager().registerEvents(new MagicSpellsListener(this), this);
|
this.getServer().getPluginManager().registerEvents(new MagicSpellsListener(this), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.garbagemule.MobArena.listeners;
|
package com.garbagemule.MobArena.listeners;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.garbagemule.MobArena.Messenger;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@@ -14,6 +14,7 @@ import org.bukkit.event.Listener;
|
|||||||
import com.garbagemule.MobArena.framework.Arena;
|
import com.garbagemule.MobArena.framework.Arena;
|
||||||
import com.garbagemule.MobArena.waves.enums.*;
|
import com.garbagemule.MobArena.waves.enums.*;
|
||||||
import com.garbagemule.MobArena.MobArena;
|
import com.garbagemule.MobArena.MobArena;
|
||||||
|
|
||||||
import com.nisovin.magicspells.events.SpellCastEvent;
|
import com.nisovin.magicspells.events.SpellCastEvent;
|
||||||
|
|
||||||
public class MagicSpellsListener implements Listener
|
public class MagicSpellsListener implements Listener
|
||||||
@@ -26,10 +27,14 @@ public class MagicSpellsListener implements Listener
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
// Set up the MagicSpells config-file.
|
// Set up the MagicSpells config-file.
|
||||||
plugin.saveResource("res/magicspells.yml", false);
|
File file = new File(plugin.getDataFolder(), "magicspells.yml");
|
||||||
FileConfiguration config = new YamlConfiguration();
|
if (!file.exists()) {
|
||||||
|
plugin.saveResource("magicspells.yml", false);
|
||||||
|
Messenger.info("magicspells.yml created.");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
config.load(new File(plugin.getDataFolder(), "magicspells.yml"));
|
FileConfiguration config = new YamlConfiguration();
|
||||||
|
config.load(file);
|
||||||
setupSpells(config);
|
setupSpells(config);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Reference in New Issue
Block a user