Disables the MagicSpells purge spell during boss fights.
This commit is contained in:
@@ -1064,6 +1064,21 @@ public class Arena
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
public boolean isRunning()
|
||||
{
|
||||
return running;
|
||||
}
|
||||
|
||||
public boolean isPvpEnabled()
|
||||
{
|
||||
return pvp;
|
||||
}
|
||||
|
||||
public boolean isBossWave()
|
||||
{
|
||||
return bossWave != null;
|
||||
}
|
||||
|
||||
public String configName()
|
||||
{
|
||||
return MAUtils.nameArenaToConfig(name);
|
||||
@@ -1083,11 +1098,6 @@ public class Arena
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
||||
public boolean isPvpEnabled()
|
||||
{
|
||||
return pvp;
|
||||
}
|
||||
|
||||
public void setBossWave(BossWave bossWave)
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.bukkit.util.config.Configuration;
|
||||
|
||||
//import com.nijiko.permissions.PermissionHandler;
|
||||
//import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import com.garbagemule.MobArena.listeners.MagicSpellsListener;
|
||||
import com.garbagemule.MobArena.util.FileUtils;
|
||||
import com.garbagemule.register.payment.Method;
|
||||
import com.garbagemule.register.payment.Methods;
|
||||
@@ -34,23 +35,22 @@ public class MobArena extends JavaPlugin
|
||||
private Configuration config;
|
||||
private ArenaMaster am;
|
||||
|
||||
// Permissions stuff
|
||||
//private PermissionHandler permissionHandler;
|
||||
|
||||
// Heroes stuff
|
||||
private HeroManager heroManager = null;
|
||||
|
||||
// Economy stuff
|
||||
protected Methods Methods;
|
||||
protected Method Method;
|
||||
|
||||
// Spout stuff
|
||||
public static boolean hasSpout;
|
||||
|
||||
// Heroes stuff
|
||||
private HeroManager heroManager = null;
|
||||
|
||||
// Global variables
|
||||
public static PluginDescriptionFile desc;
|
||||
public static File dir, arenaDir;
|
||||
public static final double MIN_PLAYER_DISTANCE = 15.0;
|
||||
public static final double MIN_PLAYER_DISTANCE_SQUARED = MIN_PLAYER_DISTANCE * MIN_PLAYER_DISTANCE;
|
||||
public static final int ECONOMY_MONEY_ID = -29;
|
||||
public static boolean hasSpout;
|
||||
public static Random random = new Random();
|
||||
|
||||
public void onEnable()
|
||||
@@ -69,11 +69,11 @@ public class MobArena extends JavaPlugin
|
||||
// Download external libraries if needed.
|
||||
FileUtils.fetchLibs(config);
|
||||
|
||||
// Set up permissions and economy
|
||||
//setupPermissions();
|
||||
// Set up soft dependencies
|
||||
setupRegister();
|
||||
setupSpout();
|
||||
setupHeroes();
|
||||
setupMagicSpells();
|
||||
|
||||
// Set up the ArenaMaster and the announcements
|
||||
am = new ArenaMaster(this);
|
||||
@@ -147,11 +147,7 @@ public class MobArena extends JavaPlugin
|
||||
|
||||
// Permissions stuff
|
||||
public boolean has(Player p, String s)
|
||||
{
|
||||
// First check for NijikoPerms
|
||||
//if (permissionHandler != null)
|
||||
// return permissionHandler.has(p, s);
|
||||
|
||||
{
|
||||
// If the permission is set, check if player has permission
|
||||
if (p.isPermissionSet(s))
|
||||
return p.hasPermission(s);
|
||||
@@ -165,17 +161,6 @@ public class MobArena extends JavaPlugin
|
||||
public static void warning(String msg) { Bukkit.getServer().getLogger().warning("[MobArena] " + msg); }
|
||||
public static void error(String msg) { Bukkit.getServer().getLogger().severe("[MobArena] " + msg); }
|
||||
|
||||
/*private void setupPermissions()
|
||||
{
|
||||
if (permissionHandler != null)
|
||||
return;
|
||||
|
||||
Plugin permissionsPlugin = this.getServer().getPluginManager().getPlugin("Permissions");
|
||||
if (permissionsPlugin == null) return;
|
||||
|
||||
permissionHandler = ((Permissions) permissionsPlugin).getHandler();
|
||||
}*/
|
||||
|
||||
private void setupRegister()
|
||||
{
|
||||
Methods = new Methods();
|
||||
@@ -203,6 +188,16 @@ public class MobArena extends JavaPlugin
|
||||
heroManager = ((Heroes) heroes).getHeroManager();
|
||||
}
|
||||
|
||||
private void setupMagicSpells()
|
||||
{
|
||||
Plugin spells = this.getServer().getPluginManager().getPlugin("MagicSpells");
|
||||
if (spells == null) return;
|
||||
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
MagicSpellsListener spellsListener = new MagicSpellsListener(this);
|
||||
pm.registerEvent(Event.Type.CUSTOM_EVENT, spellsListener, Priority.Normal, this);
|
||||
}
|
||||
|
||||
public Configuration getConfig() { return config; }
|
||||
public ArenaMaster getAM() { return am; } // More convenient.
|
||||
public ArenaMaster getArenaMaster() { return am; }
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.garbagemule.MobArena.listeners;
|
||||
|
||||
import com.garbagemule.MobArena.Arena;
|
||||
import com.garbagemule.MobArena.MobArena;
|
||||
import com.nisovin.MagicSpells.Events.SpellCastEvent;
|
||||
import com.nisovin.MagicSpells.Events.SpellListener;
|
||||
|
||||
public class MagicSpellsListener extends SpellListener
|
||||
{
|
||||
private MobArena plugin;
|
||||
|
||||
public MagicSpellsListener(MobArena plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public void onSpellCast(SpellCastEvent event)
|
||||
{
|
||||
Arena arena = plugin.getAM().getArenaWithPlayer(event.getCaster());
|
||||
if (arena == null || !arena.isRunning()) return;
|
||||
|
||||
if (event.getSpell().getName().equals("purge") && arena.isBossWave())
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user