Maven not found for MagicSpells, remove this hook for the time being.

This commit is contained in:
asofold 2015-07-30 12:44:43 +02:00
parent 64da08c65c
commit 0c52cbef60
4 changed files with 38 additions and 63 deletions

View File

@ -1,8 +0,0 @@
The folder "local-maven" contains the following dependencies,
some of which will be removed, once the maven repository is found (see pom.xml):
- NoCheatPlus
- mcMMO
- MagicSpells
- Citizens
TODO: Links to the projects, re-check for CURRENT repositories.

View File

@ -59,13 +59,6 @@
<version>2.0.16-SNAPSHOT</version> <version>2.0.16-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.nisovin</groupId>
<artifactId>MagicSpells</artifactId>
<version>todo</version>
<scope>system</scope>
<systemPath>${basedir}/local-maven/MagicSpells.jar</systemPath>
</dependency>
</dependencies> </dependencies>
<!-- Building --> <!-- Building -->

View File

@ -182,11 +182,11 @@ public class CompatNoCheatPlus extends JavaPlugin implements Listener {
builtinHooks.add(new me.asofold.bpl.cncp.hooks.mcmmo.HookmcMMO()); builtinHooks.add(new me.asofold.bpl.cncp.hooks.mcmmo.HookmcMMO());
} }
catch (Throwable t){} catch (Throwable t){}
// MagicSpells // // MagicSpells
try{ // try{
builtinHooks.add(new me.asofold.bpl.cncp.hooks.magicspells.HookMagicSpells()); // builtinHooks.add(new me.asofold.bpl.cncp.hooks.magicspells.HookMagicSpells());
} // }
catch (Throwable t){} // catch (Throwable t){}
// Simple generic hooks // Simple generic hooks
for (Hook hook : new Hook[]{ for (Hook hook : new Hook[]{
new HookPlayerClass(), new HookPlayerClass(),

View File

@ -10,21 +10,11 @@ import me.asofold.bpl.cncp.config.compatlayer.CompatConfig;
import me.asofold.bpl.cncp.config.compatlayer.CompatConfigFactory; import me.asofold.bpl.cncp.config.compatlayer.CompatConfigFactory;
import me.asofold.bpl.cncp.config.compatlayer.ConfigUtil; import me.asofold.bpl.cncp.config.compatlayer.ConfigUtil;
import me.asofold.bpl.cncp.hooks.AbstractConfigurableHook; import me.asofold.bpl.cncp.hooks.AbstractConfigurableHook;
import me.asofold.bpl.cncp.utils.TickTask2;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import com.nisovin.magicspells.Spell;
import com.nisovin.magicspells.Spell.SpellCastState;
import com.nisovin.magicspells.events.SpellCastEvent;
import com.nisovin.magicspells.events.SpellCastedEvent;
import fr.neatmonster.nocheatplus.checks.CheckType; import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
public class HookMagicSpells extends AbstractConfigurableHook implements Listener{ public class HookMagicSpells extends AbstractConfigurableHook implements Listener{
@ -42,39 +32,39 @@ public class HookMagicSpells extends AbstractConfigurableHook implements Listene
}; };
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) // @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSpellCast(final SpellCastEvent event){ // public void onSpellCast(final SpellCastEvent event){
if (event.getSpellCastState() != SpellCastState.NORMAL) return; // if (event.getSpellCastState() != SpellCastState.NORMAL) return;
exempt(event.getCaster(), event.getSpell()); // exempt(event.getCaster(), event.getSpell());
} // }
//
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) // @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSpellCasted(final SpellCastedEvent event){ // public void onSpellCasted(final SpellCastedEvent event){
unexempt(event.getCaster(), event.getSpell()); // unexempt(event.getCaster(), event.getSpell());
} // }
//
private void exempt(final Player player, final Spell spell) { // private void exempt(final Player player, final Spell spell) {
final CheckType[] types = getCheckTypes(spell); // final CheckType[] types = getCheckTypes(spell);
if (types == null) return; // if (types == null) return;
for (final CheckType type : types){ // for (final CheckType type : types){
NCPExemptionManager.exemptPermanently(player, type); // NCPExemptionManager.exemptPermanently(player, type);
// Safety fall-back: // // Safety fall-back:
// TODO: Might interfere with "slow" effects of spells ? [might add config for this.] // // TODO: Might interfere with "slow" effects of spells ? [might add config for this.]
TickTask2.addUnexemptions(player, types); // TickTask2.addUnexemptions(player, types);
} // }
} // }
//
private void unexempt(final Player player, final Spell spell) { // private void unexempt(final Player player, final Spell spell) {
final CheckType[] types = getCheckTypes(spell); // final CheckType[] types = getCheckTypes(spell);
if (types == null) return; // if (types == null) return;
for (final CheckType type : types){ // for (final CheckType type : types){
NCPExemptionManager.unexempt(player, type); // NCPExemptionManager.unexempt(player, type);
} // }
} // }
//
protected CheckType[] getCheckTypes(final Spell spell){ // protected CheckType[] getCheckTypes(final Spell spell){
return spellMap.get(spell.getName()); // return spellMap.get(spell.getName());
} // }
/* (non-Javadoc) /* (non-Javadoc)
* @see me.asofold.bpl.cncp.hooks.AbstractConfigurableHook#applyConfig(me.asofold.bpl.cncp.config.compatlayer.CompatConfig, java.lang.String) * @see me.asofold.bpl.cncp.hooks.AbstractConfigurableHook#applyConfig(me.asofold.bpl.cncp.config.compatlayer.CompatConfig, java.lang.String)