Remove MagicSpells integration.

The integration only works reliably with the `clear-wave-` settings set
to `true`, because it relies on there being only one "current" wave.
This is a fundamental issue with the way sessions run right now, and is
another good example of why the Sessions Rework is necessary.

It is possible to achieve the exact same functionality by just making a
couple of Upgrade Waves before and after the waves that need to have
limited skill sets (thanks Lucy). With just a couple of quality-of-life
features like wave "triggers", it's possible to make things just the way
they were with the integration, but by using some more general building
blocks.

Closes #609
This commit is contained in:
Andreas Troelsen 2020-07-16 22:19:33 +02:00
parent 962eb7aaba
commit c682e45714
5 changed files with 2 additions and 102 deletions

View File

@ -19,6 +19,7 @@ These changes will (most likely) be included in the next version.
- Config-files with missing `pet-items` nodes no longer errors. A missing `pet-items` node in `global-settings` is treated as empty, i.e. no pet items will be registered.
- The `player-time-in-arena` setting has been fixed.
- Config-file errors imposed by incorrect usage of `/ma setting` no longer cause "internal errors". Instead, the errors are properly communicated in the command output similar to how the `/ma reload` command works.
- The MagicSpells integration has been removed. This means that the extra `magicspells.yml` config-file (if it exists) no longer does anything and can be removed.
## [0.104.2] - 2020-01-03
- The region overlap check now works across both arena and lobby regions, i.e. all four combinations of intersections between two regions (arena-arena, arena-lobby, lobby-arena, and lobby-lobby) are evaluated.

10
pom.xml
View File

@ -83,7 +83,7 @@
<url>http://repo.codemc.org/repository/maven-public/</url>
</repository>
<!-- JitPack for Vault, MagicSpells -->
<!-- JitPack for Vault -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
@ -115,14 +115,6 @@
<scope>compile</scope>
</dependency>
<!-- MagicSpells -->
<dependency>
<groupId>com.github.TheComputerGeek2</groupId>
<artifactId>MagicSpells</artifactId>
<version>3.5-Release</version>
<scope>provided</scope>
</dependency>
<!-- JUnit -->
<dependency>
<groupId>junit</groupId>

View File

@ -5,7 +5,6 @@ import com.garbagemule.MobArena.config.LoadsConfigFile;
import com.garbagemule.MobArena.framework.Arena;
import com.garbagemule.MobArena.framework.ArenaMaster;
import com.garbagemule.MobArena.listeners.MAGlobalListener;
import com.garbagemule.MobArena.listeners.MagicSpellsListener;
import com.garbagemule.MobArena.metrics.ArenaCountChart;
import com.garbagemule.MobArena.metrics.ClassChestsChart;
import com.garbagemule.MobArena.metrics.ClassCountChart;
@ -96,7 +95,6 @@ public class MobArena extends JavaPlugin
registerConfigurationSerializers();
setupVault();
setupMagicSpells();
setupBossAbilities();
setupListeners();
setupMetrics();
@ -147,16 +145,6 @@ public class MobArena extends JavaPlugin
}
}
private void setupMagicSpells() {
Plugin spells = this.getServer().getPluginManager().getPlugin("MagicSpells");
if (spells == null) {
return;
}
getLogger().info("MagicSpells found, loading config-file.");
this.getServer().getPluginManager().registerEvents(new MagicSpellsListener(this), this);
}
private void setupBossAbilities() {
AbilityManager.loadCoreAbilities();
AbilityManager.loadCustomAbilities(getDataFolder());

View File

@ -1,63 +0,0 @@
package com.garbagemule.MobArena.listeners;
import com.garbagemule.MobArena.MobArena;
import com.garbagemule.MobArena.framework.Arena;
import com.garbagemule.MobArena.waves.enums.WaveType;
import com.nisovin.magicspells.events.SpellCastEvent;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import java.io.File;
import java.util.List;
public class MagicSpellsListener implements Listener
{
private MobArena plugin;
private List<String> disabled, disabledOnBoss, disabledOnSwarm;
public MagicSpellsListener(MobArena plugin)
{
this.plugin = plugin;
// Set up the MagicSpells config-file.
File file = new File(plugin.getDataFolder(), "magicspells.yml");
if (!file.exists()) {
plugin.saveResource("magicspells.yml", false);
plugin.getLogger().info("magicspells.yml created.");
}
try {
FileConfiguration config = new YamlConfiguration();
config.load(file);
setupSpells(config);
} catch (Exception e) {
e.printStackTrace();
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void onSpellCast(SpellCastEvent event)
{
Arena arena = plugin.getArenaMaster().getArenaWithPlayer(event.getCaster());
if (arena == null || !arena.isRunning()) return;
String spell = event.getSpell().getName();
WaveType type = (arena.getWaveManager().getCurrent() != null) ? arena.getWaveManager().getCurrent().getType() : null;
if (disabled.contains(spell) ||
(type == WaveType.BOSS && disabledOnBoss.contains(spell)) ||
(type == WaveType.SWARM && disabledOnSwarm.contains(spell))) {
event.setCancelled(true);
}
}
private void setupSpells(ConfigurationSection config)
{
this.disabled = config.getStringList("disabled-spells");
this.disabledOnBoss = config.getStringList("disabled-on-bosses");
this.disabledOnSwarm = config.getStringList("disabled-on-swarms");
}
}

View File

@ -1,18 +0,0 @@
# MobArena disabled MagicSpells spells
#
# 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
# spell, and try to keep the indentation proper.
#
# Spells that will be disabled for the entire arena session.
disabled-spells:
- carpet
- blink
# Spells that will be disabled only while a boss is present.
disabled-on-bosses:
- purge
# Spells that will be disabled only during swarm waves.
disabled-on-swarms:
- purge