Add CMI
This commit is contained in:
parent
5533a67f0b
commit
3fe0212321
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
name: CompatNoCheatPlus
|
||||
main: me.asofold.bpl.cncp.CompatNoCheatPlus
|
||||
version: ${project.version}-s${BUILD_SERIES}-b${BUILD_NUMBER}
|
||||
version: ${project.version}-${buildDescription}
|
||||
dev-url: http://dev.bukkit.org/server-mods/compatnocheatplus-cncp/
|
||||
|
||||
loadbefore:
|
||||
|
@ -9,6 +9,8 @@ softdepend:
|
|||
- mcMMO
|
||||
- Citizens
|
||||
- MagicSpells
|
||||
- GravityTubes
|
||||
- CMI
|
||||
|
||||
commands:
|
||||
compatnocheatplus:
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
<url>http://repo.citizensnpcs.co/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>repo-public</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||
<id>drtshock-repo</id>
|
||||
<url>http://ci.drtshock.net/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
@ -48,13 +48,13 @@
|
|||
<dependency>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.158</version>
|
||||
<version>1.5.04-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus</artifactId>
|
||||
<version>3.16.1-SNAPSHOT</version>
|
||||
<version>3.16.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -62,43 +62,10 @@
|
|||
<artifactId>citizensapi</artifactId>
|
||||
<version>2.0.16-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.benzoft.gravitytubes</groupId>
|
||||
<artifactId>gravitytubes</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/GravityTubes.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- Build Description Profiles -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>timestamp</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>!env.BUILD_NUMBER</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<buildDescription>${maven.build.timestamp}</buildDescription>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>dynamic_build_number</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env.BUILD_NUMBER</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<buildDescription>b${env.BUILD_NUMBER}</buildDescription>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<!-- Building -->
|
||||
|
||||
<!-- Building -->
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<sourceDirectory>${basedir}/src</sourceDirectory>
|
||||
|
@ -119,8 +86,8 @@
|
|||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -139,6 +106,7 @@
|
|||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@ -147,6 +115,7 @@
|
|||
<!-- Properties -->
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.build.timestamp.format>yyyy_MM_dd-HH_mm</maven.build.timestamp.format>
|
||||
<BUILD_SERIES>?</BUILD_SERIES>
|
||||
<BUILD_NUMBER>?</BUILD_NUMBER>
|
||||
</properties>
|
||||
</project>
|
|
@ -187,6 +187,11 @@ public class CompatNoCheatPlus extends JavaPlugin implements Listener {
|
|||
builtinHooks.add(new me.asofold.bpl.cncp.hooks.GravityTubes.HookGravityTubes());
|
||||
}
|
||||
catch(Throwable t){}
|
||||
// CMI
|
||||
try {
|
||||
builtinHooks.add(new me.asofold.bpl.cncp.hooks.CMI.HookCMI());
|
||||
}
|
||||
catch (Throwable t){}
|
||||
// // MagicSpells
|
||||
// try{
|
||||
// builtinHooks.add(new me.asofold.bpl.cncp.hooks.magicspells.HookMagicSpells());
|
||||
|
|
|
@ -0,0 +1,142 @@
|
|||
package me.asofold.bpl.cncp.hooks.CMI;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import com.Zrips.CMI.CMI;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.access.IViolationInfo;
|
||||
import fr.neatmonster.nocheatplus.hooks.NCPHook;
|
||||
import me.asofold.bpl.cncp.CompatNoCheatPlus;
|
||||
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.AbstractHook;
|
||||
import me.asofold.bpl.cncp.hooks.generic.ConfigurableHook;
|
||||
import me.asofold.bpl.cncp.hooks.generic.ExemptionManager;
|
||||
import me.asofold.bpl.cncp.utils.TickTask2;
|
||||
|
||||
public class HookCMI extends AbstractHook implements Listener, ConfigurableHook {
|
||||
|
||||
protected Object ncpHook = null;
|
||||
|
||||
protected boolean enabled = true;
|
||||
|
||||
protected String configPrefix = "cmi.";
|
||||
|
||||
protected final ExemptionManager exMan = new ExemptionManager();
|
||||
|
||||
protected final CheckType[] exemptBreakMany = new CheckType[]{
|
||||
CheckType.BLOCKBREAK, CheckType.COMBINED_IMPROBABLE,
|
||||
};
|
||||
|
||||
protected final CheckType[] exemptPlaceMany = new CheckType[]{
|
||||
CheckType.BLOCKPLACE, CheckType.COMBINED_IMPROBABLE,
|
||||
};
|
||||
|
||||
public HookCMI(){
|
||||
assertPluginPresent("CMI");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return "CMI(default)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookVersion() {
|
||||
return "1.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener[] getListeners() {
|
||||
return new Listener[]{
|
||||
this
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public NCPHook getNCPHook() {
|
||||
if (ncpHook == null){
|
||||
ncpHook = new NCPHook() {
|
||||
@Override
|
||||
public String getHookName() {
|
||||
return "CMI(cncp)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookVersion() {
|
||||
return "1.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCheckFailure(CheckType checkType, Player player, IViolationInfo info) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
return (NCPHook) ncpHook;
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.MONITOR)
|
||||
//@RegisterMethodWithOrder(tag = CompatNoCheatPlus.tagLateFeature, afterTag = CompatNoCheatPlus.afterTagLateFeature)
|
||||
public final void onMirrorBreakMonitor(final BlockBreakEvent event){
|
||||
removeExemption(event.getPlayer(), exemptBreakMany);
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOWEST)
|
||||
//@RegisterMethodWithOrder(tag = CompatNoCheatPlus.tagEarlyFeature, beforeTag = CompatNoCheatPlus.beforeTagEarlyFeature)
|
||||
public final void onMirrorBreakLowest(final BlockBreakEvent event){
|
||||
if (CMI.getInstance().getMirrorManager().isMirroring(event.getPlayer())) {
|
||||
addExemption(event.getPlayer(), exemptBreakMany);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.MONITOR)
|
||||
//@RegisterMethodWithOrder(tag = CompatNoCheatPlus.tagLateFeature, afterTag = CompatNoCheatPlus.afterTagLateFeature)
|
||||
public final void onMirrorPlaceMonitor(final BlockPlaceEvent event){
|
||||
removeExemption(event.getPlayer(), exemptPlaceMany);
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOWEST)
|
||||
//@RegisterMethodWithOrder(tag = CompatNoCheatPlus.tagEarlyFeature, beforeTag = CompatNoCheatPlus.beforeTagEarlyFeature)
|
||||
public final void onMirrorPlaceLowest(final BlockPlaceEvent event){
|
||||
if (CMI.getInstance().getMirrorManager().isMirroring(event.getPlayer())) {
|
||||
addExemption(event.getPlayer(), exemptPlaceMany);
|
||||
}
|
||||
}
|
||||
|
||||
public void addExemption(final Player player, final CheckType[] types){
|
||||
for (final CheckType type : types){
|
||||
exMan.addExemption(player, type);
|
||||
TickTask2.addUnexemptions(player, types);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeExemption(final Player player, final CheckType[] types){
|
||||
for (final CheckType type : types){
|
||||
exMan.removeExemption(player, type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyConfig(CompatConfig cfg, String prefix) {
|
||||
enabled = cfg.getBoolean(prefix + configPrefix + "enabled", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateConfig(CompatConfig cfg, String prefix) {
|
||||
CompatConfig defaults = CompatConfigFactory.getConfig(null);
|
||||
defaults.set(prefix + configPrefix + "enabled", true);
|
||||
return ConfigUtil.forceDefaults(defaults, cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue