mirror of
https://github.com/asofold/CompatNoCheatPlus.git
synced 2024-11-18 11:16:23 +01:00
Quick adaption: back to NoCheatPlus
This commit is contained in:
parent
addfd395a6
commit
dd0c22fae2
@ -22,6 +22,15 @@ STACK
|
||||
VERSION HISTORY
|
||||
---------------------------
|
||||
|
||||
(3.0.0)
|
||||
- (BIG CHANGE) Back to NoCheatPlus !
|
||||
This is a quick adaption only for a few check types,
|
||||
it would probably not work with all thinkable external hooks.
|
||||
Supported mappings:
|
||||
(all)
|
||||
fight: speed, angle
|
||||
moving: survivalfly, creativefly, nofall
|
||||
blockbreak: fastbreak, noswing, direction
|
||||
|
||||
(2.0.1)
|
||||
- (bugfix?) Re release with corrected class name (something went wrong).
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: CompatNoCheatPlus
|
||||
main: me.asofold.bpl.cncp.CompatNoCheatPlus
|
||||
version: 2.0.1
|
||||
version: 3.0.0
|
||||
depend:
|
||||
- DeadNoCheat
|
||||
- NoCheatPlus
|
||||
softdepend:
|
||||
- mcMMO
|
@ -15,8 +15,6 @@ import me.asofold.bpl.cncp.hooks.generic.HookPlayerClass;
|
||||
import me.asofold.bpl.cncp.setttings.GroupHooks;
|
||||
import me.asofold.bpl.cncp.setttings.Settings;
|
||||
import me.asofold.bpl.cncp.utils.Utils;
|
||||
import me.asofold.bpl.dead.nocheat.checks.Check;
|
||||
import me.asofold.bpl.dead.nocheat.checks.CheckEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Server;
|
||||
@ -28,8 +26,18 @@ import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.CheckEvent;
|
||||
import fr.neatmonster.nocheatplus.checks.blockbreak.Direction.DirectionEvent;
|
||||
import fr.neatmonster.nocheatplus.checks.blockbreak.FastBreak.FastBreakEvent;
|
||||
import fr.neatmonster.nocheatplus.checks.blockbreak.NoSwing.NoSwingEvent;
|
||||
import fr.neatmonster.nocheatplus.checks.fight.Angle.AngleEvent;
|
||||
import fr.neatmonster.nocheatplus.checks.fight.Speed.SpeedEvent;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.CreativeFly.CreativeFlyEvent;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.NoFall.NoFallEvent;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.SurvivalFly.SurvivalFlyEvent;
|
||||
|
||||
/**
|
||||
* Quick attempt to provide compatibility to DeadNoCheat (former NoCheatPlus by NeatMonster) for some other plugins that change the vanilla game mechanichs, for instance by fast block breaking.
|
||||
* Quick attempt to provide compatibility to NoCheatPlus (by NeatMonster) for some other plugins that change the vanilla game mechanichs, for instance by fast block breaking.
|
||||
* @author mc_dev
|
||||
*
|
||||
*/
|
||||
@ -243,9 +251,48 @@ public class CompatNoCheatPlus extends JavaPlugin implements Listener {
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled=true)
|
||||
final void onCheckFail(final CheckEvent event){
|
||||
// Check hooks, most specific first:
|
||||
final Check check = event.getCheck();
|
||||
final String gn = check.getGroup();
|
||||
final String cn = check.getName();
|
||||
final String gn;
|
||||
final String cn;
|
||||
|
||||
|
||||
if (event instanceof SurvivalFlyEvent){
|
||||
gn = "moving";
|
||||
cn = "survivalfly";
|
||||
}
|
||||
else if (event instanceof CreativeFlyEvent){
|
||||
gn = "moving";
|
||||
cn = "creativefly";
|
||||
}
|
||||
else if (event instanceof NoFallEvent){
|
||||
gn = "moving";
|
||||
cn = "nofall";
|
||||
}
|
||||
else if (event instanceof FastBreakEvent){
|
||||
gn = "blockbreak";
|
||||
cn = "fastbreak";
|
||||
}
|
||||
else if (event instanceof NoSwingEvent){
|
||||
gn = "blockbreak";
|
||||
cn = "noswing";
|
||||
}
|
||||
else if (event instanceof DirectionEvent){
|
||||
gn = "blockbreak";
|
||||
cn = "direction";
|
||||
}
|
||||
else if (event instanceof SpeedEvent){
|
||||
gn = "fight";
|
||||
cn = "speed";
|
||||
}
|
||||
else if (event instanceof AngleEvent){
|
||||
gn = "fight";
|
||||
cn = "angle";
|
||||
}
|
||||
else{
|
||||
// TODO: ...
|
||||
gn = "";
|
||||
cn = "";
|
||||
}
|
||||
|
||||
final GroupHooks gh = hooksGroups.get(gn.trim().toLowerCase());
|
||||
if (gh != null){
|
||||
final ArrayList<Hook> hooks = gh.byCheck.get(cn.trim().toLowerCase());
|
||||
|
@ -1,9 +1,9 @@
|
||||
package me.asofold.bpl.cncp.hooks;
|
||||
|
||||
import me.asofold.bpl.dead.nocheat.checks.CheckEvent;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.CheckEvent;
|
||||
|
||||
/**
|
||||
* Interface for hooking into another plugin.<br>
|
||||
*
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import me.asofold.bpl.cncp.hooks.AbstractHook;
|
||||
import me.asofold.bpl.dead.nocheat.checks.CheckEvent;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckEvent;
|
||||
|
||||
public final class HookPlayerClass extends AbstractHook {
|
||||
|
||||
@ -48,15 +48,15 @@ public final class HookPlayerClass extends AbstractHook {
|
||||
|
||||
@Override
|
||||
public final String getHookVersion() {
|
||||
return "0.0";
|
||||
return "0.1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void processEvent(final String group, final String check, final CheckEvent event) {
|
||||
if (exemptAll && !event.getPlayer().getBukkitPlayer().getClass().getSimpleName().equals(playerClassName)) event.setCancelled(true);
|
||||
if (exemptAll && !event.getPlayer().getClass().getSimpleName().equals(playerClassName)) event.setCancelled(true);
|
||||
else {
|
||||
if (classNames.isEmpty()) return;
|
||||
final Class<?> clazz = event.getPlayer().getBukkitPlayer().getClass();
|
||||
final Class<?> clazz = event.getPlayer().getClass();
|
||||
final String name = clazz.getSimpleName();
|
||||
if (classNames.contains(name)) event.setCancelled(true);
|
||||
else if (checkSuperClass){
|
||||
|
@ -5,8 +5,6 @@ import java.util.Map;
|
||||
|
||||
import me.asofold.bpl.cncp.hooks.AbstractHook;
|
||||
import me.asofold.bpl.cncp.utils.PluginGetter;
|
||||
import me.asofold.bpl.dead.nocheat.checks.CheckEvent;
|
||||
import me.asofold.bpl.dead.nocheat.players.DNCPlayer;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -19,6 +17,8 @@ import com.gmail.nossr50.events.fake.FakeBlockBreakEvent;
|
||||
import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.CheckEvent;
|
||||
|
||||
public final class HookmcMMO extends AbstractHook implements Listener {
|
||||
|
||||
private static final Map<String, Integer> cancelChecksBlockBreak = new HashMap<String, Integer>();
|
||||
@ -54,7 +54,7 @@ public final class HookmcMMO extends AbstractHook implements Listener {
|
||||
|
||||
@Override
|
||||
public String getHookVersion() {
|
||||
return "0.0";
|
||||
return "0.1";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -62,7 +62,7 @@ public final class HookmcMMO extends AbstractHook implements Listener {
|
||||
return new String[][]{
|
||||
{"blockbreak", "fastbreak", "noswing"},
|
||||
{"fight", "angle", "speed"},
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -126,11 +126,12 @@ public final class HookmcMMO extends AbstractHook implements Listener {
|
||||
// System.out.println("[cncp] Return on cancel == null: "+event.getPlayer().getName());
|
||||
return;
|
||||
}
|
||||
final DNCPlayer ncpPlayer = event.getPlayer();
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
final String name = ncpPlayer.getName();
|
||||
final String name = player.getName();
|
||||
if (cancel.equals(name)){
|
||||
final Player player = ncpPlayer.getBukkitPlayer();
|
||||
|
||||
if (player == null || player.getTicksLived() != cancelTicks){
|
||||
// System.out.println("[cncp] No cancel (ticks/player): "+event.getPlayer().getName());
|
||||
cancel = null;
|
||||
|
@ -25,7 +25,7 @@ public class Settings {
|
||||
public static CompatConfig getDefaultConfig(){
|
||||
CompatConfig cfg = new NewConfig(null);
|
||||
Settings ref = new Settings();
|
||||
cfg.set("plugins.force-enable-later", ConfigUtil.asList(new String[]{ "DeadNoCheat" }));
|
||||
cfg.set("plugins.force-enable-later", ConfigUtil.asList(new String[]{ "NoCheatPlus" }));
|
||||
cfg.set("plugins.ensure-enable", ConfigUtil.asList(new String[]{ "WorldGuard" }));
|
||||
cfg.set("hooks.player-class.exempt-names", new LinkedList<String>());
|
||||
cfg.set("hooks.player-class.exempt-all", ref.exemptAllPlayerClassNames);
|
||||
|
Loading…
Reference in New Issue
Block a user