mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-09 12:10:37 +01:00
Merge branch 'master' of
https://git@github.com/NeatMonster/NoCheatPlus.git Conflicts: src/fr/neatmonster/nocheatplus/checks/chat/ChatListener.java
This commit is contained in:
commit
d5a4082fd4
32
.gitignore
vendored
32
.gitignore
vendored
@ -1,32 +0,0 @@
|
||||
# Eclipse stuff
|
||||
/.classpath
|
||||
/.project
|
||||
/.settings
|
||||
|
||||
# netbeans
|
||||
/nbproject
|
||||
|
||||
# we use maven!
|
||||
/build.xml
|
||||
|
||||
# maven
|
||||
/target
|
||||
|
||||
# vim
|
||||
.*.sw[a-p]
|
||||
|
||||
# various other potential build files
|
||||
/build
|
||||
/bin
|
||||
/dist
|
||||
/manifest.mf
|
||||
|
||||
# Mac filesystem dust
|
||||
/.DS_Store
|
||||
|
||||
# intellij
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
/auth.properties
|
132
pom.xml
Normal file
132
pom.xml
Normal file
@ -0,0 +1,132 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<!-- Informations -->
|
||||
<name>NoCheatPlus</name>
|
||||
<version>3.7</version>
|
||||
<description>Detect and fight the exploitation of various flaws/bugs in Minecraft.</description>
|
||||
<url>http://dev.bukkit.org/server-mods/nocheatplus</url>
|
||||
|
||||
<groupId>fr.neatmonster.nocheatplus</groupId>
|
||||
<artifactId>NoCheatPlus</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<!-- License -->
|
||||
<licenses>
|
||||
<license>
|
||||
<name>GNU General Public License v3</name>
|
||||
<url>http://www.gnu.org/licenses/gpl-3.0.html</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<!-- Source code -->
|
||||
<scm>
|
||||
<developerConnection>scm:git:git@github.com:NeatMonster/${project.name}.git</developerConnection>
|
||||
<connection>scm:git:git://github.com/NeatMonster/${project.name}.git</connection>
|
||||
<url>https://github.com/NeatMonster/${project.name}</url>
|
||||
</scm>
|
||||
|
||||
<!-- Repositories -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>bukkit</id>
|
||||
<name>Bukkit</name>
|
||||
<url>http://repo.bukkit.org/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<!-- Dependencies -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.3.1-R1.0</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- Building -->
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<sourceDirectory>${basedir}/src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}</directory>
|
||||
<includes>
|
||||
<include>plugin.yml</include>
|
||||
<include>LICENSE.txt</include>
|
||||
<include>Instructions.txt</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<finalName>NoCheatPlus</finalName>
|
||||
<archive>
|
||||
<addMavenDescriptor>false</addMavenDescriptor>
|
||||
<pomPropertiesFile>false</pomPropertiesFile>
|
||||
<manifest>
|
||||
<addDefaultSpecificationEntries>false</addDefaultSpecificationEntries>
|
||||
<addDefaultImplementationEntries>false</addDefaultImplementationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>deploy-build</id>
|
||||
<phase>install</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<property file="auth.properties" prefix="auth" />
|
||||
<scp todir="${auth.user}:${auth.pass}@${auth.host}:${auth.path}"
|
||||
file="target/NoCheatPlus.jar" sftp="yes" trust="yes"
|
||||
failonerror="no" />
|
||||
<sshexec host="${auth.host}" username="${auth.user}"
|
||||
password="${auth.pass}" command="${auth.cmd}" trust="yes"
|
||||
failonerror="no" />
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-jsch</artifactId>
|
||||
<version>1.8.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<!-- Properties -->
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
@ -132,10 +132,10 @@ public class ChatListener implements Listener {
|
||||
* |___/
|
||||
*/
|
||||
final Player player = event.getPlayer();
|
||||
final ChatConfig cc = ChatConfig.getConfig(player); // Non critical use (concurrency).
|
||||
final ChatConfig cc = ChatConfig.getConfig(player);
|
||||
|
||||
// Then the no pwnage check, if the login isn't already disallowed.
|
||||
if (event.getResult() != Result.KICK_OTHER && noPwnage.check(player))
|
||||
// Execute the no pwnage check.
|
||||
if (noPwnage.isEnabled(player) && noPwnage.check(player))
|
||||
event.disallow(Result.KICK_OTHER, cc.noPwnageReloginKickMessage);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class InstantHeal extends Check {
|
||||
return false;
|
||||
}
|
||||
|
||||
final long delta = System.currentTimeMillis() - (data.instantHealLastTime + 3500L);
|
||||
final long delta = System.currentTimeMillis() - (data.instantHealLastTime + 3000L);
|
||||
data.instantHealBuffer += delta;
|
||||
|
||||
if (data.instantHealBuffer < 0) {
|
||||
|
@ -67,6 +67,9 @@ public class MovingListener implements Listener {
|
||||
/** The more packets vehicle check. */
|
||||
private final MorePacketsVehicle morePacketsVehicle = new MorePacketsVehicle();
|
||||
|
||||
/** The no fall check. */
|
||||
private final NoFall noFall = new NoFall();
|
||||
|
||||
/** The survival fly check. */
|
||||
private final SurvivalFly survivalFly = new SurvivalFly();
|
||||
|
||||
@ -313,10 +316,13 @@ public class MovingListener implements Listener {
|
||||
if ((player.getGameMode() == GameMode.CREATIVE || player.getAllowFlight()) && creativeFly.isEnabled(player))
|
||||
// If the player is handled by the creative fly check, execute it.
|
||||
newTo = creativeFly.check(player, from, to);
|
||||
else if (survivalFly.isEnabled(player))
|
||||
else if (survivalFly.isEnabled(player)) {
|
||||
// If he is handled by the survival fly check, execute it.
|
||||
newTo = survivalFly.check(player, from, to);
|
||||
else
|
||||
if (newTo == null && noFall.isEnabled(player))
|
||||
// If he is handled by the no fall check, execute it.
|
||||
noFall.check(player, from, to);
|
||||
} else
|
||||
// He isn't handled by any fly check, clear his data.
|
||||
data.clearFlyData();
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class NoFall extends Check {
|
||||
// feeling.
|
||||
if (from.getY() > to.getY()) {
|
||||
final float deltaY = (float) (from.getY() - to.getY());
|
||||
data.noFallDistance += deltaY * 0.75F; // Magic number. :)
|
||||
data.noFallDistance += deltaY * 0.75D; // Magic number. :)
|
||||
|
||||
if (deltaY > 1F) {
|
||||
data.noFallLastAddedDistance = deltaY;
|
||||
@ -114,7 +114,7 @@ public class NoFall extends Check {
|
||||
} else
|
||||
data.noFallLastAddedDistance = 0F;
|
||||
|
||||
if (to.isOnGround())
|
||||
if (to.isOnGround() || from.isOnStairs())
|
||||
data.noFallDistance = 0F;
|
||||
|
||||
// Reduce violation level.
|
||||
|
@ -84,7 +84,7 @@ public class SurvivalFly extends Check {
|
||||
private static final double SOULSAND_SPRINTING_MOVE = 0.18D;
|
||||
|
||||
/** The horizontal speed limit when sprinting. */
|
||||
private static final double SPRINTING_MOVE = 0.37D;
|
||||
private static final double SPRINTING_MOVE = 0.35D;
|
||||
|
||||
/** The vertical speed limit when ascending into water. */
|
||||
private static final double WATER_ASCEND = 0.13D + MARGIN;
|
||||
@ -95,9 +95,6 @@ public class SurvivalFly extends Check {
|
||||
/** The horizontal speed limit when moving into water. */
|
||||
private static final double WATER_MOVE = 0.18D;
|
||||
|
||||
/** The no fall check. */
|
||||
private final NoFall noFall = new NoFall();
|
||||
|
||||
/**
|
||||
* Instantiates a new survival fly check.
|
||||
*/
|
||||
@ -177,7 +174,7 @@ public class SurvivalFly extends Check {
|
||||
hAllowedDistance = cc.survivalFlyBlockingSpeed / 100D * BLOCKING_MOVE;
|
||||
else if (from.isInWater() && to.isInWater())
|
||||
hAllowedDistance = cc.survivalFlyWaterSpeed / 100D * WATER_MOVE;
|
||||
else if (player.isSprinting() && player.getFoodLevel() > 5)
|
||||
else if (sprinting)
|
||||
hAllowedDistance = cc.survivalFlySprintingSpeed / 100D * SPRINTING_MOVE;
|
||||
|
||||
if (data.survivalFlyOnIce > 0)
|
||||
@ -221,6 +218,16 @@ public class SurvivalFly extends Check {
|
||||
|
||||
hDistanceAboveLimit = Math.max(0D, hDistanceAboveLimit);
|
||||
|
||||
if (hDistanceAboveLimit == 0D && sprinting && !player.hasPermission(Permissions.MOVING_SURVIVALFLY_SPRINTING)) {
|
||||
final double dX = to.getX() - from.getX();
|
||||
final double dZ = to.getZ() - from.getZ();
|
||||
final float yaw = from.getYaw();
|
||||
// Prevent players from sprinting if they're moving backwards.
|
||||
if (dX < 0D && dZ > 0D && yaw > 180F && yaw < 270F || dX < 0D && dZ < 0D && yaw > 270F && yaw < 360F
|
||||
|| dX > 0D && dZ < 0D && yaw > 0F && yaw < 90F || dX > 0D && dZ > 0D && yaw > 90F && yaw < 180F)
|
||||
hDistanceAboveLimit = hDistance;
|
||||
}
|
||||
|
||||
// Potion effect "Jump".
|
||||
double jumpAmplifier = 1D;
|
||||
if (entity.hasEffect(MobEffectList.JUMP)) {
|
||||
@ -288,7 +295,8 @@ public class SurvivalFly extends Check {
|
||||
data.survivalFlyLastDistances[1] = data.survivalFlyLastDistances[0];
|
||||
data.survivalFlyLastDistances[0] = vDistance;
|
||||
|
||||
double vAllowedDistance = (data.verticalFreedom + 1.35D) * data.jumpAmplifier;
|
||||
double vAllowedDistance = (data.verticalFreedom + (!from.isOnGround() && to.isOnGround() ? 1.5D : 1.35D))
|
||||
* data.jumpAmplifier;
|
||||
if (data.survivalFlyJumpPhase > JUMP_PHASE + data.jumpAmplifier)
|
||||
vAllowedDistance -= (data.survivalFlyJumpPhase - JUMP_PHASE) * JUMP_STEP;
|
||||
|
||||
@ -352,10 +360,6 @@ public class SurvivalFly extends Check {
|
||||
data.survivalFlyJumpPhase = 0;
|
||||
}
|
||||
|
||||
if (noFall.isEnabled(player))
|
||||
// Execute the NoFall check.
|
||||
noFall.check(player, from, to);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,6 @@ public class Permissions {
|
||||
* "88,d88 888 888 "88 888 888
|
||||
*/
|
||||
private static final String CHAT = CHECKS + ".chat";
|
||||
public static final String CHAT_ARRIVALS = CHAT + ".arrivals";
|
||||
public static final String CHAT_COLOR = CHAT + ".color";
|
||||
public static final String CHAT_NOPWNAGE = CHAT + ".nopwnage";
|
||||
|
||||
@ -167,4 +166,5 @@ public class Permissions {
|
||||
public static final String MOVING_SURVIVALFLY = MOVING + ".survivalfly";
|
||||
public static final String MOVING_SURVIVALFLY_BLOCKING = MOVING_SURVIVALFLY + ".blocking";
|
||||
public static final String MOVING_SURVIVALFLY_SNEAKING = MOVING_SURVIVALFLY + ".sneaking";
|
||||
public static final String MOVING_SURVIVALFLY_SPRINTING = MOVING_SURVIVALFLY + ".sprinting";
|
||||
}
|
||||
|
@ -102,6 +102,9 @@ public class PlayerLocation {
|
||||
/** Is the player on soul sand? */
|
||||
private final CustomBoolean onSoulSand = new CustomBoolean();
|
||||
|
||||
/** Is the player on stairs? */
|
||||
private final CustomBoolean onStairs = new CustomBoolean();
|
||||
|
||||
/** The bounding box of the player. */
|
||||
private final AxisAlignedBB boundingBox;
|
||||
|
||||
@ -348,4 +351,30 @@ public class PlayerLocation {
|
||||
}
|
||||
return onSoulSand.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player is on stairs.
|
||||
*
|
||||
* @return true, if the player is on stairs
|
||||
*/
|
||||
public boolean isOnStairs() {
|
||||
if (!onStairs.isSet()) {
|
||||
AxisAlignedBB boundingBoxGround = boundingBox.clone();
|
||||
boundingBoxGround = boundingBoxGround.d(0D, -0.5D, 0D);
|
||||
for (final Object object : world.getCubes(entity, boundingBoxGround)) {
|
||||
final AxisAlignedBB aabbCube = (AxisAlignedBB) object;
|
||||
final int blockX = (int) Math.floor(aabbCube.a);
|
||||
final int blockY = (int) Math.floor(aabbCube.b);
|
||||
final int blockZ = (int) Math.floor(aabbCube.c);
|
||||
final int id = world.getTypeId(blockX, blockY, blockZ);
|
||||
if (!onStairs.get()
|
||||
&& (id == 53 || id == 67 || id == 108 || id == 109 || id == 114 || id == 128 || id == 134
|
||||
|| id == 135 || id == 136))
|
||||
onStairs.set(true);
|
||||
}
|
||||
if (!onStairs.isSet())
|
||||
onStairs.set(false);
|
||||
}
|
||||
return onStairs.get();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user