diff --git a/NCPBuildBase/pom.xml b/NCPBuildBase/pom.xml deleted file mode 100644 index 01c381201..000000000 --- a/NCPBuildBase/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - nocheatplus-parent - 1.1-SNAPSHOT - ../pom.xml - - - ncpbuildbase - 1.1-SNAPSHOT - - NCPBuildBase - Very basic dependencies that have to be built before commons, no use of Bukkit. - - - - junit - junit - 4.8.2 - test - - - - - - - . - true - ../NCPBuildBase/src/main/resources - - BuildParameters.properties - - - - - - diff --git a/NCPCommons/pom.xml b/NCPCommons/pom.xml deleted file mode 100644 index d5adf4feb..000000000 --- a/NCPCommons/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - nocheatplus-parent - 1.1-SNAPSHOT - ../pom.xml - - - ncpcommons - 1.1-SNAPSHOT - - NCPCommons - Common data structures and other, no use of Bukkit. - - - - fr.neatmonster - ncpbuildbase - 1.1-SNAPSHOT - - - junit - junit - 4.8.2 - test - - - - diff --git a/NCPCompatBukkit/pom.xml b/NCPCompatBukkit/pom.xml deleted file mode 100644 index 7f24835a4..000000000 --- a/NCPCompatBukkit/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - nocheatplus-parent - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatbukkit - 1.1-SNAPSHOT - - NCPCompatBukkit - Compatibility for using the Bukkit API only. - - - - org.spigotmc - spigot-api - 1.21-R0.1-SNAPSHOT - provided - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/NCPCompatAggregated/pom.xml b/NCPCompatNonFree/NCPCompatAggregated/pom.xml deleted file mode 100644 index 1ac5d0c38..000000000 --- a/NCPCompatNonFree/NCPCompatAggregated/pom.xml +++ /dev/null @@ -1,298 +0,0 @@ - - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompataggregated - 1.1-SNAPSHOT - pom - - NCPCompatAggregated - Aggregator for the NMS compat modules. - - - - - all - - - fr.neatmonster - ncpcompatcbdev - 1.1-SNAPSHOT - - - - fr.neatmonster - ncpcompatspigotcb1_11_r1 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatspigotcb1_10_r1 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatspigotcb1_9_r2 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatspigotcb1_9_r1 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatspigotcb1_8_r3 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatspigotcb1_8_r2 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatspigotcb1_8_r1 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb3100 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb3043 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb3026 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb2922 - 1.1-SNAPSHOT - - - - - - - cbdev - - - fr.neatmonster - ncpcompatcbdev - 1.1-SNAPSHOT - - - - - - spigot1_12_r1 - - - fr.neatmonster - ncpcompatcbdev - 1.1-SNAPSHOT - - - - - - spigot1_11_r1 - - - fr.neatmonster - ncpcompatspigotcb1_11_r1 - 1.1-SNAPSHOT - - - - - - spigot1_10_r1 - - - fr.neatmonster - ncpcompatspigotcb1_10_r1 - 1.1-SNAPSHOT - - - - - - spigot1_9_r2 - - - fr.neatmonster - ncpcompatspigotcb1_9_r2 - 1.1-SNAPSHOT - - - - - - spigot1_9_r1 - - - fr.neatmonster - ncpcompatspigotcb1_9_r1 - 1.1-SNAPSHOT - - - - - - spigot1_8_r3 - - - fr.neatmonster - ncpcompatspigotcb1_8_r3 - 1.1-SNAPSHOT - - - - - - spigot1_7_r4 - - - fr.neatmonster - ncpcompatcb3100 - 1.1-SNAPSHOT - - - - - - cblegacy - - - fr.neatmonster - ncpcompatcb3100 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb3043 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb3026 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb2922 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb2882 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb2808 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb2794 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb2763 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb2691 - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatcb2645 - 1.1-SNAPSHOT - - - - - - - diff --git a/NCPCompatNonFree/NCPCompatCB2512/pom.xml b/NCPCompatNonFree/NCPCompatCB2512/pom.xml deleted file mode 100644 index 402986823..000000000 --- a/NCPCompatNonFree/NCPCompatCB2512/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - fr.neatmonster - ncpcompatcb2512 - jar - NCPCompatCB2512 - 1.1-SNAPSHOT - - - fr.neatmonster - nocheatplus-parent - 1.1-SNAPSHOT - - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.4.5-R1.0 - provided - - - - Compatibility since CB2512. - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - - \ No newline at end of file diff --git a/NCPCompatNonFree/NCPCompatCB2512/src/main/java/fr/neatmonster/nocheatplus/compat/cb2512/BlockCacheCB2512.java b/NCPCompatNonFree/NCPCompatCB2512/src/main/java/fr/neatmonster/nocheatplus/compat/cb2512/BlockCacheCB2512.java deleted file mode 100644 index ffd0e4854..000000000 --- a/NCPCompatNonFree/NCPCompatCB2512/src/main/java/fr/neatmonster/nocheatplus/compat/cb2512/BlockCacheCB2512.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2512/src/main/java/fr/neatmonster/nocheatplus/compat/cb2512/MCAccessCB2512.java b/NCPCompatNonFree/NCPCompatCB2512/src/main/java/fr/neatmonster/nocheatplus/compat/cb2512/MCAccessCB2512.java deleted file mode 100644 index c5a059545..000000000 --- a/NCPCompatNonFree/NCPCompatCB2512/src/main/java/fr/neatmonster/nocheatplus/compat/cb2512/MCAccessCB2512.java +++ /dev/null @@ -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 . - */ -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. - // } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2545/pom.xml b/NCPCompatNonFree/NCPCompatCB2545/pom.xml deleted file mode 100644 index 4e3eb1b4a..000000000 --- a/NCPCompatNonFree/NCPCompatCB2545/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - fr.neatmonster - ncpcompatcb2545 - jar - NCPCompatCB2545 - 1.1-SNAPSHOT - - - fr.neatmonster - nocheatplus-parent - 1.1-SNAPSHOT - - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.4.6-R0.3 - provided - - - - Compatibility since CB2545 (MC 1.4.6). - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - - \ No newline at end of file diff --git a/NCPCompatNonFree/NCPCompatCB2545/src/main/java/fr/neatmonster/nocheatplus/compat/cb2545/BlockCacheCB2545.java b/NCPCompatNonFree/NCPCompatCB2545/src/main/java/fr/neatmonster/nocheatplus/compat/cb2545/BlockCacheCB2545.java deleted file mode 100644 index 0f06707fd..000000000 --- a/NCPCompatNonFree/NCPCompatCB2545/src/main/java/fr/neatmonster/nocheatplus/compat/cb2545/BlockCacheCB2545.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2545/src/main/java/fr/neatmonster/nocheatplus/compat/cb2545/MCAccessCB2545.java b/NCPCompatNonFree/NCPCompatCB2545/src/main/java/fr/neatmonster/nocheatplus/compat/cb2545/MCAccessCB2545.java deleted file mode 100644 index b3f6bc32c..000000000 --- a/NCPCompatNonFree/NCPCompatCB2545/src/main/java/fr/neatmonster/nocheatplus/compat/cb2545/MCAccessCB2545.java +++ /dev/null @@ -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 . - */ -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. - // } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2602/pom.xml b/NCPCompatNonFree/NCPCompatCB2602/pom.xml deleted file mode 100644 index 089ad2901..000000000 --- a/NCPCompatNonFree/NCPCompatCB2602/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - fr.neatmonster - ncpcompatcb2602 - jar - NCPCompatCB2602 - 1.1-SNAPSHOT - - - fr.neatmonster - nocheatplus-parent - 1.1-SNAPSHOT - - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.4.7-R1.0 - provided - - - - Compatibility for CB2602 (1.4.7). - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - - \ No newline at end of file diff --git a/NCPCompatNonFree/NCPCompatCB2602/src/main/java/fr/neatmonster/nocheatplus/compat/cb2602/BlockCacheCB2602.java b/NCPCompatNonFree/NCPCompatCB2602/src/main/java/fr/neatmonster/nocheatplus/compat/cb2602/BlockCacheCB2602.java deleted file mode 100644 index 0d8f102e2..000000000 --- a/NCPCompatNonFree/NCPCompatCB2602/src/main/java/fr/neatmonster/nocheatplus/compat/cb2602/BlockCacheCB2602.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2602/src/main/java/fr/neatmonster/nocheatplus/compat/cb2602/MCAccessCB2602.java b/NCPCompatNonFree/NCPCompatCB2602/src/main/java/fr/neatmonster/nocheatplus/compat/cb2602/MCAccessCB2602.java deleted file mode 100644 index 804b637a6..000000000 --- a/NCPCompatNonFree/NCPCompatCB2602/src/main/java/fr/neatmonster/nocheatplus/compat/cb2602/MCAccessCB2602.java +++ /dev/null @@ -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 . - */ -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. - // } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2645/libs/put_craftbukkit-1.5-R0.1-20130317.180842-21.jar_here.txt b/NCPCompatNonFree/NCPCompatCB2645/libs/put_craftbukkit-1.5-R0.1-20130317.180842-21.jar_here.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/NCPCompatNonFree/NCPCompatCB2645/pom.xml b/NCPCompatNonFree/NCPCompatCB2645/pom.xml deleted file mode 100644 index a7b6373f6..000000000 --- a/NCPCompatNonFree/NCPCompatCB2645/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatcb2645 - 1.1-SNAPSHOT - - NCPCompatCB2645 - Compatibility for CB2645 (MC 1.5). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.5-R0.1 - system - ${basedir}/libs/craftbukkit-1.5-R0.1-20130317.180842-21.jar - - - - diff --git a/NCPCompatNonFree/NCPCompatCB2645/src/main/java/fr/neatmonster/nocheatplus/compat/cb2645/BlockCacheCB2645.java b/NCPCompatNonFree/NCPCompatCB2645/src/main/java/fr/neatmonster/nocheatplus/compat/cb2645/BlockCacheCB2645.java deleted file mode 100644 index 0510f5c65..000000000 --- a/NCPCompatNonFree/NCPCompatCB2645/src/main/java/fr/neatmonster/nocheatplus/compat/cb2645/BlockCacheCB2645.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2645/src/main/java/fr/neatmonster/nocheatplus/compat/cb2645/MCAccessCB2645.java b/NCPCompatNonFree/NCPCompatCB2645/src/main/java/fr/neatmonster/nocheatplus/compat/cb2645/MCAccessCB2645.java deleted file mode 100644 index 53f9be93a..000000000 --- a/NCPCompatNonFree/NCPCompatCB2645/src/main/java/fr/neatmonster/nocheatplus/compat/cb2645/MCAccessCB2645.java +++ /dev/null @@ -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 . - */ -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. - // } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2691/libs/put_craftbukkit-1.5.1-R0.2-SNAPSHOT.jar_here.txt b/NCPCompatNonFree/NCPCompatCB2691/libs/put_craftbukkit-1.5.1-R0.2-SNAPSHOT.jar_here.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/NCPCompatNonFree/NCPCompatCB2691/pom.xml b/NCPCompatNonFree/NCPCompatCB2691/pom.xml deleted file mode 100644 index abc1f30b4..000000000 --- a/NCPCompatNonFree/NCPCompatCB2691/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatcb2691 - 1.1-SNAPSHOT - - NCPCompatCB2691 - Compatibility for CB2691 (MC 1.5.1-R0.2 beta release). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.5.1-R0.2 - system - ${basedir}/libs/craftbukkit-1.5.1-R0.2-SNAPSHOT.jar - - - - diff --git a/NCPCompatNonFree/NCPCompatCB2691/src/main/java/fr/neatmonster/nocheatplus/compat/cb2691/BlockCacheCB2691.java b/NCPCompatNonFree/NCPCompatCB2691/src/main/java/fr/neatmonster/nocheatplus/compat/cb2691/BlockCacheCB2691.java deleted file mode 100644 index b81a0fde1..000000000 --- a/NCPCompatNonFree/NCPCompatCB2691/src/main/java/fr/neatmonster/nocheatplus/compat/cb2691/BlockCacheCB2691.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2691/src/main/java/fr/neatmonster/nocheatplus/compat/cb2691/MCAccessCB2691.java b/NCPCompatNonFree/NCPCompatCB2691/src/main/java/fr/neatmonster/nocheatplus/compat/cb2691/MCAccessCB2691.java deleted file mode 100644 index 3ee05eddd..000000000 --- a/NCPCompatNonFree/NCPCompatCB2691/src/main/java/fr/neatmonster/nocheatplus/compat/cb2691/MCAccessCB2691.java +++ /dev/null @@ -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 . - */ -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. - // } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2763/libs/put_craftbukkit-1.5.2-R1.0.jar_here.txt b/NCPCompatNonFree/NCPCompatCB2763/libs/put_craftbukkit-1.5.2-R1.0.jar_here.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/NCPCompatNonFree/NCPCompatCB2763/pom.xml b/NCPCompatNonFree/NCPCompatCB2763/pom.xml deleted file mode 100644 index 130a6cd7f..000000000 --- a/NCPCompatNonFree/NCPCompatCB2763/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatcb2763 - 1.1-SNAPSHOT - - NCPCompatCB2763 - Compatibility for CB2763 (MC 1.5.2). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.5.2-R1.0 - system - ${basedir}/libs/craftbukkit-1.5.2-R1.0.jar - - - - diff --git a/NCPCompatNonFree/NCPCompatCB2763/src/main/java/fr/neatmonster/nocheatplus/compat/cb2763/BlockCacheCB2763.java b/NCPCompatNonFree/NCPCompatCB2763/src/main/java/fr/neatmonster/nocheatplus/compat/cb2763/BlockCacheCB2763.java deleted file mode 100644 index 9d685c688..000000000 --- a/NCPCompatNonFree/NCPCompatCB2763/src/main/java/fr/neatmonster/nocheatplus/compat/cb2763/BlockCacheCB2763.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2763/src/main/java/fr/neatmonster/nocheatplus/compat/cb2763/MCAccessCB2763.java b/NCPCompatNonFree/NCPCompatCB2763/src/main/java/fr/neatmonster/nocheatplus/compat/cb2763/MCAccessCB2763.java deleted file mode 100644 index d168ceba0..000000000 --- a/NCPCompatNonFree/NCPCompatCB2763/src/main/java/fr/neatmonster/nocheatplus/compat/cb2763/MCAccessCB2763.java +++ /dev/null @@ -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 . - */ -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. - // } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2794/libs/put_craftbukkit-1.6.1-R0.1-SNAPSHOT.jar_here.txt b/NCPCompatNonFree/NCPCompatCB2794/libs/put_craftbukkit-1.6.1-R0.1-SNAPSHOT.jar_here.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/NCPCompatNonFree/NCPCompatCB2794/pom.xml b/NCPCompatNonFree/NCPCompatCB2794/pom.xml deleted file mode 100644 index d7cfbcaf6..000000000 --- a/NCPCompatNonFree/NCPCompatCB2794/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatcb2794 - 1.1-SNAPSHOT - - NCPCompatCB2794 - Compatibility for CB2794 (MC 1.6.1). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.6.1-R0.1 - system - ${basedir}/libs/craftbukkit-1.6.1-R0.1-SNAPSHOT.jar - - - - diff --git a/NCPCompatNonFree/NCPCompatCB2794/src/main/java/fr/neatmonster/nocheatplus/compat/cb2794/AttributeAccess.java b/NCPCompatNonFree/NCPCompatCB2794/src/main/java/fr/neatmonster/nocheatplus/compat/cb2794/AttributeAccess.java deleted file mode 100644 index 6a5150f21..000000000 --- a/NCPCompatNonFree/NCPCompatCB2794/src/main/java/fr/neatmonster/nocheatplus/compat/cb2794/AttributeAccess.java +++ /dev/null @@ -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 . - */ -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()); - } - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2794/src/main/java/fr/neatmonster/nocheatplus/compat/cb2794/BlockCacheCB2794.java b/NCPCompatNonFree/NCPCompatCB2794/src/main/java/fr/neatmonster/nocheatplus/compat/cb2794/BlockCacheCB2794.java deleted file mode 100644 index 506be0443..000000000 --- a/NCPCompatNonFree/NCPCompatCB2794/src/main/java/fr/neatmonster/nocheatplus/compat/cb2794/BlockCacheCB2794.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2794/src/main/java/fr/neatmonster/nocheatplus/compat/cb2794/MCAccessCB2794.java b/NCPCompatNonFree/NCPCompatCB2794/src/main/java/fr/neatmonster/nocheatplus/compat/cb2794/MCAccessCB2794.java deleted file mode 100644 index b08af504b..000000000 --- a/NCPCompatNonFree/NCPCompatCB2794/src/main/java/fr/neatmonster/nocheatplus/compat/cb2794/MCAccessCB2794.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2808/libs/put_craftbukkit-1.6.2-R0.1-SNAPSHOT.jar_here.txt b/NCPCompatNonFree/NCPCompatCB2808/libs/put_craftbukkit-1.6.2-R0.1-SNAPSHOT.jar_here.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/NCPCompatNonFree/NCPCompatCB2808/pom.xml b/NCPCompatNonFree/NCPCompatCB2808/pom.xml deleted file mode 100644 index baa5c6923..000000000 --- a/NCPCompatNonFree/NCPCompatCB2808/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatcb2808 - 1.1-SNAPSHOT - - NCPCompatCB2808 - Compatibility for CB2808 (MC 1.6.2). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.6.2-R0.1 - system - ${basedir}/libs/craftbukkit-1.6.2-R0.1-SNAPSHOT.jar - - - - diff --git a/NCPCompatNonFree/NCPCompatCB2808/src/main/java/fr/neatmonster/nocheatplus/compat/cb2808/AttributeAccess.java b/NCPCompatNonFree/NCPCompatCB2808/src/main/java/fr/neatmonster/nocheatplus/compat/cb2808/AttributeAccess.java deleted file mode 100644 index 2b634ae38..000000000 --- a/NCPCompatNonFree/NCPCompatCB2808/src/main/java/fr/neatmonster/nocheatplus/compat/cb2808/AttributeAccess.java +++ /dev/null @@ -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 . - */ -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()); - } - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2808/src/main/java/fr/neatmonster/nocheatplus/compat/cb2808/BlockCacheCB2808.java b/NCPCompatNonFree/NCPCompatCB2808/src/main/java/fr/neatmonster/nocheatplus/compat/cb2808/BlockCacheCB2808.java deleted file mode 100644 index c46fc3e5e..000000000 --- a/NCPCompatNonFree/NCPCompatCB2808/src/main/java/fr/neatmonster/nocheatplus/compat/cb2808/BlockCacheCB2808.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2808/src/main/java/fr/neatmonster/nocheatplus/compat/cb2808/MCAccessCB2808.java b/NCPCompatNonFree/NCPCompatCB2808/src/main/java/fr/neatmonster/nocheatplus/compat/cb2808/MCAccessCB2808.java deleted file mode 100644 index de25ad73c..000000000 --- a/NCPCompatNonFree/NCPCompatCB2808/src/main/java/fr/neatmonster/nocheatplus/compat/cb2808/MCAccessCB2808.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2882/libs/put_craftbukkit-1.6.4-R2.0.jar_here.txt b/NCPCompatNonFree/NCPCompatCB2882/libs/put_craftbukkit-1.6.4-R2.0.jar_here.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/NCPCompatNonFree/NCPCompatCB2882/pom.xml b/NCPCompatNonFree/NCPCompatCB2882/pom.xml deleted file mode 100644 index bd56f72a2..000000000 --- a/NCPCompatNonFree/NCPCompatCB2882/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatcb2882 - 1.1-SNAPSHOT - - NCPCompatCB2882 - Compatibility for CB2882 (MC 1.6.4). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.6.4-R2.0 - system - ${basedir}/libs/craftbukkit-1.6.4-R2.0.jar - - - - diff --git a/NCPCompatNonFree/NCPCompatCB2882/src/main/java/fr/neatmonster/nocheatplus/compat/cb2882/AttributeAccess.java b/NCPCompatNonFree/NCPCompatCB2882/src/main/java/fr/neatmonster/nocheatplus/compat/cb2882/AttributeAccess.java deleted file mode 100644 index a35ba72c1..000000000 --- a/NCPCompatNonFree/NCPCompatCB2882/src/main/java/fr/neatmonster/nocheatplus/compat/cb2882/AttributeAccess.java +++ /dev/null @@ -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 . - */ -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()); - } - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2882/src/main/java/fr/neatmonster/nocheatplus/compat/cb2882/BlockCacheCB2882.java b/NCPCompatNonFree/NCPCompatCB2882/src/main/java/fr/neatmonster/nocheatplus/compat/cb2882/BlockCacheCB2882.java deleted file mode 100644 index 50908f4d1..000000000 --- a/NCPCompatNonFree/NCPCompatCB2882/src/main/java/fr/neatmonster/nocheatplus/compat/cb2882/BlockCacheCB2882.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2882/src/main/java/fr/neatmonster/nocheatplus/compat/cb2882/MCAccessCB2882.java b/NCPCompatNonFree/NCPCompatCB2882/src/main/java/fr/neatmonster/nocheatplus/compat/cb2882/MCAccessCB2882.java deleted file mode 100644 index baa0b0a33..000000000 --- a/NCPCompatNonFree/NCPCompatCB2882/src/main/java/fr/neatmonster/nocheatplus/compat/cb2882/MCAccessCB2882.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2922/pom.xml b/NCPCompatNonFree/NCPCompatCB2922/pom.xml deleted file mode 100644 index 39da61642..000000000 --- a/NCPCompatNonFree/NCPCompatCB2922/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatcb2922 - 1.1-SNAPSHOT - - NCPCompatCB2922 - Compatibility for CB2922 (MC 1.7.2). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.7.2-R0.4-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/NCPCompatCB2922/src/main/java/fr/neatmonster/nocheatplus/compat/cb2922/AttributeAccess.java b/NCPCompatNonFree/NCPCompatCB2922/src/main/java/fr/neatmonster/nocheatplus/compat/cb2922/AttributeAccess.java deleted file mode 100644 index 5a77d1426..000000000 --- a/NCPCompatNonFree/NCPCompatCB2922/src/main/java/fr/neatmonster/nocheatplus/compat/cb2922/AttributeAccess.java +++ /dev/null @@ -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 . - */ -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()); - } - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2922/src/main/java/fr/neatmonster/nocheatplus/compat/cb2922/BlockCacheCB2922.java b/NCPCompatNonFree/NCPCompatCB2922/src/main/java/fr/neatmonster/nocheatplus/compat/cb2922/BlockCacheCB2922.java deleted file mode 100644 index 38912d859..000000000 --- a/NCPCompatNonFree/NCPCompatCB2922/src/main/java/fr/neatmonster/nocheatplus/compat/cb2922/BlockCacheCB2922.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB2922/src/main/java/fr/neatmonster/nocheatplus/compat/cb2922/MCAccessCB2922.java b/NCPCompatNonFree/NCPCompatCB2922/src/main/java/fr/neatmonster/nocheatplus/compat/cb2922/MCAccessCB2922.java deleted file mode 100644 index f7359f811..000000000 --- a/NCPCompatNonFree/NCPCompatCB2922/src/main/java/fr/neatmonster/nocheatplus/compat/cb2922/MCAccessCB2922.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB3026/pom.xml b/NCPCompatNonFree/NCPCompatCB3026/pom.xml deleted file mode 100644 index 0ba040bea..000000000 --- a/NCPCompatNonFree/NCPCompatCB3026/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatcb3026 - 1.1-SNAPSHOT - - NCPCompatCB3026 - Compatibility for CB3026 (MC 1.7.5). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.7.5-R0.1-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/NCPCompatCB3026/src/main/java/fr/neatmonster/nocheatplus/compat/cb3026/AttributeAccess.java b/NCPCompatNonFree/NCPCompatCB3026/src/main/java/fr/neatmonster/nocheatplus/compat/cb3026/AttributeAccess.java deleted file mode 100644 index 9c666a6ce..000000000 --- a/NCPCompatNonFree/NCPCompatCB3026/src/main/java/fr/neatmonster/nocheatplus/compat/cb3026/AttributeAccess.java +++ /dev/null @@ -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 . - */ -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()); - } - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB3026/src/main/java/fr/neatmonster/nocheatplus/compat/cb3026/BlockCacheCB3026.java b/NCPCompatNonFree/NCPCompatCB3026/src/main/java/fr/neatmonster/nocheatplus/compat/cb3026/BlockCacheCB3026.java deleted file mode 100644 index 1f0b5d697..000000000 --- a/NCPCompatNonFree/NCPCompatCB3026/src/main/java/fr/neatmonster/nocheatplus/compat/cb3026/BlockCacheCB3026.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB3026/src/main/java/fr/neatmonster/nocheatplus/compat/cb3026/MCAccessCB3026.java b/NCPCompatNonFree/NCPCompatCB3026/src/main/java/fr/neatmonster/nocheatplus/compat/cb3026/MCAccessCB3026.java deleted file mode 100644 index 1e8ffbb30..000000000 --- a/NCPCompatNonFree/NCPCompatCB3026/src/main/java/fr/neatmonster/nocheatplus/compat/cb3026/MCAccessCB3026.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB3043/pom.xml b/NCPCompatNonFree/NCPCompatCB3043/pom.xml deleted file mode 100644 index 3108e0cf0..000000000 --- a/NCPCompatNonFree/NCPCompatCB3043/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatcb3043 - 1.1-SNAPSHOT - - NCPCompatCB3043 - Compatibility for CB3043 (MC 1.7.9). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.7.9-R0.2-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/NCPCompatCB3043/src/main/java/fr/neatmonster/nocheatplus/compat/cb3043/AttributeAccess.java b/NCPCompatNonFree/NCPCompatCB3043/src/main/java/fr/neatmonster/nocheatplus/compat/cb3043/AttributeAccess.java deleted file mode 100644 index 6f51cebf8..000000000 --- a/NCPCompatNonFree/NCPCompatCB3043/src/main/java/fr/neatmonster/nocheatplus/compat/cb3043/AttributeAccess.java +++ /dev/null @@ -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 . - */ -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()); - } - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB3043/src/main/java/fr/neatmonster/nocheatplus/compat/cb3043/BlockCacheCB3043.java b/NCPCompatNonFree/NCPCompatCB3043/src/main/java/fr/neatmonster/nocheatplus/compat/cb3043/BlockCacheCB3043.java deleted file mode 100644 index 926bc740a..000000000 --- a/NCPCompatNonFree/NCPCompatCB3043/src/main/java/fr/neatmonster/nocheatplus/compat/cb3043/BlockCacheCB3043.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB3043/src/main/java/fr/neatmonster/nocheatplus/compat/cb3043/MCAccessCB3043.java b/NCPCompatNonFree/NCPCompatCB3043/src/main/java/fr/neatmonster/nocheatplus/compat/cb3043/MCAccessCB3043.java deleted file mode 100644 index 35d144382..000000000 --- a/NCPCompatNonFree/NCPCompatCB3043/src/main/java/fr/neatmonster/nocheatplus/compat/cb3043/MCAccessCB3043.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB3100/pom.xml b/NCPCompatNonFree/NCPCompatCB3100/pom.xml deleted file mode 100644 index 02d88be60..000000000 --- a/NCPCompatNonFree/NCPCompatCB3100/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatcb3100 - 1.1-SNAPSHOT - - NCPCompatCB3100 - Compatibility for CraftBukkit build 3100 (MC 1.7.10). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.7.10-R0.1-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/NCPCompatCB3100/src/main/java/fr/neatmonster/nocheatplus/compat/cb3100/AttributeAccess.java b/NCPCompatNonFree/NCPCompatCB3100/src/main/java/fr/neatmonster/nocheatplus/compat/cb3100/AttributeAccess.java deleted file mode 100644 index d56e38d3b..000000000 --- a/NCPCompatNonFree/NCPCompatCB3100/src/main/java/fr/neatmonster/nocheatplus/compat/cb3100/AttributeAccess.java +++ /dev/null @@ -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 . - */ -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()); - } - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB3100/src/main/java/fr/neatmonster/nocheatplus/compat/cb3100/BlockCacheCB3100.java b/NCPCompatNonFree/NCPCompatCB3100/src/main/java/fr/neatmonster/nocheatplus/compat/cb3100/BlockCacheCB3100.java deleted file mode 100644 index 60087662f..000000000 --- a/NCPCompatNonFree/NCPCompatCB3100/src/main/java/fr/neatmonster/nocheatplus/compat/cb3100/BlockCacheCB3100.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCB3100/src/main/java/fr/neatmonster/nocheatplus/compat/cb3100/MCAccessCB3100.java b/NCPCompatNonFree/NCPCompatCB3100/src/main/java/fr/neatmonster/nocheatplus/compat/cb3100/MCAccessCB3100.java deleted file mode 100644 index a769e6dc3..000000000 --- a/NCPCompatNonFree/NCPCompatCB3100/src/main/java/fr/neatmonster/nocheatplus/compat/cb3100/MCAccessCB3100.java +++ /dev/null @@ -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 . - */ -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; - } - -} diff --git a/NCPCompatNonFree/NCPCompatCBDev/pom.xml b/NCPCompatNonFree/NCPCompatCBDev/pom.xml deleted file mode 100644 index d3ba23f37..000000000 --- a/NCPCompatNonFree/NCPCompatCBDev/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatcbdev - 1.1-SNAPSHOT - - NCPCompatCBDev - - 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). - - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.spigotmc - spigot - 1.12.2-R0.1-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/NCPCompatSpigotCB1_10_R1/pom.xml b/NCPCompatNonFree/NCPCompatSpigotCB1_10_R1/pom.xml deleted file mode 100644 index 0fbb93909..000000000 --- a/NCPCompatNonFree/NCPCompatSpigotCB1_10_R1/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatspigotcb1_10_r1 - 1.1-SNAPSHOT - - NCPCompatSpigotCB1_10_R1 - Compatibility for SpigotCB1_10_R1. - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.spigotmc - spigot - 1.10.2-R0.1-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/NCPCompatSpigotCB1_11_R1/pom.xml b/NCPCompatNonFree/NCPCompatSpigotCB1_11_R1/pom.xml deleted file mode 100644 index 995e7ea97..000000000 --- a/NCPCompatNonFree/NCPCompatSpigotCB1_11_R1/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatspigotcb1_11_r1 - 1.1-SNAPSHOT - - NCPCompatSpigotCB1_11_R1 - Compatibility for SpigotCB1_11_R1. - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.spigotmc - spigot - 1.11-R0.1-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/NCPCompatSpigotCB1_8_R1/pom.xml b/NCPCompatNonFree/NCPCompatSpigotCB1_8_R1/pom.xml deleted file mode 100644 index 1ea06a688..000000000 --- a/NCPCompatNonFree/NCPCompatSpigotCB1_8_R1/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatspigotcb1_8_r1 - 1.1-SNAPSHOT - - NCPCompatSpigotCB1_8_R1 - Compatibility for Minecraft 1.8 with CraftBukkit/Spigot (R1). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.8-R0.1-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/NCPCompatSpigotCB1_8_R2/pom.xml b/NCPCompatNonFree/NCPCompatSpigotCB1_8_R2/pom.xml deleted file mode 100644 index fc5059ac1..000000000 --- a/NCPCompatNonFree/NCPCompatSpigotCB1_8_R2/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatspigotcb1_8_r2 - 1.1-SNAPSHOT - - NCPCompatSpigotCB1_8_R2 - Compatibility for Minecraft 1.8.3 with CraftBukkit/Spigot (1_8_R2). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.bukkit - craftbukkit - 1.8.3-R0.1-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/NCPCompatSpigotCB1_8_R3/pom.xml b/NCPCompatNonFree/NCPCompatSpigotCB1_8_R3/pom.xml deleted file mode 100644 index 8bf4f77d6..000000000 --- a/NCPCompatNonFree/NCPCompatSpigotCB1_8_R3/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatspigotcb1_8_r3 - 1.1-SNAPSHOT - - NCPCompatSpigotCB1_8_R3 - Compatibility for Minecraft 1.8.4-1.8.6 with CraftBukkit/Spigot (1_8_R3). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.spigotmc - spigot - 1.8.8-R0.1-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/NCPCompatSpigotCB1_9_R1/pom.xml b/NCPCompatNonFree/NCPCompatSpigotCB1_9_R1/pom.xml deleted file mode 100644 index 37ae9a835..000000000 --- a/NCPCompatNonFree/NCPCompatSpigotCB1_9_R1/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatspigotcb1_9_r1 - 1.1-SNAPSHOT - - NCPCompatSpigotCB1_9_R1 - Compatibility for Minecraft 1.9-1.9.3 with CraftBukkit/Spigot (1_9_R1). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.spigotmc - spigot - 1.9-R0.1-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/NCPCompatSpigotCB1_9_R2/pom.xml b/NCPCompatNonFree/NCPCompatSpigotCB1_9_R2/pom.xml deleted file mode 100644 index bb49afa58..000000000 --- a/NCPCompatNonFree/NCPCompatSpigotCB1_9_R2/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - ncpcompatnonfree - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatspigotcb1_9_r2 - 1.1-SNAPSHOT - - NCPCompatSpigotCB1_9_R2 - Compatibility for Minecraft 1.9.4 with CraftBukkit/Spigot (1_9_R2). - - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - org.spigotmc - spigot - 1.9.4-R0.1-SNAPSHOT - provided - - - - diff --git a/NCPCompatNonFree/pom.xml b/NCPCompatNonFree/pom.xml deleted file mode 100644 index 056d98b94..000000000 --- a/NCPCompatNonFree/pom.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - 4.0.0 - - - fr.neatmonster - nocheatplus-parent - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatnonfree - 1.1-SNAPSHOT - pom - - NCPCompatNonFree - - 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). - - - - NCPCompatAggregated - - - - - - all - - - NCPCompatCB2922 - NCPCompatCB3026 - NCPCompatCB3043 - NCPCompatCB3100 - NCPCompatSpigotCB1_8_R1 - NCPCompatSpigotCB1_8_R2 - NCPCompatSpigotCB1_8_R3 - NCPCompatSpigotCB1_9_R1 - NCPCompatSpigotCB1_9_R2 - NCPCompatSpigotCB1_10_R1 - NCPCompatSpigotCB1_11_R1 - - NCPCompatCBDev - - - - - cbdev - - NCPCompatCBDev - - - - - spigot1_12_r1 - - NCPCompatCBDev - - - - - spigot1_11_r1 - - NCPCompatSpigotCB1_11_R1 - - - - - spigot1_10_r1 - - NCPCompatSpigotCB1_10_R1 - - - - - spigot1_9_r2 - - NCPCompatSpigotCB1_9_R2 - - - - - spigot1_9_r1 - - NCPCompatSpigotCB1_9_R1 - - - - - spigot1_8_r3 - - NCPCompatSpigotCB1_8_R3 - - - - - spigot1_7_r4 - - NCPCompatCB3100 - - - - - cblegacy - - - NCPCompatCB2645 - NCPCompatCB2691 - NCPCompatCB2763 - NCPCompatCB2794 - NCPCompatCB2808 - NCPCompatCB2882 - NCPCompatCB2922 - NCPCompatCB3026 - NCPCompatCB3043 - - - - - - - nms-repo - https://repo.codemc.org/repository/nms/ - - - - diff --git a/NCPCompatProtocolLib/pom.xml b/NCPCompatProtocolLib/pom.xml deleted file mode 100644 index 2a4821a07..000000000 --- a/NCPCompatProtocolLib/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - nocheatplus-parent - 1.1-SNAPSHOT - ../pom.xml - - - ncpcompatprotocollib - 1.1-SNAPSHOT - - NCPCompatProtocolLib - - Features using the plugin ProtocolLib: - https://dev.bukkit.org/bukkit-plugins/protocollib/ - - - - - dmulloy2-repo - https://repo.dmulloy2.net/nexus/repository/public/ - - - plib-legacy - https://repo.loohpjames.com/repository/ - - - - - - org.spigotmc - spigot-api - 1.19.4-R0.1-SNAPSHOT - provided - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - provided - - - com.comphenix.protocol - ProtocolLib - 4.8.0 - provided - - - - diff --git a/NCPCore/pom.xml b/NCPCore/pom.xml deleted file mode 100644 index 814386de8..000000000 --- a/NCPCore/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - nocheatplus-parent - 1.1-SNAPSHOT - ../pom.xml - - - ncpcore - 1.1-SNAPSHOT - - NCPCore - - 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. - - - - - org.spigotmc - spigot-api - 1.19.4-R0.1-SNAPSHOT - provided - - - fr.neatmonster - ncpcommons - 1.1-SNAPSHOT - - - junit - junit - 4.12 - test - - - - diff --git a/NCPPlugin/pom.xml b/NCPPlugin/pom.xml deleted file mode 100644 index 2a85047e4..000000000 --- a/NCPPlugin/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - 4.0.0 - - - fr.neatmonster - nocheatplus-parent - 1.1-SNAPSHOT - ../pom.xml - - - ncpplugin - 1.1-SNAPSHOT - - NCPPlugin - - Mainly contains the plugin class and the factories. - For the plugin/artifact version see the NoCheatPlus module. - - - - - org.spigotmc - spigot-api - 1.19.4-R0.1-SNAPSHOT - provided - - - fr.neatmonster - ncpcore - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatbukkit - 1.1-SNAPSHOT - - - fr.neatmonster - ncpcompatprotocollib - 1.1-SNAPSHOT - - - junit - junit - 4.8.2 - test - - - - - - - nonfree_build - - - fr.neatmonster - ncpcompataggregated - 1.1-SNAPSHOT - pom - - - - - - diff --git a/NCPPlugin/src/main/resources/plugin.yml b/NCPPlugin/src/main/resources/plugin.yml index 5f0e3d438..52b106651 100644 --- a/NCPPlugin/src/main/resources/plugin.yml +++ b/NCPPlugin/src/main/resources/plugin.yml @@ -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 diff --git a/NoCheatPlus/pom.xml b/NoCheatPlus/pom.xml deleted file mode 100644 index cae466267..000000000 --- a/NoCheatPlus/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - 4.0.0 - - fr.neatmonster - nocheatplus - 3.17.1-SNAPSHOT - - NoCheatPlus - Detect and fight the exploitation of various flaws/bugs in Minecraft. - https://dev.bukkit.org/projects/nocheatplus - - - UTF-8 - yyyy_MM_dd-HH_mm - ${maven.build.timestamp} - ? - ? - - - - - fr.neatmonster - ncpplugin - 1.1-SNAPSHOT - - - - - - - timestamp - - - !env.BUILD_NUMBER - - - - ${maven.build.timestamp} - - - - dynamic_build_number - - - env.BUILD_NUMBER - - - - b${env.BUILD_NUMBER} - - - - - - - clean package - ../target - NoCheatPlus - - - . - true - .. - - LICENSE.txt - - - - - . - true - ../NCPPlugin/src/main/resources - - plugin.yml - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - - - diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..cc3bd2f62 --- /dev/null +++ b/build.gradle.kts @@ -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 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") { + 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().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().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().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().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") { exclude("plugin.yml") } +} diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 000000000..4c3ab9597 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/formatter/eclipse-java-formatter.xml b/config/formatter/eclipse-java-formatter.xml new file mode 100644 index 000000000..a3e01a0e8 --- /dev/null +++ b/config/formatter/eclipse-java-formatter.xml @@ -0,0 +1,404 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse.gradle.kts b/eclipse.gradle.kts new file mode 100644 index 000000000..b0dffb3d0 --- /dev/null +++ b/eclipse.gradle.kts @@ -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 by rootProject.extra + +val kotlinPluginProjects = configurations +.getByName("compileClasspath") +.allDependencies + .filterIsInstance() + .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 { + 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>() + +kotlinPluginProjects.forEach { path -> + val sub = project(path) + val shadowJarProv = sub.tasks.named("shadowJar") + val copyTask = + tasks.register("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() + 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() + +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() diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..1b33c55ba Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..d4081da47 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/gradlew b/gradlew new file mode 100755 index 000000000..23d15a936 --- /dev/null +++ b/gradlew @@ -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" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 000000000..5eed7ee84 --- /dev/null +++ b/gradlew.bat @@ -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 diff --git a/pom.xml b/pom.xml deleted file mode 100644 index bb0dfc489..000000000 --- a/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - 4.0.0 - - fr.neatmonster - nocheatplus-parent - pom - 1.1-SNAPSHOT - - NoCheatPlus Parent - - 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? - - https://dev.bukkit.org/projects/nocheatplus - - - UTF-8 - yyyy_MM_dd-HH_mm - - - - - NCPBuildBase - NCPCommons - NCPCore - NCPCompatBukkit - NCPCompatProtocolLib - NCPPlugin - NoCheatPlus - - - - - - nonfree_build - - NCPCompatNonFree - - - - - - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots - - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - - true - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - 1.8 - 1.8 - - - - - - - diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 000000000..8c8e6ac6e --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,13 @@ +rootProject.name = "NoCheatPlus" + +include(":NCPBuildBase") + +include(":NCPCommons") + +include(":NCPCore") + +include(":NCPCompatBukkit") + +include(":NCPCompatProtocolLib") + +include(":NCPPlugin")