Disables the MagicSpells purge spell during boss fights.
This commit is contained in:
Binary file not shown.
@@ -1,7 +1,7 @@
|
|||||||
name: MobArena
|
name: MobArena
|
||||||
main: com.garbagemule.MobArena.MobArena
|
main: com.garbagemule.MobArena.MobArena
|
||||||
version: 0.94.1
|
version: 0.94.1
|
||||||
softdepend: [Spout,Permissions,MultiVerse,XcraftGate,Towny,Heroes]
|
softdepend: [Spout,Permissions,MultiVerse,XcraftGate,Towny,Heroes,MagicSpells]
|
||||||
commands:
|
commands:
|
||||||
ma:
|
ma:
|
||||||
description: Base command for MobArena
|
description: Base command for MobArena
|
||||||
|
|||||||
@@ -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()
|
public String configName()
|
||||||
{
|
{
|
||||||
return MAUtils.nameArenaToConfig(name);
|
return MAUtils.nameArenaToConfig(name);
|
||||||
@@ -1083,11 +1098,6 @@ public class Arena
|
|||||||
{
|
{
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPvpEnabled()
|
|
||||||
{
|
|
||||||
return pvp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBossWave(BossWave bossWave)
|
public void setBossWave(BossWave bossWave)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.bukkit.util.config.Configuration;
|
|||||||
|
|
||||||
//import com.nijiko.permissions.PermissionHandler;
|
//import com.nijiko.permissions.PermissionHandler;
|
||||||
//import com.nijikokun.bukkit.Permissions.Permissions;
|
//import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
|
import com.garbagemule.MobArena.listeners.MagicSpellsListener;
|
||||||
import com.garbagemule.MobArena.util.FileUtils;
|
import com.garbagemule.MobArena.util.FileUtils;
|
||||||
import com.garbagemule.register.payment.Method;
|
import com.garbagemule.register.payment.Method;
|
||||||
import com.garbagemule.register.payment.Methods;
|
import com.garbagemule.register.payment.Methods;
|
||||||
@@ -34,23 +35,22 @@ public class MobArena extends JavaPlugin
|
|||||||
private Configuration config;
|
private Configuration config;
|
||||||
private ArenaMaster am;
|
private ArenaMaster am;
|
||||||
|
|
||||||
// Permissions stuff
|
|
||||||
//private PermissionHandler permissionHandler;
|
|
||||||
|
|
||||||
// Heroes stuff
|
|
||||||
private HeroManager heroManager = null;
|
|
||||||
|
|
||||||
// Economy stuff
|
// Economy stuff
|
||||||
protected Methods Methods;
|
protected Methods Methods;
|
||||||
protected Method Method;
|
protected Method Method;
|
||||||
|
|
||||||
|
// Spout stuff
|
||||||
|
public static boolean hasSpout;
|
||||||
|
|
||||||
|
// Heroes stuff
|
||||||
|
private HeroManager heroManager = null;
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
public static PluginDescriptionFile desc;
|
public static PluginDescriptionFile desc;
|
||||||
public static File dir, arenaDir;
|
public static File dir, arenaDir;
|
||||||
public static final double MIN_PLAYER_DISTANCE = 15.0;
|
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 double MIN_PLAYER_DISTANCE_SQUARED = MIN_PLAYER_DISTANCE * MIN_PLAYER_DISTANCE;
|
||||||
public static final int ECONOMY_MONEY_ID = -29;
|
public static final int ECONOMY_MONEY_ID = -29;
|
||||||
public static boolean hasSpout;
|
|
||||||
public static Random random = new Random();
|
public static Random random = new Random();
|
||||||
|
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
@@ -69,11 +69,11 @@ public class MobArena extends JavaPlugin
|
|||||||
// Download external libraries if needed.
|
// Download external libraries if needed.
|
||||||
FileUtils.fetchLibs(config);
|
FileUtils.fetchLibs(config);
|
||||||
|
|
||||||
// Set up permissions and economy
|
// Set up soft dependencies
|
||||||
//setupPermissions();
|
|
||||||
setupRegister();
|
setupRegister();
|
||||||
setupSpout();
|
setupSpout();
|
||||||
setupHeroes();
|
setupHeroes();
|
||||||
|
setupMagicSpells();
|
||||||
|
|
||||||
// Set up the ArenaMaster and the announcements
|
// Set up the ArenaMaster and the announcements
|
||||||
am = new ArenaMaster(this);
|
am = new ArenaMaster(this);
|
||||||
@@ -147,11 +147,7 @@ public class MobArena extends JavaPlugin
|
|||||||
|
|
||||||
// Permissions stuff
|
// Permissions stuff
|
||||||
public boolean has(Player p, String s)
|
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 the permission is set, check if player has permission
|
||||||
if (p.isPermissionSet(s))
|
if (p.isPermissionSet(s))
|
||||||
return p.hasPermission(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 warning(String msg) { Bukkit.getServer().getLogger().warning("[MobArena] " + msg); }
|
||||||
public static void error(String msg) { Bukkit.getServer().getLogger().severe("[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()
|
private void setupRegister()
|
||||||
{
|
{
|
||||||
Methods = new Methods();
|
Methods = new Methods();
|
||||||
@@ -203,6 +188,16 @@ public class MobArena extends JavaPlugin
|
|||||||
heroManager = ((Heroes) heroes).getHeroManager();
|
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 Configuration getConfig() { return config; }
|
||||||
public ArenaMaster getAM() { return am; } // More convenient.
|
public ArenaMaster getAM() { return am; } // More convenient.
|
||||||
public ArenaMaster getArenaMaster() { return am; }
|
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