mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-27 14:13:11 +02:00
RAW split setup (does not compile in eclipse).
This commit is contained in:
parent
934644633f
commit
f21ffd68cb
24
NCPCommons/pom.xml
Normal file
24
NCPCommons/pom.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<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>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcommons</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCommons</name>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<description>Common data structures and other, no use of Bukkit.</description>
|
||||
</project>
|
@ -0,0 +1,282 @@
|
||||
package fr.neatmonster.nocheatplus.test;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.ds.CoordMap;
|
||||
import fr.neatmonster.nocheatplus.utilities.ds.CoordMap.Entry;
|
||||
|
||||
public class TestCoordMap {
|
||||
|
||||
public static class Pos{
|
||||
private static final int p1 = 73856093;
|
||||
private static final int p2 = 19349663;
|
||||
private static final int p3 = 83492791;
|
||||
private static final int getHash(final int x, final int y, final int z) {
|
||||
return p1 * x ^ p2 * y ^ p3 * z;
|
||||
}
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
private final int hash;
|
||||
public Pos(int x, int y, int z){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.hash = getHash(x, y, z);
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Pos){
|
||||
Pos other = (Pos) obj;
|
||||
return other.hash == hash && other.x == x && other.y == y && other.z == z;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
public int[][] getRandomCoords(int n, int max, Random random) {
|
||||
final int [][] coords = new int[n][3];
|
||||
for (int i = 0; i < n; i++){
|
||||
for (int j = 0; j < 3 ; j++){
|
||||
coords[i][j] = random.nextInt(2*max) - max;
|
||||
}
|
||||
}
|
||||
return coords;
|
||||
}
|
||||
|
||||
public int[][] getUniqueRandomCoords(int n, int max, Random random) {
|
||||
Set<Pos> present = new HashSet<Pos>();
|
||||
int failures = 0;
|
||||
final int [][] coords = new int[n][3];
|
||||
for (int i = 0; i < n; i++){
|
||||
boolean unique = false;
|
||||
Pos pos = null;
|
||||
while (!unique){
|
||||
pos = new Pos(random.nextInt(2*max) - max, random.nextInt(2*max) - max, random.nextInt(2*max) - max);
|
||||
if (!present.contains(pos)) break;
|
||||
failures ++;
|
||||
if (failures >= 2 * n){
|
||||
throw new RuntimeException("Too many failed attempts to create a unique coordinate.");
|
||||
}
|
||||
}
|
||||
coords[i][0] = pos.x;
|
||||
coords[i][1] = pos.y;
|
||||
coords[i][2] = pos.z;
|
||||
present.add(pos);
|
||||
}
|
||||
present.clear();
|
||||
return coords;
|
||||
}
|
||||
|
||||
public Map<Integer, int[]> getIndexMap(int[][] coords) {
|
||||
final Map<Integer, int[]> indexMap = new HashMap<Integer, int[]>(coords.length);
|
||||
for (int i = 0; i < coords.length; i ++){
|
||||
indexMap.put(i, coords[i]);
|
||||
}
|
||||
return indexMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill map and check if filled in elements are inside (no size check).
|
||||
* @param map
|
||||
* @param coords
|
||||
*/
|
||||
public void fillMap(CoordMap<Integer> map, int[][] coords) {
|
||||
for (int i = 0; i < coords.length ; i++){
|
||||
map.put(coords[i][0], coords[i][1], coords[i][2], i);
|
||||
Integer value = map.get(coords[i][0], coords[i][1], coords[i][2]);
|
||||
if (value == null) fail("Value is null, get after put: " + i);
|
||||
else if (value.intValue() != i) fail("get right after put");
|
||||
if (!map.contains(coords[i][0], coords[i][1], coords[i][2])) fail("Contains returns false: " + i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Match map contents (must match exactly).
|
||||
* @param map
|
||||
* @param coords
|
||||
*/
|
||||
public void matchAll(CoordMap<Integer> map, int[][] coords) {
|
||||
for (int i = 0; i < coords.length ; i++){
|
||||
Integer value = map.get(coords[i][0], coords[i][1], coords[i][2]).intValue();
|
||||
if (value == null) fail("Value is null instead of " + i);
|
||||
if (value.intValue() != i) fail("Wrong value: " + value + " vs. " + i);
|
||||
if (!map.contains(coords[i][0], coords[i][1], coords[i][2])) fail("Contains returns false.");
|
||||
}
|
||||
if (map.size() != coords.length) fail("Iterator wrong number of elements: " + map.size() + "/" + coords.length);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Match map contents with an (must match exactly).
|
||||
* @param map
|
||||
* @param indexMap
|
||||
*/
|
||||
public void matchAllIterator(CoordMap<Integer> map, Map<Integer, int[]> indexMap){
|
||||
Iterator<Entry<Integer>> it = map.iterator();
|
||||
Set<Integer> found = new HashSet<Integer>();
|
||||
while (it.hasNext()){
|
||||
Entry<Integer> entry = it.next();
|
||||
Integer value = entry.getValue();
|
||||
if (value == null) fail("Null value.");
|
||||
int[] pos = indexMap.get(value);
|
||||
// if (pos == null) fail
|
||||
if (pos[0] != entry.getX() || pos[1] != entry.getY() || pos[2] != entry.getZ()) fail("Wrong coordinates.");
|
||||
if (map.get(pos[0], pos[1], pos[2]).intValue() != value.intValue()) fail("Wrong value.");
|
||||
if (found.contains(value)) fail("Already found: " + value);
|
||||
if (!map.contains(pos[0], pos[1], pos[2])) fail("Contains returns false");
|
||||
found.add(value);
|
||||
}
|
||||
if (found.size() != indexMap.size()) fail("Iterator wrong number of elements: " + found.size() + "/" + indexMap.size());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all coords (expect map to be only filled with those).
|
||||
* @param map
|
||||
* @param coords
|
||||
*/
|
||||
public void removeAll(CoordMap<Integer> map, int[][] coords) {
|
||||
for (int i = 0; i < coords.length ; i++){
|
||||
if (map.remove(coords[i][0], coords[i][1], coords[i][2]).intValue() != i) fail("removed should be " + i );
|
||||
int expectedSize = coords.length - (i + 1);
|
||||
if (map.size() != expectedSize) fail("Bad size (" + map.size() + "), expect " + expectedSize);
|
||||
if (map.get(coords[i][0], coords[i][1], coords[i][2]) != null) fail("get right after remove not null");
|
||||
if (map.contains(coords[i][0], coords[i][1], coords[i][2])) fail ("Still contains");
|
||||
}
|
||||
if (map.size() != 0) fail("Map not emptied, left: " + map.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all coords using an iterator (expect map to be only filled with those).
|
||||
* @param map
|
||||
* @param indexMap
|
||||
*/
|
||||
public void removeAllIterator(CoordMap<Integer> map, Map<Integer, int[]> indexMap)
|
||||
{
|
||||
Iterator<Entry<Integer>> it = map.iterator();
|
||||
Set<Integer> removed = new HashSet<Integer>();
|
||||
while (it.hasNext()){
|
||||
Entry<Integer> entry = it.next();
|
||||
Integer value = entry.getValue();
|
||||
if (value == null) fail("Null value.");
|
||||
int[] pos = indexMap.get(value);
|
||||
// if (pos == null) fail
|
||||
if (pos[0] != entry.getX() || pos[1] != entry.getY() || pos[2] != entry.getZ()) fail("Wrong coordinates.");
|
||||
if (removed.contains(value)) fail("Already removed: " + value);
|
||||
removed.add(value);
|
||||
it.remove();
|
||||
if (map.get(pos[0], pos[1], pos[2]) != null) fail("get right after remove not null");
|
||||
if (map.contains(pos[0], pos[1], pos[2])) fail("Still contains.");
|
||||
}
|
||||
if (map.size() != 0) fail("Map not emptied, left: " + map.size());
|
||||
if (removed.size() != indexMap.size()) fail("Iterator wrong number of elements: " + removed.size() + "/" + indexMap.size());
|
||||
}
|
||||
|
||||
public void assertSize(CoordMap<?> map, int size){
|
||||
if (map.size() != size) fail("Map returns wrong size: " + map.size() + " instead of " + size);
|
||||
int found = 0;
|
||||
final Iterator<?> it = map.iterator();
|
||||
while (it.hasNext()){
|
||||
found ++;
|
||||
it.next();
|
||||
}
|
||||
if (found != size) fail("Iterator has wrong number of elements: " + found + " instead of " + size);
|
||||
}
|
||||
|
||||
/**
|
||||
* One integrity test series with a map with given initial size.
|
||||
* @param coords
|
||||
* @param indexMap
|
||||
* @param initialSize
|
||||
*/
|
||||
public void series(int[][] coords, Map<Integer, int[]> indexMap, int initialSize, float loadFactor) {
|
||||
CoordMap<Integer> map;
|
||||
|
||||
// Fill and check
|
||||
map = new CoordMap<Integer>(initialSize, loadFactor);
|
||||
fillMap(map, coords);
|
||||
assertSize(map, indexMap.size());
|
||||
matchAll(map, coords);
|
||||
|
||||
// Fill and check with iterator.
|
||||
map = new CoordMap<Integer>(initialSize, loadFactor);
|
||||
fillMap(map, coords);
|
||||
assertSize(map, indexMap.size());
|
||||
matchAllIterator(map, indexMap);
|
||||
|
||||
// Normal removing
|
||||
map = new CoordMap<Integer>(initialSize, loadFactor);
|
||||
fillMap(map, coords);
|
||||
assertSize(map, indexMap.size());
|
||||
removeAll(map, coords);
|
||||
assertSize(map, 0);
|
||||
|
||||
// Removing with iterator.
|
||||
map = new CoordMap<Integer>(initialSize, loadFactor);
|
||||
fillMap(map, coords);
|
||||
assertSize(map, indexMap.size());
|
||||
removeAllIterator(map, indexMap);
|
||||
assertSize(map, 0);
|
||||
|
||||
// Fill twice.
|
||||
map = new CoordMap<Integer>(initialSize, loadFactor);
|
||||
fillMap(map, coords);
|
||||
assertSize(map, indexMap.size());
|
||||
fillMap(map, coords);
|
||||
assertSize(map, indexMap.size());
|
||||
matchAll(map, coords);
|
||||
removeAll(map, coords);
|
||||
assertSize(map, 0);
|
||||
|
||||
// Fill twice iterator.
|
||||
map = new CoordMap<Integer>(initialSize, loadFactor);
|
||||
fillMap(map, coords);
|
||||
assertSize(map, indexMap.size());
|
||||
fillMap(map, coords);
|
||||
assertSize(map, indexMap.size());
|
||||
matchAllIterator(map, indexMap);
|
||||
removeAllIterator(map, indexMap);
|
||||
assertSize(map, 0);
|
||||
|
||||
// TODO: test / account for identical keys.
|
||||
|
||||
// ? random sequence of actions ?
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIntegrity() {
|
||||
|
||||
final Random random = new Random(System.nanoTime() - (System.currentTimeMillis() % 2 == 1 ? 37 : 137));
|
||||
|
||||
final int n = 20000; // Number of coordinates.
|
||||
final int max = 1000; // Coordinate maximum.
|
||||
|
||||
int [][] coords = getUniqueRandomCoords(n, max, random);
|
||||
|
||||
Map<Integer, int[]> indexMap = getIndexMap(coords);
|
||||
|
||||
// No resize
|
||||
series(coords, indexMap, 3 * n, 0.75f);
|
||||
|
||||
// With some times resize.
|
||||
series(coords, indexMap, 1, 0.75f);
|
||||
|
||||
// TODO: Also test with certain sets of coords that always are the same.
|
||||
// TODO: fill in multiple times + size, fill in new ones (careful random) + size
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Test set: fr.neatmonster.nocheatplus.test.TestCoordMap
|
||||
-------------------------------------------------------------------------------
|
||||
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 28.894 sec
|
||||
|
@ -0,0 +1,5 @@
|
||||
#surefire
|
||||
#Thu Dec 13 22:19:06 CET 2012
|
||||
user.dir=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons
|
||||
localRepository=C\:\\Users\\mc_dev\\.m2\\repository
|
||||
basedir=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons
|
@ -0,0 +1,5 @@
|
||||
#surefire
|
||||
#Thu Dec 13 22:15:37 CET 2012
|
||||
user.dir=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons
|
||||
localRepository=C\:\\Users\\mc_dev\\.m2\\repository
|
||||
basedir=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons
|
27
NCPCommons/target/surefire/surefire649402021971128663tmp
Normal file
27
NCPCommons/target/surefire/surefire649402021971128663tmp
Normal file
@ -0,0 +1,27 @@
|
||||
#surefire
|
||||
#Thu Dec 13 22:15:37 CET 2012
|
||||
testClassesDirectory=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons\\target\\test-classes
|
||||
classPathUrl.2=C\:\\Users\\mc_dev\\.m2\\repository\\junit\\junit\\4.8.2\\junit-4.8.2.jar
|
||||
useManifestOnlyJar=true
|
||||
classPathUrl.1=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons\\target\\classes
|
||||
reportsDirectory=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons\\target\\surefire-reports
|
||||
classPathUrl.0=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons\\target\\test-classes
|
||||
dirscanner.0=directoryScannerOptions
|
||||
providerConfiguration=org.apache.maven.surefire.junit4.JUnit4Provider
|
||||
testSuiteDefinitionTestSourceDirectory=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons\\src\\test\\java
|
||||
surefireClassPathUrl.1=C\:\\Users\\mc_dev\\.m2\\repository\\org\\apache\\maven\\surefire\\surefire-api\\2.7.1\\surefire-api-2.7.1.jar
|
||||
surefireClassPathUrl.0=C\:\\Users\\mc_dev\\.m2\\repository\\org\\apache\\maven\\surefire\\surefire-junit4\\2.7.1\\surefire-junit4-2.7.1.jar
|
||||
report.2=org.apache.maven.surefire.report.XMLReporter
|
||||
useSystemClassLoader=true
|
||||
report.1=org.apache.maven.surefire.report.BriefFileReporter
|
||||
report.0=org.apache.maven.surefire.report.ForkingConsoleReporter
|
||||
excludes0=**/*$*
|
||||
isTrimStackTrace=true
|
||||
dirscanner.0.params=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons\\target\\test-classes|[**/Test*.java, **/*Test.java, **/*TestCase.java]|[**/*$*]
|
||||
enableAssertions=true
|
||||
includes2=**/*TestCase.java
|
||||
failIfNoTests=false
|
||||
includes1=**/*Test.java
|
||||
dirscanner.0.types=java.io.File|java.util.ArrayList|java.util.ArrayList
|
||||
includes0=**/Test*.java
|
||||
childDelegation=false
|
27
NCPCommons/target/surefire/surefire9068458813515423727tmp
Normal file
27
NCPCommons/target/surefire/surefire9068458813515423727tmp
Normal file
@ -0,0 +1,27 @@
|
||||
#surefire
|
||||
#Thu Dec 13 22:19:06 CET 2012
|
||||
testClassesDirectory=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons\\target\\test-classes
|
||||
classPathUrl.2=C\:\\Users\\mc_dev\\.m2\\repository\\junit\\junit\\4.8.2\\junit-4.8.2.jar
|
||||
useManifestOnlyJar=true
|
||||
classPathUrl.1=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons\\target\\classes
|
||||
reportsDirectory=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons\\target\\surefire-reports
|
||||
classPathUrl.0=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons\\target\\test-classes
|
||||
dirscanner.0=directoryScannerOptions
|
||||
providerConfiguration=org.apache.maven.surefire.junit4.JUnit4Provider
|
||||
testSuiteDefinitionTestSourceDirectory=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons\\src\\test\\java
|
||||
surefireClassPathUrl.1=C\:\\Users\\mc_dev\\.m2\\repository\\org\\apache\\maven\\surefire\\surefire-api\\2.7.1\\surefire-api-2.7.1.jar
|
||||
surefireClassPathUrl.0=C\:\\Users\\mc_dev\\.m2\\repository\\org\\apache\\maven\\surefire\\surefire-junit4\\2.7.1\\surefire-junit4-2.7.1.jar
|
||||
report.2=org.apache.maven.surefire.report.XMLReporter
|
||||
useSystemClassLoader=true
|
||||
report.1=org.apache.maven.surefire.report.BriefFileReporter
|
||||
report.0=org.apache.maven.surefire.report.ForkingConsoleReporter
|
||||
excludes0=**/*$*
|
||||
isTrimStackTrace=true
|
||||
dirscanner.0.params=C\:\\Users\\mc_dev\\git\\NoCheatPlus\\NCPCommons\\target\\test-classes|[**/Test*.java, **/*Test.java, **/*TestCase.java]|[**/*$*]
|
||||
enableAssertions=true
|
||||
includes2=**/*TestCase.java
|
||||
failIfNoTests=false
|
||||
includes1=**/*Test.java
|
||||
dirscanner.0.types=java.io.File|java.util.ArrayList|java.util.ArrayList
|
||||
includes0=**/Test*.java
|
||||
childDelegation=false
|
BIN
NCPCommons/target/surefire/surefirebooter8155792297212593590.jar
Normal file
BIN
NCPCommons/target/surefire/surefirebooter8155792297212593590.jar
Normal file
Binary file not shown.
BIN
NCPCommons/target/surefire/surefirebooter9025509969879930780.jar
Normal file
BIN
NCPCommons/target/surefire/surefirebooter9025509969879930780.jar
Normal file
Binary file not shown.
32
NCPCompat/pom.xml
Normal file
32
NCPCompat/pom.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<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>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompat</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompat</name>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>LATEST</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcommons</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<classifier>NCPCommons</classifier>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<description>API for the compatibility modules. Uses Bukkit.</description>
|
||||
</project>
|
37
NCPCompatCB2511/pom.xml
Normal file
37
NCPCompatCB2511/pom.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<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>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2511</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatCB2511</name>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcommons</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<classifier>NCPCommons</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompat</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<classifier>NCPCompat</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.4.5-R0.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<description>Compatibility up to CB2512 (i.e. 1.4.5-R0.2).</description>
|
||||
</project>
|
37
NCPCompatCB2512/pom.xml
Normal file
37
NCPCompatCB2512/pom.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<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>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2512</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatCB2512</name>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcommons</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<classifier>NCPCommons</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompat</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<classifier>NCPCompat</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.4.5-R0.3-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<description>Compatibility since CB2512.</description>
|
||||
</project>
|
180
NCPPlugin/pom.xml
Normal file
180
NCPPlugin/pom.xml
Normal file
@ -0,0 +1,180 @@
|
||||
<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 -->
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>NoCheatPlus</artifactId>
|
||||
<name>NoCheatPlus</name>
|
||||
<version>3.8.6</version>
|
||||
<description>Detect and fight the exploitation of various flaws/bugs in Minecraft.</description>
|
||||
<url>http://dev.bukkit.org/server-mods/nocheatplus</url>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>bukkit</id>
|
||||
<name>Bukkit</name>
|
||||
<url>http://repo.bukkit.org/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcommons</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<classifier>NCPCommons</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompat</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<classifier>NCPCompat</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2511</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<classifier>NCPCompatCB2511</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2512</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<classifier>NCPCompatCB2512</classifier>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- Building -->
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<directory>../target</directory> <!-- Build it one level up, because it is the one we care about -->
|
||||
<finalName>NoCheatPlus</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>plugin.yml</include>
|
||||
<include>LICENSE.txt</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>fr.neatmonster:ncp*</include>
|
||||
<!-- <include>fr.neatmonster:nocheatplus-parent</include> -->
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<!-- <build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>plugin.yml</include>
|
||||
<include>LICENSE.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 if="deploy">
|
||||
<property file="password.properties" prefix="password"/>
|
||||
<scp todir="root:${password.value}@nocheatplus.org:/home/Minecraft/plugins/" file="target/NoCheatPlus.jar" sftp="yes" trust="yes" failonerror="no"/>
|
||||
<sshexec host="nocheatplus.org" username="root" password="${password.value}" command="tmux send "reload" C-m" 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>
|
@ -367,9 +367,11 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
||||
if (verbose) LogUtil.logInfo("[NoCheatPlus] Cleanup DataManager...");
|
||||
dataMan.onDisable();
|
||||
|
||||
// Clear command changes list (compatibility issues with NPCs, leads to rrecalculation of perms).
|
||||
changedCommands.clear();
|
||||
changedCommands = null;
|
||||
// Clear command changes list (compatibility issues with NPCs, leads to recalculation of perms).
|
||||
if (changedCommands != null){
|
||||
changedCommands.clear();
|
||||
changedCommands = null;
|
||||
}
|
||||
// // Restore changed commands.
|
||||
// if (verbose) LogUtil.logInfo("[NoCheatPlus] Undo command changes...");
|
||||
// undoCommandChanges();
|
@ -98,6 +98,7 @@ public class CombinedListener extends CheckListener {
|
||||
@EventHandler(priority=EventPriority.LOW)
|
||||
public void onPlayerToggleSneak(final PlayerToggleSneakEvent event){
|
||||
// Check also in case of cancelled events.
|
||||
// TODO: Maybe this is not good to cancel.
|
||||
if (Improbable.check(event.getPlayer(), 0.35f, System.currentTimeMillis())) event.setCancelled(true);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user