mirror of
https://github.com/Updated-NoCheatPlus/NoCheatPlus.git
synced 2026-11-08 09:35:18 -05:00
Compare commits
209
Commits
v1.3-beta.4
...
v1.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2a2687b83 | ||
|
|
e90d8306a4 | ||
|
|
c84966bbd4 | ||
|
|
83426ab04f | ||
|
|
39e0f10019 | ||
|
|
008f1a7a7e | ||
|
|
55b9590a52 | ||
|
|
a73ad559df | ||
|
|
0bbd26dd9b | ||
|
|
b39f8e0bf4 | ||
|
|
c2512bc014 | ||
|
|
f588275d37 | ||
|
|
3034c8db7a | ||
|
|
d3be5af828 | ||
|
|
17d2c3245d | ||
|
|
41bf0cc684 | ||
|
|
0a973ff745 | ||
|
|
c7137ff5b6 | ||
|
|
e1357e96f2 | ||
|
|
2b313d70fa | ||
|
|
517e4be891 | ||
|
|
08b2f47404 | ||
|
|
9a2473029f | ||
|
|
f6a1d2bed7 | ||
|
|
f5ad1d36ae | ||
|
|
7d41589529 | ||
|
|
ab4d0a9004 | ||
|
|
a823f1e6e8 | ||
|
|
4736f75563 | ||
|
|
3ea26bf0cb | ||
|
|
eb52a3c516 | ||
|
|
e770a09342 | ||
|
|
6bd529cc40 | ||
|
|
07aed9bb6c | ||
|
|
38ff02682a | ||
|
|
43195a3a8d | ||
|
|
9500b491f0 | ||
|
|
b91bceaf38 | ||
|
|
7473559e6f | ||
|
|
2a1678dcb5 | ||
|
|
3822f69fe3 | ||
|
|
bda7cc7742 | ||
|
|
1e3e2b0842 | ||
|
|
83a391d15d | ||
|
|
2e26c51988 | ||
|
|
d640a702d6 | ||
|
|
eee2eab5ce | ||
|
|
1822366c87 | ||
|
|
bc6b9e548f | ||
|
|
77d9a806cc | ||
|
|
c5ccf0c237 | ||
|
|
d1b6bc0ac2 | ||
|
|
0f57ca23a6 | ||
|
|
5b6d0475da | ||
|
|
36af146c10 | ||
|
|
263ec46f19 | ||
|
|
df58970cd9 | ||
|
|
3e2a99e2e5 | ||
|
|
c24346708d | ||
|
|
94ed22789c | ||
|
|
2e41d0273d | ||
|
|
e47260d5c7 | ||
|
|
8286810566 | ||
|
|
63c9e403e4 | ||
|
|
b4e4999803 | ||
|
|
20fc013b6e | ||
|
|
b3143bc432 | ||
|
|
cc96d90199 | ||
|
|
b3da6cf1af | ||
|
|
50d5fdffb6 | ||
|
|
e746ba5c92 | ||
|
|
7d01b45e93 | ||
|
|
f0d22a110d | ||
|
|
e1b11c367c | ||
|
|
2ada6d74cc | ||
|
|
7b8d285c83 | ||
|
|
35cc00b3b2 | ||
|
|
60a8b7db9d | ||
|
|
ff0497ec62 | ||
|
|
9a32beb9ba | ||
|
|
b880e5ddd2 | ||
|
|
bf431db516 | ||
|
|
110de1eef3 | ||
|
|
15d2923407 | ||
|
|
528cf5e5e1 | ||
|
|
90d0f41824 | ||
|
|
2dca31bf63 | ||
|
|
f287974765 | ||
|
|
a5021c5bdb | ||
|
|
3d7f20bb29 | ||
|
|
2e05c37f25 | ||
|
|
b069c6c494 | ||
|
|
1f6bc2694a | ||
|
|
e72929d87b | ||
|
|
e4569977e9 | ||
|
|
de08c6d400 | ||
|
|
55263ce969 | ||
|
|
327be7b302 | ||
|
|
2537611620 | ||
|
|
7c9a081a63 | ||
|
|
7da9bde43f | ||
|
|
52e3ea1556 | ||
|
|
f599946e3c | ||
|
|
693789a448 | ||
|
|
485f4d2e82 | ||
|
|
e1b554edd0 | ||
|
|
bd46085c46 | ||
|
|
6d4dbb28e8 | ||
|
|
4a192f3a1b | ||
|
|
a3b3d4a482 | ||
|
|
e44da6266f | ||
|
|
d737693787 | ||
|
|
b7b684917e | ||
|
|
3e0af41412 | ||
|
|
a8060ff3d2 | ||
|
|
cd5444b794 | ||
|
|
770b0b9322 | ||
|
|
47f2e0267c | ||
|
|
361c1e8355 | ||
|
|
cbcef74a54 | ||
|
|
6bb4f682e9 | ||
|
|
b638d0dff9 | ||
|
|
9961dc99b7 | ||
|
|
5d32ce87af | ||
|
|
e4761ef731 | ||
|
|
682a5717f5 | ||
|
|
c9787ac81b | ||
|
|
1cfab2ee1a | ||
|
|
fb114c3532 | ||
|
|
5f89bbf462 | ||
|
|
a2ac285c0c | ||
|
|
b58049b81a | ||
|
|
da9f94e566 | ||
|
|
cc50883150 | ||
|
|
8c1408546a | ||
|
|
8fda3b0d1f | ||
|
|
9cd142e942 | ||
|
|
e7560fa894 | ||
|
|
e7761cc1e4 | ||
|
|
ae8d5bcd01 | ||
|
|
e60343cd52 | ||
|
|
e20b240669 | ||
|
|
791fabcaf8 | ||
|
|
168eadfec2 | ||
|
|
6511de888c | ||
|
|
2a84e271d7 | ||
|
|
6c25848136 | ||
|
|
ead9915bf3 | ||
|
|
c471130756 | ||
|
|
e9516a9bb3 | ||
|
|
205d7957c3 | ||
|
|
ada91e81cf | ||
|
|
6778416d61 | ||
|
|
76e51ac36b | ||
|
|
5f7f364061 | ||
|
|
8d72767061 | ||
|
|
b7c5c085a9 | ||
|
|
7db23f7cbd | ||
|
|
a4475f5e97 | ||
|
|
c5370ced6f | ||
|
|
cf0d6af701 | ||
|
|
e28479d6c5 | ||
|
|
eb6ba15e50 | ||
|
|
8a03e8ef12 | ||
|
|
86c9137c23 | ||
|
|
26524a6436 | ||
|
|
d7a4e9be77 | ||
|
|
50dc07e8a4 | ||
|
|
2c295f56dd | ||
|
|
6b33f681dd | ||
|
|
7eecae02d4 | ||
|
|
d2a33779fd | ||
|
|
201dae4c1d | ||
|
|
8b908220ef | ||
|
|
9b4589b264 | ||
|
|
9b75344e3e | ||
|
|
a3d64dd5c7 | ||
|
|
3e9f405451 | ||
|
|
c8df5b33ed | ||
|
|
407f8e14f9 | ||
|
|
d3b53bb68b | ||
|
|
280d537064 | ||
|
|
67b7f49af7 | ||
|
|
6eb88e3106 | ||
|
|
3d85f8dd89 | ||
|
|
d9fb5e1444 | ||
|
|
ea685240a3 | ||
|
|
c800e1cc26 | ||
|
|
ab690f7e72 | ||
|
|
84a32fbcf8 | ||
|
|
8dbdeded5e | ||
|
|
47947fc1c5 | ||
|
|
235f937056 | ||
|
|
ad6d1ffe91 | ||
|
|
f6b3ab0a9d | ||
|
|
1075d63244 | ||
|
|
784aed2a0c | ||
|
|
7791cff8a0 | ||
|
|
dd7eebd3a1 | ||
|
|
25b96ca846 | ||
|
|
096bb7ff2d | ||
|
|
f32303cfd7 | ||
|
|
152859da78 | ||
|
|
b44c1eb280 | ||
|
|
687fcafd3d | ||
|
|
9e5ab88f28 | ||
|
|
49a31edc15 | ||
|
|
c8077b43a8 | ||
|
|
be047840c7 |
No files matched your search
@@ -15,9 +15,9 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.13-R0.1-SNAPSHOT</version>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.14.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -43,4 +43,5 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
+1
-1
@@ -116,7 +116,7 @@ public class MCAccessBukkitBase implements MCAccess {
|
||||
public String getMCVersion() {
|
||||
// Bukkit API.
|
||||
// TODO: maybe output something else.
|
||||
return "1.4.6-1.11.2|?"; // uh oh
|
||||
return "1.6.1-1.14.4|?"; // uh oh
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+104
-16
@@ -21,17 +21,7 @@ import org.bukkit.Material;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.init.BlockInit;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitDirectionalCentered;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitDoor;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitEndPortalFrame;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitFence;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitGate;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitShapeModel;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitShulkerBox;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitSlab;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitStairs;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitStatic;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitTrapDoor;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.model.*;
|
||||
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
|
||||
@@ -48,9 +38,13 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
private static final BukkitShapeModel MODEL_GATE = new BukkitGate(
|
||||
0.375, 1.5);
|
||||
private static final BukkitShapeModel MODEL_SHULKER_BOX = new BukkitShulkerBox();
|
||||
private static final BukkitShapeModel MODEL_CHORUS_PLANT = new BukkitChorusPlant();
|
||||
|
||||
// Blocks with different heights based on whatever.
|
||||
private static final BukkitShapeModel MODEL_END_PORTAL_FRAME = new BukkitEndPortalFrame();
|
||||
private static final BukkitShapeModel MODEL_SEA_PICKLE = new BukkitSeaPickle();
|
||||
private static final BukkitShapeModel MODEL_COCOA = new BukkitCocoa();
|
||||
private static final BukkitShapeModel MODEL_TURTLE_EGG = new BukkitTurtleEgg();
|
||||
|
||||
// Blocks that have a different shape, based on how they have been placed.
|
||||
private static final BukkitShapeModel MODEL_SLAB = new BukkitSlab();
|
||||
@@ -63,13 +57,24 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
0.4375, 1.0);
|
||||
private static final BukkitShapeModel MODEL_THICK_FENCE = new BukkitFence(
|
||||
0.375, 1.5);
|
||||
private static final BukkitShapeModel MODEL_THICK_FENCE2 = new BukkitWall(
|
||||
0.25, 1.5);
|
||||
// .75 .25 0 max: .25 .75 .5
|
||||
private static final BukkitShapeModel MODEL_WALL_HEAD = new BukkitWallHead();
|
||||
|
||||
|
||||
// Static blocks (various height and inset values).
|
||||
private static final BukkitShapeModel MODEL_BELL = new BukkitBell();
|
||||
private static final BukkitShapeModel MODEL_LECTERN = new BukkitStatic(0.25, 0.875);
|
||||
private static final BukkitShapeModel MODEL_BAMBOO = new BukkitBamboo();
|
||||
private static final BukkitShapeModel MODEL_ANVIL = new BukkitAnvil();
|
||||
private static final BukkitShapeModel MODEL_LILY_PAD = new BukkitStatic(
|
||||
0.09375);
|
||||
private static final BukkitShapeModel MODEL_FLOWER_POT = new BukkitStatic(
|
||||
0.33, 0.375); // TODO: XZ really?
|
||||
private static final BukkitShapeModel MODEL_LANTERN = new BukkitLantern();
|
||||
private static final BukkitShapeModel MODEL_CONDUIT = new BukkitStatic(
|
||||
0.33, 0.6875);
|
||||
private static final BukkitShapeModel MODEL_GROUND_HEAD= new BukkitStatic(
|
||||
0.25, 0.5); // TODO: XZ-really? 275 ?
|
||||
private static final BukkitShapeModel MODEL_SINGLE_CHEST = new BukkitStatic(
|
||||
@@ -117,7 +122,7 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
return "1.13|?";
|
||||
return "1.13-1.14.4|?";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,10 +140,21 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
|
||||
// TODO: Also consider removing flags (passable_x4 etc).
|
||||
|
||||
// Adjust flags for individual blocks.
|
||||
// Variables for repeated flags (Temporary flags, these should be fixed later so that they are not added here)
|
||||
final long blockFix = BlockFlags.SOLID_GROUND;
|
||||
// Adjust flags for individual blocks.
|
||||
BlockProperties.setBlockFlags(Material.CAULDRON,
|
||||
BlockFlags.SOLID_GROUND | BlockProperties.F_GROUND_HEIGHT
|
||||
| BlockProperties.F_MIN_HEIGHT4_1);
|
||||
BlockProperties.setBlockFlags(Material.COCOA, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.TURTLE_EGG, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.CHORUS_PLANT, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.CREEPER_WALL_HEAD, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.ZOMBIE_WALL_HEAD, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.PLAYER_WALL_HEAD, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.DRAGON_WALL_HEAD, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.WITHER_SKELETON_WALL_SKULL, blockFix);
|
||||
BlockProperties.setBlockFlags(Material.SKELETON_WALL_SKULL, blockFix);
|
||||
|
||||
// Directly keep blocks as is.
|
||||
for (final Material mat : new Material[] {
|
||||
@@ -146,11 +162,25 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
BridgeMaterial.COBWEB,
|
||||
Material.HOPPER,
|
||||
BridgeMaterial.MOVING_PISTON,
|
||||
Material.SNOW
|
||||
Material.SNOW,
|
||||
Material.CAKE,
|
||||
Material.BEACON,
|
||||
Material.LADDER,
|
||||
Material.VINE,
|
||||
Material.CHORUS_FLOWER
|
||||
}) {
|
||||
processedBlocks.add(mat);
|
||||
}
|
||||
|
||||
//Anvil
|
||||
for (Material mat : new Material[] {
|
||||
Material.ANVIL,
|
||||
Material.CHIPPED_ANVIL,
|
||||
Material.DAMAGED_ANVIL
|
||||
}) {
|
||||
addModel(mat, MODEL_ANVIL);
|
||||
}
|
||||
|
||||
// Lily pad
|
||||
addModel(BridgeMaterial.LILY_PAD, MODEL_LILY_PAD);
|
||||
|
||||
@@ -238,7 +268,35 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
for (Material mat : MaterialUtil.FLOWER_POTS) {
|
||||
addModel(mat, MODEL_FLOWER_POT);
|
||||
}
|
||||
|
||||
|
||||
// Turtle Eggs.
|
||||
for (Material mat : new Material[] {
|
||||
Material.TURTLE_EGG
|
||||
}) {
|
||||
addModel(mat, MODEL_TURTLE_EGG);
|
||||
}
|
||||
|
||||
// Conduit
|
||||
for (Material mat : new Material[] {
|
||||
Material.CONDUIT
|
||||
}) {
|
||||
addModel(mat, MODEL_CONDUIT);
|
||||
}
|
||||
|
||||
// Cocoa
|
||||
for (Material mat : new Material[] {
|
||||
Material.COCOA
|
||||
}) {
|
||||
addModel(mat, MODEL_COCOA);
|
||||
}
|
||||
|
||||
// Sea Pickles
|
||||
for (Material mat : new Material[] {
|
||||
Material.SEA_PICKLE
|
||||
}) {
|
||||
addModel(mat, MODEL_SEA_PICKLE);
|
||||
}
|
||||
|
||||
// Carpets.
|
||||
for (final Material mat : MaterialUtil.CARPETS) {
|
||||
addModel(mat, MODEL_XZ100_HEIGHT16_1);
|
||||
@@ -248,6 +306,9 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
for (final Material mat : MaterialUtil.HEADS_GROUND) {
|
||||
addModel(mat, MODEL_GROUND_HEAD);
|
||||
}
|
||||
for (final Material mat : MaterialUtil.HEADS_WALL) {
|
||||
addModel(mat, MODEL_WALL_HEAD);
|
||||
}
|
||||
|
||||
// Doors.
|
||||
for (final Material mat : MaterialUtil.ALL_DOORS) {
|
||||
@@ -258,7 +319,30 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
for (final Material mat : MaterialUtil.ALL_TRAP_DOORS) {
|
||||
addModel(mat, MODEL_TRAP_DOOR);
|
||||
}
|
||||
|
||||
// Chorus Plant.
|
||||
for (Material mat : new Material[] {
|
||||
Material.CHORUS_PLANT
|
||||
}) {
|
||||
addModel(mat, MODEL_CHORUS_PLANT);
|
||||
}
|
||||
|
||||
//Lantern
|
||||
Material mt = BridgeMaterial.getBlock("lantern");
|
||||
if (mt != null) addModel(mt, MODEL_LANTERN);
|
||||
|
||||
// Lectern
|
||||
mt = BridgeMaterial.getBlock("lectern");
|
||||
if (mt != null) addModel(mt, MODEL_LECTERN);
|
||||
|
||||
// Bamboo
|
||||
mt = BridgeMaterial.getBlock("bamboo");
|
||||
if (mt != null) addModel(mt, MODEL_BAMBOO);
|
||||
|
||||
// Bell
|
||||
mt = BridgeMaterial.getBlock("bell");
|
||||
if (mt != null) addModel(mt, MODEL_BELL);
|
||||
|
||||
// Sort to processed by flags.
|
||||
for (final Material mat : Material.values()) {
|
||||
final long flags = BlockProperties.getBlockFlags(mat);
|
||||
@@ -266,7 +350,7 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
if (BlockFlags.hasAnyFlag(flags, BlockProperties.F_STAIRS)) {
|
||||
addModel(mat, MODEL_STAIRS);
|
||||
}
|
||||
// Fences, cobblestone wall.
|
||||
// Fences.
|
||||
if (BlockFlags.hasAnyFlag(flags, BlockProperties.F_THICK_FENCE)) {
|
||||
if (BlockFlags.hasAnyFlag(flags, BlockProperties.F_PASSABLE_X4)) {
|
||||
// TODO: Perhaps another model flag.
|
||||
@@ -276,6 +360,10 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
|
||||
addModel(mat, MODEL_THICK_FENCE);
|
||||
}
|
||||
}
|
||||
// Walls
|
||||
if (BlockFlags.hasAnyFlag(flags, BlockProperties.F_THICK_FENCE2)) {
|
||||
addModel(mat, MODEL_THICK_FENCE2);
|
||||
}
|
||||
}
|
||||
|
||||
super.setupBlockProperties(worldConfigProvider);
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitAnvil implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Directional) {
|
||||
BlockFace face = ((Directional) blockData).getFacing();
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
return new double[] {0.1815, 0.0, 0.0, 1.0 - 0.1815, 1.0, 1.0};
|
||||
case WEST:
|
||||
case EAST:
|
||||
return new double[] {0.0, 0.0, 0.1815, 1.0, 1.0, 1.0 - 0.1815};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitBamboo implements BukkitShapeModel {
|
||||
private DecimalFormat df = new DecimalFormat("#.000");
|
||||
private final double xz = 0.375;
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
|
||||
double minX = Math.abs(block.getBoundingBox().getMinX()) - Math.abs((int) block.getBoundingBox().getMinX());
|
||||
double minZ = Math.abs(block.getBoundingBox().getMinZ()) - Math.abs((int) block.getBoundingBox().getMinZ());
|
||||
|
||||
minX = Double.parseDouble(df.format(minX));
|
||||
minZ = Double.parseDouble(df.format(minZ));
|
||||
|
||||
//return new double[] {1.0 - minX + 0.09, 0.0, minZ + 0.09, 1.0 - minX + xz - 0.09, 1.0, minZ + xz - 0.09}; (1)
|
||||
//return new double[] {minX + 0.09, 0.0, 1.0 - minZ + 0.09, minX + xz - 0.09, 1.0, 1.0 - minZ + xz - 0.09}; (2)
|
||||
// (1) + (2) =>
|
||||
return new double[] {1.0 - minX + 0.09, 0.0, 1.0 - minZ + 0.09, 1.0 - minX + xz - 0.09, 1.0, 1.0 - minZ + xz - 0.09};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Bell;
|
||||
import org.bukkit.block.data.type.Bell.Attachment;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitBell implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Bell) {
|
||||
Bell b = (Bell) blockData;
|
||||
BlockFace face = b.getFacing();
|
||||
switch (b.getAttachment()) {
|
||||
case CEILING: return new double[] {0.25, 1-0.75, 0.25, 0.75, 1.0, 0.75};
|
||||
case DOUBLE_WALL:
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
return new double[] {0.25, 0.375, 0.0, 0.75, 0.9375, 1.0};
|
||||
case WEST:
|
||||
case EAST:
|
||||
return new double[] {0.0, 0.375, 0.25, 1.0, 0.9375, 0.75};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FLOOR:
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
return new double[] {0.0, 0.0, 0.25, 1.0, 1.0, 0.75};
|
||||
case WEST:
|
||||
case EAST:
|
||||
return new double[] {0.25, 0.0, 0.0, 0.75, 1.0, 1.0};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SINGLE_WALL:
|
||||
switch (face) {
|
||||
case NORTH: return new double[] {0.25, 0.375, 0.0, 0.75, 0.9375, 1 - 0.1875};
|
||||
case SOUTH: return new double[] {0.25, 0.375, 0.1875, 0.75, 0.9375, 1.0};
|
||||
case WEST: return new double[] {0.0, 0.375, 0.25, 1.0 - 0.1875, 0.9375, 0.75};
|
||||
case EAST: return new double[] {0.1875, 0.375, 0.25, 1.0, 0.9375, 0.75};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Bell) {
|
||||
Bell b = (Bell) blockData;
|
||||
if (b.getAttachment() == Attachment.SINGLE_WALL) return 0x4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitChorusPlant implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockData blockData = block.getBlockData();
|
||||
double[] res = new double[] {0.187, 0.188, 0.187, 1.0 - 0.187, 0.8125, 1.0 - 0.187};
|
||||
if (blockData instanceof MultipleFacing) {
|
||||
final MultipleFacing chorusplant = (MultipleFacing) blockData;
|
||||
for (final BlockFace face : chorusplant.getFaces()) {
|
||||
switch (face) {
|
||||
//case DOWN:
|
||||
// res[1]=0.0;
|
||||
// break;
|
||||
case UP:
|
||||
res[4]=1.0;
|
||||
break;
|
||||
case SOUTH:
|
||||
res[5]=1.0;
|
||||
break;
|
||||
case NORTH:
|
||||
res[2]=0.0;
|
||||
break;
|
||||
case WEST:
|
||||
res[0]=0.0;
|
||||
break;
|
||||
case EAST:
|
||||
res[3]=1.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
import org.bukkit.block.data.type.Cocoa;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitCocoa implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
|
||||
if (blockData instanceof Cocoa && blockData instanceof Directional) {
|
||||
BlockFace face = ((Directional) blockData).getFacing();
|
||||
final Cocoa cocoa = (Cocoa) blockData;
|
||||
switch (cocoa.getAge()) {
|
||||
case 0: // .625 .4375 .0625 max: .375 .75 .3125
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
return new double[] {0.375, 0.4375, 0.0, 0.625, 0.75, 0.315};
|
||||
case SOUTH:
|
||||
return new double[] {0.375, 0.4375, 0.685, 0.625, 0.75, 1.0};
|
||||
case WEST:
|
||||
return new double[] {0.0, 0.4375, 0.375, 0.315, 0.75, 0.625};
|
||||
case EAST:
|
||||
return new double[] {0.685, 0.4375, 0.375, 1.0, 0.75, 0.625};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: // .6875 .3125 .0625 max: .3125 .75 .4375
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
return new double[] {0.3125, 0.3125, 0.0, 0.6875, 0.75, 0.4375};
|
||||
case SOUTH:
|
||||
return new double[] {0.3125, 0.3125, 0.5625, 0.6875, 0.75, 1.0};
|
||||
case WEST:
|
||||
return new double[] {0.0, 0.3125, 0.3125, 0.4375, 0.75, 0.6875};
|
||||
case EAST:
|
||||
return new double[] {0.5625, 0.3125, 0.3125, 1.0, 0.75, 0.6875};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2: // .75 .1875 .0625 max: .25 .75 .5625
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
return new double[] {0.25, 0.1875, 0.0, 0.75, 0.75, 0.5625};
|
||||
case SOUTH:
|
||||
return new double[] {0.25, 0.1875, 0.4375, 0.75, 0.75, 1.0};
|
||||
case WEST:
|
||||
return new double[] {0.0, 0.1875, 0.25, 0.5625, 0.75, 0.75};
|
||||
case EAST:
|
||||
return new double[] {0.4375, 0.1875, 0.25, 1.0, 0.75, 0.75};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Lantern;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitLantern implements BukkitShapeModel {
|
||||
|
||||
private double xz = 0.33;
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Lantern) {
|
||||
Lantern lantern = (Lantern) blockData;
|
||||
if (lantern.isHanging()) return new double[] {xz, 0.0625, xz, 1-xz, 1, 1-xz};
|
||||
}
|
||||
return new double[] {xz, 0.0, xz, 1.0 - xz, 0.5625, 1.0 - xz};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.SeaPickle;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitSeaPickle implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
|
||||
if (blockData instanceof SeaPickle) {
|
||||
final SeaPickle pick = (SeaPickle) blockData;
|
||||
switch (pick.getPickles()) {
|
||||
case 1: // .375 , 0 , .375 max: .625 , 375 , .625
|
||||
return new double[] {0.375, 0.0, 0.375, 0.625, 0.375, 0.625};
|
||||
case 2: // .1875 , 0 , .1875 max: .8125 , .375 , .8125
|
||||
return new double[] {0.1875, 0.0, 0.1875, 0.8125, 0.375, 0.8125};
|
||||
case 3: // .125 0 .125 max: .875 .375 .875
|
||||
return new double[] {0.125, 0.0, 0.125, 0.875, 0.375, 0.875};
|
||||
case 4: // .125 0 .125 max: .875 .4375 .875
|
||||
return new double[] {0.125, 0.0, 0.125, 0.875, 0.4375, 0.875};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.TurtleEgg;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitTurtleEgg implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
|
||||
if (blockData instanceof TurtleEgg) {
|
||||
final TurtleEgg egg = (TurtleEgg) blockData;
|
||||
switch (egg.getEggs()) {
|
||||
case 1: // .8125 0.0 .1875 max: .25 .4375 .75
|
||||
return new double[] {0.23, 0.0, 0.23, 0.75, 0.4375, 0.75};
|
||||
case 2: // .9375 .0 .0625 max: 0.0625 .4375 .9375
|
||||
case 3:
|
||||
case 4:
|
||||
return new double[] {0.0625, 0.0, 0.0625, 0.9375, 0.4375, 0.9375};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.MultipleFacing;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitWall implements BukkitShapeModel {
|
||||
|
||||
private final double minXZ;
|
||||
private final double maxXZ;
|
||||
private final double height;
|
||||
|
||||
public BukkitWall(double inset, double height) {
|
||||
this(inset, 1.0 - inset, height);
|
||||
}
|
||||
|
||||
public BukkitWall(double minXZ, double maxXZ, double height) {
|
||||
this.minXZ = minXZ;
|
||||
this.maxXZ = maxXZ;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockState state = block.getState();
|
||||
final BlockData blockData = state.getBlockData();
|
||||
|
||||
if (blockData instanceof MultipleFacing) {
|
||||
// Note isPassableWorkaround for these (no voxel shapes / multi cuboid yet).
|
||||
final MultipleFacing fence = (MultipleFacing) blockData;
|
||||
// TODO: If height > 1.0, check if it needs to be capped, provided relevant.
|
||||
double[] res = new double[] {minXZ, 0.0, minXZ, maxXZ, height, maxXZ};
|
||||
for (final BlockFace face : fence.getFaces()) {
|
||||
switch (face) {
|
||||
case EAST:
|
||||
res[3] = 1.0;
|
||||
break;
|
||||
case NORTH:
|
||||
res[2] = 0.0;
|
||||
break;
|
||||
case WEST:
|
||||
res[0] = 0.0;
|
||||
break;
|
||||
case SOUTH:
|
||||
res[5] = 1.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
final Set<BlockFace> a = fence.getFaces();
|
||||
if (!a.contains(BlockFace.UP) && a.size() == 2) {
|
||||
if (a.contains(BlockFace.SOUTH)) {
|
||||
res[0] = 0.33;
|
||||
res[3] = 1 - 0.33;
|
||||
}
|
||||
if (a.contains(BlockFace.WEST)) {
|
||||
res[2] = 0.33;
|
||||
res[5] = 1 - 0.33;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat.bukkit.model;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class BukkitWallHead implements BukkitShapeModel {
|
||||
|
||||
@Override
|
||||
public double[] getShape(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
|
||||
final Block block = world.getBlockAt(x, y, z);
|
||||
final BlockData blockData = block.getBlockData();
|
||||
if (blockData instanceof Directional) {
|
||||
BlockFace face = ((Directional) blockData).getFacing();
|
||||
switch (face) {
|
||||
case NORTH:
|
||||
return new double[] {0.25, 0.25, 0.5, 0.75, 0.75, 1.0};
|
||||
case SOUTH:
|
||||
return new double[] {0.25, 0.25, 0.0, 0.75, 0.75, 0.5};
|
||||
case WEST:
|
||||
return new double[] {0.5, 0.25, 0.25, 1.0, 0.75, 0.75};
|
||||
case EAST:
|
||||
return new double[] {0.0, 0.25, 0.25, 0.5, 0.75, 0.75};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFakeData(final BlockCache blockCache,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+4
-4
@@ -22,7 +22,7 @@ import org.bukkit.entity.Player;
|
||||
import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.BlockCacheBukkit;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.MCAccessBukkitBase;
|
||||
import fr.neatmonster.nocheatplus.compat.bukkit.MCAccessBukkitModern;
|
||||
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectHelper;
|
||||
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectHelper.ReflectFailureException;
|
||||
import fr.neatmonster.nocheatplus.compat.versions.GenericVersion;
|
||||
@@ -31,7 +31,7 @@ import fr.neatmonster.nocheatplus.logging.Streams;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.LocUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
|
||||
public class MCAccessCBReflect extends MCAccessBukkitBase {
|
||||
public class MCAccessCBReflect extends MCAccessBukkitModern {
|
||||
|
||||
protected final ReflectHelper helper;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class MCAccessCBReflect extends MCAccessBukkitBase {
|
||||
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.INIT, "The Minecraft version seems to be older than what Compat-CB-Reflect can support.");
|
||||
this.knownSupportedVersion = false;
|
||||
}
|
||||
else if (GenericVersion.compareVersions(mcVersion, "1.12.2") > 0) {
|
||||
else if (GenericVersion.compareVersions(mcVersion, "1.14.4") > 0) {
|
||||
this.knownSupportedVersion = false;
|
||||
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.INIT, "The Minecraft version seems to be more recent than the one Compat-CB-Reflect has been built with - this might work, but there could be incompatibilities.");
|
||||
} else {
|
||||
@@ -71,7 +71,7 @@ public class MCAccessCBReflect extends MCAccessBukkitBase {
|
||||
@Override
|
||||
public String getMCVersion() {
|
||||
// Potentially all :p.
|
||||
return "1.4.5-1.12.2|?";
|
||||
return "1.7-1.14.4|?";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.10-R0.1-SNAPSHOT</version>
|
||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -32,9 +32,9 @@
|
||||
|
||||
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.)
|
||||
|
||||
- Add as dependency within the profile with id 'all'.
|
||||
- (Add a new profile with both the module and dependency set.)
|
||||
|
||||
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
|
||||
|
||||
<build>
|
||||
@@ -49,4 +49,4 @@ The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, Enti
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
@@ -23,7 +23,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.11.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.11-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -32,9 +32,9 @@
|
||||
|
||||
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.)
|
||||
|
||||
- Add as dependency within the profile with id 'all'.
|
||||
- (Add a new profile with both the module and dependency set.)
|
||||
|
||||
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
|
||||
|
||||
<build>
|
||||
@@ -49,4 +49,4 @@ The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, Enti
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
@@ -23,7 +23,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8.4-R0.1-SNAPSHOT</version>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -39,4 +39,4 @@
|
||||
</plugins>
|
||||
</build>
|
||||
<description>Compatibility for Minecraft 1.8.4-1.8.6 with CraftBukkit/Spigot (1_8_R3).</description>
|
||||
</project>
|
||||
</project>
|
||||
+379
-379
@@ -1,381 +1,381 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<name>NCPCompatNonFree</name>
|
||||
<description>Combine compatibility modules with dependencies that can't be obtained from a public maven repository, such as CraftBukkit or Spigot builds, hence "NonFree".
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatnonfree</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<name>NCPCompatNonFree</name>
|
||||
<description>Combine compatibility modules with dependencies that can't be obtained from a public maven repository, such as CraftBukkit or Spigot builds, hence "NonFree".
|
||||
|
||||
To add a new compat module:
|
||||
- Add as module within the profile with id 'all'.
|
||||
- Add as dependency within the profile with id 'all'.
|
||||
- (Add a new profile with both the module and dependency set.)
|
||||
|
||||
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<!-- Profile based activation of modules and dependencies. -->
|
||||
<profiles>
|
||||
|
||||
<profile>
|
||||
<id>all</id>
|
||||
|
||||
<modules>
|
||||
<module>NCPCompatCB2512</module>
|
||||
<module>NCPCompatCB2545</module>
|
||||
<module>NCPCompatCB2602</module>
|
||||
<module>NCPCompatCB2645</module>
|
||||
<module>NCPCompatCB2691</module>
|
||||
<module>NCPCompatCB2763</module>
|
||||
<module>NCPCompatCB2794</module>
|
||||
<module>NCPCompatCB2808</module>
|
||||
<module>NCPCompatCB2882</module>
|
||||
<module>NCPCompatCB2922</module>
|
||||
<module>NCPCompatCB3026</module>
|
||||
<module>NCPCompatCB3043</module>
|
||||
<module>NCPCompatCB3100</module>
|
||||
<module>NCPCompatSpigotCB1_8_R1</module>
|
||||
<module>NCPCompatSpigotCB1_8_R2</module>
|
||||
<module>NCPCompatSpigotCB1_8_R3</module>
|
||||
<module>NCPCompatSpigotCB1_9_R1</module>
|
||||
<module>NCPCompatSpigotCB1_9_R2</module>
|
||||
<module>NCPCompatSpigotCB1_10_R1</module>
|
||||
<module>NCPCompatSpigotCB1_11_R1</module>
|
||||
<!-- ... -->
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- ... -->
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2882</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2808</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2794</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2763</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2691</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2645</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2602</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2545</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2512</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cbdev</id>
|
||||
<modules>
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<!-- ... -->
|
||||
|
||||
<profile>
|
||||
<id>spigot1_12_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_11_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_11_R1</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_10_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_10_R1</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r2</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_9_R2</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_9_R1</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_8_r3</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_8_R3</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_7_r4</id>
|
||||
<modules>
|
||||
<module>NCPCompatCB3100</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cblegacy</id>
|
||||
|
||||
<modules>
|
||||
<module>NCPCompatCB2512</module>
|
||||
<module>NCPCompatCB2545</module>
|
||||
<module>NCPCompatCB2602</module>
|
||||
<module>NCPCompatCB2645</module>
|
||||
<module>NCPCompatCB2691</module>
|
||||
<module>NCPCompatCB2763</module>
|
||||
<module>NCPCompatCB2794</module>
|
||||
<module>NCPCompatCB2808</module>
|
||||
<module>NCPCompatCB2882</module>
|
||||
<module>NCPCompatCB2922</module>
|
||||
<module>NCPCompatCB3026</module>
|
||||
<module>NCPCompatCB3043</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2882</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2808</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2794</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2763</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2691</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2645</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2602</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2545</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2512</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
- Add as dependency within the profile with id 'all'.
|
||||
- (Add a new profile with both the module and dependency set.)
|
||||
|
||||
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>nocheatplus-parent</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<!-- Profile based activation of modules and dependencies. -->
|
||||
<profiles>
|
||||
|
||||
<profile>
|
||||
<id>all</id>
|
||||
|
||||
<modules>
|
||||
<!-- <module>NCPCompatCB2512</module>
|
||||
<module>NCPCompatCB2545</module>
|
||||
<module>NCPCompatCB2602</module>
|
||||
<module>NCPCompatCB2645</module>
|
||||
<module>NCPCompatCB2691</module>
|
||||
<module>NCPCompatCB2763</module>
|
||||
<module>NCPCompatCB2794</module>
|
||||
<module>NCPCompatCB2808</module>
|
||||
<module>NCPCompatCB2882</module> -->
|
||||
<module>NCPCompatCB2922</module>
|
||||
<module>NCPCompatCB3026</module>
|
||||
<module>NCPCompatCB3043</module>
|
||||
<module>NCPCompatCB3100</module>
|
||||
<module>NCPCompatSpigotCB1_8_R1</module>
|
||||
<module>NCPCompatSpigotCB1_8_R2</module>
|
||||
<module>NCPCompatSpigotCB1_8_R3</module>
|
||||
<module>NCPCompatSpigotCB1_9_R1</module>
|
||||
<module>NCPCompatSpigotCB1_9_R2</module>
|
||||
<module>NCPCompatSpigotCB1_10_R1</module>
|
||||
<module>NCPCompatSpigotCB1_11_R1</module>
|
||||
<!-- ... -->
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- ... -->
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2882</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2808</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2794</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2763</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2691</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2645</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2602</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2545</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2512</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency> -->
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cbdev</id>
|
||||
<modules>
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<!-- ... -->
|
||||
|
||||
<profile>
|
||||
<id>spigot1_12_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatCBDev</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcbdev</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_11_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_11_R1</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_10_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_10_R1</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r2</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_9_R2</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_9_r1</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_9_R1</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_8_r3</id>
|
||||
<modules>
|
||||
<module>NCPCompatSpigotCB1_8_R3</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>spigot1_7_r4</id>
|
||||
<modules>
|
||||
<module>NCPCompatCB3100</module>
|
||||
</modules>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>cblegacy</id>
|
||||
|
||||
<modules>
|
||||
<module>NCPCompatCB2512</module>
|
||||
<module>NCPCompatCB2545</module>
|
||||
<module>NCPCompatCB2602</module>
|
||||
<module>NCPCompatCB2645</module>
|
||||
<module>NCPCompatCB2691</module>
|
||||
<module>NCPCompatCB2763</module>
|
||||
<module>NCPCompatCB2794</module>
|
||||
<module>NCPCompatCB2808</module>
|
||||
<module>NCPCompatCB2882</module>
|
||||
<module>NCPCompatCB2922</module>
|
||||
<module>NCPCompatCB3026</module>
|
||||
<module>NCPCompatCB3043</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3043</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3026</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2922</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2882</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2808</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2794</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2763</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2691</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2645</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2602</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb3100</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2545</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
<artifactId>ncpcompatcb2512</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.checks.net.protocollib;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerDigType;
|
||||
|
||||
import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
|
||||
import fr.neatmonster.nocheatplus.components.registry.order.RegistrationOrder.RegisterMethodWithOrder;
|
||||
import fr.neatmonster.nocheatplus.event.mini.MiniListener;
|
||||
import fr.neatmonster.nocheatplus.logging.StaticLog;
|
||||
import fr.neatmonster.nocheatplus.players.DataManager;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.InventoryUtil;
|
||||
|
||||
public class NoSlow extends BaseAdapter {
|
||||
private final static String dftag = "system.nocheatplus.noslow";
|
||||
private final static MiniListener<?>[] miniListeners = new MiniListener<?>[] {
|
||||
new MiniListener<PlayerItemConsumeEvent>() {
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
@RegisterMethodWithOrder(tag = dftag)
|
||||
@Override
|
||||
public void onEvent(final PlayerItemConsumeEvent event) {
|
||||
onItemConsume(event);
|
||||
}
|
||||
},
|
||||
new MiniListener<PlayerInteractEvent>() {
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@RegisterMethodWithOrder(tag = dftag)
|
||||
@Override
|
||||
public void onEvent(final PlayerInteractEvent event) {
|
||||
onItemInteract(event);
|
||||
}
|
||||
},
|
||||
new MiniListener<InventoryOpenEvent>() {
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@RegisterMethodWithOrder(tag = dftag)
|
||||
@Override
|
||||
public void onEvent(final InventoryOpenEvent event) {
|
||||
onInventoryOpen(event);
|
||||
}
|
||||
},
|
||||
new MiniListener<PlayerItemHeldEvent>() {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@RegisterMethodWithOrder(tag = dftag)
|
||||
@Override
|
||||
public void onEvent(final PlayerItemHeldEvent event) {
|
||||
onChangeSlot(event);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private static int timeBetweenRL = 53;
|
||||
private static PacketType[] initPacketTypes() {
|
||||
final List<PacketType> types = new LinkedList<PacketType>(Arrays.asList(
|
||||
PacketType.Play.Client.BLOCK_DIG
|
||||
));
|
||||
return types.toArray(new PacketType[types.size()]);
|
||||
}
|
||||
|
||||
public NoSlow(Plugin plugin) {
|
||||
super(plugin, ListenerPriority.LOW, initPacketTypes());
|
||||
final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
|
||||
for (final MiniListener<?> listener : miniListeners) {
|
||||
api.addComponent(listener, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(final PacketEvent event) {
|
||||
handleDiggingPacket(event);
|
||||
}
|
||||
|
||||
private static void onItemConsume(final PlayerItemConsumeEvent e){
|
||||
final Player p = e.getPlayer();
|
||||
|
||||
final IPlayerData pData = DataManager.getPlayerData(p);
|
||||
final MovingData data = pData.getGenericInstance(MovingData.class);
|
||||
data.isusingitem = false;
|
||||
}
|
||||
|
||||
private static void onInventoryOpen(final InventoryOpenEvent e){
|
||||
if (e.isCancelled()) return;
|
||||
final Player p = (Player) e.getPlayer();
|
||||
|
||||
final IPlayerData pData = DataManager.getPlayerData(p);
|
||||
final MovingData data = pData.getGenericInstance(MovingData.class);
|
||||
data.isusingitem = false;
|
||||
}
|
||||
|
||||
private static void onItemInteract(final PlayerInteractEvent e){
|
||||
if (e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||
final Player p = e.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(p);
|
||||
final MovingData data = pData.getGenericInstance(MovingData.class);
|
||||
Block b = e.getClickedBlock();
|
||||
if (p.getGameMode() == GameMode.CREATIVE) {
|
||||
data.isusingitem = false;
|
||||
return;
|
||||
}
|
||||
if (b != null && (
|
||||
b.getType().toString().endsWith("DOOR")
|
||||
|| b.getType().toString().endsWith("GATE")
|
||||
|| b.getType().toString().endsWith("BUTTON")
|
||||
|| b.getType().toString().endsWith("LEVER")
|
||||
)) {
|
||||
data.isusingitem = false;
|
||||
return;
|
||||
}
|
||||
if (e.hasItem()) {
|
||||
ItemStack item = e.getItem();
|
||||
Material m = item.getType();
|
||||
if (InventoryUtil.isConsumable(item)) {
|
||||
if (m == Material.POTION || m == Material.MILK_BUCKET || m.toString().endsWith("_APPLE")) {
|
||||
data.isusingitem = true;
|
||||
return;
|
||||
}
|
||||
if (item.getType().isEdible() && p.getFoodLevel() < 20) {
|
||||
data.isusingitem = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (m.toString().equals("BOW") && hasArrow(p.getInventory())) {
|
||||
data.isusingitem = true;
|
||||
}
|
||||
if (m.toString().equals("CROSSBOW")) {
|
||||
if (item.getItemMeta().serialize().get("charged").equals(false) && hasArrow(p.getInventory())) {
|
||||
data.isusingitem = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else data.isusingitem = false;
|
||||
}
|
||||
|
||||
private static void onChangeSlot(final PlayerItemHeldEvent e) {
|
||||
final Player p = e.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(p);
|
||||
final MovingData data = pData.getGenericInstance(MovingData.class);
|
||||
data.isusingitem = false;
|
||||
}
|
||||
|
||||
private static boolean hasArrow(PlayerInventory i) {
|
||||
if (Bridge1_9.hasElytra()) {
|
||||
Material m = i.getItemInOffHand().getType();
|
||||
return i.contains(Material.ARROW) || m.toString().endsWith("ARROW") || i.contains(Material.TIPPED_ARROW) || i.contains(Material.SPECTRAL_ARROW);
|
||||
}
|
||||
return i.contains(Material.ARROW);
|
||||
}
|
||||
|
||||
private void handleDiggingPacket(PacketEvent event)
|
||||
{
|
||||
if(event.getPacketType() != PacketType.Play.Client.BLOCK_DIG) return;
|
||||
|
||||
Player p = event.getPlayer();
|
||||
|
||||
if (p == null) {
|
||||
counters.add(ProtocolLibComponent.idNullPlayer, 1);
|
||||
return;
|
||||
}
|
||||
final IPlayerData pData = DataManager.getPlayerDataSafe(p);
|
||||
if (pData == null) {
|
||||
StaticLog.logWarning("Failed to fetch player data with " + event.getPacketType() + " for: " + p.toString());
|
||||
return;
|
||||
}
|
||||
final MovingData data = pData.getGenericInstance(MovingData.class);
|
||||
PlayerDigType digtype = event.getPacket().getPlayerDigTypes().read(0);
|
||||
data.isusingitem = false;
|
||||
|
||||
//Advanced check
|
||||
if(digtype == PlayerDigType.RELEASE_USE_ITEM) {
|
||||
long now = System.currentTimeMillis();
|
||||
if (data.time_rl_item != 0) {
|
||||
if (now < data.time_rl_item) {
|
||||
data.time_rl_item = now;
|
||||
data.isusingitem = false;
|
||||
return;
|
||||
}
|
||||
if (data.time_rl_item + timeBetweenRL > now) {
|
||||
data.isHackingRI = true;
|
||||
}
|
||||
}
|
||||
data.time_rl_item = now;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Minimum time between RELEASE_USE_ITEM packet is sent.
|
||||
* If time lower this value, A check will flag
|
||||
* Should be set from 51-100. Larger number, more protection more false-positive
|
||||
*
|
||||
* @param milliseconds
|
||||
*/
|
||||
public static void setuseRLThreshold(int time) {
|
||||
timeBetweenRL = time;
|
||||
}
|
||||
}
|
||||
+10
-1
@@ -27,6 +27,7 @@ import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.net.NetData;
|
||||
import fr.neatmonster.nocheatplus.checks.net.model.CountableLocation;
|
||||
import fr.neatmonster.nocheatplus.logging.StaticLog;
|
||||
import fr.neatmonster.nocheatplus.logging.Streams;
|
||||
import fr.neatmonster.nocheatplus.players.DataManager;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
@@ -58,7 +59,15 @@ public class OutgoingPosition extends BaseAdapter {
|
||||
}
|
||||
final long time = System.currentTimeMillis();
|
||||
final Player player = event.getPlayer();
|
||||
final IPlayerData pData = DataManager.getPlayerData(player);
|
||||
if (player == null) {
|
||||
counters.add(ProtocolLibComponent.idNullPlayer, 1);
|
||||
return;
|
||||
}
|
||||
final IPlayerData pData = DataManager.getPlayerDataSafe(player);
|
||||
if (pData == null) {
|
||||
StaticLog.logWarning("Failed to fetch player data with " + event.getPacketType() + " for: " + player.toString());
|
||||
return;
|
||||
}
|
||||
// TODO: In future multiple checks might use this (!)
|
||||
if (pData.isCheckActive(CheckType.NET_FLYINGFREQUENCY, player)) {
|
||||
interpretPacket(player, event.getPacket(), time,
|
||||
|
||||
+3
-1
@@ -132,7 +132,9 @@ public class ProtocolLibComponent implements IDisableListener, INotifyReload, Jo
|
||||
register("fr.neatmonster.nocheatplus.checks.net.protocollib.CatchAllAdapter", plugin);
|
||||
}
|
||||
}
|
||||
|
||||
if (ServerVersion.compareMinecraftVersion("1.8") >= 0) {
|
||||
register("fr.neatmonster.nocheatplus.checks.net.protocollib.NoSlow", plugin);
|
||||
}
|
||||
if (!registeredPacketAdapters.isEmpty()) {
|
||||
List<String> names = new ArrayList<String>(registeredPacketAdapters.size());
|
||||
for (PacketAdapter adapter : registeredPacketAdapters) {
|
||||
|
||||
+9
-3
@@ -15,9 +15,9 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.14.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -25,6 +25,12 @@
|
||||
<artifactId>ncpcommons</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<description>Core components and checks implementations. This contains about everything, just not the component/compat factories and not the plugin itself. NCPCore allows to add more modules/components that use check-specific classes to be added in the factories on NCPPlugin level.
|
||||
|
||||
@@ -72,6 +72,7 @@ public enum CheckType {
|
||||
|
||||
FIGHT(CheckTypeType.CHECK, CheckType.ALL, Permissions.FIGHT),
|
||||
FIGHT_ANGLE(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_ANGLE),
|
||||
FIGHT_CLICKPATTERN(CheckTypeType.CHECK, FIGHT),
|
||||
FIGHT_CRITICAL(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_CRITICAL),
|
||||
FIGHT_DIRECTION(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_DIRECTION),
|
||||
FIGHT_FASTHEAL(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_FASTHEAL),
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ public class BlockBreakListener extends CheckListener {
|
||||
|
||||
final Block block = event.getBlock();
|
||||
boolean cancelled = false;
|
||||
|
||||
if (block.getType().toString().equals("SCAFFOLDING")) return;
|
||||
// Do the actual checks, if still needed. It's a good idea to make computationally cheap checks first, because
|
||||
// it may save us from doing the computationally expensive checks.
|
||||
|
||||
|
||||
+5
@@ -186,6 +186,8 @@ public class BlockInteractListener extends CheckListener {
|
||||
if (block == null) {
|
||||
data.resetLastBlock();
|
||||
blockChecks = false;
|
||||
} else if (block.getType().toString().equals("SCAFFOLDING")) {
|
||||
blockChecks = false;
|
||||
}
|
||||
else {
|
||||
data.setLastBlock(block, action);
|
||||
@@ -205,6 +207,9 @@ public class BlockInteractListener extends CheckListener {
|
||||
if (stack != null && stack.getType() == Material.ENDER_PEARL) {
|
||||
checkEnderPearlRightClickBlock(player, block, face, event, previousLastTick, data, pData);
|
||||
}
|
||||
if (stack != null && stack.getType().toString().equals("SCAFFOLDING")) {
|
||||
blockChecks = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
data.setPlayerInteractEventResolution(event);
|
||||
|
||||
@@ -60,8 +60,17 @@ public class AutoSign extends Check {
|
||||
final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);
|
||||
final BlockPlaceConfig cc = pData.getGenericInstance(BlockPlaceConfig.class);
|
||||
Material mat = block.getType();
|
||||
if (mat == BridgeMaterial.SIGN || mat == Material.WALL_SIGN) {
|
||||
mat = Material.SIGN; // ITEM
|
||||
|
||||
String s = mat.toString();
|
||||
if (s.endsWith("_WALL_SIGN")) {
|
||||
s = s.replace("_WALL_SIGN", "_SIGN");
|
||||
mat = Material.getMaterial(s);
|
||||
} else if (s.endsWith("WALL_SIGN")) {
|
||||
s = s.replace("WALL_", "");
|
||||
mat = Material.getMaterial(s);
|
||||
}
|
||||
if (s.equals("SIGN_POST")) {
|
||||
mat = Material.getMaterial("SIGN");
|
||||
}
|
||||
if (data.autoSignPlacedHash != BlockPlaceListener.getBlockPlaceHash(block, mat)){
|
||||
tags.add("block_mismatch");
|
||||
|
||||
+10
-5
@@ -50,6 +50,7 @@ import fr.neatmonster.nocheatplus.checks.net.FlyingQueueHandle;
|
||||
import fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
|
||||
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
|
||||
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
|
||||
import fr.neatmonster.nocheatplus.components.data.ICheckData;
|
||||
import fr.neatmonster.nocheatplus.components.data.IData;
|
||||
@@ -212,16 +213,18 @@ public class BlockPlaceListener extends CheckListener {
|
||||
}
|
||||
shouldSkipSome = false;
|
||||
}
|
||||
} else if (placedMat.toString().equals("SCAFFOLDING")) {
|
||||
shouldSkipSome = true;
|
||||
}
|
||||
else {
|
||||
shouldSkipSome = false;
|
||||
}
|
||||
|
||||
if (placedMat == Material.SIGN) {
|
||||
if (placedMat.toString().endsWith("SIGN")) {
|
||||
// Might move to MONITOR priority.
|
||||
data.autoSignPlacedTime = System.currentTimeMillis();
|
||||
// Always hash as sign post for improved compatibility with Lockette etc.
|
||||
data.autoSignPlacedHash = getBlockPlaceHash(block, Material.SIGN);
|
||||
data.autoSignPlacedHash = getBlockPlaceHash(block, placedMat);
|
||||
}
|
||||
|
||||
// Don't run checks, if a set back is scheduled.
|
||||
@@ -410,13 +413,15 @@ public class BlockPlaceListener extends CheckListener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void placeBlock(PlayerInteractEvent event) {
|
||||
if (ServerVersion.compareMinecraftVersion("1.8") < 0) return;
|
||||
if (!Scaffold.isEnabled(event.getPlayer())) return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Block targetBlock = player.getTargetBlock((Set<Material>) null, 7);
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK || !event.isBlockInHand() || player.isFlying() && player.getAllowFlight() || targetBlock.isLiquid() || player.isSneaking()) return;
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK || !event.isBlockInHand() || player.isFlying() && player.getAllowFlight() || player.isSneaking()) return;
|
||||
Block targetBlock = player.getTargetBlock((Set<Material>) null, 7);
|
||||
if (targetBlock.isLiquid()) return;
|
||||
|
||||
List<Block> lastTarget = player.getLastTwoTargetBlocks((Set<Material>) null, 7);
|
||||
BlockFace blockFace = event.getBlockFace();
|
||||
|
||||
|
||||
@@ -15,17 +15,22 @@
|
||||
package fr.neatmonster.nocheatplus.checks.fight;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.actions.ParameterName;
|
||||
import fr.neatmonster.nocheatplus.checks.Check;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.ViolationData;
|
||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.players.PlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.StringUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.TrigUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -36,6 +41,8 @@ import org.bukkit.ChatColor;
|
||||
* Thanks @asofold for the original idea!
|
||||
*/
|
||||
public class Angle extends Check {
|
||||
|
||||
private final List<String> tags = new LinkedList<String>();
|
||||
|
||||
public static class AttackLocation {
|
||||
public final double x, y, z;
|
||||
@@ -100,6 +107,7 @@ public class Angle extends Check {
|
||||
}
|
||||
|
||||
boolean cancel = false;
|
||||
tags.clear();
|
||||
|
||||
// Quick check for expiration of all entries.
|
||||
final long time = System.currentTimeMillis();
|
||||
@@ -163,6 +171,7 @@ public class Angle extends Check {
|
||||
// If the average move is between 0 and 0.2 block(s), add it to the violation.
|
||||
if (averageMove >= 0.0 && averageMove < 0.2D) {
|
||||
violationone += 20.0 * (0.2 - averageMove) / 0.2;
|
||||
tags.add("Average_move");
|
||||
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
|
||||
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgMove: " + averageMove + " avgMove VL: " + violationone + "/" + cc.angleMove);
|
||||
}
|
||||
@@ -171,6 +180,7 @@ public class Angle extends Check {
|
||||
// If the average time elapsed is between 0 and 150 millisecond(s), add it to the violation.
|
||||
if (averageTime >= 0.0 && averageTime < 150.0) {
|
||||
violationtwo += 30.0 * (150.0 - averageTime) / 150.0;
|
||||
tags.add("Average_time");
|
||||
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
|
||||
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgTime: " + averageTime + " avgTime VL: " + violationtwo + "/" + cc.angleTime);
|
||||
}
|
||||
@@ -179,6 +189,7 @@ public class Angle extends Check {
|
||||
// If the average difference of yaw is superior to 50 degrees, add it to the violation.
|
||||
if (averageYaw > 50.0) {
|
||||
violationthree += 30.0 * averageYaw / 180.0;
|
||||
tags.add("Average_yaw");
|
||||
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
|
||||
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgYaw: " + averageYaw + " avgYaw VL: " + violationthree + "/" + cc.angleYaw);
|
||||
}
|
||||
@@ -186,6 +197,7 @@ public class Angle extends Check {
|
||||
|
||||
if (averageSwitching > 0.0) {
|
||||
violationfour += 20.0 * averageSwitching;
|
||||
tags.add("SwitchSpeed");
|
||||
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
|
||||
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgSwitch: " + averageSwitching + " avgSwitch VL: " + violationfour + "/" + cc.angleSwitch);
|
||||
}
|
||||
@@ -193,60 +205,61 @@ public class Angle extends Check {
|
||||
|
||||
// Is the violation is superior to the threshold defined in the configuration?
|
||||
if (violationone > cc.angleMove) {
|
||||
// Has the server lagged?
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
// TODO: 1.5 is a fantasy value.
|
||||
// If it hasn't, increment the violation level.
|
||||
violation = violationone;
|
||||
data.angleVL += violation;
|
||||
}
|
||||
|
||||
// Execute whatever actions are associated with this check and the violation level and find out if we should
|
||||
// cancel the event.
|
||||
cancel = executeActions(player, data.angleVL, violation, cc.angleActions).willCancel();
|
||||
} else if (violationtwo > cc.angleTime) {
|
||||
// Has the server lagged?
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
// If it hasn't, increment the violation level
|
||||
violation = violationone;
|
||||
data.angleVL += violation;
|
||||
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
|
||||
if (vd.needsParameters()){
|
||||
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
}
|
||||
return executeActions(vd).willCancel();
|
||||
}
|
||||
}
|
||||
else if (violationtwo > cc.angleTime) {
|
||||
// Has the server lagged?
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
// If it hasn't, increment the violation level
|
||||
violation = violationtwo;
|
||||
data.angleVL += violation;
|
||||
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
|
||||
if (vd.needsParameters()){
|
||||
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
}
|
||||
return executeActions(vd).willCancel();
|
||||
}
|
||||
}
|
||||
else if (violationthree > cc.angleYaw) {
|
||||
// Has the server lagged?
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
// TODO: 1.5 is a fantasy value.
|
||||
// If it hasn't, increment the violation level.
|
||||
violation = violationtwo;
|
||||
data.angleVL += violation;
|
||||
}
|
||||
|
||||
// Execute whatever actions are associated with this check and the violation level and find out if we should
|
||||
// cancel the event.
|
||||
cancel = executeActions(player, data.angleVL, violation, cc.angleActions).willCancel();
|
||||
} else if (violationthree > cc.angleYaw) {
|
||||
// Has the server lagged?
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
// TODO: 1.5 is a fantasy value.
|
||||
// If it hasn't, increment the violation level.
|
||||
violation = violationthree;
|
||||
data.angleVL += violation;
|
||||
}
|
||||
|
||||
// Execute whatever actions are associated with this check and the violation level and find out if we should
|
||||
// cancel the event.
|
||||
cancel = executeActions(player, data.angleVL, violation, cc.angleActions).willCancel();
|
||||
|
||||
} else if (violationfour > cc.angleSwitch) {
|
||||
// Has the server lagged?
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
// TODO: 1.5 is a fantasy value.
|
||||
// If it hasn't, increment the violation level.
|
||||
violation = violationfour;
|
||||
data.angleVL += violation;
|
||||
}
|
||||
|
||||
// Execute whatever actions are associated with this check and the violation level and find out if we should
|
||||
// cancel the event.
|
||||
cancel = executeActions(player, data.angleVL, violation, cc.angleActions).willCancel();
|
||||
|
||||
} else {
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
// If it hasn't, increment the violation level
|
||||
violation = violationthree;
|
||||
data.angleVL += violation;
|
||||
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
|
||||
if (vd.needsParameters()){
|
||||
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
}
|
||||
return executeActions(vd).willCancel();
|
||||
}
|
||||
}
|
||||
else if (violationfour > cc.angleSwitch) {
|
||||
// Has the server lagged?
|
||||
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
|
||||
// If it hasn't, increment the violation level
|
||||
violation = violationfour;
|
||||
data.angleVL += violation;
|
||||
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
|
||||
if (vd.needsParameters()){
|
||||
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
}
|
||||
return executeActions(vd).willCancel();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Reward the player by lowering their violation level.
|
||||
data.angleVL *= 0.98D;
|
||||
}
|
||||
|
||||
return cancel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package fr.neatmonster.nocheatplus.checks.fight;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
// import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.neatmonster.nocheatplus.checks.Check;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||
// import net.minecraft.server.v1_13_R2.EntityPlayer;
|
||||
|
||||
public class ClickPattern extends Check {
|
||||
|
||||
/**
|
||||
* Instantiates a new click pattern check.
|
||||
*/
|
||||
public ClickPattern() {
|
||||
super(CheckType.FIGHT_CLICKPATTERN);
|
||||
}
|
||||
|
||||
/*public int getPing(Player p) {
|
||||
CraftPlayer cp = (CraftPlayer) p; EntityPlayer ep = cp.getHandle(); return ep.ping;
|
||||
} */
|
||||
|
||||
HashMap<String, Long> clickData = new HashMap<String, Long>();
|
||||
|
||||
// Resets the click times to check for another click difference
|
||||
private void resetClickTime(HashMap<String, Long> clickData) {
|
||||
clickData.put("thisAttackTime", 0L);
|
||||
clickData.put("lastAttackTime", 0L);
|
||||
}
|
||||
|
||||
// Resets all the attack times once the check has been finished
|
||||
private void resetAllTimes(HashMap<String, Long> clickData) {
|
||||
clickData.put("thisAttackTime", 0L);
|
||||
clickData.put("lastAttackTime", 0L);
|
||||
clickData.put("thisClickDifference", 0L);
|
||||
clickData.put("lastClickDifference", 0L);
|
||||
}
|
||||
|
||||
/*
|
||||
* This check compares the players time between each click, and attempts to find a pattern,
|
||||
* Right now, this is bare-bone version, and more testing/fixing needs to be done to improve it.
|
||||
* This can detect AutoClickers or KillAuras that do not allow aps ranges.
|
||||
*
|
||||
*/
|
||||
public boolean check(final Player player, final FightData data, final IPlayerData pData, final FightConfig cc) {
|
||||
|
||||
boolean cancel = false;
|
||||
final long now = System.currentTimeMillis();
|
||||
|
||||
// Adds the HashMap if it has not already been added
|
||||
if (clickData.isEmpty()) {
|
||||
clickData.putIfAbsent("lastAttackTime", 0L);
|
||||
clickData.putIfAbsent("thisAttackTime", 0L);
|
||||
clickData.putIfAbsent("lastClickDifference", 0L);
|
||||
clickData.putIfAbsent("thisClickDifference", 0L);
|
||||
}
|
||||
|
||||
// Skip the player if they are lagging
|
||||
if (TickTask.getLag(1000, true) > 1.3f) return false;
|
||||
|
||||
// Setting the attack times
|
||||
else if (clickData.get("lastAttackTime").equals(0L)) {
|
||||
clickData.put("lastAttackTime", now);
|
||||
}
|
||||
else if (clickData.get("thisAttackTime").equals(0L)) {
|
||||
clickData.put("thisAttackTime", now);
|
||||
}
|
||||
|
||||
// Calculating the difference
|
||||
if (!clickData.get("lastAttackTime").equals(0L) && !clickData.get("thisAttackTime").equals(0L)) {
|
||||
if (clickData.get("lastClickDifference").equals(0L)) {
|
||||
clickData.put("lastClickDifference", Math.abs(clickData.get("thisAttackTime") - clickData.get("lastAttackTime")));
|
||||
resetClickTime(clickData);
|
||||
} else if (clickData.get("thisClickDifference").equals(0L)) {
|
||||
clickData.put("thisClickDifference", Math.abs(clickData.get("thisAttackTime") - clickData.get("lastAttackTime")));
|
||||
if (clickData.get("thisClickDifference") == clickData.get("lastClickDifference") || cc.clickRange > Math.max(clickData.get("thisClickDifference") - clickData.get("lastClickDifference"), clickData.get("lastClickDifference") - clickData.get("thisClickDifference"))) {
|
||||
cancel = executeActions(player, data.clickPatternVL, 1D, pData.getGenericInstance(FightConfig.class).clickActions).willCancel();
|
||||
data.clickPatternVL += 1D;
|
||||
} else {
|
||||
data.clickPatternVL *= 0.86D;
|
||||
}
|
||||
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
|
||||
player.sendMessage(ChatColor.RED + "NCP Debug: " + ChatColor.RESET + "ThisClick Difference: " + clickData.get("thisClickDifference") + " Last Click Differnce: " + clickData.get("lastClickDifference") + ChatColor.RED + " false");
|
||||
}
|
||||
resetAllTimes(clickData);
|
||||
}
|
||||
}
|
||||
if (cancel) {
|
||||
data.clicPatPenalty.applyPenalty(cc.clickPen);
|
||||
}
|
||||
return cancel;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to be touched up/fixed later, and the effectiveness of this check needs to be tested.
|
||||
* This part would get the average of their click difference and attempt to find a pattern there.
|
||||
* Could be useful to attempt to eliminate false positives with the click difference check.
|
||||
* Requires Java 8 to calculate the average, but a for method could be used to keep cross compatibility
|
||||
*
|
||||
* if (avgData.size() >= 8) {
|
||||
* player.sendMessage("Calculating avg:");
|
||||
* if (calcAvg(avgData) <= 25) {
|
||||
* player.sendMessage("Avg is " + ChatColor.GREEN + "true " + avgData);
|
||||
* } else {
|
||||
* player.sendMessage("Avg is " + ChatColor.RED + "false " + avgData);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* avgData.add(Math.max(clickData.get("thisClickDifference") - clickData.get("lastClickDifference"), clickData.get("lastClickDifference") - clickData.get("thisClickDifference")));
|
||||
*
|
||||
* private double calcAvg(ArrayList <Long> avgData) {
|
||||
* double avg = avgData.stream().mapToInt(Long::intValue).average().getAsDouble();
|
||||
* int size = avgData.size();
|
||||
* Bukkit.getLogger().info("[NoCheatPlus] avg: " + avg + " size " + size);
|
||||
*
|
||||
* return avg / size;
|
||||
* }
|
||||
*
|
||||
* ArrayList<Long> avgData = new ArrayList<Long>();
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,7 @@ import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
|
||||
|
||||
/**
|
||||
* Legacy check (client side health regeneration).
|
||||
@@ -35,6 +36,9 @@ public class FastHeal extends Check {
|
||||
}
|
||||
|
||||
public boolean check(final Player player, final IPlayerData pData){
|
||||
if (ServerVersion.compareMinecraftVersion("1.9") >= 0) {
|
||||
return false;
|
||||
}
|
||||
final long time = System.currentTimeMillis();
|
||||
|
||||
final FightConfig cc = pData.getGenericInstance(FightConfig.class);
|
||||
|
||||
@@ -37,6 +37,10 @@ public class FightConfig extends ACheckConfig {
|
||||
public final double angleSwitch;
|
||||
public final double angleTime;
|
||||
public final ActionList angleActions;
|
||||
|
||||
public final int clickRange;
|
||||
public long clickPen;
|
||||
public final ActionList clickActions;
|
||||
|
||||
public final long toolChangeAttackPenalty;
|
||||
|
||||
@@ -104,6 +108,10 @@ public class FightConfig extends ACheckConfig {
|
||||
angleYaw = config.getDouble(ConfPaths.FIGHT_ANGLE_THRESHOLD_YAW);
|
||||
angleTime = config.getDouble(ConfPaths.FIGHT_ANGLE_THRESHOLD_TIME);
|
||||
angleActions = config.getOptimizedActionList(ConfPaths.FIGHT_ANGLE_ACTIONS, Permissions.FIGHT_ANGLE);
|
||||
|
||||
clickRange = config.getInt(ConfPaths.FIGHT_CLICKPATTERN_RANGE);
|
||||
clickPen = config.getLong(ConfPaths.FIGHT_CLICKPATTERN_PENALTY);
|
||||
clickActions = config.getOptimizedActionList(ConfPaths.FIGHT_CLICKPATTERN_ACTIONS, Permissions.FIGHT_SPEED);
|
||||
|
||||
toolChangeAttackPenalty = config.getLong(ConfPaths.FIGHT_TOOLCHANGEPENALTY);
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
|
||||
|
||||
// Violation levels.
|
||||
public double angleVL;
|
||||
public double clickPatternVL;
|
||||
public double criticalVL;
|
||||
public double directionVL;
|
||||
public double fastHealVL;
|
||||
@@ -53,6 +54,7 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
|
||||
|
||||
/** Attack penalty (close combat, ENTITY_ATTACK). */
|
||||
public final PenaltyTime attackPenalty = new PenaltyTime();
|
||||
public final PenaltyTime clicPatPenalty = new PenaltyTime();
|
||||
|
||||
/** The entity id which might get counter-attacked. */
|
||||
public int thornsId = Integer.MIN_VALUE;
|
||||
@@ -94,7 +96,7 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
|
||||
|
||||
// Data of the no swing check.
|
||||
public boolean noSwingArmSwung = true; // TODO: First is free for now, 1.12.2, other?
|
||||
public boolean exemptArmSwing = true;
|
||||
public boolean exemptArmSwing = true;
|
||||
|
||||
// Data of the reach check.
|
||||
public double reachMod = 1.0;
|
||||
@@ -138,6 +140,8 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
|
||||
angleVL = 0;
|
||||
angleHits.clear();
|
||||
break;
|
||||
case FIGHT_CLICKPATTERN:
|
||||
clickPatternVL = 0;
|
||||
case FIGHT_SPEED:
|
||||
speedVL = 0;
|
||||
speedBuckets.clear(System.currentTimeMillis());
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.util.Iterator;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Parrot;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -91,6 +90,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
|
||||
/** The critical check. */
|
||||
private final Critical critical = addCheck(new Critical());
|
||||
|
||||
private final ClickPattern clickpat = addCheck(new ClickPattern());
|
||||
|
||||
/** The direction check. */
|
||||
private final Direction direction = addCheck(new Direction());
|
||||
@@ -324,6 +325,11 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
&& wrongTurn.check(player, loc, data, cc)) {
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
// ClickPatern check
|
||||
if (clickpat.check(player, data, pData, cc) && clickpat.isEnabled(player, pData)) {
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
// Run through the main checks.
|
||||
if (!cancelled && speed.isEnabled(player, pData)) {
|
||||
@@ -894,7 +900,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
|
||||
final Player player = e.getPlayer();
|
||||
final FightData data = DataManager.getGenericInstance(player, FightData.class);
|
||||
|
||||
if (entity instanceof Parrot) {
|
||||
if (entity != null && entity.getType().name().equals("PARROT")) {
|
||||
data.exemptArmSwing = true;
|
||||
} else {
|
||||
data.exemptArmSwing = false;
|
||||
|
||||
@@ -125,6 +125,10 @@ public class FastClick extends Check {
|
||||
amount = 1f;
|
||||
}
|
||||
|
||||
if (isShiftClick && inventoryAction.equals("MOVE_TO_OTHER_INVENTORY") && (cursorMat != null && cursorMat != Material.AIR) && clickedMat != Material.AIR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
data.fastClickFreq.add(now, amount);
|
||||
|
||||
float shortTerm = data.fastClickFreq.bucketScore(0);
|
||||
|
||||
+9
-11
@@ -167,7 +167,7 @@ public class InventoryListener extends CheckListener implements JoinLeaveListen
|
||||
}
|
||||
final InventoryConfig cc = pData.getGenericInstance(InventoryConfig.class);
|
||||
// Still check instantBow, whatever yawrate says.
|
||||
if (instantBow.check(player, event.getForce(), now)) {
|
||||
if (!event.getBow().getType().toString().equals("CROSSBOW") && instantBow.check(player, event.getForce(), now)) {
|
||||
// The check requested the event to be cancelled.
|
||||
event.setCancelled(true);
|
||||
}
|
||||
@@ -265,7 +265,7 @@ public class InventoryListener extends CheckListener implements JoinLeaveListen
|
||||
// Fast inventory manipulation check.
|
||||
if (fastClick.isEnabled(player, pData)) {
|
||||
final InventoryConfig cc = pData.getGenericInstance(InventoryConfig.class);
|
||||
if (player.getGameMode() != GameMode.CREATIVE || !cc.fastClickSpareCreative || !cc.inventoryExemptions.contains(ChatColor.stripColor(event.getInventory().getName()))) {
|
||||
if (!((event.getView().getType().equals(InventoryType.CREATIVE) || player.getGameMode() == GameMode.CREATIVE) && cc.fastClickSpareCreative) && !cc.inventoryExemptions.contains(ChatColor.stripColor(event.getView().getTitle()))) {
|
||||
if (fastClick.check(player, now,
|
||||
event.getView(), slot, cursor, clicked, event.isShiftClick(),
|
||||
inventoryAction, data, cc, pData)) {
|
||||
@@ -273,7 +273,7 @@ public class InventoryListener extends CheckListener implements JoinLeaveListen
|
||||
cancel = true;
|
||||
}
|
||||
// Listen for more than just a chest?
|
||||
if (event.getInventory().getType().equals(InventoryType.CHEST) || event.getInventory().getType().equals(InventoryType.ENDER_CHEST)) {
|
||||
if (event.getInventory().getType().equals(InventoryType.CHEST) || event.getInventory().getType().equals(InventoryType.ENDER_CHEST) || event.getInventory().getType().toString().equals("BARREL") || event.getInventory().getType().toString().equals("SHULKER_BOX")) {
|
||||
if (fastClick.fastClickChest(player, data, cc)) {
|
||||
cancel = true;
|
||||
keepCancel = true;
|
||||
@@ -321,7 +321,7 @@ public class InventoryListener extends CheckListener implements JoinLeaveListen
|
||||
|
||||
// Check left click too to prevent any bypasses
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock() != null || event.getAction() == Action.LEFT_CLICK_BLOCK && event.getClickedBlock() != null) {
|
||||
if (event.getClickedBlock().getType() == Material.CHEST || event.getClickedBlock().getType() == Material.ENDER_CHEST) {
|
||||
if (event.getClickedBlock().getType().toString().endsWith("CHEST") || event.getClickedBlock().getType().toString().equals("BARREL") || event.getClickedBlock().getType().toString().endsWith("SHULKER_BOX")) {
|
||||
data.chestOpenTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
@@ -361,10 +361,10 @@ public class InventoryListener extends CheckListener implements JoinLeaveListen
|
||||
builder.append(view.getClass().getName());
|
||||
|
||||
// Bottom inventory.
|
||||
addInventory(player, view.getBottomInventory(), " , Bottom: ", builder);
|
||||
addInventory(player, view.getBottomInventory(), view, " , Bottom: ", builder);
|
||||
|
||||
// Top inventory.
|
||||
addInventory(player, view.getBottomInventory(), " , Top: ", builder);
|
||||
addInventory(player, view.getBottomInventory(), view, " , Top: ", builder);
|
||||
|
||||
if (action != null) {
|
||||
builder.append(" , Action: ");
|
||||
@@ -379,17 +379,15 @@ public class InventoryListener extends CheckListener implements JoinLeaveListen
|
||||
debug(player, builder.toString());
|
||||
}
|
||||
|
||||
private void addInventory(final Player player, final Inventory inventory, final String prefix,
|
||||
private void addInventory(final Player player, final Inventory inventory, final InventoryView view, final String prefix,
|
||||
final StringBuilder builder) {
|
||||
builder.append(prefix);
|
||||
if (inventory == null) {
|
||||
builder.append("(none)");
|
||||
}
|
||||
else {
|
||||
final String name = inventory.getName();
|
||||
final String title = inventory.getTitle();
|
||||
final boolean same = name == null && title == null || name != null && name.equals(title);
|
||||
builder.append((same ? name : (name + "/" + title)));
|
||||
String name = view.getTitle();
|
||||
builder.append(name);
|
||||
builder.append("/");
|
||||
builder.append(inventory.getClass().getName());
|
||||
}
|
||||
|
||||
+79
-26
@@ -1,43 +1,96 @@
|
||||
package fr.neatmonster.nocheatplus.checks.inventory;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
import fr.neatmonster.nocheatplus.actions.ParameterName;
|
||||
import fr.neatmonster.nocheatplus.checks.Check;
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.ViolationData;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.StringUtil;
|
||||
|
||||
/**
|
||||
* A simple check to prevent players from interacting with their inventory if they shouldn't be allowed to.
|
||||
*/
|
||||
|
||||
public class InventoryMove extends Check {
|
||||
|
||||
private final List<String> tags = new LinkedList<String>();
|
||||
|
||||
public InventoryMove() {
|
||||
super(CheckType.INVENTORY_MOVE);
|
||||
}
|
||||
|
||||
public boolean check(final Player player, final InventoryData data, final IPlayerData pData, final InventoryConfig cc, final SlotType type) {
|
||||
public boolean check(final Player player, final InventoryData data, final IPlayerData pData, final InventoryConfig cc, final SlotType type) {
|
||||
|
||||
boolean cancel = false;
|
||||
if (player.isBlocking() || player.isSprinting() || player.isDead() || player.isSneaking() || player.isSwimming()) {
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
if (!cc.invMoveDisableCreative) {
|
||||
if (type == SlotType.QUICKBAR) {
|
||||
return false;
|
||||
} else {
|
||||
data.invMoveVL += 1D;
|
||||
cancel = executeActions(player, data.invMoveVL, 1D, pData.getGenericInstance(InventoryConfig.class).invMoveActionList).willCancel();
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
data.invMoveVL += 1D;
|
||||
cancel = executeActions(player, data.invMoveVL, 1D, pData.getGenericInstance(InventoryConfig.class).invMoveActionList).willCancel();
|
||||
}
|
||||
}
|
||||
return cancel;
|
||||
}
|
||||
|
||||
}
|
||||
boolean cancel = false;
|
||||
|
||||
// Tags
|
||||
if (player.isBlocking()) {
|
||||
tags.add("isBlocking");
|
||||
}
|
||||
else if (player.isSneaking()) {
|
||||
tags.add("isSneaking");
|
||||
}
|
||||
else if (Bridge1_13.isSwimming(player)) {
|
||||
tags.add("isSwimming");
|
||||
}
|
||||
else if (player.isSprinting()) {
|
||||
tags.add("isSprinting");
|
||||
}
|
||||
else if (player.isDead()) {
|
||||
tags.add("isDead");
|
||||
}
|
||||
|
||||
// Do the actual check
|
||||
if (player.isSneaking() || player.isSprinting() || Bridge1_13.isSwimming(player) || player.isBlocking() || player.isDead()) {
|
||||
// Check if the player is in creative
|
||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||
// (Skip hotbar interactions)
|
||||
if (type == SlotType.QUICKBAR) {
|
||||
// Prevent tag addition/spam
|
||||
tags.clear();
|
||||
return false;
|
||||
}
|
||||
// Check if the Disable_Creative option is not enabled
|
||||
else if (!cc.invMoveDisableCreative) {
|
||||
// Violation
|
||||
data.invMoveVL += 1.0D;
|
||||
final ViolationData vd = new ViolationData(this, player, data.invMoveVL, 1, pData.getGenericInstance(InventoryConfig.class).invMoveActionList);
|
||||
if (vd.needsParameters()){
|
||||
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
}
|
||||
// Clear tags
|
||||
tags.clear();
|
||||
return executeActions(vd).willCancel();
|
||||
}
|
||||
// Disable_Creative is enabled, skip
|
||||
else {
|
||||
// Prevent tag addition/spam
|
||||
tags.clear();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Player is not in creative
|
||||
else {
|
||||
// Violation
|
||||
data.invMoveVL += 1.0D;
|
||||
final ViolationData vd = new ViolationData(this, player, data.invMoveVL, 1, pData.getGenericInstance(InventoryConfig.class).invMoveActionList);
|
||||
if (vd.needsParameters()){
|
||||
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
|
||||
}
|
||||
// Clear tags
|
||||
tags.clear();
|
||||
return executeActions(vd).willCancel();
|
||||
}
|
||||
}
|
||||
return cancel;
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import fr.neatmonster.nocheatplus.checks.moving.player.PlayerSetBackMethod;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
|
||||
import fr.neatmonster.nocheatplus.command.CommandUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.compat.versions.Bugs;
|
||||
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
|
||||
@@ -56,6 +57,7 @@ public class MovingConfig extends ACheckConfig {
|
||||
// Model flying ids.
|
||||
public static final String ID_JETPACK_ELYTRA = "jetpack.elytra";
|
||||
public static final String ID_POTION_LEVITATION = "potion.levitation";
|
||||
public static final String ID_POTION_SLOWFALLING = "potion.slowfalling";
|
||||
|
||||
// INSTANCE
|
||||
|
||||
@@ -65,6 +67,7 @@ public class MovingConfig extends ACheckConfig {
|
||||
private final Map<GameMode, ModelFlying> flyingModelGameMode = new HashMap<GameMode, ModelFlying>();
|
||||
private final ModelFlying flyingModelElytra;
|
||||
private final ModelFlying flyingModelLevitation;
|
||||
private final ModelFlying flyingModelSlowfalling;
|
||||
public final ActionList creativeFlyActions;
|
||||
|
||||
/** Assumed number of packets per second under ideal conditions. */
|
||||
@@ -209,6 +212,9 @@ public class MovingConfig extends ACheckConfig {
|
||||
flyingModelLevitation = new ModelFlying(ID_POTION_LEVITATION, config,
|
||||
ConfPaths.MOVING_CREATIVEFLY_MODEL + "levitation.",
|
||||
new ModelFlying(null, defaultModel).scaleLevitationEffect(true).lock());
|
||||
flyingModelSlowfalling = new ModelFlying(ID_POTION_SLOWFALLING, config,
|
||||
ConfPaths.MOVING_CREATIVEFLY_MODEL + "slowfalling.",
|
||||
new ModelFlying(null, defaultModel).scaleSlowfallingEffect(true).lock());
|
||||
flyingModelElytra = new ModelFlying(ID_JETPACK_ELYTRA, config,
|
||||
ConfPaths.MOVING_CREATIVEFLY_MODEL + "elytra.",
|
||||
new ModelFlying(null, defaultModel).verticalAscendGliding(true).lock());
|
||||
@@ -390,6 +396,10 @@ public class MovingConfig extends ACheckConfig {
|
||||
&& !fromLocation.isInLiquid()) {
|
||||
return flyingModelLevitation;
|
||||
}
|
||||
// Slow Falling
|
||||
if (gameMode != GameMode.CREATIVE && !Double.isInfinite(Bridge1_13.getSlowfallingAmplifier(player))) {
|
||||
return flyingModelSlowfalling;
|
||||
}
|
||||
// Default by game mode.
|
||||
return modelGameMode;
|
||||
}
|
||||
|
||||
+1385
-1373
File diff suppressed because it is too large.
Load diff
+2955
-2859
File diff suppressed because it is too large.
Load diff
@@ -48,21 +48,27 @@ public class Magic {
|
||||
public static final double WALK_SPEED = 0.221D;
|
||||
public static final double modSneak = 0.13D / WALK_SPEED;
|
||||
// public static final double modSprint = 0.29 / walkSpeed; // TODO: without bunny 0.29 / practical is 0.35
|
||||
public static final double modBlock = 0.16D / WALK_SPEED;
|
||||
public static final double modSwim = 0.3D / WALK_SPEED; // 0.152D / WALK_SPEED
|
||||
public static final double modRiptide = 10.0D;
|
||||
public static final double modDolphinsGrace = 5.0D; // TODO: Adjust value to be more stricter and closer to actual movement speed, and use different value from in water vs above water
|
||||
public static final double modBlock = 0.1277D / WALK_SPEED;
|
||||
public static final double[] modSwim = new double[] {0.155D / WALK_SPEED, 0.3D / WALK_SPEED, 0.115D / WALK_SPEED}; // 0.155D / WALK_SPEED(1.13 above); 0.115D / WALK_SPEED(1.12.2 below)
|
||||
public static final double[] modRiptide = new double[] {
|
||||
1.0,
|
||||
4.8, //4.6 ?
|
||||
7.2, //7.0 ?
|
||||
10.0
|
||||
};
|
||||
public static final double modDolphinsGrace = 3.6D; // TODO: Adjust value to be more stricter and closer to actual movement speed, and use different value from in water vs above water
|
||||
public static final double[] modDepthStrider = new double[] {
|
||||
1.0,
|
||||
0.1645 / modSwim / WALK_SPEED,
|
||||
0.1995 / modSwim / WALK_SPEED,
|
||||
1.0 / modSwim, // Results in walkspeed.
|
||||
0.1645 / modSwim[0] / WALK_SPEED,
|
||||
0.1995 / modSwim[0] / WALK_SPEED,
|
||||
1.0 / modSwim[0], // Results in walkspeed.
|
||||
};
|
||||
public static final double modWeb = 0.105D / WALK_SPEED; // TODO: walkingSpeed * 0.15D; <- does not work
|
||||
public static final double modSoulSand = 0.16D / WALK_SPEED;
|
||||
public static final double modIce = 2.5D; //
|
||||
/** Faster moving down stream (water mainly). */
|
||||
public static final double modDownStream = 0.19 / (WALK_SPEED * modSwim);
|
||||
public static final double modDownStream = 0.19 / (WALK_SPEED * modSwim[0]);
|
||||
public static final double modDownStream2 = 0.19 / (WALK_SPEED * modSwim[1]);
|
||||
|
||||
/**
|
||||
* Somewhat arbitrary horizontal speed gain maximum for advance glide phase.
|
||||
@@ -125,9 +131,9 @@ public class Magic {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static double swimBaseSpeedV() {
|
||||
public static double swimBaseSpeedV(boolean isSwimming) {
|
||||
// TODO: Does this have to be the dynamic walk speed (refactoring)?
|
||||
return WALK_SPEED * modSwim + 0.1; // 0.244
|
||||
return isSwimming ? WALK_SPEED * modSwim[1] + 0.1 : WALK_SPEED * modSwim[0] + 0.1; // 0.244
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,7 @@ import fr.neatmonster.nocheatplus.checks.moving.MovingData;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.model.LiftOffEnvelope;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
|
||||
import fr.neatmonster.nocheatplus.checks.workaround.WRPT;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.PlayerLocation;
|
||||
|
||||
public class MagicAir {
|
||||
@@ -273,7 +274,7 @@ public class MagicAir {
|
||||
&& yDistance - lastMove.yDistance < 0.0114
|
||||
// 1: Any leaving liquid and keeping distance once.
|
||||
|| data.sfJumpPhase == 1
|
||||
&& Math.abs(yDistance) <= Magic.swimBaseSpeedV() && yDistance == lastMove.yDistance
|
||||
&& Math.abs(yDistance) <= Magic.swimBaseSpeedV(Bridge1_13.isSwimming(from.getPlayer())) && yDistance == lastMove.yDistance
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -62,6 +62,12 @@ public class ModelFlying {
|
||||
* level.
|
||||
*/
|
||||
private boolean scaleLevitationEffect = false;
|
||||
|
||||
/**
|
||||
* Allow an extra amount to ascend speed, scaling with the slowfalling effect
|
||||
* level.
|
||||
*/
|
||||
private boolean scaleSlowfallingEffect = false;
|
||||
|
||||
// TODO: vertical ascend/descend, limit gain a/d/v, limit abs. distance a/d/v
|
||||
// TODO: possibly other friction based envelope constraints.
|
||||
@@ -104,6 +110,7 @@ public class ModelFlying {
|
||||
gravity(config.getBoolean(prefix + ConfPaths.SUB_VERTICAL_GRAVITY, defaults.getGravity()));
|
||||
ground(config.getBoolean(prefix + ConfPaths.SUB_GROUND, defaults.getGround()));
|
||||
scaleLevitationEffect(defaults.getScaleLevitationEffect()); // Config?
|
||||
scaleSlowfallingEffect(defaults.getScaleSlowfallingEffect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,6 +131,7 @@ public class ModelFlying {
|
||||
gravity(defaults.getGravity());
|
||||
ground(defaults.getGround());
|
||||
scaleLevitationEffect(defaults.getScaleLevitationEffect());
|
||||
scaleSlowfallingEffect(defaults.getScaleSlowfallingEffect());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,6 +199,10 @@ public class ModelFlying {
|
||||
public boolean getScaleLevitationEffect() {
|
||||
return scaleLevitationEffect;
|
||||
}
|
||||
|
||||
public boolean getScaleSlowfallingEffect() {
|
||||
return scaleSlowfallingEffect;
|
||||
}
|
||||
|
||||
public ModelFlying horizontalModSpeed(double horizontalModSpeed) {
|
||||
checkLocked();
|
||||
@@ -246,4 +258,9 @@ public class ModelFlying {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModelFlying scaleSlowfallingEffect(final boolean scaleSlowfallingEffect) {
|
||||
checkLocked();
|
||||
this.scaleSlowfallingEffect = scaleSlowfallingEffect;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
+45
-1
@@ -22,6 +22,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||
import fr.neatmonster.nocheatplus.actions.ParameterName;
|
||||
@@ -36,13 +37,18 @@ import fr.neatmonster.nocheatplus.checks.moving.model.LiftOffEnvelope;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.model.ModelFlying;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.changetracker.BlockChangeTracker;
|
||||
import fr.neatmonster.nocheatplus.components.modifier.IAttributeAccess;
|
||||
import fr.neatmonster.nocheatplus.components.registry.event.IGenericInstanceHandle;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.PotionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.StringUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.PlayerLocation;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.TrigUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
|
||||
/**
|
||||
* A check designed for people that are allowed to fly. The complement to the "SurvivalFly", which is for people that
|
||||
@@ -52,6 +58,7 @@ public class CreativeFly extends Check {
|
||||
|
||||
private final List<String> tags = new LinkedList<String>();
|
||||
private final BlockChangeTracker blockChangeTracker;
|
||||
private IGenericInstanceHandle<IAttributeAccess> attributeAccess = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstanceHandle(IAttributeAccess.class);
|
||||
|
||||
/**
|
||||
* Instantiates a new creative fly check.
|
||||
@@ -153,6 +160,14 @@ public class CreativeFly extends Check {
|
||||
}
|
||||
|
||||
resultH *= 100.0; // Normalize to % of a block.
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
// Sometimes resultH can be up to 18
|
||||
if (Bridge1_9.isGliding(player) && (Bridge1_13.isRiptiding(player) || data.timeRiptiding + 4000 > now) && resultH<14.0) {
|
||||
resultH = 0.0;
|
||||
}
|
||||
|
||||
if (resultH > 0.0) {
|
||||
tags.add("hdist");
|
||||
}
|
||||
@@ -195,9 +210,22 @@ public class CreativeFly extends Check {
|
||||
}
|
||||
|
||||
resultV *= 100.0; // Normalize to % of a block.
|
||||
// Sometimes resultV can be up to 78
|
||||
if (Bridge1_9.isGliding(player) && (Bridge1_13.isRiptiding(player) || data.timeRiptiding + 4000 > now) && resultV<60.0) {
|
||||
resultV = 0.0;
|
||||
}
|
||||
if (resultV > 0.0) {
|
||||
tags.add("vdist");
|
||||
}
|
||||
|
||||
if (!player.isFlying() && !Double.isInfinite(Bridge1_9.getLevitationAmplifier(player))
|
||||
&& !from.isHeadObstructed() && !to.isHeadObstructed()
|
||||
//Exempt check for 20 seconds after joined
|
||||
&& !(now > pData.getLastJoinTime() && pData.getLastJoinTime() + 20000 > now)
|
||||
&& !from.isInLiquid() && !BlockProperties.isNewLiq(from.getTypeId()) && from.getY() >= to.getY()) {
|
||||
resultV = Math.max(resultV,1.0);
|
||||
tags.add("antilevitate");
|
||||
}
|
||||
|
||||
final double result = Math.max(0.0, resultH) + Math.max(0.0, resultV);
|
||||
|
||||
@@ -312,15 +340,28 @@ public class CreativeFly extends Check {
|
||||
}
|
||||
else {
|
||||
// (Ignore sprinting here).
|
||||
final double attrMod = attributeAccess.getHandle().getSpeedAttributeMultiplier(player);
|
||||
if (attrMod != Double.MAX_VALUE) fSpeed *= attrMod;
|
||||
fSpeed *= data.walkSpeed / Magic.DEFAULT_WALKSPEED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
fSpeed = 1.0;
|
||||
}
|
||||
|
||||
|
||||
double limitH = model.getHorizontalModSpeed() / 100.0 * ModelFlying.HORIZONTAL_SPEED * fSpeed;
|
||||
|
||||
if (from.isInWater() || to.isInWater() || BlockProperties.isNewLiq(from.getTypeId()) || BlockProperties.isNewLiq(to.getTypeId())) {
|
||||
if (!Double.isInfinite(Bridge1_13.getDolphinGraceAmplifier(player))) {
|
||||
limitH *= Magic.modDolphinsGrace;
|
||||
}
|
||||
}
|
||||
|
||||
if (model.getScaleSlowfallingEffect() && Bridge1_13.hasSlowfalling()) {
|
||||
Double Amplifier = PotionUtil.getPotionEffectAmplifier(from.getPlayer(), PotionEffectType.SPEED);
|
||||
limitH = Double.isInfinite(Amplifier) ? limitH : limitH + 0.1*(Amplifier +1);
|
||||
}
|
||||
|
||||
if (lastMove.toIsValid) {
|
||||
// TODO: Use last friction (as well)?
|
||||
// TODO: Test/adjust more.
|
||||
@@ -379,6 +420,9 @@ public class CreativeFly extends Check {
|
||||
limitV += 0.046 * levitation; // (It ends up like 0.5 added extra for some levels of levitation, roughly.)
|
||||
tags.add("levitation:" + levitation);
|
||||
}
|
||||
} else if (model.getScaleSlowfallingEffect() && Bridge1_13.hasSlowfalling()) {
|
||||
Double Amplifier = PotionUtil.getPotionEffectAmplifier(from.getPlayer(), PotionEffectType.JUMP);
|
||||
limitV += Double.isInfinite(Amplifier) ? 0.5 : 0.5 + 0.1*(Amplifier +1);
|
||||
}
|
||||
|
||||
// Related to elytra.
|
||||
|
||||
@@ -27,6 +27,8 @@ import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.checks.ViolationData;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.changetracker.BlockChangeTracker;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.collision.Axis;
|
||||
@@ -164,7 +166,8 @@ public class Passable extends Check {
|
||||
rayTracing.loop();
|
||||
rayTracing.setIgnoreInitiallyColliding(false);
|
||||
//rayTracing.setCutOppositeDirectionMargin(false);
|
||||
if (rayTracing.collides() && !player.isSwimming() && !player.isGliding()) {
|
||||
//getEyeHeight() is a way to check isSwimming but not in water
|
||||
if (rayTracing.collides() && !Bridge1_13.isSwimming(player) && !Bridge1_9.isGliding(player) && !(player.getEyeHeight()<0.45)) {
|
||||
tags = "raytracing_collide_";
|
||||
}
|
||||
else if (rayTracing.getStepsDone() >= rayTracing.getMaxSteps()) {
|
||||
|
||||
+231
-65
@@ -19,11 +19,17 @@ import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Levelled;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
|
||||
import fr.neatmonster.nocheatplus.NCPAPIProvider;
|
||||
import fr.neatmonster.nocheatplus.actions.ParameterName;
|
||||
@@ -43,6 +49,7 @@ import fr.neatmonster.nocheatplus.checks.moving.util.AuxMoving;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.velocity.VelocityFlags;
|
||||
import fr.neatmonster.nocheatplus.checks.workaround.WRPT;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeEnchant;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
|
||||
@@ -54,6 +61,7 @@ import fr.neatmonster.nocheatplus.logging.Streams;
|
||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.CheckUtils;
|
||||
import fr.neatmonster.nocheatplus.utilities.PotionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.StringUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.ds.count.ActionAccumulator;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.PlayerLocation;
|
||||
@@ -313,7 +321,7 @@ public class SurvivalFly extends Check {
|
||||
data.bunnyhopDelay--; // TODO: Design to do the changing at the bottom? [if change: check limits in bunnyHop(...)]
|
||||
|
||||
// Set flag for swimming with the flowing direction of liquid.
|
||||
thisMove.downStream = hDistance > thisMove.walkSpeed * Magic.modSwim && thisMove.from.inLiquid && from.isDownStream(xDistance, zDistance);
|
||||
thisMove.downStream = hDistance > (Bridge1_13.isSwimming(player) ? thisMove.walkSpeed * Magic.modSwim[1] : thisMove.walkSpeed * Magic.modSwim[0]) && thisMove.from.inLiquid && from.isDownStream(xDistance, zDistance);
|
||||
|
||||
// Handle ice.
|
||||
// TODO: Re-model ice stuff and other (e.g. general thing: ground-modifier + reset conditions).
|
||||
@@ -335,12 +343,16 @@ public class SurvivalFly extends Check {
|
||||
// TODO: Remove these local variables ?
|
||||
double hAllowedDistance = 0.0, hDistanceAboveLimit = 0.0, hFreedom = 0.0;
|
||||
if (hasHdist) {
|
||||
final double attrMod = attributeAccess.getHandle().getSpeedAttributeMultiplier(player);
|
||||
// Check allowed vs. taken horizontal distance.
|
||||
// Get the allowed distance.
|
||||
hAllowedDistance = setAllowedhDist(player, sprinting, thisMove, data, cc, pData, from, false);
|
||||
// Judge if horizontal speed is above limit.
|
||||
hDistanceAboveLimit = hDistance - hAllowedDistance;
|
||||
|
||||
if ((Bridge1_13.isRiptiding(player) || data.timeRiptiding + 4000 > now) && hDistanceAboveLimit < 3.0) {
|
||||
hDistanceAboveLimit =0;
|
||||
}
|
||||
// Velocity, buffers and after failure checks.
|
||||
if (hDistanceAboveLimit > 0) {
|
||||
// TODO: Move more of the workarounds (buffer, bunny, ...) into this method.
|
||||
@@ -405,7 +417,7 @@ public class SurvivalFly extends Check {
|
||||
if (hDistanceAboveLimit <= 0D && hDistance > 0.1D && yDistance == 0D && !toOnGround && !fromOnGround
|
||||
&& lastMove.toIsValid && lastMove.yDistance == 0D
|
||||
&& BlockProperties.isLiquid(to.getTypeId()) && BlockProperties.isLiquid(from.getTypeId())
|
||||
&& !from.isHeadObstructed() && !to.isHeadObstructed() && !player.isSwimming() // TODO: Might decrease margin here.
|
||||
&& !from.isHeadObstructed() && !to.isHeadObstructed() && !Bridge1_13.isSwimming(player) // TODO: Might decrease margin here.
|
||||
) {
|
||||
// TODO: Relative hdistance.
|
||||
// TODO: Might check actual bounds (collidesBlock). Might implement + use BlockProperties.getCorrectedBounds or getSomeHeight.
|
||||
@@ -414,34 +426,74 @@ public class SurvivalFly extends Check {
|
||||
}
|
||||
|
||||
// Detects walking directly above water
|
||||
Material blockUnder = player.getLocation().subtract(0, 0.12, 0).getBlock().getType();
|
||||
Material blockAbove = player.getLocation().add(0, 0.10, 0).getBlock().getType();
|
||||
if (blockUnder != null && blockAbove != null) {
|
||||
// Checks if the player is above water but not in water.
|
||||
if (blockUnder == Material.WATER && blockAbove == Material.AIR) {
|
||||
// hDist and vDist checks, simply checks for horizontal movement with little y distance
|
||||
if (hDistanceAboveLimit <= 0D && hDistance > 0.11D && yDistance <= 0.1D && !toOnGround && !fromOnGround
|
||||
&& lastMove.toIsValid && lastMove.yDistance == yDistance || lastMove.yDistance == yDistance * -1 && lastMove.yDistance != 0D
|
||||
&& !from.isHeadObstructed() && !to.isHeadObstructed() && !player.isSwimming()) {
|
||||
// Prevent being flagged if a player transitions from a block to water and the player falls into the water.
|
||||
if (!(yDistance < 0 && yDistance != 0 && lastMove.yDistance < 0 && lastMove.yDistance != 0)) {
|
||||
hDistanceAboveLimit = Math.max(hDistanceAboveLimit, hDistance);
|
||||
tags.add("watermove");
|
||||
}
|
||||
}
|
||||
Block blockUnder = player.getLocation().subtract(0, 0.3, 0).getBlock();
|
||||
Material blockAbove = player.getLocation().add(0, 0.10, 0).getBlock().getType();
|
||||
if (blockUnder != null && blockAbove != null && blockUnder.getType().toString().endsWith("WATER")) {
|
||||
// Checks if the player is above water but not in water.
|
||||
// Much more effective than hspeed check
|
||||
if (!(data.timeRiptiding + 2500 > now) && from.isInLiquid() && Double.isInfinite(Bridge1_13.getDolphinGraceAmplifier(player))) {
|
||||
double threshold = data.liqtick < 35 ? 0.4 : 0.165;
|
||||
if (Bridge1_13.hasIsSwimming()) {
|
||||
if (Bridge1_13.isSwimming(player)) threshold += 0.05; else threshold += 0.03;
|
||||
}
|
||||
final int level = BridgeEnchant.getDepthStriderLevel(player);
|
||||
threshold += level * 0.03;
|
||||
// Apply if moving to quickly from ground to water or having DepthStrider
|
||||
if (attrMod != Double.MAX_VALUE) {
|
||||
if (data.liqtick < 35 || level > 0) threshold *= attrMod;
|
||||
}
|
||||
if (Math.sqrt(TrigUtil.distanceSquared(from.getX(), from.getZ(), to.getX(), to.getZ())) > threshold) {
|
||||
data.watermovect += 2;
|
||||
if (data.watermovect > 7) {
|
||||
hDistanceAboveLimit = Math.max(hDistanceAboveLimit, hDistance);
|
||||
tags.add("watermove(2)");
|
||||
}
|
||||
} else {
|
||||
data.watermovect = data.watermovect > 0 ? data.watermovect - 1 : 0;
|
||||
}
|
||||
}
|
||||
if (blockAbove == Material.AIR) {
|
||||
//Bouncing on water
|
||||
if (hDistanceAboveLimit <= 0D && hDistance > (Bridge1_13.hasDolphinGrace() ? 0.18D : 0.12D)
|
||||
&& !Bridge1_9.isGliding(player) && !Bridge1_13.isRiptiding(player)
|
||||
&& Double.isInfinite(Bridge1_13.getDolphinGraceAmplifier(player)) && !toOnGround && !fromOnGround && (attrMod == Double.MAX_VALUE || attrMod <= 1.0)
|
||||
&& (from.getY() < to.getY()) && !(lastMove.from.inLiquid && !to.isInLiquid())
|
||||
&& !lastMove.from.onGround && !standsOnEntity(player,from.getY())
|
||||
&& lastMove.toIsValid && !from.isHeadObstructed() && !to.isHeadObstructed() && !Bridge1_13.isSwimming(player)) {
|
||||
boolean tag = false;
|
||||
if (Bridge1_13.hasIsSwimming()) {
|
||||
if (((Levelled)blockUnder.getBlockData()).getLevel() == 0) tag = true;
|
||||
} else if (blockUnder.getData() == 0) tag = true;
|
||||
if (tag) {
|
||||
hDistanceAboveLimit = Math.max(hDistanceAboveLimit, hDistance);
|
||||
tags.add("waterjump");
|
||||
}
|
||||
}
|
||||
// hDist and vDist checks, simply checks for horizontal movement with little y distance
|
||||
if (hDistanceAboveLimit <= 0D && hDistance > 0.11D && yDistance <= 0.1D && !toOnGround && !fromOnGround
|
||||
&& lastMove.toIsValid && lastMove.yDistance == yDistance || lastMove.yDistance == yDistance * -1 && lastMove.yDistance != 0D
|
||||
&& !from.isHeadObstructed() && !to.isHeadObstructed() && !Bridge1_13.isSwimming(player)) {
|
||||
// Prevent being flagged if a player transitions from a block to water and the player falls into the water.
|
||||
if (!(yDistance < 0 && yDistance != 0 && lastMove.yDistance < 0 && lastMove.yDistance != 0)) {
|
||||
hDistanceAboveLimit = Math.max(hDistanceAboveLimit, hDistance);
|
||||
tags.add("watermove");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent players from sprinting if they're moving backwards (allow buffers to cover up !?).
|
||||
if (sprinting && data.lostSprintCount == 0 && !cc.assumeSprint && hDistance > thisMove.walkSpeed && !data.hasActiveHorVel()) {
|
||||
// (Ignore some cases, in order to prevent false positives.)
|
||||
// TODO: speed effects ?
|
||||
if (TrigUtil.isMovingBackwards(xDistance, zDistance, from.getYaw())
|
||||
&& !pData.hasPermission(Permissions.MOVING_SURVIVALFLY_SPRINTING, player)) {
|
||||
// (Might have to account for speeding permissions.)
|
||||
// TODO: hDistance is too harsh?
|
||||
hDistanceAboveLimit = Math.max(hDistanceAboveLimit, hDistance);
|
||||
tags.add("sprintback"); // Might add it anyway.
|
||||
// Prevent players from sprinting if they're moving backwards (allow buffers to cover up !?).
|
||||
if (sprinting && data.lostSprintCount == 0 && hDistance > thisMove.walkSpeed && !data.hasActiveHorVel() && !player.hasPotionEffect(PotionEffectType.SPEED) && (attrMod == Double.MAX_VALUE || attrMod <= 1.0)
|
||||
&& !((from.isInWater() || isWaterlogged(from) || player.getLocation().subtract(0.0, 0.3, 0.0).getBlock().getType() == Material.WATER) && !Double.isInfinite(Bridge1_13.getDolphinGraceAmplifier(player)))) {
|
||||
// (Ignore some cases, in order to prevent false positives.)
|
||||
// TODO: speed effects ?
|
||||
if (TrigUtil.isMovingBackwards(xDistance, zDistance, from.getYaw())
|
||||
&& !pData.hasPermission(Permissions.MOVING_SURVIVALFLY_SPRINTING, player)) {
|
||||
// (Might have to account for speeding permissions.)
|
||||
// TODO: hDistance is too harsh?
|
||||
hDistanceAboveLimit = Math.max(hDistanceAboveLimit, hDistance);
|
||||
if (hDistanceAboveLimit < 0.5) {hDistanceAboveLimit =0.0;}
|
||||
tags.add("sprintback"); // Might add it anyway.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -461,6 +513,8 @@ public class SurvivalFly extends Check {
|
||||
// Vertical move.
|
||||
//////////////////////////
|
||||
|
||||
if (fromOnGround || from.isInLiquid() || from.isInWeb() || from.isOnClimbable() || resetFrom || resetTo) data.yDis = 0.0;
|
||||
|
||||
// Calculate the vertical speed limit based on the current jump phase.
|
||||
double vAllowedDistance = 0, vDistanceAboveLimit = 0;
|
||||
// Distinguish certain media.
|
||||
@@ -496,7 +550,7 @@ public class SurvivalFly extends Check {
|
||||
final double[] res = vDistLiquid(from, to, toOnGround, yDistance, lastMove, data, player);
|
||||
vAllowedDistance = res[0];
|
||||
vDistanceAboveLimit = res[1];
|
||||
if (vDistanceAboveLimit <= 0.0 && yDistance > 0.0 && Math.abs(yDistance) > Magic.swimBaseSpeedV()) {
|
||||
if (vDistanceAboveLimit <= 0.0 && yDistance > 0.0 && Math.abs(yDistance) > Magic.swimBaseSpeedV(Bridge1_13.isSwimming(player))) {
|
||||
data.setFrictionJumpPhase();
|
||||
}
|
||||
}
|
||||
@@ -898,21 +952,24 @@ public class SurvivalFly extends Check {
|
||||
double friction = data.lastFrictionHorizontal; // Friction to use with this move.
|
||||
// TODO: sfDirty: Better friction/envelope-based.
|
||||
boolean useBaseModifiers = false;
|
||||
boolean useBaseModifiersSprint = true;
|
||||
if (thisMove.from.inWeb) {
|
||||
data.sfOnIce = 0;
|
||||
// TODO: if (from.isOnIce()) <- makes it even slower !
|
||||
// Does include sprinting by now (would need other accounting methods).
|
||||
hAllowedDistance = Magic.modWeb * thisMove.walkSpeed * cc.survivalFlyWalkingSpeed / 100D;
|
||||
friction = 0.0; // Ensure friction can't be used to speed.
|
||||
useBaseModifiers = true;
|
||||
}
|
||||
else if (thisMove.to.onSoulSand && thisMove.from.onSoulSand) {
|
||||
hAllowedDistance = Magic.modSoulSand * thisMove.walkSpeed * cc.survivalFlyWalkingSpeed / 100D;
|
||||
useBaseModifiers = true;
|
||||
}
|
||||
else if (thisMove.from.inLiquid && thisMove.to.inLiquid) {
|
||||
// Check all liquids (lava might demand even slower speed though).
|
||||
// TODO: Test how to go with only checking from (less dolphins).
|
||||
// TODO: Sneaking and blocking applies to when in water !
|
||||
hAllowedDistance = Magic.modSwim * thisMove.walkSpeed * cc.survivalFlySwimmingSpeed / 100D;
|
||||
hAllowedDistance = Bridge1_13.isSwimming(player) ? Magic.modSwim[1] : Magic.modSwim[0] * thisMove.walkSpeed * cc.survivalFlySwimmingSpeed / 100D;
|
||||
useBaseModifiers = true;
|
||||
if (thisMove.from.inWater || !thisMove.from.inLava) { // (We don't really have other liquids, though.)
|
||||
final int level = BridgeEnchant.getDepthStriderLevel(player);
|
||||
@@ -920,31 +977,31 @@ public class SurvivalFly extends Check {
|
||||
// The hard way.
|
||||
hAllowedDistance *= Magic.modDepthStrider[level];
|
||||
// Modifiers: Most speed seems to be reached on ground, but couldn't nail down.
|
||||
} else if (player.hasPotionEffect(PotionEffectType.DOLPHINS_GRACE)) {
|
||||
} else if (!Double.isInfinite(Bridge1_13.getDolphinGraceAmplifier(player))) {
|
||||
// TODO: Allow for faster swimming above water with Dolhphins Grace
|
||||
hAllowedDistance *= Magic.modDolphinsGrace;
|
||||
} if (level > 0 && player.hasPotionEffect(PotionEffectType.DOLPHINS_GRACE)) {
|
||||
} if (level > 0 && !Double.isInfinite(Bridge1_13.getDolphinGraceAmplifier(player))) {
|
||||
hAllowedDistance *= Magic.modDepthStrider[level] * Magic.modDolphinsGrace * 4;
|
||||
} if (player.isRiptiding() || (data.timeRiptiding + 3000 > now)) {
|
||||
hAllowedDistance *= Magic.modRiptide;
|
||||
} if (Bridge1_13.isRiptiding(player) || (data.timeRiptiding + 3000 > now)) {
|
||||
hAllowedDistance *= Magic.modRiptide[data.RiptideLevel];
|
||||
}
|
||||
}
|
||||
// (Friction is used as is.)
|
||||
} else if (data.newHDist) {
|
||||
hAllowedDistance = 0.345D;
|
||||
|
||||
} else if (snowFix) {
|
||||
// (Friction is used as is.)
|
||||
} else if (Bridge1_13.isRiptiding(player) || (data.timeRiptiding + 3000 > now)) {
|
||||
hAllowedDistance = Magic.modRiptide[data.RiptideLevel] * thisMove.walkSpeed * cc.survivalFlySpeedingSpeed / 100D;
|
||||
} else if (data.newHDist && hAllowedDistance < 0.345D) {
|
||||
useBaseModifiers = true;
|
||||
hAllowedDistance = 0.445D;
|
||||
} else if (snowFix && hAllowedDistance < 0.377D) {
|
||||
hAllowedDistance = 0.377D;
|
||||
useBaseModifiers = true;
|
||||
}
|
||||
else if (player.isRiptiding() || (data.timeRiptiding + 3000 > now)) {
|
||||
hAllowedDistance = Magic.modRiptide * thisMove.walkSpeed * cc.survivalFlySpeedingSpeed / 100D;
|
||||
}
|
||||
// Allows faster speed for player when swimming above water since from -> to does not seem to detect correctly
|
||||
else if ((BlockProperties.isLiquid(from.getTypeIdBelow()) || BlockProperties.isNewLiq(from.getTypeIdBelow()) && player.hasPotionEffect(PotionEffectType.DOLPHINS_GRACE))) {
|
||||
hAllowedDistance = Magic.modSwim * thisMove.walkSpeed * cc.survivalFlySwimmingSpeed * Magic.modDolphinsGrace / 100D;
|
||||
else if ((BlockProperties.isLiquid(from.getTypeIdBelow()) || BlockProperties.isNewLiq(from.getTypeIdBelow()) && !Double.isInfinite(Bridge1_13.getDolphinGraceAmplifier(player)))) {
|
||||
hAllowedDistance = Bridge1_13.isSwimming(player) ? Magic.modSwim[1] : Magic.modSwim[0] * thisMove.walkSpeed * cc.survivalFlySwimmingSpeed * Magic.modDolphinsGrace / 100D;
|
||||
final int level = BridgeEnchant.getDepthStriderLevel(player);
|
||||
if (level > 0) {
|
||||
hAllowedDistance = Magic.modSwim * thisMove.walkSpeed * cc.survivalFlySwimmingSpeed * Magic.modDolphinsGrace * Magic.modDepthStrider[level] / 100D;
|
||||
hAllowedDistance = Magic.modSwim[0] * thisMove.walkSpeed * cc.survivalFlySwimmingSpeed * Magic.modDolphinsGrace * Magic.modDepthStrider[level] / 100D;
|
||||
}
|
||||
}
|
||||
// TODO: !sfDirty is very coarse, should use friction instead.
|
||||
@@ -952,13 +1009,19 @@ public class SurvivalFly extends Check {
|
||||
&& (!checkPermissions || !pData.hasPermission(Permissions.MOVING_SURVIVALFLY_SNEAKING, player))) {
|
||||
hAllowedDistance = Magic.modSneak * thisMove.walkSpeed * cc.survivalFlySneakingSpeed / 100D;
|
||||
friction = 0.0; // Ensure friction can't be used to speed.
|
||||
useBaseModifiers = true;
|
||||
useBaseModifiersSprint = false;
|
||||
// TODO: Attribute modifiers can count in here, e.g. +0.5 (+ 50% doesn't seem to pose a problem, neither speed effect 2).
|
||||
}
|
||||
// TODO: !sfDirty is very coarse, should use friction instead.
|
||||
else if (!sfDirty && thisMove.from.onGround && player.isBlocking()
|
||||
// Find out why it didn't flag immediately
|
||||
else if (!sfDirty && thisMove.from.onGround && (data.isusingitem || data.isHackingRI || player.isBlocking())
|
||||
&& (!checkPermissions || !pData.hasPermission(Permissions.MOVING_SURVIVALFLY_BLOCKING, player))) {
|
||||
data.isHackingRI = false;
|
||||
hAllowedDistance = Magic.modBlock * thisMove.walkSpeed * cc.survivalFlyBlockingSpeed / 100D;
|
||||
friction = 0.0; // Ensure friction can't be used to speed.
|
||||
useBaseModifiers = true;
|
||||
useBaseModifiersSprint = false;
|
||||
}
|
||||
else {
|
||||
useBaseModifiers = true;
|
||||
@@ -974,7 +1037,7 @@ public class SurvivalFly extends Check {
|
||||
}
|
||||
// Apply modifiers (sprinting, attributes, ...).
|
||||
if (useBaseModifiers) {
|
||||
if (sprinting) {
|
||||
if (useBaseModifiersSprint && sprinting) {
|
||||
hAllowedDistance *= data.multSprinting;
|
||||
}
|
||||
// Note: Attributes count in slowness potions, thus leaving out isn't possible.
|
||||
@@ -1010,7 +1073,7 @@ public class SurvivalFly extends Check {
|
||||
// Account for flowing liquids (only if needed).
|
||||
// Assume: If in liquids this would be placed right here.
|
||||
if (thisMove.downStream) {
|
||||
hAllowedDistance *= Magic.modDownStream;
|
||||
hAllowedDistance *= Bridge1_13.isSwimming(player) ? Magic.modDownStream2 : Magic.modDownStream;
|
||||
}
|
||||
|
||||
// If the player is on ice, give them a higher maximum speed.
|
||||
@@ -1098,6 +1161,13 @@ public class SurvivalFly extends Check {
|
||||
// Change seen from last yDistance.
|
||||
final double yDistChange = lastMove.toIsValid ? yDistance - lastMove.yDistance : Double.MAX_VALUE;
|
||||
|
||||
final double dis = TrigUtil.xzDistance(from, to);
|
||||
if (dis < 0.2 && yDistance > 0.2) {
|
||||
data.yDis += yDistance;
|
||||
if (data.yDis <0.0 || data.yDis > 257.0) {
|
||||
data.yDis = 0.0;
|
||||
}
|
||||
}
|
||||
// Hacks.
|
||||
final boolean envelopeHack;
|
||||
if (!resetFrom && !resetTo && MagicAir.venvHacks(from, to, yDistance, yDistChange, thisMove, lastMove, data)) {
|
||||
@@ -1150,7 +1220,7 @@ public class SurvivalFly extends Check {
|
||||
}
|
||||
}
|
||||
strictVdistRel = false;
|
||||
} else if (player.isRiptiding() || (data.timeRiptiding + 3000 > now)) {
|
||||
} else if (Bridge1_13.isRiptiding(player) || (data.timeRiptiding + 3000 > now)) {
|
||||
vAllowedDistance = lastMove.yDistance * 5.0D;
|
||||
strictVdistRel = false;
|
||||
} else if (data.bedLeaveTime + 500 > now && yDistance < 0.45) {
|
||||
@@ -1228,6 +1298,13 @@ public class SurvivalFly extends Check {
|
||||
// Odd decrease with water.
|
||||
}
|
||||
else if (MagicAir.oddJunction(from, to, yDistance, yDistChange, yDistDiffEx, maxJumpGain, resetTo, thisMove, lastMove, data, cc)) {
|
||||
// A quick fix for 4.5 block height jesus bypass
|
||||
// TODO: should fix data.isVelocityJumpPhase() instead
|
||||
if (data.liftOffEnvelope == LiftOffEnvelope.LIMIT_LIQUID) {
|
||||
if (yDistance > 0.0 && yDistance > (Bridge1_13.hasIsSwimming() ? 0.3 : 0.155)) {
|
||||
vDistRelVL = true;
|
||||
}
|
||||
}
|
||||
// Several types of odd in-air moves, mostly with gravity near maximum, friction, medium change.
|
||||
}
|
||||
else if (yDistDiffEx < 0.025
|
||||
@@ -1238,9 +1315,9 @@ public class SurvivalFly extends Check {
|
||||
* slightly above the top.
|
||||
*/
|
||||
}
|
||||
else if (BlockProperties.isNewLiq(from.getTypeIdBelowLiq())) {
|
||||
else if (BlockProperties.isNewLiq(from.getTypeIdBelowLiq()) || isLanternUpper(to) || isWaterlogged(from)) {
|
||||
|
||||
} else if (player.isRiptiding() || (data.timeRiptiding + 3000 > now)) {
|
||||
} else if (Bridge1_13.isRiptiding(player) || (data.timeRiptiding + 3000 > now)) {
|
||||
vDistRelVL = false;
|
||||
} else if (data.bedLeaveTime + 500 > now && yDistance < 0.45) {
|
||||
vDistRelVL = false;
|
||||
@@ -1280,7 +1357,7 @@ public class SurvivalFly extends Check {
|
||||
// Allow too strong decrease.
|
||||
// TODO: Another magic check here? Route most checks through methods anyway?
|
||||
}
|
||||
else if (BlockProperties.isNewLiq(from.getTypeIdBelowLiq())) {
|
||||
else if (BlockProperties.isNewLiq(from.getTypeIdBelowLiq()) || isLanternUpper(to)) {
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -1320,10 +1397,10 @@ public class SurvivalFly extends Check {
|
||||
else if (lastMove.toIsValid && MagicAir.oddJunction(from, to, yDistance, yDistChange, yDistDiffEx, maxJumpGain, resetTo, thisMove, lastMove, data, cc)) {
|
||||
// Several types of odd in-air moves, mostly with gravity near maximum, friction, medium change.
|
||||
}
|
||||
else if (BlockProperties.isNewLiq(from.getTypeIdBelowLiq())) {
|
||||
else if (BlockProperties.isNewLiq(from.getTypeIdBelowLiq()) || isLanternUpper(to)) {
|
||||
|
||||
}
|
||||
else if (player.isRiptiding() || (data.timeRiptiding + 3000 > now)) {
|
||||
else if (Bridge1_13.isRiptiding(player) || (data.timeRiptiding + 3000 > now)) {
|
||||
vDistRelVL = false;
|
||||
} else if (data.bedLeaveTime + 500 > now && yDistance < 0.45) {
|
||||
vDistRelVL = false;
|
||||
@@ -1334,6 +1411,14 @@ public class SurvivalFly extends Check {
|
||||
}
|
||||
// else Accept small aberrations !?
|
||||
}
|
||||
if (data.yDis > (Bridge1_13.hasIsSwimming() ? 1.37 : 1.245)
|
||||
&& !data.isVelocityJumpPhase()
|
||||
&& data.timeRiptiding + 3500 < now
|
||||
&& Double.isInfinite(PotionUtil.getPotionEffectAmplifier(player, PotionEffectType.JUMP))) {
|
||||
vDistanceAboveLimit = 1.37;
|
||||
vDistRelVL = true;
|
||||
data.yDis -= 1.0;
|
||||
}
|
||||
|
||||
if (vDistRelVL) {
|
||||
if (data.getOrUseVerticalVelocity(yDistance) == null) {
|
||||
@@ -1363,9 +1448,12 @@ public class SurvivalFly extends Check {
|
||||
else if (Magic.skipPaper(thisMove, lastMove, data)) {
|
||||
// Tag already set above.
|
||||
}
|
||||
else if (player.isRiptiding() || (data.timeRiptiding + 3000 > now)) {
|
||||
else if (Bridge1_13.isRiptiding(player) || (data.timeRiptiding + 3000 > now)) {
|
||||
tags.add("yriptide");
|
||||
}
|
||||
else if (Bridge1_13.isSwimming(player) && isWaterlogged(from)) {
|
||||
// Ignore water logged blocks
|
||||
}
|
||||
// Attempt to use velocity.
|
||||
else if (data.getOrUseVerticalVelocity(yDistance) == null) {
|
||||
// Violation.
|
||||
@@ -1418,7 +1506,7 @@ public class SurvivalFly extends Check {
|
||||
if (yDistance < 0.5) {
|
||||
// Ignore falling, and let accounting deal with it.
|
||||
}
|
||||
else if (player.isRiptiding() || (data.timeRiptiding + 3000 > now)) {
|
||||
else if (Bridge1_13.isRiptiding(player) || (data.timeRiptiding + 3000 > now)) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1517,7 +1605,7 @@ public class SurvivalFly extends Check {
|
||||
else if (thisMove.verVelUsed == null) { // Only skip if just used.
|
||||
// Here yDistance can be negative and positive.
|
||||
// if (yDistance != 0.0) {
|
||||
if ( (BlockProperties.isNewLiq(from.getTypeIdBelow())) || (data.timeRiptiding + 500 > now) || (data.bedLeaveTime + 500 > now && yDistance < 0.45) || (snowFix) ) {
|
||||
if ( (BlockProperties.isNewLiq(from.getTypeIdBelow())) || (data.timeRiptiding + 500 > now) || (data.bedLeaveTime + 500 > now && yDistance < 0.45) || (snowFix) || isLanternUpper(to) || isWaterlogged(from)) {
|
||||
// Ignore
|
||||
}
|
||||
else {
|
||||
@@ -1539,6 +1627,53 @@ public class SurvivalFly extends Check {
|
||||
return vDistanceAboveLimit;
|
||||
}
|
||||
|
||||
private boolean standsOnEntity(final Entity entity, final double minY){
|
||||
// TODO: Probably check other ids too before doing this ?
|
||||
for (final Entity other : entity.getNearbyEntities(1.5, 1.0, 1.5)){
|
||||
final EntityType type = other.getType();
|
||||
if (type != EntityType.BOAT){
|
||||
continue;
|
||||
}
|
||||
Material m = other.getLocation().getBlock().getType();
|
||||
final double locY = other.getLocation().getY();
|
||||
if (Math.abs(locY - minY) < 0.7 && (BlockProperties.isLiquid(m) || BlockProperties.isNewLiq(m))){
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isLanternUpper(PlayerLocation from) {
|
||||
World w = from.getWorld();
|
||||
final int x = from.getBlockX();
|
||||
final int y = from.getBlockY() + 2;
|
||||
final int z = from.getBlockZ();
|
||||
if (w.getBlockAt(x, y, z).getType().toString().equals("LANTERN")) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isWaterlogged(PlayerLocation from) {
|
||||
if (!Bridge1_13.hasIsSwimming()) return false;
|
||||
World w = from.getWorld();
|
||||
final int x = from.getBlockX();
|
||||
final int y = from.getBlockY();
|
||||
final int z = from.getBlockZ();
|
||||
BlockData bd = w.getBlockAt(x,y-1,z).getBlockData();
|
||||
if (bd instanceof Waterlogged) {
|
||||
return ((Waterlogged)bd).isWaterlogged();
|
||||
}
|
||||
BlockData bd2 = w.getBlockAt(x,y,z).getBlockData();
|
||||
if (bd2 instanceof Waterlogged) {
|
||||
return ((Waterlogged)bd2).isWaterlogged();
|
||||
}
|
||||
BlockData bd4 = w.getBlockAt(x,y+2,z).getBlockData();
|
||||
if (bd4 instanceof Waterlogged) {
|
||||
return ((Waterlogged)bd4).isWaterlogged();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Demand that with time the values decrease.<br>
|
||||
* The ActionAccumulator instance must have 3 buckets, bucket 1 is checked against
|
||||
@@ -1606,7 +1741,7 @@ public class SurvivalFly extends Check {
|
||||
// Moving upwards after falling without having touched the ground.
|
||||
if (data.bunnyhopDelay < 9 && !((lastMove.touchedGround || lastMove.from.onGroundOrResetCond) && lastMove.yDistance == 0D) && data.getOrUseVerticalVelocity(yDistance) == null) {
|
||||
// TODO: adjust limit for bunny-hop.
|
||||
if ( (BlockProperties.isNewLiq(from.getTypeIdBelow())) || (data.timeRiptiding + 500 > now) || (data.bedLeaveTime + 500 > now && yDistance < 0.45) || (snowFix) ) {
|
||||
if ( (BlockProperties.isNewLiq(from.getTypeIdBelow())) || (data.timeRiptiding + 500 > now) || (data.bedLeaveTime + 500 > now && yDistance < 0.45) || (snowFix) || (isLanternUpper(to))) {
|
||||
|
||||
} else {
|
||||
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance));
|
||||
@@ -1688,13 +1823,13 @@ public class SurvivalFly extends Check {
|
||||
hDistanceAboveLimit = bunnyHop(from, to, hAllowedDistance, hDistanceAboveLimit, sprinting, thisMove, lastMove, data, cc);
|
||||
|
||||
// After failure permission checks ( + speed modifier + sneaking + blocking + speeding) and velocity (!).
|
||||
if (hDistanceAboveLimit > 0.12 && !skipPermChecks && !thisMove.from.inLiquid && !thisMove.to.inLiquid && !player.hasPotionEffect(PotionEffectType.DOLPHINS_GRACE)) {
|
||||
if (hDistanceAboveLimit > 0.12 && !skipPermChecks && !thisMove.from.inLiquid && !thisMove.to.inLiquid && Double.isInfinite(Bridge1_13.getDolphinGraceAmplifier(player))) {
|
||||
// TODO: Most cases these will not apply. Consider redesign to do these last or checking right away and skip here on some conditions.
|
||||
hAllowedDistance = setAllowedhDist(player, sprinting, thisMove, data, cc, pData, from, true);
|
||||
hDistanceAboveLimit = thisMove.hDistance - hAllowedDistance;
|
||||
tags.add("permchecks-outliq");
|
||||
}
|
||||
if (hDistanceAboveLimit > 0.6 && !skipPermChecks && thisMove.from.inLiquid && thisMove.to.inLiquid && player.hasPotionEffect(PotionEffectType.DOLPHINS_GRACE)) {
|
||||
if (hDistanceAboveLimit > 0.6 && !skipPermChecks && thisMove.from.inLiquid && thisMove.to.inLiquid && !Double.isInfinite(Bridge1_13.getDolphinGraceAmplifier(player))) {
|
||||
hAllowedDistance = setAllowedhDist(player, sprinting, thisMove, data, cc, pData, from, true);
|
||||
hDistanceAboveLimit = thisMove.hDistance - hAllowedDistance;
|
||||
tags.add("permchecks-inliq");
|
||||
@@ -1760,7 +1895,10 @@ public class SurvivalFly extends Check {
|
||||
}
|
||||
}
|
||||
|
||||
if (player.isRiptiding() || (data.timeRiptiding + 3000 > now)) {
|
||||
if (Bridge1_13.isRiptiding(player) || (data.timeRiptiding + 3000 > now)) {
|
||||
if (Bridge1_9.isGliding(player) && hDistanceAboveLimit< 0.5) {
|
||||
hDistanceAboveLimit=0.0;
|
||||
}
|
||||
tags.add("hriptide");
|
||||
}
|
||||
|
||||
@@ -1981,9 +2119,9 @@ public class SurvivalFly extends Check {
|
||||
// Expected envelopes.
|
||||
final double baseSpeed;
|
||||
if (player.isOnGround()) {
|
||||
baseSpeed = Magic.swimBaseSpeedV() + 0.1;
|
||||
baseSpeed = Magic.swimBaseSpeedV(Bridge1_13.isSwimming(player)) + 0.1;
|
||||
} else {
|
||||
baseSpeed = Magic.swimBaseSpeedV(); } // TODO: Lava?
|
||||
baseSpeed = Magic.swimBaseSpeedV(Bridge1_13.isSwimming(player)); } // TODO: Lava?
|
||||
final double yDistAbs = Math.abs(yDistance);
|
||||
|
||||
// TODO: Later also cover things like a sudden stop.
|
||||
@@ -2016,14 +2154,18 @@ public class SurvivalFly extends Check {
|
||||
return new double[]{yDistance, 0.0};
|
||||
}
|
||||
|
||||
if (player.isRiptiding() || (data.timeRiptiding + 1000 > now)) {
|
||||
if (Bridge1_13.isRiptiding(player) || (data.timeRiptiding + 1000 > now)) {
|
||||
return new double[]{yDistance, 0.0};
|
||||
}
|
||||
|
||||
// TODO: Set magic speeds
|
||||
if (from.getTypeId() == Material.BUBBLE_COLUMN) {
|
||||
if (isBubbleColumn(from)) {
|
||||
return new double[]{yDistance, 0.0};
|
||||
}
|
||||
|
||||
if (Bridge1_13.hasIsSwimming() && yDistance > 0.0 && from.isOnGround()) {
|
||||
return new double[]{yDistance, 0.0};
|
||||
}
|
||||
|
||||
// At this point a violation.
|
||||
tags.add(yDistance < 0.0 ? "swimdown" : "swimup");
|
||||
@@ -2037,6 +2179,26 @@ public class SurvivalFly extends Check {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isBubbleColumn(PlayerLocation from) {
|
||||
if (!Bridge1_13.hasIsSwimming()) return false;
|
||||
if (from.getTypeId() == Material.BUBBLE_COLUMN) {
|
||||
return true;
|
||||
}
|
||||
World w = from.getWorld();
|
||||
int x = from.getBlockX();
|
||||
int y = from.getBlockY();
|
||||
int z = from.getBlockZ();
|
||||
if (w.getBlockAt(x + 1,y,z).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x - 1,y,z).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x,y,z + 1).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x,y,z - 1).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x + 1,y,z - 1).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x + 1,y,z + 1).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x - 1,y,z - 1).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x - 1,y,z + 1).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* On-climbable vertical distance checking.
|
||||
* @param from
|
||||
@@ -2080,6 +2242,10 @@ public class SurvivalFly extends Check {
|
||||
tags.add("climbspeed");
|
||||
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance) - maxSpeed);
|
||||
}
|
||||
long now = System.currentTimeMillis();
|
||||
if ((Bridge1_13.isRiptiding(player) || data.timeRiptiding + 3000 > now) && vDistanceAboveLimit< 4.0) {
|
||||
vDistanceAboveLimit = 0.0;
|
||||
}
|
||||
}
|
||||
if (yDistance > 0) {
|
||||
if (!data.playerMoves.getCurrentMove().touchedGround) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.player.PlayerSetBackMethod;
|
||||
import fr.neatmonster.nocheatplus.checks.net.NetData;
|
||||
import fr.neatmonster.nocheatplus.checks.net.model.CountableLocation;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
|
||||
import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
@@ -96,6 +97,7 @@ public class MovingUtil {
|
||||
Double.isInfinite(Bridge1_9.getLevitationAmplifier(player))
|
||||
|| fromLocation.isInLiquid()
|
||||
)
|
||||
&& (Double.isInfinite(Bridge1_13.getSlowfallingAmplifier(player)))
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -219,6 +219,7 @@ public class VehicleChecks extends CheckListener {
|
||||
debug(player, "onPlayerMoveVehicle: vehicle: " + vehicle);
|
||||
}
|
||||
data.wasInVehicle = true;
|
||||
data.waspreInVehicle = true;
|
||||
data.sfHoverTicks = -1;
|
||||
data.removeAllVelocity();
|
||||
data.sfLowJump = false;
|
||||
@@ -727,6 +728,9 @@ public class VehicleChecks extends CheckListener {
|
||||
if (debug) {
|
||||
debug(player, "Vehicle enter: first vehicle: " + vehicle.getClass().getName());
|
||||
}
|
||||
|
||||
data.waspreInVehicle = true;
|
||||
|
||||
// Check for nested vehicles.
|
||||
final Entity lastVehicle = passengerUtil.getLastNonPlayerVehicle(vehicle, true);
|
||||
if (lastVehicle == null) {
|
||||
|
||||
+58
-5
@@ -17,12 +17,17 @@ package fr.neatmonster.nocheatplus.checks.moving.vehicle;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import fr.neatmonster.nocheatplus.actions.ParameterName;
|
||||
import fr.neatmonster.nocheatplus.checks.Check;
|
||||
@@ -36,7 +41,10 @@ import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.model.VehicleMoveData;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.model.VehicleMoveInfo;
|
||||
import fr.neatmonster.nocheatplus.checks.workaround.WRPT;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.players.IPlayerData;
|
||||
import fr.neatmonster.nocheatplus.utilities.PotionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.StringUtil;
|
||||
|
||||
@@ -168,9 +176,14 @@ public class VehicleEnvelope extends Check {
|
||||
final MovingData data, final MovingConfig cc,
|
||||
final boolean debug) {
|
||||
boolean violation = false;
|
||||
long now = System.currentTimeMillis();
|
||||
if (debug) {
|
||||
debugDetails.add("inair: " + data.sfJumpPhase);
|
||||
}
|
||||
|
||||
if (isBubbleColumn(vehicle.getLocation())) {
|
||||
data.timeVehicletoss = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
// Medium dependent checking.
|
||||
|
||||
@@ -178,6 +191,12 @@ public class VehicleEnvelope extends Check {
|
||||
|
||||
// Maximum thinkable horizontal speed.
|
||||
// TODO: Further distinguish, best set in CheckDetails.
|
||||
if (vehicle instanceof LivingEntity) {
|
||||
Double speed = PotionUtil.getPotionEffectAmplifier((LivingEntity)vehicle, PotionEffectType.SPEED);
|
||||
if (!Double.isInfinite(speed)) {
|
||||
if (maxDistHorizontal(thisMove, getHDistCap(checkDetails.simplifiedType, cc) * (1 + 0.2 * (speed+1)))) return true;
|
||||
} else if (maxDistHorizontal(thisMove, getHDistCap(checkDetails.simplifiedType, cc))) return true;
|
||||
} else
|
||||
if (maxDistHorizontal(thisMove, getHDistCap(checkDetails.simplifiedType, cc))) { // Override type for now.
|
||||
return true;
|
||||
}
|
||||
@@ -252,7 +271,7 @@ public class VehicleEnvelope extends Check {
|
||||
}
|
||||
else if (checkDetails.inAir) {
|
||||
// In-air move.
|
||||
if (checkInAir(thisMove, data, debug)) {
|
||||
if (checkInAir(thisMove, data, debug, vehicle)) {
|
||||
violation = true;
|
||||
}
|
||||
}
|
||||
@@ -268,11 +287,23 @@ public class VehicleEnvelope extends Check {
|
||||
// TODO: At least do something here?
|
||||
}
|
||||
}
|
||||
if (vehicle instanceof LivingEntity) {
|
||||
Double levitation = Bridge1_9.getLevitationAmplifier((LivingEntity)vehicle);
|
||||
if (!Double.isInfinite(levitation)) {
|
||||
checkDetails.maxAscend += 0.046 * (levitation + 1);
|
||||
violation = false;
|
||||
}
|
||||
}
|
||||
// Maximum ascend speed.
|
||||
if (checkDetails.checkAscendMuch && thisMove.yDistance > checkDetails.maxAscend) {
|
||||
tags.add("ascend_much");
|
||||
violation = true;
|
||||
}
|
||||
|
||||
if (data.timeVehicletoss + 2000 > now && thisMove.yDistance < 4.0) {
|
||||
violation = false;
|
||||
}
|
||||
|
||||
// Maximum descend speed.
|
||||
if (checkDetails.checkDescendMuch && thisMove.yDistance < -MagicVehicle.maxDescend) {
|
||||
// TODO: At times it looks like one move is skipped, resulting in double distance ~ -5 and at the same time 'vehicle moved too quickly'.
|
||||
@@ -305,6 +336,26 @@ public class VehicleEnvelope extends Check {
|
||||
|
||||
return violation;
|
||||
}
|
||||
|
||||
private boolean isBubbleColumn(Location from) {
|
||||
if (!Bridge1_13.hasIsSwimming()) return false;
|
||||
if (from.getBlock().getType() == Material.BUBBLE_COLUMN) {
|
||||
return true;
|
||||
}
|
||||
World w = from.getWorld();
|
||||
int x = from.getBlockX();
|
||||
int y = from.getBlockY();
|
||||
int z = from.getBlockZ();
|
||||
if (w.getBlockAt(x + 1,y,z).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x - 1,y,z).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x,y,z + 1).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x,y,z - 1).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x + 1,y,z - 1).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x + 1,y,z + 1).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x - 1,y,z - 1).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
if (w.getBlockAt(x - 1,y,z + 1).getType() == Material.BUBBLE_COLUMN) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare checkDetails according to vehicle-specific interpretation of side
|
||||
@@ -359,7 +410,7 @@ public class VehicleEnvelope extends Check {
|
||||
// Generic settings.
|
||||
// (maxAscend is not checked for stepping up blocks)
|
||||
if (checkDetails.canJump) {
|
||||
checkDetails.maxAscend = 1.0; // Coarse envelope. Actual lift off gain should be checked on demand.
|
||||
checkDetails.maxAscend = 1.2; // Coarse envelope. Actual lift off gain should be checked on demand.
|
||||
}
|
||||
// Climbable
|
||||
if (checkDetails.canClimb) {
|
||||
@@ -381,7 +432,7 @@ public class VehicleEnvelope extends Check {
|
||||
* @return
|
||||
*/
|
||||
private boolean checkInAir(final VehicleMoveData thisMove, final MovingData data,
|
||||
final boolean debug) {
|
||||
final boolean debug, final Entity vehicle) {
|
||||
|
||||
// TODO: Distinguish sfJumpPhase and inAirDescendCount (after reaching the highest point).
|
||||
|
||||
@@ -417,8 +468,10 @@ public class VehicleEnvelope extends Check {
|
||||
final double maxDescend = getInAirMaxDescend(thisMove, data);
|
||||
if (data.sfJumpPhase > (checkDetails.canJump ? MagicVehicle.maxJumpPhaseAscend : 1)
|
||||
&& thisMove.yDistance > Math.max(minDescend, -checkDetails.gravityTargetSpeed)) {
|
||||
tags.add("slow_fall_vdist");
|
||||
violation = true;
|
||||
if (!(vehicle instanceof LivingEntity && !Double.isInfinite(Bridge1_13.getSlowfallingAmplifier((LivingEntity)vehicle)))) {
|
||||
tags.add("slow_fall_vdist");
|
||||
violation = true;
|
||||
}
|
||||
}
|
||||
// Fast falling (vdist).
|
||||
else if (data.sfJumpPhase > 1 && thisMove.yDistance < maxDescend) {
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package fr.neatmonster.nocheatplus.compat;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.PotionUtil;
|
||||
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
||||
|
||||
public class Bridge1_13 {
|
||||
private static final PotionEffectType SLOWFALLING = PotionEffectType.getByName("SLOW_FALLING");
|
||||
private static final PotionEffectType DOLPHINSGRACE = PotionEffectType.getByName("DOLPHINS_GRACE");
|
||||
private static final boolean hasIsRiptiding = ReflectionUtil.getMethodNoArgs(Player.class, "isRiptiding", boolean.class) != null;
|
||||
private static final boolean hasIsSwimming = ReflectionUtil.getMethodNoArgs(Player.class, "isSwimming", boolean.class) != null;
|
||||
|
||||
public static boolean hasSlowfalling() {
|
||||
return SLOWFALLING != null;
|
||||
}
|
||||
|
||||
public static boolean hasDolphinGrace() {
|
||||
return DOLPHINSGRACE != null;
|
||||
}
|
||||
|
||||
public static boolean hasIsRiptiding() {
|
||||
return hasIsRiptiding;
|
||||
}
|
||||
|
||||
public static boolean hasIsSwimming() {
|
||||
return hasIsSwimming;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for the 'slowfalling' potion effect.
|
||||
*
|
||||
* @param player
|
||||
* @return Double.NEGATIVE_INFINITY if not present.
|
||||
*/
|
||||
public static double getSlowfallingAmplifier(final Player player) {
|
||||
if (SLOWFALLING == null) {
|
||||
return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
return PotionUtil.getPotionEffectAmplifier(player, SLOWFALLING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for the 'slowfalling' potion effect.
|
||||
*
|
||||
* @param LivingEntity
|
||||
* @return Double.NEGATIVE_INFINITY if not present.
|
||||
*/
|
||||
public static double getSlowfallingAmplifier(final LivingEntity entity) {
|
||||
if (SLOWFALLING == null) {
|
||||
return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
return PotionUtil.getPotionEffectAmplifier(entity, SLOWFALLING);
|
||||
}
|
||||
|
||||
public static double getDolphinGraceAmplifier(final Player player) {
|
||||
if (DOLPHINSGRACE == null) {
|
||||
return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
return PotionUtil.getPotionEffectAmplifier(player, DOLPHINSGRACE);
|
||||
}
|
||||
|
||||
public static boolean isRiptiding(final Player player) {
|
||||
return hasIsRiptiding ? player.isRiptiding() : false;
|
||||
}
|
||||
|
||||
public static boolean isSwimming(final Player player) {
|
||||
return hasIsSwimming ? player.isSwimming() : false;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
package fr.neatmonster.nocheatplus.compat;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
@@ -83,6 +84,19 @@ public class Bridge1_9 {
|
||||
}
|
||||
return PotionUtil.getPotionEffectAmplifier(player, LEVITATION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for the 'levitation' potion effect.
|
||||
*
|
||||
* @param player
|
||||
* @return Double.NEGATIVE_INFINITY if not present.
|
||||
*/
|
||||
public static double getLevitationAmplifier(final LivingEntity entity) {
|
||||
if (LEVITATION == null) {
|
||||
return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
return PotionUtil.getPotionEffectAmplifier(entity, LEVITATION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gliding + wearing elytra.
|
||||
|
||||
@@ -35,6 +35,8 @@ public final class BridgeEnchant {
|
||||
private final static Enchantment DEPTH_STRIDER = parseEnchantment("DEPTH_STRIDER");
|
||||
|
||||
private final static Enchantment THORNS = parseEnchantment("THORNS");
|
||||
|
||||
private final static Enchantment RIPTIDE = parseEnchantment("RIPTIDE");
|
||||
|
||||
/**
|
||||
* Retrieve the maximum level for an enchantment, present in armor slots.
|
||||
@@ -112,5 +114,34 @@ public final class BridgeEnchant {
|
||||
// Cap at three.
|
||||
return Math.min(3, getMaxLevelArmor(player, DEPTH_STRIDER));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the maximum level for an enchantment, present in main and off hand slot.
|
||||
*
|
||||
* @param player
|
||||
* @param enchantment
|
||||
* If null, 0 will be returned.
|
||||
* @return 0 if none found, or the maximum found.
|
||||
*/
|
||||
private static int getTrident(final Player player, final Enchantment enchantment) {
|
||||
if (enchantment == null) {
|
||||
return 0;
|
||||
}
|
||||
int level = 0;
|
||||
// Find the maximum level for the given enchantment.
|
||||
final ItemStack mainhand = player.getInventory().getItemInMainHand();
|
||||
final ItemStack offhand = player.getInventory().getItemInOffHand();
|
||||
if (mainhand.getType().toString().equals("TRIDENT")) {
|
||||
return Math.max(mainhand.getEnchantmentLevel(enchantment), level);
|
||||
}
|
||||
if (offhand.getType().toString().equals("TRIDENT")) {
|
||||
level = Math.max(offhand.getEnchantmentLevel(enchantment), level);
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
||||
public static int getRiptideLevel(final Player player) {
|
||||
return Math.min(3, getTrident(player, RIPTIDE));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -276,7 +276,7 @@ public class BridgeMaterial {
|
||||
"repeating_command_block", "command_repeating");
|
||||
|
||||
/** Sign block. */
|
||||
public static final Material SIGN = getFirstNotNull("sign_post", "sign");
|
||||
public static final Material SIGN = getFirstNotNull("acacia_sign", "birch_sign", "dark_oak_sign", "jungle_sign", "oak_sign", "spruce_sign", "acacia_wall_sign", "birch_wall_sign", "dark_oak_wall_sign", "jungle_wall_sign", "oak_wall_sign", "spruce_wall_sign", "sign_post", "sign", "wall_sign");
|
||||
|
||||
/** Some skull for reference. */
|
||||
public static final Material SKELETON_SKULL = getFirst("skeleton_skull", "skull");
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ public class BlocksMC1_10 implements BlockPropertiesSetup {
|
||||
@Override
|
||||
public void setupBlockProperties(WorldConfigProvider<?> worldConfigProvider) {
|
||||
// 213 MAGMA
|
||||
BlockInit.setAs(BridgeMaterial.MAGMA_BLOCK, BridgeMaterial.STONE_PRESSURE_PLATE);
|
||||
BlockInit.setAs(BridgeMaterial.MAGMA_BLOCK, BridgeMaterial.MAGMA_BLOCK);
|
||||
// 214 NETHER_WART_BLOCK
|
||||
BlockInit.setAs("NETHER_WART_BLOCK", BridgeMaterial.SKELETON_SKULL);
|
||||
// 215 RED_NETHER_BRICK
|
||||
|
||||
+13
-1
@@ -36,7 +36,11 @@ public class BlocksMC1_13 implements BlockPropertiesSetup {
|
||||
|
||||
@Override
|
||||
public void setupBlockProperties(WorldConfigProvider<?> worldConfigProvider) {
|
||||
|
||||
// Add flag for anvil
|
||||
BlockFlags.addFlags("ANVIL", BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
|
||||
// Change flag for walls
|
||||
BlockFlags.addFlags("COBBLESTONE_WALL", BlockProperties.F_THICK_FENCE2);
|
||||
BlockFlags.removeFlags("COBBLESTONE_WALL", BlockProperties.F_THICK_FENCE);
|
||||
// Void air.
|
||||
BlockInit.setAs("VOID_AIR", Material.AIR);
|
||||
// Cave air.
|
||||
@@ -97,6 +101,10 @@ public class BlocksMC1_13 implements BlockPropertiesSetup {
|
||||
|
||||
// Red sand.
|
||||
BlockInit.setAs("RED_SAND", Material.SAND);
|
||||
|
||||
// Sea Grass.
|
||||
BlockInit.setAs("SEAGRASS", Material.SEAGRASS);
|
||||
BlockInit.setAs("TALL_SEAGRASS", Material.TALL_SEAGRASS);
|
||||
|
||||
// Sandstone slabs.
|
||||
BlockInit.setPropsAs("SANDSTONE_SLAB", Material.SANDSTONE);
|
||||
@@ -163,6 +171,10 @@ public class BlocksMC1_13 implements BlockPropertiesSetup {
|
||||
|
||||
// Conduit.
|
||||
BlockProperties.setBlockProps("CONDUIT", BlockProperties.woodDoorType);
|
||||
|
||||
// Sea Pickle.
|
||||
BlockProperties.setBlockProps("SEA_PICKLE", BlockProperties.instantType);
|
||||
BlockFlags.addFlags("SEA_PICKLE", BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
|
||||
|
||||
// Turtle egg.
|
||||
BlockProperties.setBlockProps("TURTLE_EGG", new BlockProps(
|
||||
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
package fr.neatmonster.nocheatplus.compat.blocks.init.vanilla;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.init.BlockInit;
|
||||
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
|
||||
import fr.neatmonster.nocheatplus.logging.StaticLog;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
|
||||
public class BlocksMC1_14 implements BlockPropertiesSetup{
|
||||
|
||||
public BlocksMC1_14() {
|
||||
BlockInit.assertMaterialExists("LECTERN");
|
||||
BlockInit.assertMaterialExists("STONECUTTER");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void setupBlockProperties(WorldConfigProvider<?> worldConfigProvider) {
|
||||
// TODO Auto-generated method stub
|
||||
BlockFlags.addFlags("VINE", BlockProperties.F_CLIMBUPABLE);
|
||||
final long stepFlags = BlockProperties.F_GROUND | BlockProperties.F_XZ100 | BlockProperties.F_GROUND_HEIGHT;
|
||||
final long wall = BlockProperties.F_VARIABLE | BlockProperties.F_GROUND | BlockProperties.F_HEIGHT150 | BlockProperties.F_THICK_FENCE2;
|
||||
final BlockProperties.BlockProps instant = BlockProperties.instantType;
|
||||
BlockInit.setPropsAs("END_STONE_BRICK_WALL", BridgeMaterial.END_STONE_BRICKS);
|
||||
BlockFlags.addFlags("END_STONE_BRICK_WALL", wall);
|
||||
BlockInit.setPropsAs("END_STONE_BRICK_STAIRS", BridgeMaterial.END_STONE_BRICKS);
|
||||
BlockFlags.setFlagsAs("END_STONE_BRICK_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setPropsAs("END_STONE_BRICK_SLAB", BridgeMaterial.END_STONE_BRICKS);
|
||||
BlockFlags.addFlags("END_STONE_BRICK_SLAB", stepFlags);
|
||||
|
||||
BlockInit.setPropsAs("SANDSTONE_WALL", Material.SANDSTONE);
|
||||
BlockFlags.addFlags("SANDSTONE_WALL", wall);
|
||||
BlockInit.setPropsAs("SANDSTONE_STAIRS", Material.SANDSTONE);
|
||||
BlockFlags.setFlagsAs("SANDSTONE_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setPropsAs("SMOOTH_SANDSTONE_SLAB", Material.SANDSTONE);
|
||||
BlockFlags.addFlags("SMOOTH_SANDSTONE_SLAB", stepFlags);
|
||||
BlockInit.setPropsAs("CUT_SANDSTONE_SLAB", Material.SANDSTONE);
|
||||
BlockFlags.addFlags("CUT_SANDSTONE_SLAB", stepFlags);
|
||||
BlockInit.setPropsAs("SMOOTH_SANDSTONE_STAIRS", Material.SANDSTONE);
|
||||
BlockFlags.setFlagsAs("SMOOTH_SANDSTONE_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setPropsAs("RED_SANDSTONE_WALL", Material.SANDSTONE);
|
||||
BlockFlags.addFlags("RED_SANDSTONE_WALL", wall);
|
||||
BlockInit.setPropsAs("RED_SANDSTONE_STAIRS", Material.SANDSTONE);
|
||||
BlockFlags.setFlagsAs("RED_SANDSTONE_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setPropsAs("SMOOTH_RED_SANDSTONE_STAIRS", Material.SANDSTONE);
|
||||
BlockFlags.setFlagsAs("SMOOTH_RED_SANDSTONE_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setPropsAs("SMOOTH_RED_SANDSTONE_SLAB", Material.SANDSTONE);
|
||||
BlockFlags.addFlags("SMOOTH_RED_SANDSTONE_SLAB", stepFlags);
|
||||
BlockInit.setPropsAs("CUT_RED_SANDSTONE_SLAB", Material.SANDSTONE);
|
||||
BlockFlags.addFlags("CUT_RED_SANDSTONE_SLAB", stepFlags);
|
||||
|
||||
BlockInit.setAs("RED_NETHER_BRICK_WALL", BridgeMaterial.COBBLESTONE_WALL);
|
||||
BlockInit.setAs("RED_NETHER_BRICK_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setAs("RED_NETHER_BRICK_SLAB", BridgeMaterial.STONE_SLAB);
|
||||
BlockFlags.addFlags("RED_NETHER_BRICK_SLAB", stepFlags);
|
||||
BlockInit.setAs("NETHER_BRICK_WALL", BridgeMaterial.COBBLESTONE_WALL);
|
||||
BlockInit.setAs("MOSSY_STONE_BRICK_WALL", BridgeMaterial.COBBLESTONE_WALL);
|
||||
BlockInit.setAs("MOSSY_STONE_BRICK_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setAs("MOSSY_STONE_BRICK_SLAB", BridgeMaterial.STONE_SLAB);
|
||||
BlockFlags.addFlags("MOSSY_STONE_BRICK_SLAB", stepFlags);
|
||||
BlockInit.setAs("STONE_BRICK_WALL", BridgeMaterial.COBBLESTONE_WALL);
|
||||
BlockInit.setAs("MOSSY_COBBLESTONE_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setAs("MOSSY_COBBLESTONE_SLAB", BridgeMaterial.STONE_SLAB);
|
||||
BlockFlags.addFlags("MOSSY_COBBLESTONE_SLAB", stepFlags);
|
||||
BlockInit.setAs("PRISMARINE_WALL", BridgeMaterial.COBBLESTONE_WALL);
|
||||
BlockInit.setAs("GRANITE_WALL", BridgeMaterial.COBBLESTONE_WALL);
|
||||
BlockInit.setAs("GRANITE_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setAs("POLISHED_GRANITE_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setAs("GRANITE_SLAB", BridgeMaterial.STONE_SLAB);
|
||||
BlockInit.setAs("POLISHED_GRANITE_SLAB", BridgeMaterial.STONE_SLAB);
|
||||
BlockFlags.addFlags("GRANITE_SLAB", stepFlags);
|
||||
BlockFlags.addFlags("POLISHED_GRANITE_SLAB", stepFlags);
|
||||
BlockInit.setAs("DIORITE_WALL", BridgeMaterial.COBBLESTONE_WALL);
|
||||
BlockInit.setAs("DIORITE_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setAs("POLISHED_DIORITE_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setAs("DIORITE_SLAB", BridgeMaterial.STONE_SLAB);
|
||||
BlockInit.setAs("POLISHED_DIORITE_SLAB", BridgeMaterial.STONE_SLAB);
|
||||
BlockFlags.addFlags("DIORITE_SLAB", stepFlags);
|
||||
BlockFlags.addFlags("POLISHED_DIORITE_SLAB", stepFlags);
|
||||
BlockInit.setAs("ANDESITE_WALL", BridgeMaterial.COBBLESTONE_WALL);
|
||||
BlockInit.setAs("ANDESITE_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setAs("POLISHED_ANDESITE_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setAs("ANDESITE_SLAB", BridgeMaterial.STONE_SLAB);
|
||||
BlockInit.setAs("POLISHED_ANDESITE_SLAB", BridgeMaterial.STONE_SLAB);
|
||||
BlockFlags.addFlags("ANDESITE_SLAB", stepFlags);
|
||||
BlockFlags.addFlags("POLISHED_ANDESITE_SLAB", stepFlags);
|
||||
BlockInit.setAs("BRICK_WALL", BridgeMaterial.COBBLESTONE_WALL);
|
||||
BlockInit.setAs("STONE_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setAs("SMOOTH_QUARTZ_STAIRS", BridgeMaterial.STONE_BRICK_STAIRS);
|
||||
BlockInit.setAs("SMOOTH_STONE_SLAB", BridgeMaterial.STONE_SLAB);
|
||||
BlockInit.setAs("SMOOTH_QUARTZ_SLAB", BridgeMaterial.STONE_SLAB);
|
||||
BlockFlags.addFlags("SMOOTH_STONE_SLAB", stepFlags);
|
||||
BlockFlags.addFlags("SMOOTH_QUARTZ_SLAB", stepFlags);
|
||||
|
||||
BlockInit.setAs("LOOM", BridgeMaterial.CRAFTING_TABLE);
|
||||
BlockInit.setAs("FLETCHING_TABLE", BridgeMaterial.CRAFTING_TABLE);
|
||||
BlockInit.setAs("SMITHING_TABLE", BridgeMaterial.CRAFTING_TABLE);
|
||||
BlockInit.setAs("CARTOGRAPHY_TABLE", BridgeMaterial.CRAFTING_TABLE);
|
||||
BlockInit.setAs("JIGSAW", BridgeMaterial.COMMAND_BLOCK);
|
||||
BlockInit.setAs("BLAST_FURNACE", Material.FURNACE);
|
||||
BlockInit.setAs("SMOKER", Material.FURNACE);
|
||||
BlockProperties.setBlockProps("COMPOSTER", new BlockProperties.BlockProps(BlockProperties.woodAxe, 0.7f, BlockProperties.secToMs(1.1, 0.5, 0.2, 0.15, 0.1, 0.05)));
|
||||
BlockFlags.addFlags("COMPOSTER", BlockFlags.SOLID_GROUND | BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_MIN_HEIGHT8_1);
|
||||
BlockInit.setAs("LECTERN", Material.OAK_PLANKS);
|
||||
BlockFlags.addFlags("LECTERN", BlockProperties.F_MIN_HEIGHT8_1 | BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
|
||||
BlockInit.setAs("BARREL", Material.OAK_PLANKS);
|
||||
BlockProperties.setBlockProps("SCAFFOLDING", instant);
|
||||
BlockFlags.addFlags("SCAFFOLDING", BlockProperties.F_IGN_PASSABLE);
|
||||
BlockFlags.addFlags("SCAFFOLDING", BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
|
||||
BlockFlags.addFlags("SCAFFOLDING", BlockProperties.F_CLIMBABLE);
|
||||
BlockProperties.setBlockProps("STONECUTTER", new BlockProperties.BlockProps(BlockProperties.woodPickaxe, 6.0f, BlockProperties.secToMs(17.0, 2.8, 1.8, 0.7, 0.8, 0.5)));
|
||||
BlockFlags.addFlags("STONECUTTER", BlockProperties.F_MIN_HEIGHT16_9 | BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
|
||||
BlockProperties.setBlockProps("BAMBOO", new BlockProperties.BlockProps(BlockProperties.woodAxe, 0.7f, BlockProperties.secToMs(1.2, 0.5, 0.2, 0.15, 0.1, 0.05)));
|
||||
BlockProperties.setBlockProps("BAMBOO_SAPLING", new BlockProperties.BlockProps(BlockProperties.noTool, 0.7f, BlockProperties.secToMs(1.25)));
|
||||
BlockFlags.addFlags("BAMBOO", BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
|
||||
BlockFlags.addFlags("BAMBOO_SAPLING", BlockProperties.F_IGN_PASSABLE);
|
||||
BlockFlags.addFlags("WITHER_ROSE", BlockProperties.F_IGN_PASSABLE);
|
||||
BlockProperties.setBlockProps("WITHER_ROSE", instant);
|
||||
BlockFlags.addFlags("CORNFLOWER", BlockProperties.F_IGN_PASSABLE);
|
||||
BlockProperties.setBlockProps("CORNFLOWER", instant);
|
||||
BlockFlags.addFlags("LILY_OF_THE_VALLEY", BlockProperties.F_IGN_PASSABLE);
|
||||
BlockProperties.setBlockProps("LILY_OF_THE_VALLEY", instant);
|
||||
BlockInit.setAs("ACACIA_WALL_SIGN", BridgeMaterial.SIGN);
|
||||
BlockInit.setAs("BIRCH_SIGN", BridgeMaterial.SIGN);
|
||||
BlockInit.setAs("BIRCH_WALL_SIGN", BridgeMaterial.SIGN);
|
||||
BlockInit.setAs("DARK_OAK_SIGN", BridgeMaterial.SIGN);
|
||||
BlockInit.setAs("DARK_OAK_WALL_SIGN", BridgeMaterial.SIGN);
|
||||
BlockInit.setAs("JUNGLE_SIGN", BridgeMaterial.SIGN);
|
||||
BlockInit.setAs("JUNGLE_WALL_SIGN", BridgeMaterial.SIGN);
|
||||
BlockInit.setAs("OAK_SIGN", BridgeMaterial.SIGN);
|
||||
BlockInit.setAs("OAK_WALL_SIGN", BridgeMaterial.SIGN);
|
||||
BlockInit.setAs("SPRUCE_SIGN", BridgeMaterial.SIGN);
|
||||
BlockInit.setAs("SPRUCE_WALL_SIGN", BridgeMaterial.SIGN);
|
||||
BlockInit.setAs("GRINDSTONE", Material.COBBLESTONE);
|
||||
BlockFlags.addFlags("GRINDSTONE", BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
|
||||
BlockInit.setAs("CAMPFIRE", Material.OAK_PLANKS);
|
||||
BlockFlags.addFlags("CAMPFIRE", BlockProperties.F_MIN_HEIGHT16_7);
|
||||
BlockFlags.addFlags("CAMPFIRE", BlockProperties.F_GROUND_HEIGHT);
|
||||
BlockFlags.addFlags("BELL", BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
|
||||
BlockProperties.setBlockProps("BELL", new BlockProperties.BlockProps(BlockProperties.woodPickaxe, 7f, BlockProperties.secToMs(23.0, 3.8, 2.2, 1, 1.5, 0.8)));
|
||||
BlockProperties.setBlockProps("LANTERN", new BlockProperties.BlockProps(BlockProperties.woodPickaxe, 6.0f, BlockProperties.secToMs(17.0, 2.8, 1.8, 0.7, 0.8, 0.5)));
|
||||
BlockFlags.addFlags("LANTERN", BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
|
||||
BlockFlags.addFlags("SWEET_BERRY_BUSH", BlockProperties.F_COBWEB);
|
||||
StaticLog.logInfo("Added block-info for Minecraft 1.14 blocks.");
|
||||
}
|
||||
|
||||
}
|
||||
+3
@@ -16,6 +16,7 @@ package fr.neatmonster.nocheatplus.compat.blocks.init.vanilla;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.init.BlockInit;
|
||||
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
|
||||
@@ -40,6 +41,8 @@ public class BlocksMC1_6_1 implements BlockPropertiesSetup{
|
||||
// Hay Bale
|
||||
BlockInit.setPropsAs("HAY_BLOCK", Material.STONE_BUTTON);
|
||||
BlockFlags.setFlagsAs("HAY_BLOCK", Material.STONE); // TODO: Assumption (!).
|
||||
|
||||
if (BridgeMaterial.getBlock("wall_sign") != null) BlockInit.setAs("WALL_SIGN", BridgeMaterial.SIGN);
|
||||
|
||||
// (Carpet via generic setup.)
|
||||
|
||||
|
||||
+1
-2
@@ -48,12 +48,11 @@ public class BlocksMC1_8 implements BlockPropertiesSetup {
|
||||
Material.PUMPKIN,
|
||||
Material.JACK_O_LANTERN,
|
||||
// Same core breaking times, but behave different on efficiency + other tool (?):
|
||||
Material.WALL_SIGN,
|
||||
BridgeMaterial.SIGN,
|
||||
}) {
|
||||
BlockProperties.setBlockProps(mat, props);
|
||||
}
|
||||
|
||||
|
||||
// Ladder.
|
||||
props = new BlockProps(BlockProperties.woodAxe, 0.4f, BlockProperties.secToMs(0.6, 0.3, 0.15, 0.1, 0.075, 0.05));
|
||||
BlockProperties.setBlockProps(Material.LADDER, props);
|
||||
|
||||
+1
@@ -40,6 +40,7 @@ public class VanillaBlocksFactory {
|
||||
setups.add(new BlocksMC1_11());
|
||||
setups.add(new BlocksMC1_12());
|
||||
setups.add(new BlocksMC1_13());
|
||||
setups.add(new BlocksMC1_14());
|
||||
}
|
||||
catch(Throwable t){}
|
||||
for (final BlockPropertiesSetup setup : setups){
|
||||
|
||||
+3
-2
@@ -29,7 +29,7 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
|
||||
/**
|
||||
* Multi client protocol support between 1.7.x - 1.13.x.
|
||||
* Multi client protocol support between 1.7.x - 1.14.x.
|
||||
*
|
||||
* @author asofold
|
||||
*
|
||||
@@ -39,7 +39,7 @@ public class MultiClientProtocolBlockShapePatch extends AbstractBlockPropertiesP
|
||||
|
||||
public MultiClientProtocolBlockShapePatch() {
|
||||
activation
|
||||
.neutralDescription("Block shape patch for multi client protocol support around 1.7.x - 1.13.x.")
|
||||
.neutralDescription("Block shape patch for multi client protocol support around 1.7.x - 1.14.x.")
|
||||
.advertise(true)
|
||||
.setConditionsAND()
|
||||
.notUnitTest()
|
||||
@@ -53,6 +53,7 @@ public class MultiClientProtocolBlockShapePatch extends AbstractBlockPropertiesP
|
||||
|
||||
final List<String> done = new LinkedList<String>();
|
||||
|
||||
//This freaks out with 1.8 using viaversion
|
||||
BlockFlags.addFlags(BridgeMaterial.LILY_PAD,
|
||||
BlockProperties.F_GROUND
|
||||
| BlockProperties.F_HEIGHT8_1
|
||||
|
||||
@@ -483,7 +483,13 @@ public abstract class ConfPaths {
|
||||
public static final String FIGHT_ANGLE_THRESHOLD_YAW = FIGHT_ANGLE_THRESHOLD + "average_yaw";
|
||||
public static final String FIGHT_ANGLE_THRESHOLD_SWITCH = FIGHT_ANGLE_THRESHOLD + "average_switch";
|
||||
public static final String FIGHT_ANGLE_ACTIONS = FIGHT_ANGLE + "actions";
|
||||
|
||||
|
||||
private static final String FIGHT_CLICKPATTERN = FIGHT + "clickpattern.";
|
||||
public static final String FIGHT_CLICKPATTERN_CHECK = FIGHT_CLICKPATTERN + SUB_ACTIVE;
|
||||
public static final String FIGHT_CLICKPATTERN_RANGE = FIGHT_CLICKPATTERN + "range";
|
||||
public static final String FIGHT_CLICKPATTERN_PENALTY = FIGHT_CLICKPATTERN + "penalty";
|
||||
public static final String FIGHT_CLICKPATTERN_ACTIONS = FIGHT_CLICKPATTERN + "actions";
|
||||
|
||||
private static final String FIGHT_CRITICAL = FIGHT + "critical.";
|
||||
public static final String FIGHT_CRITICAL_CHECK = FIGHT_CRITICAL + SUB_ACTIVE;
|
||||
// TODO: Deprecate or rename (->falldistancemin)?
|
||||
@@ -953,7 +959,7 @@ public abstract class ConfPaths {
|
||||
final List<ManyMoved> multiEntries = new LinkedList<ManyMoved>();
|
||||
|
||||
// Add entries.
|
||||
final List<String> cfModels = Arrays.asList("creative", "spectator", "survival", "adventure", "elytra", "levitation");
|
||||
final List<String> cfModels = Arrays.asList("creative", "spectator", "survival", "adventure", "elytra", "levitation", "slowfalling");
|
||||
multiEntries.add(new ManyMoved(MOVING_CREATIVEFLY_MODEL, cfModels, "horizontalspeed", SUB_HORIZONTAL_SPEED));
|
||||
multiEntries.add(new ManyMoved(MOVING_CREATIVEFLY_MODEL, cfModels, "modsprint", SUB_HORIZONTAL_MODSPRINT));
|
||||
multiEntries.add(new ManyMoved(MOVING_CREATIVEFLY_MODEL, cfModels, "maxheight", SUB_VERTICAL_MAXHEIGHT));
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.LinkedList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
|
||||
|
||||
@@ -342,6 +343,11 @@ public class DefaultConfig extends ConfigFile {
|
||||
set(ConfPaths.FIGHT_ANGLE_THRESHOLD_YAW, 50, 1153);
|
||||
set(ConfPaths.FIGHT_ANGLE_THRESHOLD_SWITCH, 50, 1153);
|
||||
set(ConfPaths.FIGHT_ANGLE_ACTIONS, "cancel vl>100 log:angle:3:5:f cancel vl>250 log:angle:0:5:cif cancel", 785);
|
||||
|
||||
set(ConfPaths.FIGHT_CLICKPATTERN_CHECK, "default", 1154);
|
||||
set(ConfPaths.FIGHT_CLICKPATTERN_RANGE, 8, 1154);
|
||||
set(ConfPaths.FIGHT_CLICKPATTERN_PENALTY, 150L, 1154);
|
||||
set(ConfPaths.FIGHT_CLICKPATTERN_ACTIONS, "vl>2 cancel vl>6 log:clickpat:0:7:cif cancel", 1154);
|
||||
|
||||
set(ConfPaths.FIGHT_CRITICAL_CHECK, "default", 785);
|
||||
set(ConfPaths.FIGHT_CRITICAL_FALLDISTANCE, 0.06251, 785);
|
||||
@@ -465,6 +471,15 @@ public class DefaultConfig extends ConfigFile {
|
||||
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "levitation." + ConfPaths.SUB_GRAVITY, false, 785);
|
||||
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "levitation." + ConfPaths.SUB_GROUND, false, 785);
|
||||
}
|
||||
if (Bridge1_13.hasSlowfalling()) {
|
||||
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "slowfalling." + ConfPaths.SUB_HORIZONTAL_SPEED, 110, 785);
|
||||
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "slowfalling." + ConfPaths.SUB_VERTICAL_ASCEND_SPEED, 10, 785);
|
||||
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "slowfalling." + ConfPaths.SUB_VERTICAL_MAXHEIGHT, 128, 1104);
|
||||
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "slowfalling." + ConfPaths.SUB_VERTICAL_GRAVITY, false, 785);
|
||||
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "slowfalling." + ConfPaths.SUB_MODIFIERS, false, 785);
|
||||
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "slowfalling." + ConfPaths.SUB_GRAVITY, true, 785);
|
||||
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "slowfalling." + ConfPaths.SUB_GROUND, true, 785);
|
||||
}
|
||||
if (Bridge1_9.hasElytra()) {
|
||||
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "elytra." + ConfPaths.SUB_HORIZONTAL_SPEED, 520, 785);
|
||||
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "elytra." + ConfPaths.SUB_HORIZONTAL_MODSPRINT, 1.0, 785);
|
||||
@@ -559,6 +574,8 @@ public class DefaultConfig extends ConfigFile {
|
||||
set(ConfPaths.MOVING_VEHICLE_MOREPACKETS_ACTIONS, "cancel vl>10 log:morepackets:0:2:if cancel", 785);
|
||||
|
||||
set(ConfPaths.MOVING_VEHICLE_ENVELOPE_ACTIVE, "default", 785);
|
||||
set(ConfPaths.MOVING_VEHICLE_ENVELOPE_HSPEEDCAP + ".default", 0.9, 1154);
|
||||
set(ConfPaths.MOVING_VEHICLE_ENVELOPE_HSPEEDCAP + ".pig", 0.3, 1154);
|
||||
set(ConfPaths.MOVING_VEHICLE_ENVELOPE_ACTIONS, "cancel vl>100 cancel log:vehicleenvelope:0:15:icf", 785);
|
||||
|
||||
// Messages
|
||||
@@ -618,7 +635,7 @@ public class DefaultConfig extends ConfigFile {
|
||||
final String start = "[player] failed [check]: ";
|
||||
final String end = ". VL [violations].";
|
||||
final String tell = "ncp tell [player] ";
|
||||
set(ConfPaths.STRINGS + ".angle", start + "tried to hit multiple entities at the same time" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".angle", start + "tried to hit multiple entities at the same time (Tags [tags])" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".attackfrequency", start + "attacks with too high a frequency ([packets]/[limit], [tags])" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".ban", "ban [player]", 785);
|
||||
set(ConfPaths.STRINGS + ".ban-ip", "ban-ip [ip]", 785);
|
||||
@@ -633,6 +650,7 @@ public class DefaultConfig extends ConfigFile {
|
||||
set(ConfPaths.STRINGS + ".bwrong", start + "broke another block than clicked" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".captcha", "[player] failed captcha repeatedly" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".chatnormal", start + "potentially annoying chat" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".clickpat", start + " seems to be clicking with bot-like frequencies" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".color", start + "sent colored chat message" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".commands", start + "issued too many commands" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".critical", start + "tried to do a critical hit but wasn't technically jumping [tags]" + end, 785);
|
||||
@@ -658,7 +676,7 @@ public class DefaultConfig extends ConfigFile {
|
||||
set(ConfPaths.STRINGS + ".improbable", start + "meets the improbable more than expected" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".instantbow", start + "fires bow too fast" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".instanteat", start + "eats food [food] too fast" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".inventorymove", start + "interacted with inventory while it was not possible" + end, 1153);
|
||||
set(ConfPaths.STRINGS + ".inventorymove", start + "interacted with inventory while it was not possible (tags [tags])" + end, 1153);
|
||||
set(ConfPaths.STRINGS + ".keepalive", start + "spams keep-alive packets (god/freecam?)" + end, 785);
|
||||
set(ConfPaths.STRINGS + ".kick", "kick [player]", 785);
|
||||
set(ConfPaths.STRINGS + ".kickalive", "ncp kick [player] Too many keep-alive packets.", 785);
|
||||
@@ -716,92 +734,6 @@ public class DefaultConfig extends ConfigFile {
|
||||
)) {
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + name, "default+ign_passable+ground_height", 785);
|
||||
}
|
||||
for (final String woodtype : Arrays.asList(
|
||||
"OAK",
|
||||
"SPRUCE",
|
||||
"BIRCH",
|
||||
"JUNGLE",
|
||||
"ACACIA",
|
||||
"DARK_OAK"
|
||||
)) {
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + woodtype + "_FENCE", "HEIGHT150+THICK_FENCE+VARIABLE+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "NETHER_BRICK_FENCE", "HEIGHT150+THICK_FENCE+VARIABLE+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + woodtype + "_FENCE_GATE", "PASSABLE_X4+VARIABLE_USE+HEIGHT150+THICK_FENCE+VARIABLE+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + woodtype + "_DOOR", "PASSABLE_X4+VARIABLE_USE+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "IRON_DOOR", "PASSABLE_X4+VARIABLE_USE+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + woodtype + "_SLAB", "default+GROUND+XZ100+ground_height", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + woodtype + "_TRAPDOOR", "default+ign_passable+ground_height", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "IRON_TRAPDOOR", "default+ign_passable+ground_height", 1154);
|
||||
} for (final String colors : Arrays.asList(
|
||||
"WHITE",
|
||||
"BLUE",
|
||||
"RED",
|
||||
"MAGENTA",
|
||||
"LIME",
|
||||
"YELLOW",
|
||||
"PINK",
|
||||
"GRAY",
|
||||
"BROWN",
|
||||
"GREEN",
|
||||
"LIGHT_BLUE",
|
||||
"CYAN",
|
||||
"PURPLE",
|
||||
"BLACK",
|
||||
"LIGHT_GRAY",
|
||||
"ORANGE"
|
||||
)) {
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + colors + "_BED", "default+ground_height", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + colors + "_STAINED_GLASS_PANE", "THIN_FENCE+VARIABLE+ground_height+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + colors + "_SHULKER_BOX", "default+HEIGHT150+ground", 1154);
|
||||
} for (final String headType : Arrays.asList(
|
||||
"ZOMBIE",
|
||||
"PLAYER",
|
||||
"CREEPER",
|
||||
"DRAGON"
|
||||
)) {
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + headType + "_HEAD", "solid+ground_height+ground+ground+ign_passable", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "SKELETON_SKULL", "solid+ground_height+ground+ground+ign_passable", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "WITHER_SKELETON_WALL_SKULL", "solid+ground_height+ground+ground+ign_passable", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + headType + "_WALL_HEAD", "solid+ground_height+ground+ground+ign_passable", 1154);
|
||||
} for (final String slabType : Arrays.asList(
|
||||
"STONE",
|
||||
"SANDSTONE",
|
||||
"PETRIFIED_OAK",
|
||||
"COBBLESTONE",
|
||||
"BRICK",
|
||||
"STONE_BRICK",
|
||||
"NETHER_BRICK",
|
||||
"QUARTZ",
|
||||
"RED_SANDSTONE",
|
||||
"PURPUR",
|
||||
"PRISMARINE",
|
||||
"PRISMARINE_BRICK",
|
||||
"DARK_PRISMARINE"
|
||||
)) {
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + slabType + "_SLAB", "default+GROUND+XZ100+ground_height", 1154);
|
||||
}
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "MAGMA_BLOCK", "default+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "LILY_PAD", "default+ign_passable+ground_height", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "END_ROD", "default+ign_passable", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "IRON_BARS", "THIN_FENCE+VARIABLE+ground_height+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "GLASS_PANE", "THIN_FENCE+VARIABLE+ground_height+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "COBBLESTONE_WALL", "HEIGHT150+VARIABLE+THICK_FENCE+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "MOSSY_COBBLESTONE_WALL", "HEIGHT150+VARIABLE+THICK_FENCE+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "ANVIL", "default+ground_height", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "DAMAGED_ANVIL", "default+ground_height", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "CHIPPED_ANVIL", "default+ground_height", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "GRASS_PATH", "default+ground_height", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "SHULKER_BOX", "default+HEIGHT150+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "CHEST", "ground_height+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "TRAPPED_CHEST", "ground_height+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "ENDER_CHEST", "ground_height+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "FARMLAND", "default+height100+ground_height+min_height16_15", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "TURTLE_EGG", "ground_height+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "SEA_PICKLE", "default+ground_height+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "CAULDRON", "ground_height+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "CONDUIT", "ground_height+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "FLOWER_POT", "ground_height+ground", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "ENCHANTING_TABLE", "ground_height+ground", 1154);
|
||||
for (final String DeadCoralType : Arrays.asList(
|
||||
"DEAD_TUBE",
|
||||
"DEAD_BRAIN",
|
||||
@@ -815,12 +747,6 @@ public class DefaultConfig extends ConfigFile {
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "DEAD_TUBE_CORAL_FAN", "default+ign_passable+ground_height", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "DEAD_BRAIN_CORAL_FAN", "default+ign_passable+ground_height", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "DEAD_BUBBLE_CORAL_FAN", "default+ign_passable+ground_height", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "DAYLIGHT_DETECTOR", "default+GROUND+XZ100+ground_height", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "BLUE_ICE", "default+ground_height+allow_lowjump+ice", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "END_PORTAL_FRAME", "default+ign_passable+ground_height+ALLOW_LOWJUMP", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "COCOA", "default+ign_passable+ground_height+ALLOW_LOWJUMP", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "REPEATER", "default+ign_passable+ground_height+ALLOW_LOWJUMP", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "COMPARATOR", "default+ign_passable+ground_height+ALLOW_LOWJUMP", 1154);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS_CHANGETRACKER_ACTIVE, true, 1036); // With lastChangedBuildNumber.
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS_CHANGETRACKER_PISTONS, true, 785);
|
||||
set(ConfPaths.COMPATIBILITY_BLOCKS_CHANGETRACKER_MAXAGETICKS, 80, 785);
|
||||
|
||||
@@ -907,8 +907,13 @@ public class PlayerDataManager implements IPlayerDataManager, ComponentWithName
|
||||
|
||||
@Override
|
||||
public PlayerData getPlayerData(final Player player, boolean create) {
|
||||
try {
|
||||
return getPlayerData(player.getUniqueId(), player.getName(),
|
||||
create, create ? worldDataManager.getWorldDataSafe(player) : null);
|
||||
} catch (Exception e) {
|
||||
// Fake player
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@ package fr.neatmonster.nocheatplus.utilities;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
@@ -51,5 +52,29 @@ public class PotionUtil {
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get amplifier for a potion effect.
|
||||
*
|
||||
* @param entity
|
||||
* the LivingEntity
|
||||
* @param type
|
||||
* the type
|
||||
* @return Double.NEGATIVE_INFINITY if not present, otherwise the maximal
|
||||
* amplifier.
|
||||
*/
|
||||
public static final double getPotionEffectAmplifier(final LivingEntity entity, final PotionEffectType type) {
|
||||
if (!entity.hasPotionEffect(type)) {
|
||||
return Double.NEGATIVE_INFINITY; // TODO: Might not win anything.
|
||||
}
|
||||
final Collection<PotionEffect> effects = entity.getActivePotionEffects();
|
||||
double max = Double.NEGATIVE_INFINITY;
|
||||
for (final PotionEffect effect : effects){
|
||||
if (effect.getType().equals(type)){
|
||||
max = Math.max(max, effect.getAmplifier());
|
||||
}
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -267,6 +267,26 @@ public abstract class AxisTracing implements ICollideBlocks, ISetMargins {
|
||||
return;
|
||||
}
|
||||
final boolean checkInitiallyColliding = shouldCheckForIgnoredBlocks();
|
||||
if (increment == -1) {
|
||||
final double dis = Math.abs(yIn - this.y1);
|
||||
for (int x = iMinX; x <= iMaxX; x++) {
|
||||
for (int z = iMinZ; z <= iMaxZ; z++) {
|
||||
if (dis >= 0.1217 && !step(x, y, z, xMin, increment == 1 ? yStart : yEnd, zMin, xMax, increment == 1 ? yEnd : yStart, zMax, Axis.Y_AXIS, increment)) {
|
||||
if (step(x, y - 1, z, xMin, yEnd, zMin, xMax, yStart -0.7, zMax, Axis.Y_AXIS, increment)) {
|
||||
collides = false;
|
||||
return;
|
||||
} else {
|
||||
if (checkInitiallyColliding && isBlockIgnored(x, y, z) && isBlockIgnored(x, y-1, z)) {
|
||||
// Ignore.
|
||||
} else {
|
||||
collides = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int x = iMinX; x <= iMaxX; x++) {
|
||||
for (int z = iMinZ; z <= iMaxZ; z++) {
|
||||
if (checkInitiallyColliding && isBlockIgnored(x, y, z)) {
|
||||
|
||||
+6
-1
@@ -22,6 +22,7 @@ import fr.neatmonster.nocheatplus.compat.MCAccess;
|
||||
import fr.neatmonster.nocheatplus.components.registry.event.IHandle;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
@@ -32,6 +33,8 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
*/
|
||||
public class RichEntityLocation extends RichBoundsLocation {
|
||||
|
||||
private final boolean is1_14Above = BridgeMaterial.getBlock("lectern") != null;
|
||||
|
||||
/*
|
||||
* TODO: HumanEntity default with + height (1.11.2): elytra 0.6/0.6,
|
||||
* sleeping 0.2/0.2, sneaking 0.6/1.65, normal 0.6/1.8 - head height is 0.4
|
||||
@@ -369,7 +372,9 @@ public class RichEntityLocation extends RichBoundsLocation {
|
||||
isLiving = true;
|
||||
final LivingEntity living = (LivingEntity) entity;
|
||||
eyeHeight = living.getEyeHeight();
|
||||
fullHeight = Math.max(Math.max(fullHeight, eyeHeight), living.getEyeHeight(true));
|
||||
//Sneaking in Minecraft 1.14 and possibility later version will have lower height
|
||||
// 0.179999?
|
||||
fullHeight = is1_14Above ? eyeHeight + 0.179 : Math.max(Math.max(fullHeight, eyeHeight), living.getEyeHeight(true));
|
||||
}
|
||||
else {
|
||||
isLiving = false;
|
||||
|
||||
+4966
-4906
File diff suppressed because it is too large.
Load diff
@@ -88,7 +88,7 @@ public class MapUtil {
|
||||
for (int cz = minZ; cz <= maxZ; cz ++) {
|
||||
if (!world.isChunkLoaded(cx, cz)) {
|
||||
try {
|
||||
world.loadChunk(cx, cz);
|
||||
world.getChunkAt(cx, cz);
|
||||
loaded ++;
|
||||
} catch (Exception ex) {
|
||||
// (Can't seem to catch more precisely: TileEntity with CB 1.7.10)
|
||||
|
||||
@@ -365,7 +365,7 @@ public class MaterialUtil {
|
||||
public static final Set<Material> WATER = Collections.unmodifiableSet(
|
||||
BridgeMaterial.getAllBlocks("water", "stationary_water"));
|
||||
public static final Set<Material> NEWLIQ = Collections.unmodifiableSet(
|
||||
BridgeMaterial.getAllBlocks("SEA_PICKLE", "TALL_SEAGRASS", "KELP_PLANT", "SEAGRASS"));
|
||||
BridgeMaterial.getAllBlocks("TALL_SEAGRASS", "KELP_PLANT", "SEAGRASS", "KELP"));
|
||||
|
||||
/** Wood types (1.13 rather). */
|
||||
public static final Set<Material> WOOD_BLOCKS = Collections.unmodifiableSet(addBlocks(
|
||||
@@ -518,6 +518,15 @@ public class MaterialUtil {
|
||||
Material.LEVER,
|
||||
BridgeMaterial.END_PORTAL,
|
||||
BridgeMaterial.NETHER_PORTAL))
|
||||
|
||||
));
|
||||
/**
|
||||
* Collections of blocks that are allowed all types of movement.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final Set<Material> LIQUID_BLOCKS = Collections.unmodifiableSet(join(
|
||||
DEAD_CORAL_PARTS,
|
||||
NEWLIQ
|
||||
));
|
||||
|
||||
////////////////////
|
||||
|
||||
+6
-6
@@ -10,8 +10,8 @@
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>Mainly contains the plugin class and the factories.
|
||||
|
||||
<description>Mainly contains the plugin class and the factories.
|
||||
|
||||
For the plugin/artifact version see the NoCheatPlus module.</description>
|
||||
<parent>
|
||||
<groupId>fr.neatmonster</groupId>
|
||||
@@ -28,9 +28,9 @@ For the plugin/artifact version see the NoCheatPlus module.</description>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.14.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -100,4 +100,4 @@ For the plugin/artifact version see the NoCheatPlus module.</description>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
@@ -1085,7 +1085,6 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
||||
StaticLog.setStreamID(Streams.STATUS);
|
||||
// Tell the server administrator that we finished loading NoCheatPlus now.
|
||||
logManager.info(Streams.INIT, "Version " + getDescription().getVersion() + " is enabled.");
|
||||
logManager.warning(Streams.INIT, "You are running a modified version of NCP. This version should only be used on 1.13 servers. This is only intended as a band-aid fix while NCP can be properly updated to 1.13. You may be sacrificing cheat protection for compatibility");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
@@ -47,6 +47,12 @@ public class DefaultComponentFactory {
|
||||
|
||||
public DefaultComponentFactory() {
|
||||
for (Activation condition : Arrays.asList(
|
||||
new Activation()
|
||||
.neutralDescription("ProtocolLib 4.5.0 or later for Minecraft 1.14.x")
|
||||
.pluginVersionGT("ProtocolLib", "4.5.0", true)
|
||||
.minecraftVersionBetween("1.14", true, "1.15", false)
|
||||
.advertise(true)
|
||||
,
|
||||
new Activation()
|
||||
.neutralDescription("ProtocolLib 4.4.0 or later for Minecraft 1.13.x")
|
||||
.pluginVersionGT("ProtocolLib", "4.4.0", true)
|
||||
|
||||
+11
-10
@@ -33,9 +33,10 @@ import fr.neatmonster.nocheatplus.logging.StaticLog;
|
||||
*/
|
||||
public class MCAccessFactory {
|
||||
|
||||
//Message below is sent when CBDedicated and CBReflect failed to run and NCP switches to bukkit's api as it can't tell the server version.
|
||||
private final String[] updateLocs = new String[] {
|
||||
" Check for updates and support at BukkitDev: https://dev.bukkit.org/projects/nocheatplus/",
|
||||
" Development builds (unsupported by the Bukkit Staff, use at your own risk): https://ci.md-5.net/job/NoCheatPlus/changes",
|
||||
// " Check for updates and support at BukkitDev: https://dev.bukkit.org/projects/nocheatplus/",
|
||||
// " Development builds (unsupported by the Bukkit Staff, use at your own risk): https://ci.md-5.net/job/NoCheatPlus/changes",
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -49,6 +50,14 @@ public class MCAccessFactory {
|
||||
MCAccess mcAccess = null;
|
||||
// Try to set up native access.
|
||||
|
||||
// Bukkit API only: 1.13 (and possibly later).
|
||||
try {
|
||||
return new MCAccessBukkitModern();
|
||||
}
|
||||
catch(Throwable t) {
|
||||
throwables.add(t);
|
||||
}
|
||||
|
||||
// CraftBukkit (dedicated).
|
||||
if (config.enableCBDedicated) {
|
||||
mcAccess = getMCAccessCraftBukkit(throwables);
|
||||
@@ -67,14 +76,6 @@ public class MCAccessFactory {
|
||||
}
|
||||
}
|
||||
|
||||
// Bukkit API only: 1.13 (and possibly later).
|
||||
try {
|
||||
return new MCAccessBukkitModern();
|
||||
}
|
||||
catch(Throwable t) {
|
||||
throwables.add(t);
|
||||
}
|
||||
|
||||
// Try to set up api-only access (since 1.4.6).
|
||||
try {
|
||||
mcAccess = new MCAccessBukkit();
|
||||
|
||||
@@ -46,16 +46,16 @@ public class TestConfig {
|
||||
testReadMaterial(lilys.replaceAll("_", "-"), lily);
|
||||
testReadMaterial(lilys.replaceAll("e", "E"), lily);
|
||||
|
||||
testReadMaterial("flint and steel", Material.FLINT_AND_STEEL);
|
||||
testReadMaterial("259", Material.FLINT_AND_STEEL);
|
||||
//testReadMaterial("flint and steel", Material.FLINT_AND_STEEL);
|
||||
//testReadMaterial("259", Material.FLINT_AND_STEEL);
|
||||
|
||||
// Generic test.
|
||||
for (final Material mat : Material.values()) {
|
||||
if (mat.name().equalsIgnoreCase("LOCKED_CHEST")) {
|
||||
continue;
|
||||
}
|
||||
testReadMaterial(mat.name(), mat);
|
||||
testReadMaterial(Integer.toString(mat.getId()), mat);
|
||||
//testReadMaterial(mat.name(), mat);
|
||||
//testReadMaterial(Integer.toString(mat.getId()), mat);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,10 +103,10 @@ public class TestConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActionLists() {
|
||||
ConfigFile config = new DefaultConfig();
|
||||
config.getOptimizedActionList(ConfPaths.MOVING_SURVIVALFLY_ACTIONS, null);
|
||||
}
|
||||
// @Test
|
||||
// public void testActionLists() {
|
||||
// ConfigFile config = new DefaultConfig();
|
||||
// config.getOptimizedActionList(ConfPaths.MOVING_SURVIVALFLY_ACTIONS, null);
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
### Build Status
|
||||
[](https://semaphoreci.com/captainobvious0/nocheatplus)
|
||||
|
||||
NoCheatPlus
|
||||
---------
|
||||
NoCheatPlus is a fork of the famous anti-cheat plugin [NoCheat](https://dev.bukkit.org/projects/nocheat/) created by [Evenprime](https://github.com/Evenprime). NoCheatPlus attempts to enforce "vanilla Minecraft" mechanics, as well as preventing players from abusing weaknesses in Minecraft or its protocol, making your server more safe. Organized in different sections, various checks are performed to test players doing, covering a wide range including flying and speeding, fighting hacks, fast block breaking and nukers, inventory hacks, chat spam and other types of malicious behaviour. For a more complete list have a look at the always outdated [Features Page](https://github.com/NoCheatPlus/Docs/wiki/Features).
|
||||
@@ -15,78 +18,3 @@ Hints
|
||||
* Don't use tabs in the config.yml file.
|
||||
* Use [ProtocolLib](https://dev.bukkit.org/bukkit-plugins/protocollib) for full efficiency of the fight checks and other. Using a version of ProtocolLib that is supported by NCP is essential, as otherwise some checks will be disabled.
|
||||
* For compatibility with other plugins such as mcMMO, citizens and more check out [CompatNoCheatPlus](https://dev.bukkit.org/projects/compatnocheatplus-cncp/).
|
||||
|
||||
Links
|
||||
---------
|
||||
|
||||
###### Project
|
||||
* [NoCheatPlus at SpigotMC](https://www.spigotmc.org/resources/nocheatplus2015-07-25.26/)
|
||||
* [NoCheatPlus at BukkitDev](https://dev.bukkit.org/projects/nocheatplus/)
|
||||
|
||||
###### Download
|
||||
* [BukkitDev (approved by staff)](https://dev.bukkit.org/projects/nocheatplus/files/)
|
||||
* [SpigotMC (not inspected by staff)](https://www.spigotmc.org/resources/nocheatplus2015-07-25.26/updates)
|
||||
* [Jenkins (all builds including development versions)](https://ci.md-5.net/job/NoCheatPlus/)
|
||||
|
||||
###### Support and Documentation
|
||||
* [Issues/Tickets](https://github.com/NoCheatPlus/Issues/issues)
|
||||
* [Wiki](https://github.com/NoCheatPlus/Docs/wiki)
|
||||
* [Configuration](https://github.com/NoCheatPlus/Docs/wiki/Configuration)
|
||||
* [Permissions](https://github.com/NoCheatPlus/Docs/wiki/Permissions)
|
||||
* [Commands](https://github.com/NoCheatPlus/Docs/wiki/Commands)
|
||||
|
||||
###### Developers
|
||||
* [License (GPLv3)](https://github.com/NoCheatPlus/NoCheatPlus/blob/master/LICENSE.txt)
|
||||
* [API](https://github.com/NoCheatPlus/Docs/wiki/API)
|
||||
* [Contribute](https://github.com/NoCheatPlus/NoCheatPlus/blob/master/CONTRIBUTING.md)
|
||||
|
||||
###### Related Plugins
|
||||
* [ProtocolLib at BukkitDev](https://dev.bukkit.org/bukkit-plugins/protocollib)
|
||||
* [CompatNoCheatPlus at BukkitDev](https://dev.bukkit.org/projects/compatnocheatplus-cncp/)
|
||||
|
||||
###### Obtain a build of Spigot
|
||||
* [Get the latest BuildTools.jar](https://hub.spigotmc.org/jenkins/job/BuildTools/)
|
||||
* [Run according to instructions](https://www.spigotmc.org/wiki/buildtools/)
|
||||
* ([Server installation instructions](https://www.spigotmc.org/wiki/spigot-installation/))
|
||||
|
||||
Compiling NoCheatPlus
|
||||
---------
|
||||
* NoCheatPlus used to be compiled with java 6 compliance (note OpenJDK, possibly we'll switch to 8 directly, once appropriate, e.g. with ProtocolLib dropping support for 7.).
|
||||
* We use [Maven](http://maven.apache.org/download.cgi) 3 to handle the dependencies. Tested both with Eclipse and Jenkins is Maven 3.3.9.
|
||||
* You can compile with this Maven goal: `mvn clean package`, for a build without any of the "non free" modules, which depened on not publicly downloadable resources, such as the CraftBukkit/Spigot server jar - the reflection based compatibility module is still contained.
|
||||
* In order to include a pre-built jar with the "non free" modules contained, use `-P nonfree_include`.
|
||||
* To also (re-) build "non free" compatibility modules, use `-P nonfree_build` as well as activating the appropriate module to build via a profile such as `-P cbdev` - see the tables below for reference.
|
||||
* Have a look at the NCPCompatNonFree sub module for reference on how to add custom compatibility modules. If you add custom modules with a different package naming than `fr.neatmonster`, you might have to update the includes section within NCPCompatNonFreeJar as well. The related factories are located within the NCPPlugin module (e.g. MCAccessFactory).
|
||||
* "Non free" jar file dependencies needed for the dedicated compat modules, which your local maven repository might be missing, can be installed manually.
|
||||
Example for Eclipse with embedded maven:
|
||||
Add a new maven build run configuration, name it appropriately, e.g. ```Install CB 1.7.5```.
|
||||
Set goals to: ```install:install-file -Dfile=<PATH TO JAR> -DgroupId=org.bukkit -DartifactId=craftbukkit -Dversion=1.7.5-R0.1-SNAPSHOT -Dpackaging=jar```
|
||||
On Windows the <PATH TO JAR> might look like: ```X:\...\craftbukkit\3042\craftbukkit-1.7.5-R0.1-20140408.020329-16.jar```
|
||||
To let it run you might have to set the base directory, e.g. to ```${workspace_loc}```, it does not seem to have significance.
|
||||
Do set the correct version alongside the file name. On newer version of maven, you might do with much simplified goals, because the pom files inside the jars are parsed.
|
||||
* **The latest versions of BuildTools.jar will automatically install the created server jars into the local .m2 repository (e.g. on linux) - provided configuration paths are standard. Thus you don't need to do this manually anymore, if you then build NCP with the specific profile, if you have run BuildTools.jar to generate the server jars on that machine/environment.**
|
||||
|
||||
Options and profiles related to enabling/disabling including/building "non free" compatibility modules.
|
||||
|
||||
| Profile | Parameter | Description |
|
||||
| :------------------ | :-------------- | :-------------- |
|
||||
| `-P nonfree_include` | _none_ | The "non free" modules are included via a pre-built jar file from the repository. |
|
||||
| `-P nonfree_build` | _none_ | Enable building "non free" compatibility modules. The NCPCompatNonFree jar file is built/installed/(deployed). |
|
||||
| _none_ | _none_ | The "non free" modules are neither built, nor included via a pre-built jar file. |
|
||||
|
||||
Profiles for choice of "non free" compatibility modules to build:
|
||||
|
||||
| Profile | Description |
|
||||
| :------------------ | :-------------- |
|
||||
| _none_ | Default build without any of the native access modules, might pose compatibility issues with latest Minecraft versions. The reflection based module is included here. |
|
||||
| `-P all` | All compatibility modules. |
|
||||
| `-P cbdev` | The latest version in development. |
|
||||
| `-P spigot1_12_r1` | Spigot 1.12 R1 (MC 1.12-1.12.2). |
|
||||
| `-P spigot1_11_r1` | Spigot 1.11 R1 (MC 1.11-1.11.2). |
|
||||
| `-P spigot1_10_r1` | Spigot 1.10 R1 (MC 1.10-1.10.2). |
|
||||
| `-P spigot1_9_r2` | Spigot 1.9 R2 (MC 1.9.4). |
|
||||
| `-P spigot1_8_r3` | Spigot 1.8 R3 (MC 1.8.4-1.8.8). |
|
||||
| `-P spigot1_7_r4` | Spigot 1.7 R4 (MC 1.7.10). |
|
||||
| `-P cblegacy` | The pre-DMCA CraftBukkit builds. |
|
||||
|
||||
(On the long run, only the latest module for a major Minecraft release may be be kept, such as 1_8_r3 for all of 1.8.x.)
|
||||
@@ -44,10 +44,14 @@
|
||||
</repository>
|
||||
<!-- <repository> <id>md_5-releases</id> <url>http://repo.md-5.net/content/repositories/releases/</url>
|
||||
</repository> <repository> <id>md_5-snapshots</id> <url>http://repo.md-5.net/content/repositories/snapshots/</url>
|
||||
</repository> -->
|
||||
</repository>
|
||||
<repository>
|
||||
<id>bukkit</id>
|
||||
<url>http://repo.bukkit.org/content/groups/public/</url>
|
||||
</repository> -->
|
||||
<repository>
|
||||
<id>nms-repo</id>
|
||||
<url>https://repo.codemc.org/repository/nms/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
||||
Reference in new issue
Block a user