mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-03 22:37:44 +01:00
Now we use Maven - plugin description/website added to
plugin.yml - a bit of missing whitespace formatting
This commit is contained in:
parent
d502f66472
commit
79d545f5e3
31
.gitignore
vendored
Normal file
31
.gitignore
vendored
Normal 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/
|
@ -1,9 +1,12 @@
|
|||||||
name: NoCheat
|
name: NoCheat
|
||||||
|
version: ${project.version}
|
||||||
|
description: ${project.description}
|
||||||
|
|
||||||
author: Evenprime
|
author: Evenprime
|
||||||
|
website: ${project.url}
|
||||||
|
|
||||||
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
||||||
version: 2.16c
|
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
nocheat:
|
nocheat:
|
||||||
|
84
pom.xml
Normal file
84
pom.xml
Normal 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>
|
@ -1,6 +1,5 @@
|
|||||||
package cc.co.evenprime.bukkit.nocheat.checks;
|
package cc.co.evenprime.bukkit.nocheat.checks;
|
||||||
|
|
||||||
|
|
||||||
import cc.co.evenprime.bukkit.nocheat.NoCheat;
|
import cc.co.evenprime.bukkit.nocheat.NoCheat;
|
||||||
import cc.co.evenprime.bukkit.nocheat.NoCheatPlayer;
|
import cc.co.evenprime.bukkit.nocheat.NoCheatPlayer;
|
||||||
import cc.co.evenprime.bukkit.nocheat.actions.types.ActionWithParameters.WildCard;
|
import cc.co.evenprime.bukkit.nocheat.actions.types.ActionWithParameters.WildCard;
|
||||||
|
@ -82,7 +82,7 @@ public class DirectionCheck extends BlockBreakCheck {
|
|||||||
switch (wildcard) {
|
switch (wildcard) {
|
||||||
|
|
||||||
case VIOLATIONS:
|
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:
|
default:
|
||||||
return super.getParameter(wildcard, player);
|
return super.getParameter(wildcard, player);
|
||||||
|
@ -42,7 +42,7 @@ public class NoswingCheck extends BlockBreakCheck {
|
|||||||
switch (wildcard) {
|
switch (wildcard) {
|
||||||
|
|
||||||
case VIOLATIONS:
|
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:
|
default:
|
||||||
return super.getParameter(wildcard, player);
|
return super.getParameter(wildcard, player);
|
||||||
|
@ -55,7 +55,7 @@ public class ReachCheck extends BlockBreakCheck {
|
|||||||
switch (wildcard) {
|
switch (wildcard) {
|
||||||
|
|
||||||
case VIOLATIONS:
|
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:
|
case REACHDISTANCE:
|
||||||
return String.format(Locale.US, "%.2f", player.getData().blockbreak.reachDistance);
|
return String.format(Locale.US, "%.2f", player.getData().blockbreak.reachDistance);
|
||||||
|
@ -96,7 +96,7 @@ public class DirectionCheck extends BlockPlaceCheck {
|
|||||||
switch (wildcard) {
|
switch (wildcard) {
|
||||||
|
|
||||||
case VIOLATIONS:
|
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:
|
default:
|
||||||
return super.getParameter(wildcard, player);
|
return super.getParameter(wildcard, player);
|
||||||
|
@ -56,7 +56,7 @@ public class ReachCheck extends BlockPlaceCheck {
|
|||||||
switch (wildcard) {
|
switch (wildcard) {
|
||||||
|
|
||||||
case VIOLATIONS:
|
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:
|
case REACHDISTANCE:
|
||||||
return String.format(Locale.US, "%.2f", player.getData().blockplace.reachdistance);
|
return String.format(Locale.US, "%.2f", player.getData().blockplace.reachdistance);
|
||||||
|
@ -77,7 +77,7 @@ public class DirectionCheck extends FightCheck {
|
|||||||
switch (wildcard) {
|
switch (wildcard) {
|
||||||
|
|
||||||
case VIOLATIONS:
|
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:
|
default:
|
||||||
return super.getParameter(wildcard, player);
|
return super.getParameter(wildcard, player);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class NoswingCheck extends FightCheck {
|
|||||||
switch (wildcard) {
|
switch (wildcard) {
|
||||||
|
|
||||||
case VIOLATIONS:
|
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:
|
default:
|
||||||
return super.getParameter(wildcard, player);
|
return super.getParameter(wildcard, player);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class SelfhitCheck extends FightCheck {
|
|||||||
switch (wildcard) {
|
switch (wildcard) {
|
||||||
|
|
||||||
case VIOLATIONS:
|
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:
|
default:
|
||||||
return super.getParameter(wildcard, player);
|
return super.getParameter(wildcard, player);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,6 @@ public class FlyingCheck extends MovingCheck {
|
|||||||
// horizontal
|
// horizontal
|
||||||
double speedLimitHorizontal = player.isCreative() ? Math.max(creativeSpeed, ccmoving.flyingSpeedLimitHorizontal) : ccmoving.flyingSpeedLimitHorizontal;
|
double speedLimitHorizontal = player.isCreative() ? Math.max(creativeSpeed, ccmoving.flyingSpeedLimitHorizontal) : ccmoving.flyingSpeedLimitHorizontal;
|
||||||
|
|
||||||
|
|
||||||
speedLimitHorizontal *= player.getSpeedAmplifier();
|
speedLimitHorizontal *= player.getSpeedAmplifier();
|
||||||
|
|
||||||
result += Math.max(0.0D, horizontalDistance - moving.horizFreedom - speedLimitHorizontal);
|
result += Math.max(0.0D, horizontalDistance - moving.horizFreedom - speedLimitHorizontal);
|
||||||
@ -105,7 +104,7 @@ public class FlyingCheck extends MovingCheck {
|
|||||||
switch (wildcard) {
|
switch (wildcard) {
|
||||||
|
|
||||||
case VIOLATIONS:
|
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:
|
default:
|
||||||
return super.getParameter(wildcard, player);
|
return super.getParameter(wildcard, player);
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ public class MorePacketsCheck extends MovingCheck {
|
|||||||
|
|
||||||
switch (wildcard) {
|
switch (wildcard) {
|
||||||
case VIOLATIONS:
|
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:
|
case PACKETS:
|
||||||
return String.valueOf(player.getData().moving.packets);
|
return String.valueOf(player.getData().moving.packets);
|
||||||
default:
|
default:
|
||||||
|
@ -106,7 +106,7 @@ public class NoFallCheck extends MovingCheck {
|
|||||||
|
|
||||||
switch (wildcard) {
|
switch (wildcard) {
|
||||||
case VIOLATIONS:
|
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:
|
case FALLDISTANCE:
|
||||||
return String.format(Locale.US, "%.2f", player.getData().moving.fallDistance);
|
return String.format(Locale.US, "%.2f", player.getData().moving.fallDistance);
|
||||||
default:
|
default:
|
||||||
|
@ -45,7 +45,7 @@ public class GodmodeCheck extends TimedCheck {
|
|||||||
// Reduce violation level over time
|
// Reduce violation level over time
|
||||||
data.godmodeVL -= cc.tickTime / 2.0;
|
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
|
// close enough, let it pass
|
||||||
data.ticksBehind -= cc.tickTime / 4;
|
data.ticksBehind -= cc.tickTime / 4;
|
||||||
// Reduce violation level over time
|
// Reduce violation level over time
|
||||||
@ -63,13 +63,11 @@ public class GodmodeCheck extends TimedCheck {
|
|||||||
|
|
||||||
cancel = executeActions(player, cc.godmodeActions.getActions(data.godmodeVL));
|
cancel = executeActions(player, cc.godmodeActions.getActions(data.godmodeVL));
|
||||||
|
|
||||||
|
|
||||||
if(cancel) {
|
if(cancel) {
|
||||||
// Catch up for at least some of the ticks
|
// Catch up for at least some of the ticks
|
||||||
try {
|
try {
|
||||||
player.increaseAge(cc.tickTime);
|
player.increaseAge(cc.tickTime);
|
||||||
}
|
} catch(Exception e) {
|
||||||
catch(Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +102,7 @@ public class GodmodeCheck extends TimedCheck {
|
|||||||
switch (wildcard) {
|
switch (wildcard) {
|
||||||
|
|
||||||
case VIOLATIONS:
|
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:
|
default:
|
||||||
return super.getParameter(wildcard, player);
|
return super.getParameter(wildcard, player);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class FlatFileAction {
|
|||||||
|
|
||||||
// four pieces is the minimum we need, no matter what it is
|
// four pieces is the minimum we need, no matter what it is
|
||||||
if(parts.length < 4) {
|
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];
|
String type = parts[0];
|
||||||
@ -71,41 +71,36 @@ public class FlatFileAction {
|
|||||||
int delay = 0;
|
int delay = 0;
|
||||||
try {
|
try {
|
||||||
delay = Integer.parseInt(parts[2]);
|
delay = Integer.parseInt(parts[2]);
|
||||||
}
|
} catch(Exception e) {
|
||||||
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.");
|
||||||
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;
|
int repeat = 0;
|
||||||
try {
|
try {
|
||||||
repeat = Integer.parseInt(parts[3]);
|
repeat = Integer.parseInt(parts[3]);
|
||||||
}
|
} catch(Exception e) {
|
||||||
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.");
|
||||||
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")) {
|
if(type.equalsIgnoreCase("log")) {
|
||||||
// A log action, it seems
|
// A log action, it seems
|
||||||
if(parts.length < 5) {
|
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]);
|
return readLogAction(name, delay, repeat, parts[4]);
|
||||||
}
|
} else if(type.equalsIgnoreCase("consolecommand")) {
|
||||||
else if(type.equalsIgnoreCase("consolecommand")) {
|
|
||||||
// A consolecommand action, it seems
|
// A consolecommand action, it seems
|
||||||
if(parts.length < 5) {
|
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]);
|
return new ConsolecommandAction(name, delay, repeat, parts[4]);
|
||||||
}
|
} else if(type.equalsIgnoreCase("special")) {
|
||||||
else if(type.equalsIgnoreCase("special")) {
|
|
||||||
// A "special" actions, it seems
|
// A "special" actions, it seems
|
||||||
return new SpecialAction(name, delay, repeat);
|
return new SpecialAction(name, delay, repeat);
|
||||||
}
|
} else {
|
||||||
else {
|
throw new IllegalArgumentException("Unknown action type " + type + " of action with name " + name + ".");
|
||||||
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);
|
String[] rest = lastPart.split("\\s+", 2);
|
||||||
|
|
||||||
if(rest.length < 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;
|
LogLevel level;
|
||||||
try {
|
try {
|
||||||
level = LogLevel.getLogLevelFromString(rest[0]);
|
level = LogLevel.getLogLevelFromString(rest[0]);
|
||||||
}
|
} catch(IllegalArgumentException e) {
|
||||||
catch(IllegalArgumentException e) {
|
throw new IllegalArgumentException("Illegal fifth parameter of action " + name + ". " + e.getMessage());
|
||||||
throw new IllegalArgumentException("Illegal fifth parameter of action "+name+". "+e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LogAction(name, delay, repeat, level, rest[1]);
|
return new LogAction(name, delay, repeat, level, rest[1]);
|
||||||
|
@ -7,7 +7,6 @@ public class CCDebug {
|
|||||||
public final boolean showchecks;
|
public final boolean showchecks;
|
||||||
public final boolean overrideIdiocy;
|
public final boolean overrideIdiocy;
|
||||||
|
|
||||||
|
|
||||||
public CCDebug(Configuration data) {
|
public CCDebug(Configuration data) {
|
||||||
|
|
||||||
showchecks = data.getBoolean(Configuration.DEBUG_SHOWACTIVECHECKS);
|
showchecks = data.getBoolean(Configuration.DEBUG_SHOWACTIVECHECKS);
|
||||||
|
@ -3,7 +3,8 @@ package cc.co.evenprime.bukkit.nocheat.data;
|
|||||||
import org.bukkit.Location;
|
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
|
* which can't be easily recycled
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -32,6 +33,7 @@ public final class PreciseLocation {
|
|||||||
public final boolean isSet() {
|
public final boolean isSet() {
|
||||||
return x != Double.MAX_VALUE;
|
return x != Double.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void reset() {
|
public final void reset() {
|
||||||
x = Double.MAX_VALUE;
|
x = Double.MAX_VALUE;
|
||||||
y = Double.MAX_VALUE;
|
y = Double.MAX_VALUE;
|
||||||
|
@ -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.events.EventManager;
|
||||||
import cc.co.evenprime.bukkit.nocheat.log.LogLevel;
|
import cc.co.evenprime.bukkit.nocheat.log.LogLevel;
|
||||||
|
|
||||||
|
|
||||||
public class ActiveCheckPrinter {
|
public class ActiveCheckPrinter {
|
||||||
|
|
||||||
public static void printActiveChecks(NoCheat plugin, List<EventManager> eventManagers) {
|
public static void printActiveChecks(NoCheat plugin, List<EventManager> eventManagers) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package cc.co.evenprime.bukkit.nocheat.debug;
|
package cc.co.evenprime.bukkit.nocheat.debug;
|
||||||
|
|
||||||
|
|
||||||
public class Performance {
|
public class Performance {
|
||||||
|
|
||||||
private long totalTime = 0;
|
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 final boolean enabled;
|
||||||
|
|
||||||
private static final long NANO = 1;
|
private static final long NANO = 1;
|
||||||
@ -13,7 +13,6 @@ public class Performance {
|
|||||||
private static final long SECOND = MILLI * 1000;
|
private static final long SECOND = MILLI * 1000;
|
||||||
private static final long MINUTE = SECOND * 60;
|
private static final long MINUTE = SECOND * 60;
|
||||||
|
|
||||||
|
|
||||||
public Performance(boolean enabled) {
|
public Performance(boolean enabled) {
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
}
|
}
|
||||||
@ -31,12 +30,10 @@ public class Performance {
|
|||||||
return this.totalTime / this.counter;
|
return this.totalTime / this.counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public long getCounter() {
|
public long getCounter() {
|
||||||
return this.counter;
|
return this.counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,6 @@ public class PerformanceManager {
|
|||||||
BLOCKBREAK, BLOCKDAMAGE, BLOCKPLACE, CHAT, MOVING, VELOCITY, FIGHT, TIMED
|
BLOCKBREAK, BLOCKDAMAGE, BLOCKPLACE, CHAT, MOVING, VELOCITY, FIGHT, TIMED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private final Map<Type, Performance> map;
|
private final Map<Type, Performance> map;
|
||||||
|
|
||||||
public PerformanceManager() {
|
public PerformanceManager() {
|
||||||
|
@ -80,7 +80,7 @@ public class TimedEventManager extends EventManager {
|
|||||||
if(performanceCheck)
|
if(performanceCheck)
|
||||||
nanoTimeStart = System.nanoTime();
|
nanoTimeStart = System.nanoTime();
|
||||||
|
|
||||||
handleEvent(plugin.getPlayer((Player)p.getBukkitEntity()));
|
handleEvent(plugin.getPlayer((Player) p.getBukkitEntity()));
|
||||||
|
|
||||||
// store performance time
|
// store performance time
|
||||||
if(performanceCheck)
|
if(performanceCheck)
|
||||||
|
Loading…
Reference in New Issue
Block a user