Maven -> Gradle (1.8-1.19.4 supported)
This commit is contained in:
1 parent
cac6e0b9e7
commit
70c6ebf4a0
80 files changed
+1179
-6793
No files matched your search
@@ -1,40 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpbuildbase</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPBuildBase</name>
|
||||
<description>Very basic dependencies that have to be built before commons, no use of Bukkit.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>../NCPBuildBase/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>BuildParameters.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -1,32 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcommons</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCommons</name>
|
||||
<description>Common data structures and other, no use of Bukkit.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpbuildbase</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,33 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatbukkit</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatBukkit</name>
|
||||
<description>Compatibility for using the Bukkit API only.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,298 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompataggregated</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>NCPCompatAggregated</name>
|
||||
<description>Aggregator for the NMS compat modules.</description>
|
||||
|
||||
<!-- Profile based activation of modules and dependencies. -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>all</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- ... -->
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- Legacy, usupported
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2882</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2808</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2794</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2763</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2691</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2645</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2602</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2545</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2512</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cbdev</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_12_r1</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_11_r1</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_10_r1</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r2</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r1</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_8_r3</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_7_r4</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cblegacy</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2882</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2808</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2794</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2763</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2691</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2645</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- Legacy, unsupported
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2602</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2545</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2512</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
<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.1-SNAPSHOT</version>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.4.5-R1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<description>Compatibility since CB2512.
|
||||
</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
-160
@@ -1,160 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2512;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_4_5.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_4_5.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_4_5.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_4_5.IBlockAccess;
|
||||
import net.minecraft.server.v1_4_5.Material;
|
||||
import net.minecraft.server.v1_4_5.TileEntity;
|
||||
import net.minecraft.server.v1_4_5.Vec3DPool;
|
||||
|
||||
public class BlockCacheCB2512 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_4_5.World world;
|
||||
protected World bukkitWorld;
|
||||
|
||||
private final IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public int getTypeId(int x, int y, int z) {
|
||||
return BlockCacheCB2512.this.getType(x, y, z).getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getData(int x, int y, int z) {
|
||||
return BlockCacheCB2512.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial(final int x, final int y, final int z) {
|
||||
return world.getMaterial(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3DPool getVec3DPool() {
|
||||
return world.getVec3DPool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockFacePowered(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.isBlockFacePowered(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean t(final int x, final int y, final int z) {
|
||||
return world.t(x, y, z);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB2512(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
this.bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
|
||||
// TODO: change api for this / use nodes (!)
|
||||
@SuppressWarnings("deprecation")
|
||||
final int id = getType(x, y, z).getId();
|
||||
final net.minecraft.server.v1_4_5.Block block = net.minecraft.server.v1_4_5.Block.byId[id];
|
||||
if (block == null) return null;
|
||||
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.v(), block.x(), block.z(), block.w(), block.y(), block.A()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
|
||||
final net.minecraft.server.v1_4_5.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_4_5.Entity other = (net.minecraft.server.v1_4_5.Entity) iterator.next();
|
||||
final EntityType type = other.getBukkitEntity().getType();
|
||||
if (type != EntityType.BOAT && type != EntityType.MINECART) continue;
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue;
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
bukkitWorld = null;
|
||||
}
|
||||
|
||||
}
|
||||
-194
@@ -1,194 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2512;
|
||||
|
||||
import net.minecraft.server.v1_4_5.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_4_5.Block;
|
||||
import net.minecraft.server.v1_4_5.DamageSource;
|
||||
import net.minecraft.server.v1_4_5.EntityComplexPart;
|
||||
import net.minecraft.server.v1_4_5.EntityPlayer;
|
||||
import net.minecraft.server.v1_4_5.MobEffectList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_4_5.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_4_5.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_4_5.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class MCAccessCB2512 implements MCAccess{
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB2512(){
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_4_5.", new String[]{"Entity" , "dead"});
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_4_5.Block.class,
|
||||
new String[]{"v", "w", "x", "y", "z", "A"}, double.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
return "1.4.5";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB2512";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB2512(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_4_5.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else return entityHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isLiquid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) return AlmostBoolean.NO;
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (!entityPlayer.isSleeping()){
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) return AlmostBoolean.YES;
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (int) Math.round(damage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0 ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
switch(mat){
|
||||
case SAND:
|
||||
case GRAVEL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.NO;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<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>ncpcompatcb2545</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatCB2545</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.4.6-R0.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<description>Compatibility since CB2545 (MC 1.4.6).
|
||||
</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
-160
@@ -1,160 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2545;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_4_6.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_4_6.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_4_6.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_4_6.IBlockAccess;
|
||||
import net.minecraft.server.v1_4_6.Material;
|
||||
import net.minecraft.server.v1_4_6.TileEntity;
|
||||
import net.minecraft.server.v1_4_6.Vec3DPool;
|
||||
|
||||
public class BlockCacheCB2545 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_4_6.World world;
|
||||
protected World bukkitWorld;
|
||||
|
||||
private IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public int getTypeId(final int x, final int y, final int z) {
|
||||
return BlockCacheCB2545.this.getType(x, y, z).getId();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getData(final int x, final int y, final int z) {
|
||||
return BlockCacheCB2545.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial(final int x, final int y, final int z) {
|
||||
return BlockCacheCB2545.this.world.getMaterial(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3DPool getVec3DPool() {
|
||||
return world.getVec3DPool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockFacePowered(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.isBlockFacePowered(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean t(final int x, final int y, final int z) {
|
||||
return world.t(x, y, z);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB2545(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
|
||||
// TODO: change api for this / use nodes (!)
|
||||
final int id = iBlockAccess.getTypeId(x, y, z);
|
||||
final net.minecraft.server.v1_4_6.Block block = net.minecraft.server.v1_4_6.Block.byId[id];
|
||||
if (block == null) return null;
|
||||
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.v(), block.x(), block.z(), block.w(), block.y(), block.A()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
|
||||
final net.minecraft.server.v1_4_6.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_4_6.Entity other = (net.minecraft.server.v1_4_6.Entity) iterator.next();
|
||||
final EntityType type = other.getBukkitEntity().getType();
|
||||
if (type != EntityType.BOAT && type != EntityType.MINECART) continue;
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue;
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
bukkitWorld = null;
|
||||
}
|
||||
|
||||
}
|
||||
-194
@@ -1,194 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2545;
|
||||
|
||||
import net.minecraft.server.v1_4_6.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_4_6.Block;
|
||||
import net.minecraft.server.v1_4_6.DamageSource;
|
||||
import net.minecraft.server.v1_4_6.EntityComplexPart;
|
||||
import net.minecraft.server.v1_4_6.EntityPlayer;
|
||||
import net.minecraft.server.v1_4_6.MobEffectList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_4_6.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_4_6.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_4_6.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class MCAccessCB2545 implements MCAccess{
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB2545(){
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_4_6.", new String[]{"Entity" , "dead"});
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_4_6.Block.class,
|
||||
new String[]{"v", "w", "x", "y", "z", "A"}, double.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
return "1.4.6";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB2545";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB2545(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_4_6.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else return entityHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isLiquid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) return AlmostBoolean.NO;
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (!entityPlayer.isSleeping()){
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) return AlmostBoolean.YES;
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (int) Math.round(damage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0 ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
switch(mat){
|
||||
case SAND:
|
||||
case GRAVEL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.NO;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<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>ncpcompatcb2602</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>NCPCompatCB2602</name>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.4.7-R1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<description>Compatibility for CB2602 (1.4.7).
|
||||
</description>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
-165
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2602;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.v1_4_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_4_R1.EntityBoat;
|
||||
import net.minecraft.server.v1_4_R1.IBlockAccess;
|
||||
import net.minecraft.server.v1_4_R1.Material;
|
||||
import net.minecraft.server.v1_4_R1.TileEntity;
|
||||
import net.minecraft.server.v1_4_R1.Vec3DPool;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_4_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_4_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BlockCacheCB2602 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_4_R1.World world;
|
||||
|
||||
protected World bukkitWorld;
|
||||
|
||||
private final IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public int getTypeId(int x, int y, int z) {
|
||||
return BlockCacheCB2602.this.getType(x, y, z).getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getData(int x, int y, int z) {
|
||||
return BlockCacheCB2602.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial(final int x, final int y, final int z) {
|
||||
return world.getMaterial(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3DPool getVec3DPool() {
|
||||
return world.getVec3DPool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockFacePowered(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.isBlockFacePowered(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean t(final int x, final int y, final int z) {
|
||||
return world.t(x, y, z);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB2602(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
this.bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
|
||||
// TODO: change api for this / use nodes (!)
|
||||
@SuppressWarnings("deprecation")
|
||||
final int id = getType(x, y, z).getId();
|
||||
final net.minecraft.server.v1_4_R1.Block block = net.minecraft.server.v1_4_R1.Block.byId[id];
|
||||
if (block == null) {
|
||||
return null;
|
||||
}
|
||||
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.v(), block.x(), block.z(), block.w(), block.y(), block.A()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
|
||||
final net.minecraft.server.v1_4_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_4_R1.Entity other = (net.minecraft.server.v1_4_R1.Entity) iterator.next();
|
||||
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
|
||||
continue;
|
||||
}
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue;
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
bukkitWorld = null;
|
||||
}
|
||||
|
||||
}
|
||||
-195
@@ -1,195 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2602;
|
||||
|
||||
import net.minecraft.server.v1_4_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_4_R1.Block;
|
||||
import net.minecraft.server.v1_4_R1.DamageSource;
|
||||
import net.minecraft.server.v1_4_R1.EntityComplexPart;
|
||||
import net.minecraft.server.v1_4_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_4_R1.MobEffectList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_4_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_4_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_4_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class MCAccessCB2602 implements MCAccess{
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB2602(){
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_4_R1.", new String[]{"Entity" , "dead"});
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_4_R1.Block.class,
|
||||
new String[]{"v", "w", "x", "y", "z", "A"}, double.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// 1_4_R1
|
||||
return "1.4.7";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB2602";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB2602(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_4_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else return entityHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isLiquid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) return AlmostBoolean.NO;
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (!entityPlayer.isSleeping()){
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) return AlmostBoolean.YES;
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (int) Math.round(damage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0 ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
switch(mat){
|
||||
case SAND:
|
||||
case GRAVEL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.NO;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,34 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatcb2645</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatCB2645</name>
|
||||
<description>Compatibility for CB2645 (MC 1.5).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.5-R0.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/craftbukkit-1.5-R0.1-20130317.180842-21.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
-170
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2645;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_5_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_5_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_5_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_5_R1.EntityBoat;
|
||||
import net.minecraft.server.v1_5_R1.IBlockAccess;
|
||||
import net.minecraft.server.v1_5_R1.Material;
|
||||
import net.minecraft.server.v1_5_R1.TileEntity;
|
||||
import net.minecraft.server.v1_5_R1.Vec3DPool;
|
||||
|
||||
public class BlockCacheCB2645 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_5_R1.World world;
|
||||
|
||||
protected World bukkitWorld;
|
||||
|
||||
private final IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public int getTypeId(int x, int y, int z) {
|
||||
return BlockCacheCB2645.this.getType(x, y, z).getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getData(int x, int y, int z) {
|
||||
return BlockCacheCB2645.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial(final int x, final int y, final int z) {
|
||||
return world.getMaterial(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3DPool getVec3DPool() {
|
||||
return world.getVec3DPool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockPower(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.getBlockPower(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean u(final int arg0, final int arg1, final int arg2) {
|
||||
return world.u(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB2645(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
this.bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
|
||||
// TODO: change api for this / use nodes (!)
|
||||
final org.bukkit.Material mat = getType(x, y, z);
|
||||
@SuppressWarnings("deprecation")
|
||||
final int id = mat.getId();
|
||||
final net.minecraft.server.v1_5_R1.Block block = net.minecraft.server.v1_5_R1.Block.byId[id];
|
||||
if (block == null) return null;
|
||||
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
|
||||
if (shape != null) return shape;
|
||||
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.u(), block.w(), block.y(), block.v(), block.x(), block.z()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
|
||||
final net.minecraft.server.v1_5_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_5_R1.Entity other = (net.minecraft.server.v1_5_R1.Entity) iterator.next();
|
||||
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
|
||||
continue;
|
||||
}
|
||||
if (minY >= other.locY && minY - other.locY <= 0.7){
|
||||
return true;
|
||||
}
|
||||
// Still check this for some reason.
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue;
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
bukkitWorld = null;
|
||||
}
|
||||
|
||||
}
|
||||
-200
@@ -1,200 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2645;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_5_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_5_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_5_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_5_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_5_R1.Block;
|
||||
import net.minecraft.server.v1_5_R1.DamageSource;
|
||||
import net.minecraft.server.v1_5_R1.EntityComplexPart;
|
||||
import net.minecraft.server.v1_5_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_5_R1.MobEffectList;
|
||||
|
||||
public class MCAccessCB2645 implements MCAccess {
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB2645(){
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_5_R1.", new String[]{"Entity" , "dead"});
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_5_R1.Block.class,
|
||||
new String[]{"u", "v", "w", "x", "y", "z"}, double.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// 1_5_R1
|
||||
return "1.5";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB2645";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB2645(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_5_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else return entityHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isLiquid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) return AlmostBoolean.NO;
|
||||
// TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though.
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (!entityPlayer.isSleeping()){
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) return AlmostBoolean.YES;
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (int) Math.round(damage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0 ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
switch(mat){
|
||||
case SAND:
|
||||
case GRAVEL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.NO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,34 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatcb2691</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatCB2691</name>
|
||||
<description>Compatibility for CB2691 (MC 1.5.1-R0.2 beta release).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.5.1-R0.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/craftbukkit-1.5.1-R0.2-SNAPSHOT.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
-170
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2691;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_5_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_5_R2.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_5_R2.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_5_R2.EntityBoat;
|
||||
import net.minecraft.server.v1_5_R2.IBlockAccess;
|
||||
import net.minecraft.server.v1_5_R2.Material;
|
||||
import net.minecraft.server.v1_5_R2.TileEntity;
|
||||
import net.minecraft.server.v1_5_R2.Vec3DPool;
|
||||
|
||||
public class BlockCacheCB2691 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_5_R2.World world;
|
||||
|
||||
protected World bukkitWorld;
|
||||
|
||||
private final IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public int getTypeId(final int x, final int y, final int z) {
|
||||
return BlockCacheCB2691.this.getType(x, y, z).getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getData(final int x, final int y, final int z) {
|
||||
return BlockCacheCB2691.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial(final int x, final int y, final int z) {
|
||||
return world.getMaterial(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3DPool getVec3DPool() {
|
||||
return world.getVec3DPool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockPower(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.getBlockPower(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean u(final int arg0, final int arg1, final int arg2) {
|
||||
return world.u(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB2691(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
this.bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
|
||||
// TODO: change api for this / use nodes (!)
|
||||
final org.bukkit.Material mat = getType(x, y, z);
|
||||
@SuppressWarnings("deprecation")
|
||||
final int id = mat.getId();
|
||||
final net.minecraft.server.v1_5_R2.Block block = net.minecraft.server.v1_5_R2.Block.byId[id];
|
||||
if (block == null) return null;
|
||||
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
|
||||
if (shape != null) return shape;
|
||||
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.u(), block.w(), block.y(), block.v(), block.x(), block.z()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
|
||||
final net.minecraft.server.v1_5_R2.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_5_R2.Entity other = (net.minecraft.server.v1_5_R2.Entity) iterator.next();
|
||||
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
|
||||
continue;
|
||||
}
|
||||
if (minY >= other.locY && minY - other.locY <= 0.7){
|
||||
return true;
|
||||
}
|
||||
// Still check this for some reason.
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue;
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
bukkitWorld = null;
|
||||
}
|
||||
|
||||
}
|
||||
-202
@@ -1,202 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2691;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_5_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_5_R2.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_5_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_5_R2.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_5_R2.Block;
|
||||
import net.minecraft.server.v1_5_R2.DamageSource;
|
||||
import net.minecraft.server.v1_5_R2.EntityComplexPart;
|
||||
import net.minecraft.server.v1_5_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_5_R2.MobEffectList;
|
||||
|
||||
public class MCAccessCB2691 implements MCAccess{
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB2691(){
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_5_R2.", new String[]{"Entity" , "dead"});
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_5_R2.Block.class,
|
||||
new String[]{"u", "v", "w", "x", "y", "z"}, double.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// 1_5_R2
|
||||
return "1.5.1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB2691";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB2691(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_5_R2.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else {
|
||||
return entityHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isLiquid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) return AlmostBoolean.NO;
|
||||
// TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though.
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (!entityPlayer.isSleeping()){
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) return AlmostBoolean.YES;
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (int) Math.round(damage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0 ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
switch(mat){
|
||||
case SAND:
|
||||
case GRAVEL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.NO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,34 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatcb2763</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatCB2763</name>
|
||||
<description>Compatibility for CB2763 (MC 1.5.2).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.5.2-R1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/craftbukkit-1.5.2-R1.0.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
-167
@@ -1,167 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2763;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_5_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_5_R3.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_5_R3.EntityBoat;
|
||||
import net.minecraft.server.v1_5_R3.IBlockAccess;
|
||||
import net.minecraft.server.v1_5_R3.Material;
|
||||
import net.minecraft.server.v1_5_R3.TileEntity;
|
||||
import net.minecraft.server.v1_5_R3.Vec3DPool;
|
||||
|
||||
public class BlockCacheCB2763 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_5_R3.World world;
|
||||
|
||||
protected World bukkitWorld;
|
||||
|
||||
private IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public int getTypeId(final int x, final int y, final int z) {
|
||||
return BlockCacheCB2763.this.getType(x, y, z).getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getData(final int x, final int y, final int z) {
|
||||
return BlockCacheCB2763.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial(final int x, final int y, final int z) {
|
||||
return world.getMaterial(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3DPool getVec3DPool() {
|
||||
return world.getVec3DPool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockPower(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.getBlockPower(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean u(final int arg0, final int arg1, final int arg2) {
|
||||
return world.u(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB2763(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
// TODO: change api for this / use nodes (!)
|
||||
final org.bukkit.Material mat = getType(x, y, z);
|
||||
final int id = iBlockAccess.getTypeId(x, y, z);
|
||||
final net.minecraft.server.v1_5_R3.Block block = net.minecraft.server.v1_5_R3.Block.byId[id];
|
||||
if (block == null) return null;
|
||||
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
|
||||
if (shape != null) return shape;
|
||||
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.u(), block.w(), block.y(), block.v(), block.x(), block.z()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
|
||||
final net.minecraft.server.v1_5_R3.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_5_R3.Entity other = (net.minecraft.server.v1_5_R3.Entity) iterator.next();
|
||||
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
|
||||
continue;
|
||||
}
|
||||
if (minY >= other.locY && minY - other.locY <= 0.7){
|
||||
return true;
|
||||
}
|
||||
// Still check this for some reason.
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue;
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
}
|
||||
|
||||
}
|
||||
-201
@@ -1,201 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2763;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_5_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_5_R3.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_5_R3.Block;
|
||||
import net.minecraft.server.v1_5_R3.DamageSource;
|
||||
import net.minecraft.server.v1_5_R3.EntityComplexPart;
|
||||
import net.minecraft.server.v1_5_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_5_R3.MobEffectList;
|
||||
|
||||
public class MCAccessCB2763 implements MCAccess{
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB2763(){
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_5_R3.", new String[]{"Entity" , "dead"});
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_5_R3.Block.class,
|
||||
new String[]{"u", "v", "w", "x", "y", "z"}, double.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// 1_5_R3
|
||||
return "1.5.2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB2763";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB2763(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_5_R3.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else return entityHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isLiquid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) return AlmostBoolean.NO;
|
||||
// TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though.
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (!entityPlayer.isSleeping()){
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) return AlmostBoolean.YES;
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (int) Math.round(damage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0 ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
// TODO: TEST: return mat.hasGravity();
|
||||
switch(mat){
|
||||
case SAND:
|
||||
case GRAVEL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.NO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,34 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatcb2794</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatCB2794</name>
|
||||
<description>Compatibility for CB2794 (MC 1.6.1).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.6.1-R0.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/craftbukkit-1.6.1-R0.1-SNAPSHOT.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2794;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AttribUtil;
|
||||
import fr.neatmonster.nocheatplus.components.modifier.IAttributeAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import net.minecraft.server.v1_6_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_6_R1.AttributeModifier;
|
||||
import net.minecraft.server.v1_6_R1.GenericAttributes;
|
||||
|
||||
public class AttributeAccess implements IAttributeAccess {
|
||||
|
||||
public AttributeAccess() {
|
||||
if (ReflectionUtil.getClass("net.minecraft.server.v1_6_R1.AttributeInstance") == null) {
|
||||
throw new RuntimeException("Service not available.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSpeedAttributeMultiplier(Player player) {
|
||||
final AttributeInstance attr = ((CraftLivingEntity) player).getHandle().a(GenericAttributes.d);
|
||||
double val = attr.e() / attr.b();
|
||||
final AttributeModifier mod = attr.a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return val;
|
||||
} else {
|
||||
return val / AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSprintAttributeMultiplier(Player player) {
|
||||
final AttributeModifier mod = ((CraftLivingEntity) player).getHandle().a(GenericAttributes.d).a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return 1.0;
|
||||
} else {
|
||||
return AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-170
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2794;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_6_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_6_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_6_R1.EntityBoat;
|
||||
import net.minecraft.server.v1_6_R1.IBlockAccess;
|
||||
import net.minecraft.server.v1_6_R1.Material;
|
||||
import net.minecraft.server.v1_6_R1.TileEntity;
|
||||
import net.minecraft.server.v1_6_R1.Vec3DPool;
|
||||
|
||||
public class BlockCacheCB2794 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_6_R1.World world;
|
||||
|
||||
protected World bukkitWorld;
|
||||
|
||||
IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public int getTypeId(final int x, final int y, final int z) {
|
||||
return BlockCacheCB2794.this.getType(x, y, z).getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getData(final int x, final int y, final int z) {
|
||||
return BlockCacheCB2794.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial(final int x, final int y, final int z) {
|
||||
return world.getMaterial(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3DPool getVec3DPool() {
|
||||
return world.getVec3DPool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockPower(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.getBlockPower(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean u(final int arg0, final int arg1, final int arg2) {
|
||||
return world.u(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB2794(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
|
||||
// TODO: change api for this / use nodes (!)
|
||||
final org.bukkit.Material mat = getType(x, y, z);
|
||||
@SuppressWarnings("deprecation")
|
||||
final int id = mat.getId();
|
||||
final net.minecraft.server.v1_6_R1.Block block = net.minecraft.server.v1_6_R1.Block.byId[id];
|
||||
if (block == null) return null;
|
||||
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
|
||||
if (shape != null) return shape;
|
||||
block.updateShape(iBlockAccess, x, y, z);
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.u(), block.w(), block.y(), block.v(), block.x(), block.z()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
|
||||
final net.minecraft.server.v1_6_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_6_R1.Entity other = (net.minecraft.server.v1_6_R1.Entity) iterator.next();
|
||||
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
|
||||
continue;
|
||||
}
|
||||
if (minY >= other.locY && minY - other.locY <= 0.7){
|
||||
return true;
|
||||
}
|
||||
// Still check this for some reason.
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue;
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
bukkitWorld = null;
|
||||
}
|
||||
|
||||
}
|
||||
-195
@@ -1,195 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2794;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_6_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_6_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_6_R1.Block;
|
||||
import net.minecraft.server.v1_6_R1.DamageSource;
|
||||
import net.minecraft.server.v1_6_R1.EntityComplexPart;
|
||||
import net.minecraft.server.v1_6_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R1.MobEffectList;
|
||||
|
||||
public class MCAccessCB2794 implements MCAccess {
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB2794(){
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_6_R1.", new String[]{"Entity" , "dead"});
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_6_R1.Block.class,
|
||||
new String[]{"u", "v", "w", "x", "y", "z"}, double.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// 1_6_R1
|
||||
return "1.6.1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB2794";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB2794(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_6_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else return entityHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isLiquid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) return AlmostBoolean.NO;
|
||||
// TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though.
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (!entityPlayer.isSleeping()){
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) return AlmostBoolean.YES;
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (float) damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
// TODO: Test/check.
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.NO;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,34 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatcb2808</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatCB2808</name>
|
||||
<description>Compatibility for CB2808 (MC 1.6.2).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.6.2-R0.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/craftbukkit-1.6.2-R0.1-SNAPSHOT.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2808;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AttribUtil;
|
||||
import fr.neatmonster.nocheatplus.components.modifier.IAttributeAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import net.minecraft.server.v1_6_R2.AttributeInstance;
|
||||
import net.minecraft.server.v1_6_R2.AttributeModifier;
|
||||
import net.minecraft.server.v1_6_R2.GenericAttributes;
|
||||
|
||||
public class AttributeAccess implements IAttributeAccess {
|
||||
|
||||
public AttributeAccess() {
|
||||
if (ReflectionUtil.getClass("net.minecraft.server.v1_6_R2.AttributeInstance") == null) {
|
||||
throw new RuntimeException("Service not available.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSpeedAttributeMultiplier(Player player) {
|
||||
final AttributeInstance attr = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.d);
|
||||
final double val = attr.getValue() / attr.b();
|
||||
final AttributeModifier mod = attr.a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return val;
|
||||
} else {
|
||||
return val / AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSprintAttributeMultiplier(Player player) {
|
||||
final AttributeModifier mod = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.d).a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return 1.0;
|
||||
} else {
|
||||
return AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-170
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2808;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_6_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_6_R2.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_6_R2.EntityBoat;
|
||||
import net.minecraft.server.v1_6_R2.IBlockAccess;
|
||||
import net.minecraft.server.v1_6_R2.Material;
|
||||
import net.minecraft.server.v1_6_R2.TileEntity;
|
||||
import net.minecraft.server.v1_6_R2.Vec3DPool;
|
||||
|
||||
public class BlockCacheCB2808 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_6_R2.World world;
|
||||
|
||||
protected World bukkitWorld;
|
||||
|
||||
private final IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public int getTypeId(final int x, final int y, final int z) {
|
||||
return BlockCacheCB2808.this.getType(x, y, z).getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getData(final int x, final int y, final int z) {
|
||||
return BlockCacheCB2808.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial(final int x, final int y, final int z) {
|
||||
return world.getMaterial(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3DPool getVec3DPool() {
|
||||
return world.getVec3DPool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockPower(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.getBlockPower(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean u(final int arg0, final int arg1, final int arg2) {
|
||||
return world.u(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB2808(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
this.bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
|
||||
// TODO: change api for this / use nodes (!)
|
||||
final org.bukkit.Material mat = getType(x, y, z);
|
||||
@SuppressWarnings("deprecation")
|
||||
final int id = mat.getId();
|
||||
final net.minecraft.server.v1_6_R2.Block block = net.minecraft.server.v1_6_R2.Block.byId[id];
|
||||
if (block == null) return null;
|
||||
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
|
||||
if (shape != null) return shape;
|
||||
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.u(), block.w(), block.y(), block.v(), block.x(), block.z()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
|
||||
final net.minecraft.server.v1_6_R2.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_6_R2.Entity other = (net.minecraft.server.v1_6_R2.Entity) iterator.next();
|
||||
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
|
||||
continue;
|
||||
}
|
||||
if (minY >= other.locY && minY - other.locY <= 0.7){
|
||||
return true;
|
||||
}
|
||||
// Still check this for some reason.
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue;
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
bukkitWorld = null;
|
||||
}
|
||||
|
||||
}
|
||||
-196
@@ -1,196 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2808;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_6_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_6_R2.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_6_R2.Block;
|
||||
import net.minecraft.server.v1_6_R2.DamageSource;
|
||||
import net.minecraft.server.v1_6_R2.EntityComplexPart;
|
||||
import net.minecraft.server.v1_6_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R2.MobEffectList;
|
||||
|
||||
public class MCAccessCB2808 implements MCAccess {
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB2808(){
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_6_R2.", new String[]{"Entity" , "dead"});
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_6_R2.Block.class,
|
||||
new String[]{"u", "v", "w", "x", "y", "z"}, double.class);
|
||||
// TODO: Nail it down further.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// 1_6_R2
|
||||
return "1.6.2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB2808";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB2808(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_6_R2.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else return entityHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isLiquid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) return AlmostBoolean.NO;
|
||||
// TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though.
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (!entityPlayer.isSleeping()){
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) return AlmostBoolean.YES;
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (float) damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
// TODO: Test/check.
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.NO;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Whitespace-only changes.
@@ -1,34 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatcb2882</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatCB2882</name>
|
||||
<description>Compatibility for CB2882 (MC 1.6.4).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.6.4-R2.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/craftbukkit-1.6.4-R2.0.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2882;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AttribUtil;
|
||||
import fr.neatmonster.nocheatplus.components.modifier.IAttributeAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import net.minecraft.server.v1_6_R3.AttributeInstance;
|
||||
import net.minecraft.server.v1_6_R3.AttributeModifier;
|
||||
import net.minecraft.server.v1_6_R3.GenericAttributes;
|
||||
|
||||
public class AttributeAccess implements IAttributeAccess {
|
||||
|
||||
public AttributeAccess() {
|
||||
if (ReflectionUtil.getClass("net.minecraft.server.v1_6_R3.AttributeInstance") == null) {
|
||||
throw new RuntimeException("Service not available.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSpeedAttributeMultiplier(Player player) {
|
||||
final AttributeInstance attr = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.d);
|
||||
final double val = attr.getValue() / attr.b();
|
||||
final AttributeModifier mod = attr.a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return val;
|
||||
} else {
|
||||
return val / AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSprintAttributeMultiplier(Player player) {
|
||||
final AttributeModifier mod = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.d).a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return 1.0;
|
||||
} else {
|
||||
return AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-170
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2882;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_6_R3.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_6_R3.EntityBoat;
|
||||
import net.minecraft.server.v1_6_R3.IBlockAccess;
|
||||
import net.minecraft.server.v1_6_R3.Material;
|
||||
import net.minecraft.server.v1_6_R3.TileEntity;
|
||||
import net.minecraft.server.v1_6_R3.Vec3DPool;
|
||||
|
||||
public class BlockCacheCB2882 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_6_R3.World world;
|
||||
|
||||
protected World bukkitWorld;
|
||||
|
||||
private final IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public int getTypeId(int x, int y, int z) {
|
||||
return BlockCacheCB2882.this.getType(x, y, z).getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getData(int x, int y, int z) {
|
||||
return BlockCacheCB2882.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getMaterial(final int x, final int y, final int z) {
|
||||
return world.getMaterial(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3DPool getVec3DPool() {
|
||||
return world.getVec3DPool();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockPower(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.getBlockPower(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean u(final int arg0, final int arg1, final int arg2) {
|
||||
return world.u(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB2882(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
this.bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
|
||||
// TODO: change api for this / use nodes (!)
|
||||
final org.bukkit.Material mat = getType(x, y, z);
|
||||
@SuppressWarnings("deprecation")
|
||||
final int id = mat.getId();
|
||||
final net.minecraft.server.v1_6_R3.Block block = net.minecraft.server.v1_6_R3.Block.byId[id];
|
||||
if (block == null) return null;
|
||||
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
|
||||
if (shape != null) return shape;
|
||||
block.updateShape(iBlockAccess, x, y, z);
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.u(), block.w(), block.y(), block.v(), block.x(), block.z()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
|
||||
final net.minecraft.server.v1_6_R3.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_6_R3.Entity other = (net.minecraft.server.v1_6_R3.Entity) iterator.next();
|
||||
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
|
||||
continue;
|
||||
}
|
||||
if (minY >= other.locY && minY - other.locY <= 0.7){
|
||||
return true;
|
||||
}
|
||||
// Still check this for some reason.
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue;
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
bukkitWorld = null;
|
||||
}
|
||||
|
||||
}
|
||||
-197
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2882;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_6_R3.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_6_R3.Block;
|
||||
import net.minecraft.server.v1_6_R3.DamageSource;
|
||||
import net.minecraft.server.v1_6_R3.EntityComplexPart;
|
||||
import net.minecraft.server.v1_6_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_6_R3.MobEffectList;
|
||||
|
||||
public class MCAccessCB2882 implements MCAccess{
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB2882(){
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_6_R3.", new String[]{"Entity" , "dead"});
|
||||
// block bounds, original: minX, maxX, minY, maxY, minZ, maxZ
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_6_R3.Block.class,
|
||||
new String[]{"u", "v", "w", "x", "y", "z"}, double.class);
|
||||
// TODO: Nail it down further.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// 1_6_R3
|
||||
return "1.6.4";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB2882";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB2882(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_6_R3.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else return entityHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.byId[id.getId()];
|
||||
if (block == null || block.material == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.material.isLiquid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) return AlmostBoolean.NO;
|
||||
// TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though.
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (!entityPlayer.isSleeping()){
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) return AlmostBoolean.YES;
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (float) damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
// TODO: Test/check.
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.NO;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatCB2922</name>
|
||||
<description>Compatibility for CB2922 (MC 1.7.2).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.2-R0.4-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2922;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AttribUtil;
|
||||
import fr.neatmonster.nocheatplus.components.modifier.IAttributeAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import net.minecraft.server.v1_7_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_7_R1.AttributeModifier;
|
||||
import net.minecraft.server.v1_7_R1.GenericAttributes;
|
||||
|
||||
public class AttributeAccess implements IAttributeAccess {
|
||||
|
||||
public AttributeAccess() {
|
||||
if (ReflectionUtil.getClass("net.minecraft.server.v1_7_R1.AttributeInstance") == null) {
|
||||
throw new RuntimeException("Service not available.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSpeedAttributeMultiplier(Player player) {
|
||||
final AttributeInstance attr = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.d);
|
||||
final double val = attr.getValue() / attr.b();
|
||||
final AttributeModifier mod = attr.a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return val;
|
||||
} else {
|
||||
return val / AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSprintAttributeMultiplier(Player player) {
|
||||
final AttributeModifier mod = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.d).a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return 1.0;
|
||||
} else {
|
||||
return AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-159
@@ -1,159 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2922;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_7_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R1.Block;
|
||||
import net.minecraft.server.v1_7_R1.EntityBoat;
|
||||
import net.minecraft.server.v1_7_R1.IBlockAccess;
|
||||
import net.minecraft.server.v1_7_R1.TileEntity;
|
||||
import net.minecraft.server.v1_7_R1.Vec3DPool;
|
||||
|
||||
public class BlockCacheCB2922 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_7_R1.WorldServer world;
|
||||
|
||||
protected World bukkitWorld;
|
||||
|
||||
private final IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@Override
|
||||
public int getData(int x, int y, int z) {
|
||||
return BlockCacheCB2922.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockPower(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.getBlockPower(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getType(int x, int y, int z) {
|
||||
return world.getType(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3DPool getVec3DPool() {
|
||||
return world.getVec3DPool();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB2922(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
this.bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
// TODO: change api for this / use nodes (!)
|
||||
final Material mat = getType(x, y, z);
|
||||
@SuppressWarnings("deprecation")
|
||||
final int id = mat.getId();
|
||||
final net.minecraft.server.v1_7_R1.Block block = net.minecraft.server.v1_7_R1.Block.e(id);
|
||||
if (block == null) return null;
|
||||
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
|
||||
if (shape != null) return shape;
|
||||
block.updateShape(iBlockAccess, x, y, z); // data from cache.
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.x(), block.z(), block.B(), block.y(), block.A(), block.C()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
|
||||
final net.minecraft.server.v1_7_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_7_R1.Entity other = (net.minecraft.server.v1_7_R1.Entity) iterator.next();
|
||||
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
|
||||
continue;
|
||||
}
|
||||
if (minY >= other.locY && minY - other.locY <= 0.7){
|
||||
return true;
|
||||
}
|
||||
// Still check this for some reason.
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue;
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
bukkitWorld = null;
|
||||
}
|
||||
|
||||
}
|
||||
-198
@@ -1,198 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb2922;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_7_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R1.Block;
|
||||
import net.minecraft.server.v1_7_R1.DamageSource;
|
||||
import net.minecraft.server.v1_7_R1.EntityComplexPart;
|
||||
import net.minecraft.server.v1_7_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R1.MobEffectList;
|
||||
|
||||
public class MCAccessCB2922 implements MCAccess{
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB2922(){
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_7_R1.", new String[]{"Entity" , "dead"});
|
||||
// block bounds, original: minX, maxX, minY, maxY, minZ, maxZ
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_7_R1.Block.class,
|
||||
new String[]{"x", "y", "z", "A", "B", "C"}, double.class);
|
||||
// TODO: Nail it down further.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// 1_7_R1
|
||||
return "1.7.2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB2922";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB2922(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_7_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else return entityHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.e(id.getId());
|
||||
if (block == null || block.getMaterial() == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.getMaterial().isSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.e(id.getId());
|
||||
if (block == null || block.getMaterial() == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.getMaterial().isLiquid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) return AlmostBoolean.NO;
|
||||
// TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though.
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (!entityPlayer.isSleeping()){
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) return AlmostBoolean.YES;
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (float) damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
// TODO: Test/check.
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.NO;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().by();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatCB3026</name>
|
||||
<description>Compatibility for CB3026 (MC 1.7.5).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.5-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb3026;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R2.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AttribUtil;
|
||||
import fr.neatmonster.nocheatplus.components.modifier.IAttributeAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import net.minecraft.server.v1_7_R2.AttributeInstance;
|
||||
import net.minecraft.server.v1_7_R2.AttributeModifier;
|
||||
import net.minecraft.server.v1_7_R2.GenericAttributes;
|
||||
|
||||
public class AttributeAccess implements IAttributeAccess {
|
||||
|
||||
public AttributeAccess() {
|
||||
if (ReflectionUtil.getClass("net.minecraft.server.v1_7_R2.AttributeInstance") == null) {
|
||||
throw new RuntimeException("Service not available.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSpeedAttributeMultiplier(Player player) {
|
||||
final AttributeInstance attr = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.d);
|
||||
final double val = attr.getValue() / attr.b();
|
||||
final AttributeModifier mod = attr.a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return val;
|
||||
} else {
|
||||
return val / AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSprintAttributeMultiplier(Player player) {
|
||||
final AttributeModifier mod = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.d).a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return 1.0;
|
||||
} else {
|
||||
return AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-154
@@ -1,154 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb3026;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_7_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R2.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_7_R2.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R2.Block;
|
||||
import net.minecraft.server.v1_7_R2.EntityBoat;
|
||||
import net.minecraft.server.v1_7_R2.IBlockAccess;
|
||||
import net.minecraft.server.v1_7_R2.TileEntity;
|
||||
|
||||
public class BlockCacheCB3026 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_7_R2.WorldServer world;
|
||||
|
||||
protected World bukkitWorld;
|
||||
|
||||
private final IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@Override
|
||||
public int getData(int x, int y, int z) {
|
||||
return BlockCacheCB3026.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockPower(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.getBlockPower(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getType(int x, int y, int z) {
|
||||
return world.getType(x, y, z);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB3026(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
this.bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
|
||||
// TODO: change api for this / use nodes (!)
|
||||
final Material mat = getType(x, y, z);
|
||||
@SuppressWarnings("deprecation")
|
||||
final int id = mat.getId();
|
||||
final net.minecraft.server.v1_7_R2.Block block = net.minecraft.server.v1_7_R2.Block.e(id);
|
||||
if (block == null) return null;
|
||||
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
|
||||
if (shape != null) return shape;
|
||||
block.updateShape(iBlockAccess, x, y, z); // getData from cache.
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.x(), block.z(), block.B(), block.y(), block.A(), block.C()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
|
||||
final net.minecraft.server.v1_7_R2.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_7_R2.Entity other = (net.minecraft.server.v1_7_R2.Entity) iterator.next();
|
||||
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
|
||||
continue;
|
||||
}
|
||||
if (minY >= other.locY && minY - other.locY <= 0.7){
|
||||
return true;
|
||||
}
|
||||
// Still check this for some reason.
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue;
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
bukkitWorld = null;
|
||||
}
|
||||
|
||||
}
|
||||
-198
@@ -1,198 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb3026;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_7_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R2.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_7_R2.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R2.Block;
|
||||
import net.minecraft.server.v1_7_R2.DamageSource;
|
||||
import net.minecraft.server.v1_7_R2.EntityComplexPart;
|
||||
import net.minecraft.server.v1_7_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R2.MobEffectList;
|
||||
|
||||
public class MCAccessCB3026 implements MCAccess {
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB3026(){
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_7_R2.", new String[]{"Entity" , "dead"});
|
||||
// block bounds, original: minX, maxX, minY, maxY, minZ, maxZ
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_7_R2.Block.class,
|
||||
new String[]{"x", "y", "z", "A", "B", "C"}, double.class);
|
||||
// TODO: Nail it down further.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// 1_7_R2
|
||||
return "1.7.5";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB3026";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB3026(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_7_R2.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else return entityHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.e(id.getId());
|
||||
if (block == null || block.getMaterial() == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.getMaterial().isSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.e(id.getId());
|
||||
if (block == null || block.getMaterial() == null) return AlmostBoolean.MAYBE;
|
||||
else return AlmostBoolean.match(block.getMaterial().isLiquid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) return AlmostBoolean.NO;
|
||||
// TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though.
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (!entityPlayer.isSleeping()){
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) return AlmostBoolean.YES;
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
else return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (float) damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
// TODO: Test/check.
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().bz();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatCB3043</name>
|
||||
<description>Compatibility for CB3043 (MC 1.7.9).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.9-R0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb3043;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AttribUtil;
|
||||
import fr.neatmonster.nocheatplus.components.modifier.IAttributeAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import net.minecraft.server.v1_7_R3.AttributeInstance;
|
||||
import net.minecraft.server.v1_7_R3.AttributeModifier;
|
||||
import net.minecraft.server.v1_7_R3.GenericAttributes;
|
||||
|
||||
public class AttributeAccess implements IAttributeAccess {
|
||||
|
||||
public AttributeAccess() {
|
||||
if (ReflectionUtil.getClass("net.minecraft.server.v1_7_R3.AttributeInstance") == null) {
|
||||
throw new RuntimeException("Service not available.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSpeedAttributeMultiplier(Player player) {
|
||||
final AttributeInstance attr = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.d);
|
||||
final double val = attr.getValue() / attr.b();
|
||||
final AttributeModifier mod = attr.a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return val;
|
||||
} else {
|
||||
return val / AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSprintAttributeMultiplier(Player player) {
|
||||
final AttributeModifier mod = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.d).a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return 1.0;
|
||||
} else {
|
||||
return AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-154
@@ -1,154 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb3043;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_7_R3.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R3.Block;
|
||||
import net.minecraft.server.v1_7_R3.EntityBoat;
|
||||
import net.minecraft.server.v1_7_R3.IBlockAccess;
|
||||
import net.minecraft.server.v1_7_R3.TileEntity;
|
||||
|
||||
public class BlockCacheCB3043 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_7_R3.WorldServer world;
|
||||
|
||||
protected World bukkitWorld;
|
||||
|
||||
private final IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@Override
|
||||
public int getData(int x, int y, int z) {
|
||||
return BlockCacheCB3043.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockPower(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.getBlockPower(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getType(int x, int y, int z) {
|
||||
return world.getType(x, y, z);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB3043(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
this.bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
|
||||
// TODO: change api for this / use nodes (!)
|
||||
final Material mat = getType(x, y, z);
|
||||
@SuppressWarnings("deprecation")
|
||||
final int id = mat.getId();
|
||||
final net.minecraft.server.v1_7_R3.Block block = net.minecraft.server.v1_7_R3.Block.e(id);
|
||||
if (block == null) return null;
|
||||
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
|
||||
if (shape != null) return shape;
|
||||
block.updateShape(iBlockAccess, x, y, z); // getData from cache.
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.x(), block.z(), block.B(), block.y(), block.A(), block.C()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
|
||||
final net.minecraft.server.v1_7_R3.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_7_R3.Entity other = (net.minecraft.server.v1_7_R3.Entity) iterator.next();
|
||||
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
|
||||
continue;
|
||||
}
|
||||
if (minY >= other.locY && minY - other.locY <= 0.7){
|
||||
return true;
|
||||
}
|
||||
// Still check this for some reason.
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) continue;
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
bukkitWorld = null;
|
||||
}
|
||||
|
||||
}
|
||||
-217
@@ -1,217 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb3043;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_7_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_7_R3.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R3.Block;
|
||||
import net.minecraft.server.v1_7_R3.DamageSource;
|
||||
import net.minecraft.server.v1_7_R3.EntityComplexPart;
|
||||
import net.minecraft.server.v1_7_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R3.MobEffectList;
|
||||
|
||||
public class MCAccessCB3043 implements MCAccess {
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB3043() {
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_7_R3.", new String[] {"Entity" , "dead"});
|
||||
// block bounds, original: minX, maxX, minY, maxY, minZ, maxZ
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_7_R3.Block.class,
|
||||
new String[]{"x", "y", "z", "A", "B", "C"}, double.class);
|
||||
// TODO: Nail it down further.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// 1_7_R3
|
||||
return "1.7.8|1.7.9";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB3043";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB3043(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_7_R3.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else return entityHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.e(id.getId());
|
||||
if (block == null || block.getMaterial() == null) {
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
else {
|
||||
return AlmostBoolean.match(block.getMaterial().isSolid());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.e(id.getId());
|
||||
if (block == null || block.getMaterial() == null) {
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
else {
|
||||
return AlmostBoolean.match(block.getMaterial().isLiquid());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) return AlmostBoolean.NO;
|
||||
// TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though.
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (!entityPlayer.isSleeping()) {
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) {
|
||||
return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
}
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) {
|
||||
return AlmostBoolean.YES;
|
||||
}
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) {
|
||||
return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
}
|
||||
else {
|
||||
return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) {
|
||||
return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
}
|
||||
else {
|
||||
return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (float) damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
// TODO: Test/check.
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().bz();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatCB3100</name>
|
||||
<description>Compatibility for CraftBukkit build 3100 (MC 1.7.10).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.10-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb3100;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AttribUtil;
|
||||
import fr.neatmonster.nocheatplus.components.modifier.IAttributeAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import net.minecraft.server.v1_7_R4.AttributeInstance;
|
||||
import net.minecraft.server.v1_7_R4.AttributeModifier;
|
||||
import net.minecraft.server.v1_7_R4.GenericAttributes;
|
||||
|
||||
public class AttributeAccess implements IAttributeAccess {
|
||||
|
||||
public AttributeAccess() {
|
||||
if (ReflectionUtil.getClass("net.minecraft.server.v1_7_R4.AttributeInstance") == null) {
|
||||
throw new RuntimeException("Service not available.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSpeedAttributeMultiplier(final Player player) {
|
||||
final AttributeInstance attr = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.d);
|
||||
final double val = attr.getValue() / attr.b();
|
||||
final AttributeModifier mod = attr.a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return val;
|
||||
} else {
|
||||
return val / AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSprintAttributeMultiplier(Player player) {
|
||||
final AttributeModifier mod = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.d).a(AttribUtil.ID_SPRINT_BOOST);
|
||||
if (mod == null) {
|
||||
return 1.0;
|
||||
} else {
|
||||
return AttribUtil.getMultiplier(mod.c(), mod.d());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-157
@@ -1,157 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb3100;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R4.Block;
|
||||
import net.minecraft.server.v1_7_R4.EntityBoat;
|
||||
import net.minecraft.server.v1_7_R4.IBlockAccess;
|
||||
import net.minecraft.server.v1_7_R4.TileEntity;
|
||||
|
||||
public class BlockCacheCB3100 extends BlockCache {
|
||||
|
||||
/** Box for one time use, no nesting, no extra storing this(!). */
|
||||
protected static final AxisAlignedBB useBox = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
|
||||
|
||||
protected net.minecraft.server.v1_7_R4.WorldServer world;
|
||||
|
||||
protected World bukkitWorld;
|
||||
|
||||
private final IBlockAccess iBlockAccess = new IBlockAccess() {
|
||||
|
||||
@Override
|
||||
public int getData(int x, int y, int z) {
|
||||
return BlockCacheCB3100.this.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity(final int x, final int y, final int z) {
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockPower(final int arg0, final int arg1, final int arg2, final int arg3) {
|
||||
return world.getBlockPower(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getType(int x, int y, int z) {
|
||||
return world.getType(x, y, z);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public BlockCacheCB3100(World world) {
|
||||
setAccess(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache setAccess(World world) {
|
||||
this.bukkitWorld = world;
|
||||
if (world != null) {
|
||||
this.maxBlockY = world.getMaxHeight() - 1;
|
||||
this.world = ((CraftWorld) world).getHandle();
|
||||
} else {
|
||||
this.world = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material fetchTypeId(final int x, final int y, final int z) {
|
||||
return bukkitWorld.getBlockAt(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fetchData(final int x, final int y, final int z) {
|
||||
return world.getData(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] fetchBounds(final int x, final int y, final int z){
|
||||
final Material mat = getType(x, y, z);
|
||||
@SuppressWarnings("deprecation")
|
||||
final int id = mat.getId();
|
||||
final net.minecraft.server.v1_7_R4.Block block = net.minecraft.server.v1_7_R4.Block.getById(id);
|
||||
if (block == null) {
|
||||
// TODO: Convention for null bounds -> full ?
|
||||
return null;
|
||||
}
|
||||
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
|
||||
if (shape != null) return shape;
|
||||
block.updateShape(iBlockAccess, x, y, z); // getData from cache.
|
||||
|
||||
// minX, minY, minZ, maxX, maxY, maxZ
|
||||
return new double[]{block.x(), block.z(), block.B(), block.y(), block.A(), block.C()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||
try{
|
||||
// TODO: Find some simplification!
|
||||
|
||||
final net.minecraft.server.v1_7_R4.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
|
||||
final AxisAlignedBB box = useBox.b(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final List list = world.getEntities(mcEntity, box);
|
||||
@SuppressWarnings("rawtypes")
|
||||
final Iterator iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final net.minecraft.server.v1_7_R4.Entity other = (net.minecraft.server.v1_7_R4.Entity) iterator.next();
|
||||
if (!(other instanceof EntityBoat)){ // && !(other instanceof EntityMinecart)) continue;
|
||||
continue;
|
||||
}
|
||||
if (minY >= other.locY && minY - other.locY <= 0.7){
|
||||
return true;
|
||||
}
|
||||
// Still check this for some reason.
|
||||
final AxisAlignedBB otherBox = other.boundingBox;
|
||||
if (box.a > otherBox.d || box.d < otherBox.a || box.b > otherBox.e || box.e < otherBox.b || box.c > otherBox.f || box.f < otherBox.c) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable t){
|
||||
// Ignore exceptions (Context: DisguiseCraft).
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see fr.neatmonster.nocheatplus.utilities.BlockCache#cleanup()
|
||||
*/
|
||||
@Override
|
||||
public void cleanup() {
|
||||
super.cleanup();
|
||||
world = null;
|
||||
bukkitWorld = null;
|
||||
}
|
||||
|
||||
}
|
||||
-223
@@ -1,223 +0,0 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.cb3100;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R4.Block;
|
||||
import net.minecraft.server.v1_7_R4.DamageSource;
|
||||
import net.minecraft.server.v1_7_R4.EntityComplexPart;
|
||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R4.MobEffectList;
|
||||
|
||||
public class MCAccessCB3100 implements MCAccess {
|
||||
|
||||
/**
|
||||
* Constructor to let it fail.
|
||||
*/
|
||||
public MCAccessCB3100() {
|
||||
getCommandMap();
|
||||
ReflectionUtil.checkMembers("net.minecraft.server.v1_7_R4.", new String[] {"Entity" , "dead"});
|
||||
// block bounds, original: minX, maxX, minY, maxY, minZ, maxZ
|
||||
ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_7_R4.Block.class,
|
||||
new String[]{"x", "y", "z", "A", "B", "C"}, double.class);
|
||||
// TODO: Nail it down further.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// 1_7_R4
|
||||
return "1.7.10";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServerVersionTag() {
|
||||
return "CB3100";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandMap getCommandMap() {
|
||||
return ((CraftServer) Bukkit.getServer()).getCommandMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache() {
|
||||
return getBlockCache(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockCache getBlockCache(final World world) {
|
||||
return new BlockCacheCB3100(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight(final Entity entity) {
|
||||
final net.minecraft.server.v1_7_R4.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||
final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.height, mcEntity.boundingBox.e - mcEntity.boundingBox.b));
|
||||
if (entity instanceof LivingEntity) {
|
||||
return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
|
||||
} else return entityHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockSolid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.getById(id.getId());
|
||||
if (block == null || block.getMaterial() == null) {
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
else {
|
||||
return AlmostBoolean.match(block.getMaterial().isSolid());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isBlockLiquid(final Material id) {
|
||||
@SuppressWarnings("deprecation")
|
||||
final Block block = Block.getById(id.getId());
|
||||
if (block == null || block.getMaterial() == null) {
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
else {
|
||||
return AlmostBoolean.match(block.getMaterial().isLiquid());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWidth(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle().width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean isIllegalBounds(final Player player) {
|
||||
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (entityPlayer.dead) {
|
||||
return AlmostBoolean.NO;
|
||||
}
|
||||
// TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though.
|
||||
final AxisAlignedBB box = entityPlayer.boundingBox;
|
||||
if (LocUtil.isBadCoordinate(box.a, box.b, box.c, box.d, box.e, box.f)) {
|
||||
return AlmostBoolean.YES;
|
||||
}
|
||||
if (!entityPlayer.isSleeping()) {
|
||||
// This can not really test stance but height of bounding box.
|
||||
final double dY = Math.abs(box.e - box.b);
|
||||
if (dY > 1.8) {
|
||||
return AlmostBoolean.YES; // dY > 1.65D ||
|
||||
}
|
||||
if (dY < 0.1D && entityPlayer.length >= 0.1) {
|
||||
return AlmostBoolean.YES;
|
||||
}
|
||||
}
|
||||
return AlmostBoolean.MAYBE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getJumpAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) {
|
||||
return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
}
|
||||
else {
|
||||
return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getFasterMovementAmplifier(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) {
|
||||
return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier();
|
||||
}
|
||||
else {
|
||||
return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInvulnerableTicks(final Player player) {
|
||||
return ((CraftPlayer) player).getHandle().invulnerableTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInvulnerableTicks(final Player player, final int ticks) {
|
||||
((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealFallDamage(final Player player, final double damage) {
|
||||
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (float) damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isComplexPart(final Entity entity) {
|
||||
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeZombie(final Player player) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDead(final Player player, final int deathTicks) {
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
mcPlayer.deathTicks = deathTicks;
|
||||
mcPlayer.dead = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasGravity(final Material mat) {
|
||||
// TODO: Test/check.
|
||||
return mat.hasGravity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlmostBoolean dealFallDamageFiresAnEvent() {
|
||||
return AlmostBoolean.YES;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void correctDirection(final Player player) {
|
||||
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// // Main direction.
|
||||
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
|
||||
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
|
||||
// // Consider setting the lastYaw here too.
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean resetActiveItem(Player player) {
|
||||
((CraftPlayer) player).getHandle().bA();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatCBDev</name>
|
||||
<description>
|
||||
Compatibility for the development version (latest of the supported Minecraft versions).
|
||||
|
||||
To add a new compat module the pom.xml file within NCPCompatNonFree has to be modified:
|
||||
- Add as module within the profile with id 'all'.
|
||||
- Add as dependency within the profile with id 'all'.
|
||||
- (Add a new profile with both the module and dependency set.)
|
||||
|
||||
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory,
|
||||
AttributeAccessFactory).
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,33 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatSpigotCB1_10_R1</name>
|
||||
<description>Compatibility for SpigotCB1_10_R1.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,33 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatSpigotCB1_11_R1</name>
|
||||
<description>Compatibility for SpigotCB1_11_R1.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.11-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,33 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatSpigotCB1_8_R1</name>
|
||||
<description>Compatibility for Minecraft 1.8 with CraftBukkit/Spigot (R1).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,33 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatSpigotCB1_8_R2</name>
|
||||
<description>Compatibility for Minecraft 1.8.3 with CraftBukkit/Spigot (1_8_R2).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,33 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatSpigotCB1_8_R3</name>
|
||||
<description>Compatibility for Minecraft 1.8.4-1.8.6 with CraftBukkit/Spigot (1_8_R3).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,33 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatSpigotCB1_9_R1</name>
|
||||
<description>Compatibility for Minecraft 1.9-1.9.3 with CraftBukkit/Spigot (1_9_R1).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.9-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,33 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatSpigotCB1_9_R2</name>
|
||||
<description>Compatibility for Minecraft 1.9.4 with CraftBukkit/Spigot (1_9_R2).</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.9.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,151 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>NCPCompatNonFree</name>
|
||||
<description>
|
||||
Combine compatibility modules with dependencies that can't be obtained from a public maven repository,
|
||||
such as CraftBukkit or Spigot builds, hence "NonFree".
|
||||
|
||||
To add a new compat module:
|
||||
- Add as module within the profile with id 'all'.
|
||||
- Add as dependency within the profile with id 'all'.
|
||||
- (Add a new profile with both the module and dependency set.)
|
||||
|
||||
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory,
|
||||
AttributeAccessFactory).
|
||||
</description>
|
||||
|
||||
<modules>
|
||||
<module>NCPCompatAggregated</module>
|
||||
</modules>
|
||||
|
||||
<!-- Profile based activation of modules and dependencies. -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>all</id>
|
||||
<modules>
|
||||
<!-- Legacy, unsupported
|
||||
<module>NCPCompatCB2512</module>
|
||||
<module>NCPCompatCB2545</module>
|
||||
<module>NCPCompatCB2602</module>
|
||||
<module>NCPCompatCB2645</module>
|
||||
<module>NCPCompatCB2691</module>
|
||||
<module>NCPCompatCB2763</module>
|
||||
<module>NCPCompatCB2794</module>
|
||||
<module>NCPCompatCB2808</module>
|
||||
<module>NCPCompatCB2882</module>
|
||||
-->
|
||||
<module>NCPCompatCB2922</module>
|
||||
<module>NCPCompatCB3026</module>
|
||||
<module>NCPCompatCB3043</module>
|
||||
<module>NCPCompatCB3100</module>
|
||||
<module>NCPCompatSpigotCB1_8_R1</module>
|
||||
<module>NCPCompatSpigotCB1_8_R2</module>
|
||||
<module>NCPCompatSpigotCB1_8_R3</module>
|
||||
<module>NCPCompatSpigotCB1_9_R1</module>
|
||||
<module>NCPCompatSpigotCB1_9_R2</module>
|
||||
<module>NCPCompatSpigotCB1_10_R1</module>
|
||||
<module>NCPCompatSpigotCB1_11_R1</module>
|
||||
<!-- Latest -->
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cbdev</id>
|
||||
<modules>
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_12_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_11_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_11_R1</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_10_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_10_R1</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r2</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_9_R2</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_9_R1</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_8_r3</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_8_R3</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_7_r4</id>
|
||||
<modules>
|
||||
<module>NCPCompatCB3100</module>
|
||||
</modules>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cblegacy</id>
|
||||
<modules>
|
||||
<!-- Legacy, unsupported
|
||||
<module>NCPCompatCB2512</module>
|
||||
<module>NCPCompatCB2545</module>
|
||||
<module>NCPCompatCB2602</module>
|
||||
-->
|
||||
<module>NCPCompatCB2645</module>
|
||||
<module>NCPCompatCB2691</module>
|
||||
<module>NCPCompatCB2763</module>
|
||||
<module>NCPCompatCB2794</module>
|
||||
<module>NCPCompatCB2808</module>
|
||||
<module>NCPCompatCB2882</module>
|
||||
<module>NCPCompatCB2922</module>
|
||||
<module>NCPCompatCB3026</module>
|
||||
<module>NCPCompatCB3043</module>
|
||||
</modules>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>nms-repo</id>
|
||||
<url>https://repo.codemc.org/repository/nms/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
</project>
|
||||
@@ -1,53 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcompatprotocollib</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCompatProtocolLib</name>
|
||||
<description>
|
||||
Features using the plugin ProtocolLib:
|
||||
https://dev.bukkit.org/bukkit-plugins/protocollib/
|
||||
</description>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>plib-legacy</id>
|
||||
<url>https://repo.loohpjames.com/repository/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.19.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>4.8.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,42 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPCore</name>
|
||||
<description>
|
||||
Core components and checks implementations. This contains about everything, just not the
|
||||
component/compat factories and not the plugin itself. NCPCore allows to add more modules/components that use
|
||||
check-specific classes to be added in the factories on NCPPlugin level.
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.19.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcommons</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,66 +0,0 @@
|
||||
<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>
|
||||
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>ncpplugin</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NCPPlugin</name>
|
||||
<description>
|
||||
Mainly contains the plugin class and the factories.
|
||||
For the plugin/artifact version see the NoCheatPlus module.
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.19.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcore</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatbukkit</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatprotocollib</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- Profiles for enabling/disabling features. -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>nonfree_build</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompataggregated</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
@@ -1,11 +1,11 @@
|
||||
name: ${project.name}
|
||||
version: ${project.version}-Updated-${buildDescription}
|
||||
description: ${project.description}
|
||||
name: NoCheatPlus
|
||||
version: '${version}'
|
||||
description: Anti-cheating plugin for Minecraft (1.8-1.21, Bukkit/Spigot).
|
||||
|
||||
author: NeatMonster
|
||||
authors: [asofold, Evenprime, CaptainObvious0, xaw3ep]
|
||||
website: ${project.url}
|
||||
dev-url: ${project.url}
|
||||
website: https://github.com/true-og/NoCheatPlus
|
||||
dev-url: https://github.com/true-og/NoCheatPlus
|
||||
|
||||
main: ${project.groupId}.${project.artifactId}.${project.name}
|
||||
api-version: 1.13
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
<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>nocheatplus</artifactId>
|
||||
<version>3.17.1-SNAPSHOT</version>
|
||||
|
||||
<name>NoCheatPlus</name>
|
||||
<description>Detect and fight the exploitation of various flaws/bugs in Minecraft.</description>
|
||||
<url>https://dev.bukkit.org/projects/nocheatplus</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.build.timestamp.format>yyyy_MM_dd-HH_mm</maven.build.timestamp.format>
|
||||
<buildTimestamp>${maven.build.timestamp}</buildTimestamp>
|
||||
<BUILD_NUMBER>?</BUILD_NUMBER>
|
||||
<BUILD_SERIES>?</BUILD_SERIES>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpplugin</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</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 -->
|
||||
<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>..</directory>
|
||||
<includes>
|
||||
<include>LICENSE.txt</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<!-- plugin.yml here to fill in the correct content. -->
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<filtering>true</filtering>
|
||||
<directory>../NCPPlugin/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>plugin.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,220 @@
|
||||
import org.gradle.kotlin.dsl.provideDelegate
|
||||
|
||||
/* ------------------------------ Plugins ------------------------------ */
|
||||
plugins {
|
||||
id("java") // Import Java plugin.
|
||||
id("java-library") // Import Java Library plugin.
|
||||
id("com.diffplug.spotless") version "7.0.4" // Import Spotless plugin.
|
||||
id("com.gradleup.shadow") version "8.3.6" // Import Shadow plugin.
|
||||
id("checkstyle") // Import Checkstyle plugin.
|
||||
eclipse // Import Eclipse plugin.
|
||||
kotlin("jvm") version "2.1.21" // Import Kotlin JVM plugin.
|
||||
}
|
||||
|
||||
extra["kotlinAttribute"] = Attribute.of("kotlin-tag", Boolean::class.javaObjectType)
|
||||
|
||||
val kotlinAttribute: Attribute<Boolean> by rootProject.extra
|
||||
|
||||
/* --------------------------- JDK / Kotlin ---------------------------- */
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17 // Compile with JDK 17 compatibility.
|
||||
toolchain { // Select Java toolchain.
|
||||
languageVersion.set(JavaLanguageVersion.of(17)) // Use JDK 17.
|
||||
vendor.set(JvmVendorSpec.GRAAL_VM) // Use GraalVM CE.
|
||||
}
|
||||
}
|
||||
|
||||
kotlin { jvmToolchain(17) }
|
||||
|
||||
/* ----------------------------- Metadata ------------------------------ */
|
||||
group = "fr.neatmonster" // Declare bundle identifier.
|
||||
|
||||
version = "3.17.1-SNAPSHOT" // Declare plugin version (will be in .jar).
|
||||
|
||||
val apiVersion = "1.19" // Declare minecraft server target version.
|
||||
|
||||
/* ----------------------------- Resources ----------------------------- */
|
||||
tasks.named<ProcessResources>("processResources") {
|
||||
val props =
|
||||
mapOf(
|
||||
"version" to version.toString(),
|
||||
"apiVersion" to apiVersion,
|
||||
"project" to mapOf("groupId" to group.toString(), "artifactId" to "ncpplugin", "name" to "NCPPlugin"),
|
||||
)
|
||||
inputs.properties(props) // Indicates to rerun if version changes.
|
||||
from("NCPPlugin/src/main/resources") {
|
||||
include("plugin.yml")
|
||||
expand(props)
|
||||
}
|
||||
from("LICENSE.txt") { into("/") } // Bundle licenses into jarfiles.
|
||||
}
|
||||
|
||||
/* ---------------------------- Repos ---------------------------------- */
|
||||
repositories {
|
||||
mavenCentral() // Import the Maven Central Maven Repository.
|
||||
gradlePluginPortal() // Import the Gradle Plugin Portal Maven Repository.
|
||||
maven { url = uri("https://repo.purpurmc.org/snapshots") } // Import the PurpurMC Maven Repository.
|
||||
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots") }
|
||||
maven { url = uri("https://repo.dmulloy2.net/nexus/repository/public/") }
|
||||
maven { url = uri("https://repo.loohpjames.com/repository/") }
|
||||
maven { url = uri("file://${System.getProperty("user.home")}/.m2/repository") }
|
||||
System.getProperty("SELF_MAVEN_LOCAL_REPO")?.let { // TrueOG Bootstrap mavenLocal().
|
||||
val dir = file(it)
|
||||
if (dir.isDirectory) {
|
||||
println("Using SELF_MAVEN_LOCAL_REPO at: $it")
|
||||
maven { url = uri("file://${dir.absolutePath}") }
|
||||
} else {
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven { url = uri("https://repo.purpurmc.org/snapshots") }
|
||||
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots") }
|
||||
maven { url = uri("https://repo.dmulloy2.net/nexus/repository/public/") }
|
||||
maven { url = uri("https://repo.loohpjames.com/repository/") }
|
||||
maven { url = uri("file://${System.getProperty("user.home")}/.m2/repository") }
|
||||
System.getProperty("SELF_MAVEN_LOCAL_REPO")?.let {
|
||||
val dir = file(it)
|
||||
if (dir.isDirectory) {
|
||||
println("Using SELF_MAVEN_LOCAL_REPO at: $it")
|
||||
maven { url = uri("file://${dir.absolutePath}") }
|
||||
} else {
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------- Java project deps ---------------------------- */
|
||||
dependencies { implementation(project(":NCPPlugin")) }
|
||||
|
||||
apply(from = "eclipse.gradle.kts") // Import eclipse classpath support script.
|
||||
|
||||
/* ---------------------- Reproducible jars ---------------------------- */
|
||||
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
|
||||
isPreserveFileTimestamps = false
|
||||
isReproducibleFileOrder = true
|
||||
}
|
||||
|
||||
/* ----------------------------- Shadow -------------------------------- */
|
||||
tasks.shadowJar {
|
||||
archiveFileName.set("NoCheatPlus-${version}.jar")
|
||||
archiveClassifier.set("") // Use empty string instead of null.
|
||||
minimize()
|
||||
}
|
||||
|
||||
tasks.jar { archiveClassifier.set("part") } // Applies to root jarfile only.
|
||||
|
||||
tasks.build { dependsOn(tasks.spotlessApply, tasks.shadowJar) } // Build depends on spotless and shadow.
|
||||
|
||||
/* --------------------------- Javac opts ------------------------------- */
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.compilerArgs.add("-parameters") // Enable reflection for java code.
|
||||
options.isFork = true // Run javac in its own process.
|
||||
options.compilerArgs.add("-Xlint:deprecation") // Trigger deprecation warning messages.
|
||||
options.encoding = "UTF-8" // Use UTF-8 file encoding.
|
||||
}
|
||||
|
||||
/* ----------------------------- Auto Formatting ------------------------ */
|
||||
spotless {
|
||||
java {
|
||||
eclipse().configFile("config/formatter/eclipse-java-formatter.xml") // Eclipse java formatting.
|
||||
leadingTabsToSpaces() // Convert leftover leading tabs to spaces.
|
||||
removeUnusedImports() // Remove imports that aren't being called.
|
||||
}
|
||||
kotlinGradle {
|
||||
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } // JetBrains Kotlin formatting.
|
||||
target("build.gradle.kts", "settings.gradle.kts") // Gradle files to format.
|
||||
}
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
toolVersion = "10.18.1" // Declare checkstyle version to use.
|
||||
configFile = file("config/checkstyle/checkstyle.xml") // Point checkstyle to config file.
|
||||
isIgnoreFailures = true // Don't fail the build if checkstyle does not pass.
|
||||
isShowViolations = true // Show the violations in any IDE with the checkstyle plugin.
|
||||
}
|
||||
|
||||
tasks.named("compileJava") {
|
||||
dependsOn("spotlessApply") // Run spotless before compiling with the JDK.
|
||||
}
|
||||
|
||||
tasks.named("spotlessCheck") {
|
||||
dependsOn("spotlessApply") // Run spotless before checking if spotless ran.
|
||||
}
|
||||
|
||||
/* ------------------------------ Eclipse SHIM ------------------------- */
|
||||
|
||||
// This can't be put in eclipse.gradle.kts because Gradle is weird.
|
||||
subprojects {
|
||||
apply(plugin = "java-library")
|
||||
apply(plugin = "eclipse")
|
||||
eclipse.project.name = "${project.name}-${rootProject.name}"
|
||||
tasks.withType<Jar>().configureEach { archiveBaseName.set("${project.name}-${rootProject.name}") }
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17 // Compile with JDK 17 compatibility.
|
||||
toolchain { // Select Java toolchain.
|
||||
languageVersion.set(JavaLanguageVersion.of(17)) // Use JDK 17.
|
||||
vendor.set(JvmVendorSpec.GRAAL_VM) // Use GraalVM CE.
|
||||
}
|
||||
}
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.compilerArgs.add("-parameters") // Enable reflection for java code.
|
||||
options.isFork = true // Run javac in its own process.
|
||||
options.compilerArgs.add("-Xlint:deprecation") // Trigger deprecation warning messages.
|
||||
options.encoding = "UTF-8" // Use UTF-8 file encoding.
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------ Modules ------------------------------ */
|
||||
|
||||
project(":NCPBuildBase") { dependencies { testImplementation("junit:junit:4.8.2") } }
|
||||
|
||||
project(":NCPCommons") {
|
||||
dependencies {
|
||||
api(project(":NCPBuildBase"))
|
||||
testImplementation("junit:junit:4.8.2")
|
||||
}
|
||||
}
|
||||
|
||||
project(":NCPCore") {
|
||||
dependencies {
|
||||
compileOnly("org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT") // Declare Purpur/Spigot API version to be packaged.
|
||||
api(project(":NCPCommons"))
|
||||
testImplementation("junit:junit:4.12")
|
||||
testImplementation("org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT")
|
||||
}
|
||||
}
|
||||
|
||||
project(":NCPCompatBukkit") {
|
||||
dependencies {
|
||||
compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
|
||||
compileOnly(project(":NCPCore"))
|
||||
compileOnly(project(":NCPCommons"))
|
||||
}
|
||||
}
|
||||
|
||||
project(":NCPCompatProtocolLib") {
|
||||
dependencies {
|
||||
compileOnly("org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT")
|
||||
compileOnly(project(":NCPCore"))
|
||||
compileOnly(project(":NCPCommons"))
|
||||
compileOnly("com.comphenix.protocol:ProtocolLib:4.8.0")
|
||||
}
|
||||
}
|
||||
|
||||
project(":NCPPlugin") {
|
||||
dependencies {
|
||||
compileOnly("org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT")
|
||||
implementation(project(":NCPCore"))
|
||||
implementation(project(":NCPCompatBukkit"))
|
||||
implementation(project(":NCPCompatProtocolLib"))
|
||||
testImplementation("junit:junit:4.8.2")
|
||||
}
|
||||
tasks.named<ProcessResources>("processResources") { exclude("plugin.yml") }
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
<module name="Checker">
|
||||
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="FinalLocalVariable"/>
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="Indentation">
|
||||
<property name="severity" value="ignore"/>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="\borg\.junit\.jupiter\.api\.Assertions\.fail\s*\(\s*"Not yet implemented"\s*\)\s*;"/>
|
||||
<property name="message" value="Remove placeholder fail() and implement the test."/>
|
||||
<property name="ignoreCase" value="true"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="(?<!\w)fail\s*\(\s*"Not yet implemented"\s*\)\s*;"/>
|
||||
<property name="message" value="Remove placeholder fail() and implement the test."/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,404 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles version="23">
|
||||
<profile kind="CodeFormatterProfile" name="TrueOG Network Formatting" version="23">
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow" value="20"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||
</profile>
|
||||
</profiles>
|
||||
@@ -0,0 +1,151 @@
|
||||
/* This is free and unencumbered software released into the public domain */
|
||||
|
||||
import org.gradle.plugins.ide.eclipse.model.EclipseModel
|
||||
import java.nio.file.Files
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
import javax.xml.transform.OutputKeys
|
||||
import javax.xml.transform.TransformerFactory
|
||||
import javax.xml.transform.dom.DOMSource
|
||||
import javax.xml.transform.stream.StreamResult
|
||||
|
||||
val kotlinAttribute: Attribute<Boolean> by rootProject.extra
|
||||
|
||||
val kotlinPluginProjects = configurations
|
||||
.getByName("compileClasspath")
|
||||
.allDependencies
|
||||
.filterIsInstance<ProjectDependency>()
|
||||
.filter { it -> it.attributes.getAttribute(kotlinAttribute) != null }
|
||||
.map { it.path }
|
||||
kotlinPluginProjects.forEach { evaluationDependsOn(it) }
|
||||
|
||||
val ideLibs: Configuration by
|
||||
configurations.creating {
|
||||
isCanBeResolved = true
|
||||
isCanBeConsumed = false
|
||||
}
|
||||
|
||||
configure<EclipseModel> {
|
||||
project {
|
||||
name = "Template-OG-Plugin"
|
||||
}
|
||||
classpath {
|
||||
plusConfigurations.add(ideLibs)
|
||||
}
|
||||
}
|
||||
|
||||
val ideLibDir = layout.buildDirectory.dir("ide-libs")
|
||||
val hashRegex = Regex("-[0-9a-fA-F]{10}(?=\\.jar$)") // Black magic.
|
||||
|
||||
val copyTasks = mutableListOf<TaskProvider<Copy>>()
|
||||
|
||||
kotlinPluginProjects.forEach { path ->
|
||||
val sub = project(path)
|
||||
val shadowJarProv = sub.tasks.named("shadowJar")
|
||||
val copyTask =
|
||||
tasks.register<Copy>("ideCopy${sub.name.replaceFirstChar(Char::titlecase)}") {
|
||||
dependsOn(shadowJarProv)
|
||||
from(shadowJarProv)
|
||||
into(ideLibDir)
|
||||
rename { it.replace(hashRegex, "") } // Remove git commit hash from jarfile.
|
||||
}
|
||||
copyTasks += copyTask
|
||||
}
|
||||
|
||||
/* Ensure the jars exist before .classpath is generated */
|
||||
tasks.named("eclipseClasspath").configure { dependsOn(copyTasks) }
|
||||
|
||||
/* Supply those jars to the ideLibs configuration (after evaluation) */
|
||||
afterEvaluate { dependencies { add("ideLibs", fileTree(ideLibDir) { include("*.jar") }) } }
|
||||
|
||||
val injectIdeLibs =
|
||||
tasks.register("injectIdeLibs") {
|
||||
dependsOn("eclipse") // run after all eclipse files are generated
|
||||
doLast {
|
||||
val cpFile = file(".classpath")
|
||||
if (!cpFile.exists()) return@doLast
|
||||
|
||||
val jars = fileTree(ideLibDir.get()) { include("*.jar") }.files.sortedBy { it.name }
|
||||
if (jars.isEmpty()) return@doLast
|
||||
|
||||
// Parse DOM
|
||||
val dbf = DocumentBuilderFactory.newInstance()
|
||||
val doc = dbf.newDocumentBuilder().parse(cpFile)
|
||||
val root = doc.documentElement
|
||||
|
||||
// Helper to see if an entry already exists
|
||||
fun exists(path: String): Boolean =
|
||||
root.getElementsByTagName("classpathentry").let { list ->
|
||||
(0 until list.length).any { i ->
|
||||
val n = list.item(i)
|
||||
val kind = n.attributes?.getNamedItem("kind")?.nodeValue
|
||||
val p = n.attributes?.getNamedItem("path")?.nodeValue
|
||||
kind == "lib" && p == path
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any entry that points to ide-libs dir (folder or jars) to avoid dupes
|
||||
val toRemove = mutableListOf<org.w3c.dom.Node>()
|
||||
val list = root.getElementsByTagName("classpathentry")
|
||||
val dirPath = ideLibDir.get().asFile.absolutePath
|
||||
for (i in 0 until list.length) {
|
||||
val n = list.item(i)
|
||||
val kind = n.attributes?.getNamedItem("kind")?.nodeValue
|
||||
val p = n.attributes?.getNamedItem("path")?.nodeValue ?: ""
|
||||
if (kind == "lib" && (p == dirPath || p.startsWith("$dirPath/"))) {
|
||||
toRemove += n
|
||||
}
|
||||
}
|
||||
toRemove.forEach { root.removeChild(it) }
|
||||
|
||||
// Append our jar entries LAST
|
||||
jars.forEach { f ->
|
||||
val abs = f.absolutePath
|
||||
if (!exists(abs)) {
|
||||
val entry = doc.createElement("classpathentry")
|
||||
entry.setAttribute("kind", "lib")
|
||||
entry.setAttribute("path", abs)
|
||||
root.appendChild(entry)
|
||||
}
|
||||
}
|
||||
|
||||
// Write back pretty
|
||||
val tf =
|
||||
TransformerFactory.newInstance().newTransformer().apply {
|
||||
setOutputProperty(OutputKeys.INDENT, "yes")
|
||||
setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "1")
|
||||
setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no")
|
||||
setOutputProperty(OutputKeys.ENCODING, "UTF-8")
|
||||
}
|
||||
Files.newBufferedWriter(cpFile.toPath()).use { w -> tf.transform(DOMSource(doc), StreamResult(w)) }
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("eclipse").configure { finalizedBy(injectIdeLibs) }
|
||||
|
||||
val eclipseModel = extensions.getByType<EclipseModel>()
|
||||
|
||||
fun Project.addResolvableEclipseConfigs() {
|
||||
val jarAttr =
|
||||
objects.named(org.gradle.api.attributes.LibraryElements::class, org.gradle.api.attributes.LibraryElements.JAR)
|
||||
val apiAttr = objects.named(org.gradle.api.attributes.Usage::class, org.gradle.api.attributes.Usage.JAVA_API)
|
||||
|
||||
val compileOnlyRes =
|
||||
configurations.create("eclipseCompileOnly") {
|
||||
extendsFrom(configurations.getByName("compileOnly"))
|
||||
isCanBeResolved = true
|
||||
isCanBeConsumed = false
|
||||
attributes.attribute(org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE, apiAttr)
|
||||
attributes.attribute(org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, jarAttr)
|
||||
}
|
||||
val compileOnlyApiRes =
|
||||
configurations.create("eclipseCompileOnlyApi") {
|
||||
extendsFrom(configurations.getByName("compileOnlyApi"))
|
||||
isCanBeResolved = true
|
||||
isCanBeConsumed = false
|
||||
attributes.attribute(org.gradle.api.attributes.Usage.USAGE_ATTRIBUTE, apiAttr)
|
||||
attributes.attribute(org.gradle.api.attributes.LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, jarAttr)
|
||||
}
|
||||
eclipseModel.classpath.plusConfigurations.addAll(listOf(compileOnlyRes, compileOnlyApiRes))
|
||||
}
|
||||
|
||||
addResolvableEclipseConfigs()
|
||||
Vendored
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+94
@@ -0,0 +1,94 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,84 +0,0 @@
|
||||
<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>nocheatplus-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
|
||||
<name>NoCheatPlus Parent</name>
|
||||
<description>
|
||||
The initial pom design had been taken from mbax (GitHub).
|
||||
|
||||
The naming of the native compatibility modules mostly follows NCPCompat + shortcut of server mod name + earliest
|
||||
build/version that the module would run with (though it should be compiled with the latest available build
|
||||
rather, latest build also can be used, if it is the first module depicting an API incompatibility transition).
|
||||
|
||||
NCPCompatBukkit provides compatibility for the Bukkit-API only (no native module available), aiming at keeping
|
||||
NCP up for a new MC version for if no native module is available . Tendency is to use the latest Bukkit version
|
||||
rather, but since it is used for some "unknown mods" as well, it is not compiled with the latest
|
||||
Bukkit version always.
|
||||
|
||||
TODO: Better place for descriptions like this?
|
||||
</description>
|
||||
<url>https://dev.bukkit.org/projects/nocheatplus</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.build.timestamp.format>yyyy_MM_dd-HH_mm</maven.build.timestamp.format>
|
||||
</properties>
|
||||
|
||||
<!-- Default modules -->
|
||||
<modules>
|
||||
<module>NCPBuildBase</module>
|
||||
<module>NCPCommons</module>
|
||||
<module>NCPCore</module>
|
||||
<module>NCPCompatBukkit</module>
|
||||
<module>NCPCompatProtocolLib</module>
|
||||
<module>NCPPlugin</module>
|
||||
<module>NoCheatPlus</module>
|
||||
</modules>
|
||||
|
||||
<!-- Profiles for enabling/disabling features. -->
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>nonfree_build</id>
|
||||
<modules>
|
||||
<module>NCPCompatNonFree</module>
|
||||
</modules>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Skip module deploy by default -->
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,13 @@
|
||||
rootProject.name = "NoCheatPlus"
|
||||
|
||||
include(":NCPBuildBase")
|
||||
|
||||
include(":NCPCommons")
|
||||
|
||||
include(":NCPCore")
|
||||
|
||||
include(":NCPCompatBukkit")
|
||||
|
||||
include(":NCPCompatProtocolLib")
|
||||
|
||||
include(":NCPPlugin")
|
||||
Reference in new issue
Block a user