Now we use Maven - plugin description/website added to

plugin.yml - a bit of missing whitespace formatting
This commit is contained in:
Evenprime 2011-11-19 00:41:57 +01:00
parent d502f66472
commit 79d545f5e3
34 changed files with 207 additions and 104 deletions

31
.gitignore vendored Normal file
View File

@ -0,0 +1,31 @@
# 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/

View File

@ -1,9 +1,12 @@
name: NoCheat
version: ${project.version}
description: ${project.description}
author: Evenprime
website: ${project.url}
main: cc.co.evenprime.bukkit.nocheat.NoCheat
version: 2.16c
commands:
nocheat:

84
pom.xml Normal file
View File

@ -0,0 +1,84 @@
<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>
<groupId>NoCheat</groupId>
<artifactId>NoCheat</artifactId>
<version>2.16c</version>
<packaging>jar</packaging>
<name>NoCheat</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<pluginRepositories>
<pluginRepository>
<id>bukkit-plugins</id>
<url>http://repo.bukkit.org/artifactory/plugins-release</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.8.1-R5-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>bukkit-repo</id>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
<url>http://repo.bukkit.org/artifactory/repo</url>
</repository>
</repositories>
<description>Detect and Fight the exploitation of various Flaws/Bugs in Minecraft.</description>
<url>http://dev.bukkit.org/server-mods/nocheat</url>
<scm>
<connection>scm:git:https://github.com/Evenprime/NoCheat.git</connection>
<developerConnection>scm:git:https://github.com/Evenprime/NoCheat.git</developerConnection>
<url>https://github.com/Evenprime/NoCheat</url>
</scm>
<build>
<sourceDirectory>${basedir}/src</sourceDirectory>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>.</directory>
<includes>
<include>plugin.yml</include>
<include>README.txt</include>
<include>LICENSE.txt</include>
</includes>
</resource>
</resources>
<defaultGoal>clean install</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.1</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
<finalName>NoCheat</finalName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -1,6 +1,5 @@
package cc.co.evenprime.bukkit.nocheat.checks;
import cc.co.evenprime.bukkit.nocheat.NoCheat;
import cc.co.evenprime.bukkit.nocheat.NoCheatPlayer;
import cc.co.evenprime.bukkit.nocheat.actions.types.ActionWithParameters.WildCard;

View File

