Adapt to NCP API changes (NCP build 158 +).

This commit is contained in:
asofold 2012-10-17 18:31:02 +02:00
parent e0adae50e8
commit d6c093d2fd
4 changed files with 21 additions and 9 deletions

View File

@ -43,9 +43,18 @@ add a good mechanism for adding external configurable hooks (read automatically
? HookInstaBreak : add static method to sset check types to exempt from for next break ?
cncp: check at least for logs / leaves for skill specific block types
VERSION HISTORY
---------------------------
(6.2.10)
- Adapt to NCP API changes (NCP build 158 +).
(6.2.9)
- Adapt API to NCP / 1.3.2.
(6.2.8) Add SpoutClientPlayer to default classes.
(...)

View File

@ -10,6 +10,7 @@ import net.citizensnpcs.api.CitizensAPI;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.IViolationInfo;
import fr.neatmonster.nocheatplus.hooks.NCPHook;
public class HookCitizens2 extends AbstractHook implements ConfigurableHook{
@ -32,7 +33,7 @@ public class HookCitizens2 extends AbstractHook implements ConfigurableHook{
@Override
public String getHookVersion() {
return "2.0";
return "2.1";
}
@Override
@ -40,17 +41,17 @@ public class HookCitizens2 extends AbstractHook implements ConfigurableHook{
if (ncpHook == null){
ncpHook = new NCPHook() {
@Override
public boolean onCheckFailure(CheckType checkType, Player player) {
public final boolean onCheckFailure(final CheckType checkType, final Player player, IViolationInfo info) {
return CitizensAPI.getNPCRegistry().isNPC(player);
}
@Override
public String getHookVersion() {
return "1.0";
public final String getHookVersion() {
return "2.0";
}
@Override
public String getHookName() {
public final String getHookName() {
return "Citizens2(cncp)";
}
};

View File

@ -13,6 +13,7 @@ import me.asofold.bpl.cncp.hooks.AbstractHook;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.IViolationInfo;
import fr.neatmonster.nocheatplus.hooks.NCPHook;
public final class HookPlayerClass extends AbstractHook implements ConfigurableHook {
@ -43,7 +44,7 @@ public final class HookPlayerClass extends AbstractHook implements ConfigurableH
@Override
public final String getHookVersion() {
return "2.1";
return "2.2";
}
@Override
@ -51,7 +52,7 @@ public final class HookPlayerClass extends AbstractHook implements ConfigurableH
if (ncpHook == null){
ncpHook = new NCPHook() {
@Override
public boolean onCheckFailure(CheckType checkType, Player player) {
public final boolean onCheckFailure(final CheckType checkType, final Player player, final IViolationInfo info) {
if (exemptAll && !playerClassNames.contains(player.getClass().getSimpleName())) return true;
else {
if (classNames.isEmpty()) return false;
@ -77,7 +78,7 @@ public final class HookPlayerClass extends AbstractHook implements ConfigurableH
@Override
public String getHookVersion() {
return "2.0";
return "3.0";
}
@Override

View File

@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.IViolationInfo;
import fr.neatmonster.nocheatplus.hooks.NCPHook;
import fr.neatmonster.nocheatplus.utilities.ActionFrequency;
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
@ -92,7 +93,7 @@ public class HookFacadeImpl implements HookFacade, NCPHook {
}
@Override
public final boolean onCheckFailure(CheckType checkType, final Player player) {
public final boolean onCheckFailure(final CheckType checkType, final Player player, final IViolationInfo info) {
// 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.