Update to latest NCP changes.

This commit is contained in:
asofold 2016-06-21 20:13:39 +02:00
parent aeff9584d9
commit 4c265ec186
2 changed files with 223 additions and 224 deletions

View File

@ -54,7 +54,7 @@
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus</artifactId>
<version>3.14.0-SNAPSHOT</version>
<version>3.15.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -6,13 +6,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import me.asofold.bpl.cncp.CompatNoCheatPlus;
import me.asofold.bpl.cncp.hooks.generic.ExemptionManager;
import me.asofold.bpl.cncp.hooks.generic.HookInstaBreak;
import me.asofold.bpl.cncp.hooks.mcmmo.HookmcMMO.HookFacade;
import me.asofold.bpl.cncp.utils.ActionFrequency;
import me.asofold.bpl.cncp.utils.TickTask2;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -21,9 +14,15 @@ import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.access.IViolationInfo;
import fr.neatmonster.nocheatplus.hooks.NCPHook;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.BlockProperties.ToolProps;
import fr.neatmonster.nocheatplus.utilities.BlockProperties.ToolType;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties.ToolProps;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties.ToolType;
import me.asofold.bpl.cncp.CompatNoCheatPlus;
import me.asofold.bpl.cncp.hooks.generic.ExemptionManager;
import me.asofold.bpl.cncp.hooks.generic.HookInstaBreak;
import me.asofold.bpl.cncp.hooks.mcmmo.HookmcMMO.HookFacade;
import me.asofold.bpl.cncp.utils.ActionFrequency;
import me.asofold.bpl.cncp.utils.TickTask2;
@SuppressWarnings("deprecation")
public class HookFacadeImpl implements HookFacade, NCPHook {
@ -52,8 +51,8 @@ public class HookFacadeImpl implements HookFacade, NCPHook {
// Presets for after failure exemption.
protected final Map<CheckType, Integer> cancelChecksBlockBreak = new HashMap<CheckType, Integer>();
// protected final Map<CheckType, Integer> cancelChecksBlockDamage = new HashMap<CheckType, Integer>();
// protected final Map<CheckType, Integer> cancelChecksDamage = new HashMap<CheckType, Integer>();
// protected final Map<CheckType, Integer> cancelChecksBlockDamage = new HashMap<CheckType, Integer>();
// protected final Map<CheckType, Integer> cancelChecksDamage = new HashMap<CheckType, Integer>();
protected boolean useInstaBreakHook;
protected int clicksPerSecond;
@ -78,11 +77,11 @@ public class HookFacadeImpl implements HookFacade, NCPHook {
this.clicksPerSecond = clicksPerSecond;
cancelChecksBlockBreak.put(CheckType.BLOCKBREAK_NOSWING, 1);
cancelChecksBlockBreak.put(CheckType.BLOCKBREAK_FASTBREAK, 1);
//
// cancelChecksBlockDamage.put(CheckType.BLOCKBREAK_FASTBREAK, 1);
//
// cancelChecksDamage.put(CheckType.FIGHT_ANGLE, 1);
// cancelChecksDamage.put(CheckType.FIGHT_SPEED, 1);
//
// cancelChecksBlockDamage.put(CheckType.BLOCKBREAK_FASTBREAK, 1);
//
// cancelChecksDamage.put(CheckType.FIGHT_ANGLE, 1);
// cancelChecksDamage.put(CheckType.FIGHT_SPEED, 1);
}
@Override
@ -97,7 +96,7 @@ public class HookFacadeImpl implements HookFacade, NCPHook {
@Override
public final boolean onCheckFailure(final CheckType checkType, final Player player, final IViolationInfo info) {
// System.out.println(player.getName() + " -> " + checkType + "---------------------------");
// System.out.println(player.getName() + " -> " + checkType + "---------------------------");
// Somewhat generic canceling mechanism (within the same tick).
// Might later fail, if block break event gets scheduled after block damage having set insta break, instead of letting them follow directly.
if (cancel == null){
@ -152,22 +151,22 @@ public class HookFacadeImpl implements HookFacade, NCPHook {
@Override
public final void damageLowest(final Player player) {
// System.out.println("damage lowest");
// setPlayer(player, cancelChecksDamage);
// System.out.println("damage lowest");
// setPlayer(player, cancelChecksDamage);
addExemption(player, exemptFightEffect);
}
@Override
public final void blockDamageLowest(final Player player) {
// System.out.println("block damage lowest");
// setPlayer(player, cancelChecksBlockDamage);
// System.out.println("block damage lowest");
// setPlayer(player, cancelChecksBlockDamage);
if (getToolProps(player.getItemInHand()).toolType == ToolType.AXE) addExemption(player, exemptBreakMany);
else addExemption(player, exemptBreakNormal);
}
@Override
public final boolean blockBreakLowest(final Player player) {
// System.out.println("block break lowest");
// System.out.println("block break lowest");
final boolean isAxe = getToolProps(player.getItemInHand()).toolType == ToolType.AXE;
if (breakCancel > 0){
breakCancel ++;
@ -231,13 +230,13 @@ public class HookFacadeImpl implements HookFacade, NCPHook {
@Override
public void damageMonitor(Player player) {
// System.out.println("damage monitor");
// System.out.println("damage monitor");
removeExemption(player, exemptFightEffect);
}
@Override
public void blockDamageMonitor(Player player) {
// System.out.println("block damage monitor");
// System.out.println("block damage monitor");
if (getToolProps(player.getItemInHand()).toolType == ToolType.AXE) addExemption(player, exemptBreakMany);
else removeExemption(player, exemptBreakNormal);
}
@ -248,7 +247,7 @@ public class HookFacadeImpl implements HookFacade, NCPHook {
breakCancel --;
return;
}
// System.out.println("block break monitor");
// System.out.println("block break monitor");
removeExemption(player, exemptBreakNormal);
}