@ -82,7 +82,7 @@ public class DirectionCheck extends BlockBreakCheck {
switch (wildcard) {
case VIOLATIONS:
return String.format(Locale.US, "%d", (int)player.getData().blockbreak.directionVL);
return String.format(Locale.US, "%d", (int) player.getData().blockbreak.directionVL);
default:
return super.getParameter(wildcard, player);

View File

@ -42,7 +42,7 @@ public class NoswingCheck extends BlockBreakCheck {
switch (wildcard) {
case VIOLATIONS:
return String.format(Locale.US, "%d", (int)player.getData().blockbreak.noswingVL);
return String.format(Locale.US, "%d", (int) player.getData().blockbreak.noswingVL);
default:
return super.getParameter(wildcard, player);

View File

@ -55,7 +55,7 @@ public class ReachCheck extends BlockBreakCheck {
switch (wildcard) {
case VIOLATIONS:
return String.format(Locale.US, "%d", (int)player.getData().blockbreak.reachVL);
return String.format(Locale.US, "%d", (int) player.getData().blockbreak.reachVL);
case REACHDISTANCE:
return String.format(Locale.US, "%.2f", player.getData().blockbreak.reachDistance);

View File

@ -96,7 +96,7 @@ public class DirectionCheck extends BlockPlaceCheck {
switch (wildcard) {
case VIOLATIONS:
return String.format(Locale.US, "%d", (int)player.getData().blockplace.directionVL);
return String.format(Locale.US, "%d", (int) player.getData().blockplace.directionVL);
default:
return super.getParameter(wildcard, player);

View File

@ -56,7 +56,7 @@ public class ReachCheck extends BlockPlaceCheck {
switch (wildcard) {
case VIOLATIONS:
return String.format(Locale.US, "%d", (int)player.getData().blockplace.reachVL);
return String.format(Locale.US, "%d", (int) player.getData().blockplace.reachVL);
case REACHDISTANCE:
return String.format(Locale.US, "%.2f", player.getData().blockplace.reachdistance);

View File

@ -77,7 +77,7 @@ public class DirectionCheck extends FightCheck {
switch (wildcard) {
case VIOLATIONS:
return String.format(Locale.US, "%d", (int)player.getData().fight.directionVL);
return String.format(Locale.US, "%d", (int) player.getData().fight.directionVL);
default:
return super.getParameter(wildcard, player);
}

View File

@ -43,7 +43,7 @@ public class NoswingCheck extends FightCheck {
switch (wildcard) {
case VIOLATIONS:
return String.format(Locale.US, "%d", (int)player.getData().fight.noswingVL);
return String.format(Locale.US, "%d", (int) player.getData().fight.noswingVL);
default:
return super.getParameter(wildcard, player);
}

View File

@ -42,7 +42,7 @@ public class SelfhitCheck extends FightCheck {
switch (wildcard) {
case VIOLATIONS:
return String.format(Locale.US, "%d", (int)player.getData().fight.selfhitVL);
return String.format(Locale.US, "%d", (int) player.getData().fight.selfhitVL);
default:
return super.getParameter(wildcard, player);
}

View File

@ -48,7 +48,6 @@ public class FlyingCheck extends MovingCheck {
// horizontal
double speedLimitHorizontal = player.isCreative() ? Math.max(creativeSpeed, ccmoving.flyingSpeedLimitHorizontal) : ccmoving.flyingSpeedLimitHorizontal;
speedLimitHorizontal *= player.getSpeedAmplifier();
result += Math.max(0.0D, horizontalDistance - moving.horizFreedom - speedLimitHorizontal);
@ -105,7 +104,7 @@ public class FlyingCheck extends MovingCheck {
switch (wildcard) {
case VIOLATIONS:
return String.format(Locale.US, "%d", (int)player.getData().moving.runflyVL);
return String.format(Locale.US, "%d", (int) player.getData().moving.runflyVL);
default:
return super.getParameter(wildcard, player);
}

View File

@ -109,7 +109,7 @@ public class MorePacketsCheck extends MovingCheck {
switch (wildcard) {
case VIOLATIONS:
return String.format(Locale.US, "%d", (int)player.getData().moving.morePacketsVL);
return String.format(Locale.US, "%d", (int) player.getData().moving.morePacketsVL);
case PACKETS:
return String.valueOf(player.getData().moving.packets);
default:

View File

@ -106,7 +106,7 @@ public class NoFallCheck extends MovingCheck {
switch (wildcard) {
case VIOLATIONS:
return String.format(Locale.US, "%d", (int)player.getData().moving.nofallVL);
return String.format(Locale.US, "%d", (int) player.getData().moving.nofallVL);
case FALLDISTANCE:
return String.format(Locale.US, "%.2f", player.getData().moving.fallDistance);
default:

View File

@ -45,7 +45,7 @@ public class GodmodeCheck extends TimedCheck {
// Reduce violation level over time
data.godmodeVL -= cc.tickTime / 2.0;
} else if(behind <= (cc.tickTime / 2)+1) {
} else if(behind <= (cc.tickTime / 2) + 1) {
// close enough, let it pass
data.ticksBehind -= cc.tickTime / 4;
// Reduce violation level over time
@ -63,13 +63,11 @@ public class GodmodeCheck extends TimedCheck {
cancel = executeActions(player, cc.godmodeActions.getActions(data.godmodeVL));
if(cancel) {
// Catch up for at least some of the ticks
try {
player.increaseAge(cc.tickTime);
}
catch(Exception e) {
} catch(Exception e) {
e.printStackTrace();
}
@ -104,7 +102,7 @@ public class GodmodeCheck extends TimedCheck {
switch (wildcard) {
case VIOLATIONS:
return String.format(Locale.US, "%d", (int)player.getData().timed.godmodeVL);
return String.format(Locale.US, "%d", (int) player.getData().timed.godmodeVL);
default:
return super.getParameter(wildcard, player);
}

View File

@ -62,7 +62,7 @@ public class FlatFileAction {
// four pieces is the minimum we need, no matter what it is
if(parts.length < 4) {
throw new IllegalArgumentException("The line "+line+" of the file "+file.getName()+" is malformed. It has not enough parts.");
throw new IllegalArgumentException("The line " + line + " of the file " + file.getName() + " is malformed. It has not enough parts.");
}
String type = parts[0];
@ -71,41 +71,36 @@ public class FlatFileAction {
int delay = 0;
try {
delay = Integer.parseInt(parts[2]);
}
catch(Exception e) {
throw new IllegalArgumentException("Couldn't parse third parameter of action "+name+" from file "+file.getName()+". It is "+parts[2]+" but should be a number.");
} catch(Exception e) {
throw new IllegalArgumentException("Couldn't parse third parameter of action " + name + " from file " + file.getName() + ". It is " + parts[2] + " but should be a number.");
}
int repeat = 0;
try {
repeat = Integer.parseInt(parts[3]);
}
catch(Exception e) {
throw new IllegalArgumentException("Couldn't parse fourth parameter of action "+name+" from file "+file.getName()+". It is "+parts[2]+" but should be a number.");
} catch(Exception e) {
throw new IllegalArgumentException("Couldn't parse fourth parameter of action " + name + " from file " + file.getName() + ". It is " + parts[2] + " but should be a number.");
}
if(type.equalsIgnoreCase("log")) {
// A log action, it seems
if(parts.length < 5) {
throw new IllegalArgumentException("Missing fifth parameter of action "+name+" from file "+file.getName()+".");
throw new IllegalArgumentException("Missing fifth parameter of action " + name + " from file " + file.getName() + ".");
}
return readLogAction(name, delay, repeat, parts[4]);
}
else if(type.equalsIgnoreCase("consolecommand")) {
} else if(type.equalsIgnoreCase("consolecommand")) {
// A consolecommand action, it seems
if(parts.length < 5) {
throw new IllegalArgumentException("Missing fifth parameter of action "+name+" from file "+file.getName()+".");
throw new IllegalArgumentException("Missing fifth parameter of action " + name + " from file " + file.getName() + ".");
}
return new ConsolecommandAction(name, delay, repeat, parts[4]);
}
else if(type.equalsIgnoreCase("special")) {
} else if(type.equalsIgnoreCase("special")) {
// A "special" actions, it seems
return new SpecialAction(name, delay, repeat);
}
else {
throw new IllegalArgumentException("Unknown action type "+type+ " of action with name "+name+".");
} else {
throw new IllegalArgumentException("Unknown action type " + type + " of action with name " + name + ".");
}
}
@ -115,15 +110,14 @@ public class FlatFileAction {
String[] rest = lastPart.split("\\s+", 2);
if(rest.length < 2) {
throw new IllegalArgumentException("Missing sixth parameter of action "+name+" from file "+file.getName()+".");
throw new IllegalArgumentException("Missing sixth parameter of action " + name + " from file " + file.getName() + ".");
}
LogLevel level;
try {
level = LogLevel.getLogLevelFromString(rest[0]);
}
catch(IllegalArgumentException e) {
throw new IllegalArgumentException("Illegal fifth parameter of action "+name+". "+e.getMessage());
} catch(IllegalArgumentException e) {
throw new IllegalArgumentException("Illegal fifth parameter of action " + name + ". " + e.getMessage());
}
return new LogAction(name, delay, repeat, level, rest[1]);

View File

@ -7,7 +7,6 @@ public class CCDebug {
public final boolean showchecks;
public final boolean overrideIdiocy;
public CCDebug(Configuration data) {
showchecks = data.getBoolean(Configuration.DEBUG_SHOWACTIVECHECKS);

View File

@ -3,7 +3,8 @@ package cc.co.evenprime.bukkit.nocheat.data;
import org.bukkit.Location;
/**
* A class to store x,y,z triple data, instead of using bukkits Location objects,
* A class to store x,y,z triple data, instead of using bukkits Location
* objects,
* which can't be easily recycled
*
*/
@ -32,6 +33,7 @@ public final class PreciseLocation {
public final boolean isSet() {
return x != Double.MAX_VALUE;
}
public final void reset() {
x = Double.MAX_VALUE;
y = Double.MAX_VALUE;

View File

@ -9,7 +9,6 @@ import cc.co.evenprime.bukkit.nocheat.config.cache.ConfigurationCache;
import cc.co.evenprime.bukkit.nocheat.events.EventManager;
import cc.co.evenprime.bukkit.nocheat.log.LogLevel;
public class ActiveCheckPrinter {
public static void printActiveChecks(NoCheat plugin, List<EventManager> eventManagers) {

View File

@ -1,10 +1,10 @@
package cc.co.evenprime.bukkit.nocheat.debug;
public class Performance {
private long totalTime = 0;
private long counter = 1; // start with 1 to avoid DIV/0 errors
private long counter = 1; // start with 1 to avoid
// DIV/0 errors
private final boolean enabled;
private static final long NANO = 1;
@ -13,7 +13,6 @@ public class Performance {
private static final long SECOND = MILLI * 1000;
private static final long MINUTE = SECOND * 60;
public Performance(boolean enabled) {
this.enabled = enabled;
}
@ -31,12 +30,10 @@ public class Performance {
return this.totalTime / this.counter;
}
public long getCounter() {
return this.counter;
}
public boolean isEnabled() {
return enabled;
}

View File

@ -9,8 +9,6 @@ public class PerformanceManager {
BLOCKBREAK, BLOCKDAMAGE, BLOCKPLACE, CHAT, MOVING, VELOCITY, FIGHT, TIMED
}
private final Map<Type, Performance> map;
public PerformanceManager() {

View File

@ -80,7 +80,7 @@ public class TimedEventManager extends EventManager {
if(performanceCheck)
nanoTimeStart = System.nanoTime();
handleEvent(plugin.getPlayer((Player)p.getBukkitEntity()));
handleEvent(plugin.getPlayer((Player) p.getBukkitEntity()));
// store performance time
if(performanceCheck)