mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-17 04:51:28 +01:00
Fix MagicSpells config loading issue.
This commit is contained in:
parent
402e6d4de9
commit
0a2956fb81
@ -1,16 +1,18 @@
|
|||||||
# 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
|
||||||
- blink
|
- blink
|
||||||
|
|
||||||
# Spells that will be disabled only while a boss is present.
|
# Spells that will be disabled only while a boss is present.
|
||||||
disabled-on-bosses:
|
disabled-on-bosses:
|
||||||
- purge
|
- purge
|
||||||
|
|
||||||
# Spells that will be disabled only during swarm waves.
|
# Spells that will be disabled only during swarm waves.
|
||||||
disabled-on-swarms:
|
disabled-on-swarms:
|
||||||
- purge
|
- purge
|
@ -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!");
|
||||||
}
|
}
|
||||||
@ -182,7 +183,8 @@ public class MobArena extends JavaPlugin
|
|||||||
private void setupHeroes() {
|
private void setupHeroes() {
|
||||||
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();
|
||||||
|
Loading…
Reference in New Issue
Block a user