95 Commits
Author SHA1 Message Date
Xaw3ep d2a2687b83 Merge pull request #15 from xaw3ep/tmp
Fixes bugs, bypasses
2019-09-10 18:23:36 +07:00
Xaw3ep e90d8306a4 Remove an annoying test
Some tests haven't been updated for a long time ago, so they are outdated and become useless. 
Will check all of them later on
2019-09-10 18:01:52 +07:00
xaw3ep c84966bbd4 Better speed support
- Adds attribute, DolphinGrace speed modifiers for creativefly.
- Adds speed modifiers survivalfly when sneaking, using items, moving in soulsand and cobweb. Also for some sub-checks
2019-09-07 18:00:27 +07:00
Xaw3ep 83426ab04f Attempt to fix an error
Mostly prevent from getting blocks outside the world by left-clicking
2019-09-05 21:18:06 +07:00
Xaw3ep 39e0f10019 Typo 2019-09-04 06:06:01 +07:00
Xaw3ep 008f1a7a7e Another NullPointerException fixes
Should check all ProtocolLib hooks
2019-09-04 06:00:56 +07:00
Xaw3ep 55b9590a52 Prevent stuck in blocks 2019-09-03 11:07:44 +07:00
Xaw3ep a73ad559df Active anti-levitate check
Can cause some false-positives if the player had effects before and have been on the server for longer than 20 seconds after joined but the client still doesn't apply the effects to them.
Get the effects on join and reapply those is a good solution?
2019-09-02 22:21:21 +07:00
xaw3ep 0bbd26dd9b Block some more hacks + Format
- 2.5 step
- 4.5 block height jesus
- Adds watermove(2) sub-check will be best for checking moving horizontally in water
2019-09-01 07:59:03 +07:00
xaw3ep b39f8e0bf4 Blocks BowFly + Format 2019-09-01 06:44:11 +07:00
Xaw3ep c2512bc014 Noslow fixes
NullPointerException
2019-08-31 23:06:02 +07:00
xaw3ep f588275d37 Reduces passable false-positive
When try to get out block or move around inside block
2019-08-30 22:36:42 +07:00
Xaw3ep 3034c8db7a Fixes Passable bypass
Pretty easier than I thought, hope it won't cause any trouble
2019-08-30 20:34:41 +07:00
Xaw3ep d3be5af828 Another attempt 2019-08-26 19:43:07 +07:00
Xaw3ep 17d2c3245d NullPointerException fix 2019-08-25 23:32:57 +07:00
Xaw3ep 41bf0cc684 Merge pull request #10 from xaw3ep/compatibility
- 1.7-1.14.4 compatibility
- clean up startup messages, poms
- Reduces SurvivalFly false positives
- Fixes enter endportal from bottom cause Creativefly VL spike
- ...
2019-08-22 19:34:07 +07:00
xaw3ep 0a973ff745 Reduces checks fp
- waterjump 1.8-1.14.4
- swimup 1.13-1.14.4
2019-08-22 19:16:04 +07:00
Xaw3ep c7137ff5b6 Forgot to add stationary_water 2019-08-21 16:36:32 +07:00
Xaw3ep e1357e96f2 Makes bamboo fully passable
Seem like bamboo modeling didn't work well in some servers
2019-08-20 22:20:26 +07:00
Xaw3ep 2b313d70fa Copy-pasted wrongly in a rush 2019-08-20 20:00:04 +07:00
Xaw3ep 517e4be891 Update MovingListener.java 2019-08-20 19:53:03 +07:00
xaw3ep 08b2f47404 1.14 Vehicle leave fixes
Not fully sure
2019-08-20 19:49:03 +07:00
Xaw3ep 9a2473029f Fixes an endportal issue 2019-08-20 18:15:45 +07:00
Xaw3ep f6a1d2bed7 Remove compat messages for 1.13,1.14 2019-08-17 11:19:37 +07:00
Xaw3ep f5ad1d36ae Merge pull request #8 from MarkElf/master
More minor changes for compat messages
2019-08-17 05:20:16 +07:00
Xaw3ep 7d41589529 Merge branch 'compatibility' into master 2019-08-17 05:15:28 +07:00
MarkElf ab4d0a9004 Update MCAccessBukkitModern.java 2019-08-16 14:18:07 -04:00
MarkElf a823f1e6e8 Merge pull request #1 from MarkElf/patch-1
Update MCAccessCBReflect.java
2019-08-16 13:42:31 -04:00
MarkElf 4736f75563 Update MCAccessCBReflect.java 2019-08-16 13:32:54 -04:00
xaw3ep 3ea26bf0cb Another try 2019-08-16 23:29:04 +07:00
Xaw3ep eb52a3c516 Merge pull request #9 from xaw3ep/tmp
Poms clean up
2019-08-16 16:06:56 +07:00
Xaw3ep e770a09342 Update pom.xml 2019-08-16 15:46:22 +07:00
Xaw3ep 6bd529cc40 Update pom.xml 2019-08-16 15:33:52 +07:00
Xaw3ep 07aed9bb6c Update pom.xml 2019-08-16 15:31:39 +07:00
Xaw3ep 38ff02682a Update pom.xml 2019-08-16 15:24:34 +07:00
Xaw3ep 43195a3a8d Update pom.xml 2019-08-16 15:17:36 +07:00
Xaw3ep 9500b491f0 Update pom.xml 2019-08-16 15:04:11 +07:00
Xaw3ep b91bceaf38 Update pom.xml 2019-08-16 14:56:21 +07:00
MarkElf 7473559e6f Clarity in notes
Notes update
2019-08-15 21:22:11 -04:00
MarkElf 2a1678dcb5 Removed unneeded compat warning message 2019-08-15 20:52:07 -04:00
MarkElf 3822f69fe3 Remove start-up message about 1.13 compat 2019-08-15 20:37:48 -04:00
MarkElf bda7cc7742 Update MultiClientProtocolBlockShapePatch.java 2019-08-15 20:36:06 -04:00
Xaw3ep 1e3e2b0842 Disable model for Bamboo blocks
Sometimes it works correctly and vice versa. Will investigate later
2019-08-16 07:35:00 +07:00
Xaw3ep 83a391d15d 1.13 Sign fixes 2019-08-16 06:52:12 +07:00
Xaw3ep 2e26c51988 Merge pull request #7 from MarkElf/master
Fix version output + don't keep chunks loaded forever
2019-08-16 06:12:33 +07:00
MarkElf d640a702d6 Update MapUtil.java 2019-08-15 18:37:21 -04:00
MarkElf eee2eab5ce Update MCAccessBukkitBase.java 2019-08-15 18:27:09 -04:00
xaw3ep 1822366c87 1.6.1-1.14.4 ?
Hmm, did I forget anything ?
2019-08-15 10:55:05 +07:00
Xaw3ep bc6b9e548f Merge pull request #6 from fixes-improve 2019-08-14 07:46:23 +07:00
Xaw3ep 77d9a806cc Merge branch 'master' into fixes-improve 2019-08-14 07:40:22 +07:00
Xaw3ep c5ccf0c237 Fake players fixes 2019-08-14 07:27:04 +07:00
xaw3ep d1b6bc0ac2 Noslow fixes and a bit change of movement speed 2019-08-14 07:14:24 +07:00
Xaw3ep 0f57ca23a6 Some cleanup
Update pom.xml 1.14.3 -> 1.14.4 / minor config change
2019-08-14 06:05:00 +07:00
MarkElf 5b6d0475da Update DefaultConfig.java 2019-08-13 15:54:57 -04:00
MarkElf 36af146c10 Update pom.xml 2019-08-13 15:52:28 -04:00
MarkElf 263ec46f19 Update pom.xml 2019-08-13 15:51:59 -04:00
MarkElf df58970cd9 Update pom.xml 2019-08-13 15:51:36 -04:00
xaw3ep 3e2a99e2e5 Liquid blocks fixes
Realized that kelp was block on top of kelp plant and kelp_plant was the body, in other words, kelp hasn't been defined.
And another waterlogged blocks fixes
2019-08-12 14:44:30 +07:00
xaw3ep c24346708d Disable most block checks for scaffolding
Due to its weird way of placing and some client-side problems it makes some checks work incorrectly
2019-08-11 14:34:41 +07:00
Xaw3ep 94ed22789c Oops 2019-08-10 09:30:55 +07:00
Xaw3ep 2e41d0273d Some minor fixes
- Blocks some more types of Jesus(water walk)
- Fixes another sprintback false-positive related to dolphin grace effect
2019-08-10 09:23:37 +07:00
xaw3ep e47260d5c7 Compile fix ? 2019-08-08 17:18:46 +07:00
xaw3ep 8286810566 Better no slow check
Not only for sword any longer
2019-08-08 12:09:35 +07:00
xaw3ep 63c9e403e4 Improve vehicle speed check 2019-08-08 11:22:34 +07:00
xaw3ep b4e4999803 Update Lib
For later uses
2019-08-08 11:06:20 +07:00
Xaw3ep 20fc013b6e Fixes boat and soulsand fp 2019-08-02 17:20:00 +07:00
xaw3ep b3143bc432 Adjust values
- Only allow fast swimming when isswimming return true
- Riptide speed will be given by riptide enchant level
- Change dolphin grace speed
- Reduce gliding and riptiding fp (not sure)
2019-08-02 17:08:18 +07:00
Xaw3ep cc96d90199 Compile fix ? 2019-07-31 11:09:33 +07:00
Xaw3ep b3da6cf1af Fixes soulsand water elevator cause false positive
Still quite buggy
2019-07-31 10:48:44 +07:00
Xaw3ep 50d5fdffb6 Add timeVehicletoss data 2019-07-31 10:36:08 +07:00
Xaw3ep e746ba5c92 Update MovingListener.java
- Miniature inspection scope
- Only cancel when boat is in water
2019-07-31 08:37:51 +07:00
xaw3ep 7d01b45e93 Completes blocks define 2019-07-31 00:23:54 +07:00
Xaw3ep f0d22a110d Fix player height 2019-07-30 08:34:43 +07:00
Xaw3ep e1b11c367c Update FastHeal.java
Make sure it won't be able to enable by some cases override its first setting
2019-07-29 21:43:13 +07:00
Xaw3ep 2ada6d74cc Update BukkitChorusPlant.java
Make it compatible with version 1.13 and 1.13.1
* Still won't change anything much as it still a passable block
2019-07-29 21:33:36 +07:00
Xaw3ep 7b8d285c83 Update BukkitBamboo.java 2019-07-29 11:55:56 +07:00
Xaw3ep 35cc00b3b2 Update SurvivalFly.java
Sorry for accidentally letting some hacks bypass
2019-07-27 13:21:47 +07:00
Xaw3ep 60a8b7db9d Update InventoryListener.java
I forgot there also have trapped_chest
2019-07-26 15:59:00 +07:00
Xaw3ep ff0497ec62 Update SurvivalFly.java
Reduce sp sprintback false-positive
2019-07-26 15:09:32 +07:00
Xaw3ep 9a32beb9ba Update FastClick.java
Ignore check when using method to get and put items quickly
2019-07-26 15:05:53 +07:00
Xaw3ep b880e5ddd2 Update InventoryListener.java
- Fixes FastClick check conditions
- Added check for barrel and shulker_box
2019-07-26 15:01:18 +07:00
xaw3ep bf431db516 Too close value
Easy to reach to these value.So I increaced a bit
2019-07-24 11:34:59 +07:00
Xaw3ep 110de1eef3 Riptiding and Gliding smoother 2019-07-24 00:00:44 +07:00
Xaw3ep 15d2923407 Update CreativeFly.java 2019-07-23 23:00:02 +07:00
Xaw3ep 528cf5e5e1 Update MovingListener.java
No longer be set back when riptide too high.
But be careful. You will be kicked by the server for floating too long!
2019-07-23 22:50:34 +07:00
Xaw3ep 90d0f41824 Update CreativeFly.java
Reduce false-positive when Gliding and Riptiding
2019-07-23 22:39:03 +07:00
Xaw3ep 2dca31bf63 Update VehicleEnvelope.java
A lazy way to fix false-positive when boats are knocked up by soulsand water elevator.
2019-07-23 00:21:23 +07:00
Xaw3ep f287974765 Update MovingListener.java
Fixes standing on boat issues
2019-07-23 00:15:15 +07:00
Xaw3ep a5021c5bdb Update SurvivalFly.java
Fix water elevator with soul sand false positive
2019-07-22 00:48:21 +07:00
Xaw3ep 3d7f20bb29 Fix sprint back false positive
When in water and has dolphins_grace effect
2019-07-22 00:21:06 +07:00
Xaw3ep 2e05c37f25 Update BlockProperties.java 2019-07-21 15:16:18 +07:00
Xaw3ep b069c6c494 Update MCAccessBukkitModern.java
Totally forgot that walls can have smaller XZinset when standing in a line
2019-07-21 15:12:58 +07:00
Xaw3ep 1f6bc2694a Model for walls 2019-07-21 15:07:56 +07:00
Xaw3ep e72929d87b Update SurvivalFly.java
Fixes issues related to waterlogged block
2019-07-21 13:52:22 +07:00
Xaw3ep e4569977e9 Fixes startup error on 1.13.2 2019-07-17 11:24:48 +07:00
57 changed files with 5779 additions and 4785 deletions

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.3-R0.1-SNAPSHOT</version>
<version>1.14.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -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
@@ -57,11 +57,10 @@ 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 BukkitFence(
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 BukkitStatic(
0.75, 0.25, 0.0, 0.25, 0.75, 0.5);
private static final BukkitShapeModel MODEL_WALL_HEAD = new BukkitWallHead();
// Static blocks (various height and inset values).
@@ -123,7 +122,7 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
@Override
public String getMCVersion() {
return "1.13.2-1.14|?";
return "1.13-1.14.4|?";
}
@Override
@@ -142,21 +141,20 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
// TODO: Also consider removing flags (passable_x4 etc).
// Variables for repeated flags (Temporary flags, these should be fixed later so that they are not added here)
final long headFlags = BlockFlags.SOLID_GROUND | BlockProperties.F_XZ100 | BlockProperties.F_IGN_PASSABLE;
final long blockFix = BlockFlags.SOLID_GROUND | BlockProperties.F_XZ100 | BlockProperties.F_IGN_PASSABLE;
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, BlockProperties.F_IGN_PASSABLE | BlockFlags.SOLID_GROUND | BlockProperties.F_GROUND | BlockProperties.F_XZ100);
BlockProperties.setBlockFlags(Material.TURTLE_EGG, blockFix);
BlockProperties.setBlockFlags(Material.CHORUS_PLANT, blockFix);
BlockProperties.setBlockFlags(Material.CREEPER_WALL_HEAD, headFlags);
BlockProperties.setBlockFlags(Material.ZOMBIE_WALL_HEAD, headFlags);
BlockProperties.setBlockFlags(Material.PLAYER_WALL_HEAD, headFlags);
BlockProperties.setBlockFlags(Material.DRAGON_WALL_HEAD, headFlags);
BlockProperties.setBlockFlags(Material.WITHER_SKELETON_WALL_SKULL, headFlags);
BlockProperties.setBlockFlags(Material.SKELETON_WALL_SKULL, headFlags);
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[] {
@@ -35,8 +35,11 @@ public class BukkitBamboo implements BukkitShapeModel {
minX = Double.parseDouble(df.format(minX));
minZ = Double.parseDouble(df.format(minZ));
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};
//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
@@ -14,12 +14,9 @@
*/
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;
@@ -32,16 +29,37 @@ public class BukkitChorusPlant implements BukkitShapeModel {
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;
}
}
}
double minX = Math.abs(block.getBoundingBox().getMinX()) - Math.abs((int) block.getBoundingBox().getMinX());
double minY = Math.abs(block.getBoundingBox().getMinY()) - Math.abs((int) block.getBoundingBox().getMinY());
double minZ = Math.abs(block.getBoundingBox().getMinZ()) - Math.abs((int) block.getBoundingBox().getMinZ());
double maxX = Math.abs(block.getBoundingBox().getMaxX()) - Math.abs((int) block.getBoundingBox().getMaxX());
double maxY = Math.abs(block.getBoundingBox().getMaxY()) - Math.abs((int) block.getBoundingBox().getMaxY());
double maxZ = Math.abs(block.getBoundingBox().getMaxZ()) - Math.abs((int) block.getBoundingBox().getMaxZ());
return new double[] {minX, minY, minZ, maxX, maxY, maxZ};
return res;
}
@Override
@@ -16,8 +16,10 @@ 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;
@@ -31,17 +33,51 @@ public class BukkitCocoa implements BukkitShapeModel {
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof Cocoa) {
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
return new double[] {0.625, 0.4375, 0.0625, 0.375, 0.75, 0.3125};
case 1: // .6875 .3125 .0625 max: .3125 .75 .4375
return new double[] {0.6875, 0.3125, 0.0625, 0.3125, 0.75, 0.4375};
case 2: // .75 .1875 .0625 max: .25 .75 .5625
return new double[] {0.75, 0.1875, 0.0625, 0.25, 0.75, 0.5625};
default:
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};
@@ -35,11 +35,11 @@ public class BukkitTurtleEgg implements BukkitShapeModel {
final TurtleEgg egg = (TurtleEgg) blockData;
switch (egg.getEggs()) {
case 1: // .8125 0.0 .1875 max: .25 .4375 .75
return new double[] {0.8125, 0.0, 0.1875, 0.25, 0.4375, 0.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.9375, 0.0, 0.0625, 0.0625, 0.4375, 0.9375};
return new double[] {0.0625, 0.0, 0.0625, 0.9375, 0.4375, 0.9375};
default:
break;
}
@@ -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;
}
}
@@ -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;
}
}
@@ -53,7 +53,7 @@ public class MCAccessCBReflect extends MCAccessBukkitModern {
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 MCAccessBukkitModern {
@Override
public String getMCVersion() {
// Potentially all :p.
return "1.4.5-1.13|?";
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
View File
@@ -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 &quot;NonFree&quot;.
<?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 &quot;NonFree&quot;.
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>
@@ -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;
}
}
@@ -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,
@@ -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) {
+1 -1
View File
@@ -17,7 +17,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.3-R0.1-SNAPSHOT</version>
<version>1.14.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -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.
@@ -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);
@@ -69,7 +69,9 @@ public class AutoSign extends Check {
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");
return handleViolation(player, maxEditTime, data, cc);
@@ -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,6 +213,8 @@ public class BlockPlaceListener extends CheckListener {
}
shouldSkipSome = false;
}
} else if (placedMat.toString().equals("SCAFFOLDING")) {
shouldSkipSome = true;
}
else {
shouldSkipSome = false;
@@ -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();
@@ -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);
@@ -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;
@@ -901,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);
@@ -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.getView().getTitle()))) {
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();
}
}
@@ -12,6 +12,7 @@ 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;
@@ -38,7 +39,7 @@ public class InventoryMove extends Check {
else if (player.isSneaking()) {
tags.add("isSneaking");
}
else if (player.isSwimming()) {
else if (Bridge1_13.isSwimming(player)) {
tags.add("isSwimming");
}
else if (player.isSprinting()) {
@@ -49,7 +50,7 @@ public class InventoryMove extends Check {
}
// Do the actual check
if (player.isSneaking() || player.isSprinting() || player.isSwimming() || player.isBlocking() || player.isDead()) {
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)
File diff suppressed because it is too large. Load diff
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
)
;
}
@@ -41,11 +41,14 @@ 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
@@ -55,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.
@@ -156,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");
}
@@ -198,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);
@@ -315,14 +340,23 @@ 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);
@@ -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;
@@ -165,7 +167,7 @@ public class Passable extends Check {
rayTracing.setIgnoreInitiallyColliding(false);
//rayTracing.setCutOppositeDirectionMargin(false);
//getEyeHeight() is a way to check isSwimming but not in water
if (rayTracing.collides() && !player.isSwimming() && !player.isGliding() && !(player.getEyeHeight()<0.45)) {
if (rayTracing.collides() && !Bridge1_13.isSwimming(player) && !Bridge1_9.isGliding(player) && !(player.getEyeHeight()<0.45)) {
tags = "raytracing_collide_";
}
else if (rayTracing.getStepsDone() >= rayTracing.getMaxSteps()) {
@@ -19,12 +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;
@@ -44,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;
@@ -55,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;
@@ -314,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).
@@ -336,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.
@@ -406,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.
@@ -415,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 && hDistance > thisMove.walkSpeed && !data.hasActiveHorVel() && !player.hasPotionEffect(PotionEffectType.SPEED)) {
// (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.
}
}
}
@@ -462,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.
@@ -497,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();
}
}
@@ -899,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);
@@ -921,30 +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 (player.isRiptiding() || (data.timeRiptiding + 3000 > now)) {
hAllowedDistance = Magic.modRiptide * thisMove.walkSpeed * cc.survivalFlySpeedingSpeed / 100D;
} 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;
}
// 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()) || isLanternUpper(to)) {
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;
@@ -1323,7 +1400,7 @@ public class SurvivalFly extends Check {
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) || isLanternUpper(to)) {
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,23 @@ 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();
@@ -1548,6 +1653,27 @@ public class SurvivalFly extends Check {
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
@@ -1697,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");
@@ -1769,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");
}
@@ -1990,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.
@@ -2025,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");
@@ -2046,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
@@ -2089,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) {
@@ -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) {
@@ -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) {
@@ -14,18 +14,35 @@
*/
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.
*
@@ -38,4 +55,32 @@ public class Bridge1_13 {
}
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("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", "sign_post", "wall_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");
@@ -36,10 +36,6 @@ public class BlocksMC1_13 implements BlockPropertiesSetup {
@Override
public void setupBlockProperties(WorldConfigProvider<?> worldConfigProvider) {
// Remove flag for these blocks
BlockFlags.removeFlags("TALL_SEAGRASS", BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
BlockFlags.removeFlags("SEAGRASS", BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
BlockFlags.removeFlags("KELP_PLANT", BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
// Add flag for anvil
BlockFlags.addFlags("ANVIL", BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
// Change flag for walls
@@ -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.)
@@ -52,9 +52,6 @@ public class BlocksMC1_8 implements BlockPropertiesSetup {
}) {
BlockProperties.setBlockProps(mat, props);
}
// Wall Sign
if (BridgeMaterial.getBlock("wall_sign") != null) BlockInit.setAs("WALL_SIGN", BridgeMaterial.SIGN);
// Ladder.
props = new BlockProps(BlockProperties.woodAxe, 0.4f, BlockProperties.secToMs(0.6, 0.3, 0.15, 0.1, 0.075, 0.05));
@@ -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
@@ -574,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
@@ -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)) {
@@ -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,7 +33,7 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
*/
public class RichEntityLocation extends RichBoundsLocation {
private final boolean is1_14Above = BlockProperties.getMaterial("LECTERN") != null;
private final boolean is1_14Above = BridgeMaterial.getBlock("lectern") != null;
/*
* TODO: HumanEntity default with + height (1.11.2): elytra 0.6/0.6,
@@ -372,7 +373,8 @@ public class RichEntityLocation extends RichBoundsLocation {
final LivingEntity living = (LivingEntity) entity;
eyeHeight = living.getEyeHeight();
//Sneaking in Minecraft 1.14 and possibility later version will have lower height
fullHeight = is1_14Above ? eyeHeight : Math.max(Math.max(fullHeight, eyeHeight), living.getEyeHeight(true));
// 0.179999?
fullHeight = is1_14Above ? eyeHeight + 0.179 : Math.max(Math.max(fullHeight, eyeHeight), living.getEyeHeight(true));
}
else {
isLiving = false;
@@ -986,26 +986,32 @@ public class BlockProperties {
}
private static void setFlag(Material material, long addFlag) {
try {
if (!material.isBlock()) {
// Let's not fail hard here.
StaticLog.logWarning("Attempt to set flag for a non-block: " + material);
}
} catch (Exception e) {}
blockFlags.put(material, blockFlags.get(material) | addFlag);
}
private static void maskFlag(Material material, long addFlag) {
try {
if (!material.isBlock()) {
// Let's not fail hard here.
StaticLog.logWarning("Attempt to mask flag for a non-block: " + material);
}
} catch (Exception e) {}
blockFlags.put(material, blockFlags.get(material) & addFlag);
}
private static void setBlock(Material material, BlockProps props) {
try {
if (!material.isBlock()) {
// Let's not fail hard here.
StaticLog.logWarning("Attempt to set block breaking properties for a non-block: " + material);
}
} catch (Exception e) {}
blocks.put(material, props);
}
@@ -1063,7 +1069,7 @@ public class BlockProperties {
setFlag(mat, stepFlags);
}
for (final Material mat : MaterialUtil.NEWLIQ) {
setFlag(mat, stepFlags | F_GROUND_HEIGHT | F_CLIMBABLE | F_CLIMBLIQ);
setFlag(mat, F_XZ100 | F_CLIMBABLE | F_CLIMBLIQ);
}
// Rails
@@ -1516,9 +1522,9 @@ public class BlockProperties {
// 95 Locked chest
// blocks[95] = indestructibleType; // Locked chest (prevent crash with 1.7).
if (BridgeMaterial.has("locked_chest")) {
BlockFlags.setFlagsAs("locked_chest", Material.CHEST);
BlockFlags.setFlagsAs("LOCKED_CHEST", Material.CHEST);
// Breaks like chest later on.
setBlockProps("locked_chest", BlockProperties.instantType);
setBlockProps("LOCKED_CHEST", BlockProperties.chestType);
}
// Terracotta (hard_clay).
@@ -2564,10 +2570,12 @@ public class BlockProperties {
* the flags
*/
public static final void setBlockFlags(final Material blockType, final long flags) {
try {
if (!blockType.isBlock()) {
// Let's not fail hard here.
StaticLog.logWarning("Attempt to set flags for a non-block: " + blockType);
}
} catch (Exception e) {}
blockFlags.put(blockType, flags);
}
@@ -3127,6 +3135,9 @@ public class BlockProperties {
if (!collidesFence(fx, fz, dX, dZ, dT, 0.26)) {
return true;
}
if (!collidesFence(fx, fz, dX, dZ, dT, 0.13)) {
return true;
}
}
else if ((flags & F_THICK_FENCE) != 0) {
if (!collidesFence(fx, fz, dX, dZ, dT, 0.125)) {
@@ -3166,8 +3177,9 @@ public class BlockProperties {
&& getGroundMinHeight(access, bx, by, bz, node, flags) <= Math.min(fy, fy + dY * dT)) {
return true;
} else if (id.toString().equals("BELL") && (access.getData(bx, by, bz) & 0x4) != 0) {
if (Math.max(fy, fy + dY * dT) >0.39 && Math.max(fy, fy + dY * dT) < 0.64) return true;
}
if (Math.max(fy, fy + dY * dT) >0.39 && Math.max(fy, fy + dY * dT) < 0.9) return true;
} else if (id.toString().equals("CHORUS_PLANT") && !collidesFence(fx, fz, dX, dZ, dT, 0.3)) return true;
else if (id.toString().equals("BAMBOO")) return true;
// Nothing found.
return false;
}
@@ -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("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(
+1 -1
View File
@@ -30,7 +30,7 @@ For the plugin/artifact version see the NoCheatPlus module.</description>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.3-R0.1-SNAPSHOT</version>
<version>1.14.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -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");
}
/**
@@ -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",
};
/**
@@ -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);
// }
}
+5 -1
View File
@@ -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>