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>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.nisovin</groupId>
<artifactId>MagicSpells</artifactId>
<version>todo</version>
<scope>system</scope>
<systemPath>${basedir}/local-maven/MagicSpells.jar</systemPath>
</dependency>
</dependencies>
<!-- Building -->

View File

@ -182,11 +182,11 @@ public class CompatNoCheatPlus extends JavaPlugin implements Listener {
builtinHooks.add(new me.asofold.bpl.cncp.hooks.mcmmo.HookmcMMO());
}
catch (Throwable t){}
// MagicSpells
try{
builtinHooks.add(new me.asofold.bpl.cncp.hooks.magicspells.HookMagicSpells());
}
catch (Throwable t){}
// // MagicSpells
// try{
// builtinHooks.add(new me.asofold.bpl.cncp.hooks.magicspells.HookMagicSpells());
// }
// catch (Throwable t){}
// Simple generic hooks
for (Hook hook : new Hook[]{
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.ConfigUtil;
import me.asofold.bpl.cncp.hooks.AbstractConfigurableHook;
import me.asofold.bpl.cncp.utils.TickTask2;
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 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.hooks.NCPExemptionManager;
public class HookMagicSpells extends AbstractConfigurableHook implements Listener{
@ -42,39 +32,39 @@ public class HookMagicSpells extends AbstractConfigurableHook implements Listene
};
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSpellCast(final SpellCastEvent event){
if (event.getSpellCastState() != SpellCastState.NORMAL) return;
exempt(event.getCaster(), event.getSpell());
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSpellCasted(final SpellCastedEvent event){
unexempt(event.getCaster(), event.getSpell());
}
private void exempt(final Player player, final Spell spell) {
final CheckType[] types = getCheckTypes(spell);
if (types == null) return;
for (final CheckType type : types){
NCPExemptionManager.exemptPermanently(player, type);
// Safety fall-back:
// TODO: Might interfere with "slow" effects of spells ? [might add config for this.]
TickTask2.addUnexemptions(player, types);
}
}
private void unexempt(final Player player, final Spell spell) {
final CheckType[] types = getCheckTypes(spell);
if (types == null) return;
for (final CheckType type : types){
NCPExemptionManager.unexempt(player, type);
}
}
protected CheckType[] getCheckTypes(final Spell spell){
return spellMap.get(spell.getName());
}
// @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
// public void onSpellCast(final SpellCastEvent event){
// if (event.getSpellCastState() != SpellCastState.NORMAL) return;
// exempt(event.getCaster(), event.getSpell());
// }
//
// @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
// public void onSpellCasted(final SpellCastedEvent event){
// unexempt(event.getCaster(), event.getSpell());
// }
//
// private void exempt(final Player player, final Spell spell) {
// final CheckType[] types = getCheckTypes(spell);
// if (types == null) return;
// for (final CheckType type : types){
// NCPExemptionManager.exemptPermanently(player, type);
// // Safety fall-back:
// // TODO: Might interfere with "slow" effects of spells ? [might add config for this.]
// TickTask2.addUnexemptions(player, types);
// }
// }
//
// private void unexempt(final Player player, final Spell spell) {
// final CheckType[] types = getCheckTypes(spell);
// if (types == null) return;
// for (final CheckType type : types){
// NCPExemptionManager.unexempt(player, type);
// }
// }
//
// protected CheckType[] getCheckTypes(final Spell spell){
// return spellMap.get(spell.getName());
// }
/* (non-Javadoc)
* @see me.asofold.bpl.cncp.hooks.AbstractConfigurableHook#applyConfig(me.asofold.bpl.cncp.config.compatlayer.CompatConfig, java.lang.String)