863 Commits
Author SHA1 Message Date
Lysandr0 61d329edc5 Slowly getting back a bit…
* Do register 1.21 blocks - 1.21.5 blocks are still missing TBD;
* Sweep old/legacy isVelocityJumpPhase field - no longer needed with the upcoming velocity rework;
* Naming conventions, cleanup;
* Attempt to guess/brute-force when the 0.2 climbable speed should be applied when in powder snow.
* Remove redundant collision checking for bubble columns
2025-06-01 09:40:41 +02:00
Lysandr0 457284858e Complete the supporting block mechanic sketch; misc changes.
* Clarify and clean-up javadocs; add comments.
* RichBoundsLocation:
   - getTypeId/Above() -> getBlockType/Above().
   - getAABBCopy() -> getBoundingBox().
   - Align collision checkers to the other ones (do not check in a top-down way)
* Magic: move envelope methods to PhysicsEnvelope.
* PlayerEnvelopes -> PhysicsEnvelope.
* Remove unneeded method in TrigUtil.
* BlockProperties:
   - getBlockFrictionFactor() -> getHorizontalFrictionFactor().
   - Attempt to handle powder snow behaviour within the on ground judgement.
   - Remove unused World argument in isOnGround().
* DataManager: add getPlayerDataForEntity().
* PlayerMoveData: differentiate jumping from just pressing the space bar.
* AxisAlignedBBUtils:
   - Rename creation methods.
   - When converting a BoundingBox object to a double array, check it is null and create an "empty" box of all 0.0 if so.
* SurvivalFly:
   - Correct minor oversight with the gravity-reiteration fix.
2025-03-14 13:41:14 +01:00
Lysandr0 059727e2bd [Incomplete][Broken] Some refactoring.
* Split tracing stuff into more sub-packages (distinguish ray-tracing from axis-tracing);
* Move InventoryUtil to entity package.
* Begin sketching the supporting block mechanic introduced in 1.20 (correctly, this time); incomplete. Haven't implemented it yet into the prediction system.
* Correct an oversight in PlayerEnvelopes (jumpPhase for jump motion checking).
* One more tweak for powder snow collision (use BlockProperties.collidesBlock() directly, instead of collides()).
* Naming convention: Velocity -> VelocityAdapter.
2025-02-05 20:53:39 +01:00
Lysandr0 0694419f52 Ops…
Move out BlocksMC1.21 from special…
2025-01-30 10:14:06 +01:00
Lysandr0 6089ec3f7b More tweaks on powder snow collision.
* Powder snow doesn't exist on 1.16 and below, so make sure the isInsideBlock check returns false in that case (ViaVersion maps it to regular snow which has a solid collision box, which will be a problem with wall collision: NCP will see the abrupt deceleration without knowing that it was caused by the client seeing powder snow as a solid block.)

* Attempt to adjust the collision checking:  ensure that we only check the exact block the player is currently inside.

* Check for shift key toggles within the block-shape definition.

Bonus:
* Align naming convention for velocity flags.
* More comments
2025-01-30 09:55:22 +01:00
Lysandr0 2d51e4f8cb Add support for "weaving" effect, remove old explosion flags. 2025-01-28 14:53:01 +01:00
Lysandr0 3b60ae8aa9 Bump to 1.21.4, slight revision on powder snow collision (rich bounds), fix/adjust javadocs.
Side note: need to study how bundles work exactly, and evaluate cheating potential for this gameplay mechanic (namely, fast-clicking and inventory manipulation. FastClick may need to be updated).
2025-01-27 23:01:06 +01:00
Xaw3ep 1e75c342c7 Partly velocity processor rework 2025-01-27 05:45:10 +07:00
Lysandr0 4f9a3fb605 Sketch push effect for entities (horizontal speed).
+ random change to how h-offsets are calculated.
2024-12-11 10:09:11 +01:00
Xaw3ep 33a2b1c7fe Adjustment on legacy clients 2024-11-26 11:16:19 +07:00
Lysandr0 b173710280 More clean up and clarification of docs. 2024-11-23 14:41:45 +01:00
Lysandr0 04d8e6ccde More changes.
* Suppress some warnings
* Changed my mind: keep everything in one class for legacy input calculations.
* Remove inLiquid condition for levitation in the MovingListener.
* Add inLiquid condition for the jumping envelope.

Prediction for both vertical and horizontal seems to be broken for versions below 1.12. Still investigating why… Too tired to continue right now.
2024-11-12 18:54:31 +01:00
Lysandr0 0e802ca9de It's the actual distance, not the allowed one here :) 2024-11-08 08:56:31 +01:00
Lysandr0 26a053d6cf Make use of player#getCurrentInput(), fix a bunch of errors encountered on 1.8. 2024-11-07 21:52:21 +01:00
Xaw3ep a1f11aa32a Tweak on v_exiting_liquid 2024-11-07 22:45:19 +07:00
Xaw3ep f5ed107e2b Somewhat runnable 2024-11-07 14:56:28 +07:00
Xaw3ep 8b98ac72b9 An attempt to fix old unit tests
I have no idea why it still throw java.lang.NullPointerException although the build return success?
2024-11-01 00:01:10 +07:00
Lysandr0 80dc6bb8e0 Ops. 2024-10-30 08:39:27 +01:00
Lysandr0 3bfb217896 Attempt to track the obstruction flag with the past-move tracking system.
A really hacky way to do so. Since we need the Entity instance, we cannot use RichBoundsLocation.
2024-10-30 08:31:58 +01:00
Lysandr0 2e73401803 Move some classes around
Use the compat.bukkit pacakge for Bridge classes that have the specific purpose of solving API breakages between versions.
2024-10-30 08:09:45 +01:00
Lysandr0 d1a88dbc23 No spigot dependency here. 2024-10-29 14:04:42 +01:00
Lysandr0 0a56ded6d3 Adapt to 1.21.3 changes. 2024-10-29 13:33:39 +01:00
Lysandr0 f01bcefa58 Merge branch 'hspeed' of https://github.com/Updated-NoCheatPlus/NoCheatPlus into hspeed 2024-10-27 19:43:35 +01:00
Lysandr0 c0a66a56ee Touch-ups here and there. 2024-10-27 19:17:55 +01:00
Xaw3ep 05f9b9f1de [Bleeding] Correct vertical liquid prediction 2024-10-27 23:36:03 +07:00
Lysandr0 32edebf3ba Ops. 2024-10-12 08:44:11 +02:00
Lysandr0 6c73899fa9 Throw more utility methods in AxisAlignedBBUtils 2024-10-12 08:36:24 +02:00
Lysandr0 9a9f195d03 Update several methods to 1.21 changes (collide(), maybeBackOffFromEdges()) 2024-10-04 14:27:38 +02:00
Lysandr0 e0fa64c213 Finish implementing modern attributes (+ more cleanup). 2024-10-04 13:59:09 +02:00
Lysandr0 a310b9ebef Implement (most of the) 1.20.5/1.21 attributes, continue working on the vertical liquid speed prediction, better documentation for some methods.
Attribute implementation is still missing for legacy modules… TBD at a later time.
2024-09-22 14:35:21 +02:00
Lysandr0 f8502fe8e6 [Broken] Sketch an inside-liquid vertical prediction.
Lots of issues still remain (this is mostly a starting point).
Namely:
1) I can't seem to find how the game handles gravity in liquid (descending; not pressing the space bar);
2) It still doesn't account for all version-dependent nuances (i.e.: 1.12 and below clients not being able to swim up to the surface), because it is a major pain in the ass to: 1. download all NMS sources 2. research and note down what changed across versions… So, what we(I?)'ll do is to just account for 1.8 clients, since that is the most used (and relevant) legacy version (at least for publishing a beta in master);
3) Vertical medium-checking order is (currently) wrong: Minecraft checks for water first, then for lava, then gliding, and finally, it falls back to air (Source: EntityLiving.java -> travel() method).
For vertical predictions, NCP check for climbing first (odd one out, because we still use a limit-based implementation for it), then gliding, and then it falls back to vdistrel, which unifies air and liquids.
I chose to trade NMS logic for code readability within NCP. Having two, almost-identical vdistrel methods (one for liquid, one for air) would be extremely ugly.
Still, it'd be best to (pedantically) follow what NMS does.
This could be solved by unifying vertical and horizontal predictions. But… Willpower, I guess? :)

The code is starting to get harder to read too, so perhaps it’s time to merge vertical and horizontal predictions to reduce redundancy anyway.
2024-08-07 21:54:28 +02:00
Lysandr0 89643cc734 Streamline code, much better documentation for several parts of code, refactor ray-tracing/axis-tracing code to an extra package.
* Rename methods in ClientVersion for less verbosity.
* Add convenience methods to ClientVersion.
* Add method to get either the player's or the entity's version in GenericVersion (and make use of it in RichEntityLocation).
* New Class: AxisAlignedBBUtils. To contain all utility methods related to bounding boxes.
* Remove unused code in MathUtils and MovingUtil.
* Move some methods around classes (Visible, CollisionUtil, MathUtils…).
* Do cross-version checking for bouncy blocks in RichEntityLocation.
* More conditions for checking the legitimacy of toggle sprint.
* Check for client version in the maybeElytraBoost method.
* Attempt to fix bunnyhopping in low-ceiling areas (isVerticallyConstricted…)
2024-08-06 13:40:39 +02:00
Lysandr0 676dedb199 [Bleeding] Support wind charges. 2024-08-03 11:03:49 +02:00
Lysandr0 aa45920d88 Merge branch 'master' into hspeed 2024-08-03 09:12:42 +02:00
Lysandr0 6bb5820e3a Review usage of player#isSneaking() throughout the code. 2024-07-11 23:18:19 +02:00
Lysandr0 39dca7f8b8 Mark "dirty phase" (and related code) as deprecated.
Dirty phase = an air phase affected by velocity.
Very old code that will soon be phased out once we make vDistLiquid predictive as well.
2024-07-11 21:50:42 +02:00
Lysandr0 2e3c7244f7 One more iteration for crouching VS shift key press. 2024-07-11 21:25:21 +02:00
Xaw3ep 867a5b66b4 [Bleeding] Adjustments on snow blocks 2024-07-11 23:49:56 +07:00
Lysandr0 804d5964d6 Make use of findSupportingBlock method for grabbing the correct block-friction.
Also, fix an opsie with the sprinting detection :)
2024-07-11 13:32:17 +02:00
Lysandr0 0dfb553965 [blind] attempt to patch up maybeBackOffFromEdge()
As a bonus: keep track of negligible horizontal collisions; check for Improbable on fake-bed leave packets and do check for enough impulse for sprinting (apparently the game does have such condition).
2024-07-10 16:11:45 +02:00
Xaw3ep 814b48cc3c More adjustments 2024-07-10 19:40:22 +07:00
Lysandr0 dfe93bd98a Several movement-related fixes. 2024-07-10 07:33:07 +02:00
Lysandr0 07f7eba2f4 Further clarify crouching VS sneaking.
Fix some typos
2024-07-09 16:25:39 +02:00
Lysandr0 cceb7cfd30 Patch up vertical bouncing.
Also fix a compilation error.
2024-07-07 13:57:40 +02:00
Lysandr0 0cddcd1ff1 Merge branch 'hspeed' of https://github.com/Updated-NoCheatPlus/NoCheatPlus into hspeed 2024-07-07 09:21:12 +02:00
Lysandr0 7cbd79789e Demote ImpossibleHit to boolean config options, cleanup VIII, fix some issues with Folia and teleportation. 2024-07-07 09:17:32 +02:00
Xaw3ep ea24fa1c57 Fix most horizontal movement calculation errors 2024-07-07 05:39:07 +07:00
Xaw3ep 71252d72cf Working on 1.21
Last version of NCP 3? Too many bugs can't be handle on current codebase. Will now focus on rework.
Changes:
+ Fix fall damage bug with folia on change world
+ Compatible with wind charge
2024-07-04 15:34:32 +07:00
Lysandr0 4a9bccd205 Merge pull request #352 from CMSMortal-chen/patch-1
Fix "Exception with AutoListener"(Maybe)
2024-06-15 23:12:32 +02:00
Mortal_chen 894f3b4779 Fix typo
zombeified_piglin to zombified_piglin
2024-06-01 23:09:16 +08:00
Lysandr0 6f25a0f0f8 Sketch "isSolidFace()" NMS method, change for some method signatures, Cleanup VII
Speed factor methods will now use LivingEntity instead of Player signatures, because they'll be used in the future for vehicles as well.

isSolidFace is untested.
2024-05-17 20:52:12 +02:00
Lysandr0 fd92cde1d9 Compile errors. 2024-05-15 14:05:28 +02:00
Lysandr0 11163230ac Merge branch 'master' into hspeed-collide 2024-05-13 21:54:50 +02:00
Lysandr0 c9741a3e33 Cleanup VI 2024-05-12 21:40:10 +02:00
Xaw3ep 9bb34f6f2d Core compatibility 1.20.5/1.20.6
+ Missing newly added attributes!
2024-05-13 00:15:11 +07:00
Xaw3ep cce1a0ef72 [Broken][Bleeding] Manually implement collide function 2024-04-24 01:20:13 +07:00
Lysandr0 9201ff03ec Ensure that players get the correct fall damage penalty for falling on stalagmites.
Vanilla mechanic: falling on stalagmites will roughly double the fall-distance that will be used to calculate the subsequent fall-damage.
Because the fall-distance (not damage(!)) is multiplied, this means that even just jumping on pointed dripstone can damage the player (half a heart)

+ random comments here and there.
2024-03-06 00:04:31 +01:00
Lysandr0 db3237f1ee Cleanup V: Post merge touch-ups.
+ update client version to 1.20.3/1.20.4 + explicitly state what kind of "step up" we are checking in vidstrel with the "isStep" method.
2024-02-20 17:28:45 +01:00
Lysandr0 957c1d8ea2 Merge branch 'master' into hspeed-collide 2024-02-15 22:09:20 +01:00
Lysandr0 5e1f775d59 Merge branch 'hspeed-collide' of https://github.com/Updated-NoCheatPlus/NoCheatPlus into hspeed-collide 2024-02-15 22:01:49 +01:00
Lysandr0 14a19a9512 Cleanup IV 2024-02-15 21:57:43 +01:00
Xaw3ep a094328cde Small commit to practice reverse engineering
Add shape for bamboo and dripstone on bedrock
2024-02-13 13:52:31 +07:00
Xaw3ep 91b40d88f3 Fix #334 #333 2024-02-03 22:41:54 +07:00
Xaw3ep aad0e617dd Attempt to fix #331 and fix a false positive with Visible 2024-01-21 22:44:00 +07:00
Lysandr0 da64b55ec1 Cleanup III, don't apply the step-up fix if the client is too old, keep track of forward/strafe impulses with the move-tracking system
+ adjust workarounds + use
2024-01-12 15:44:24 +01:00
Lysandr0 dfa26533cb Merge branch 'hspeed-collide' of https://github.com/Updated-NoCheatPlus/NoCheatPlus into hspeed-collide 2024-01-11 20:46:15 +01:00
Xaw3ep 2e172a4de7 Second attempt 2024-01-12 00:31:54 +07:00
Lysandr0 0665155d9f Merge branch 'hspeed-collide' of https://github.com/Updated-NoCheatPlus/NoCheatPlus into hspeed-collide 2024-01-11 14:33:08 +01:00
Lysandr0 a87262f64b Cleanup II, adjust levitation, distinguish between "fromLostGround / toLostGround" and don't wildcard lostground anymore with workarounds. 2024-01-11 14:32:52 +01:00
Xaw3ep 5e857b225e Merge pull request #330 from skbeh/replace-random
Replace usage of java.util.Random
2024-01-11 18:21:07 +07:00
Xaw3ep c0578c52b6 Close inventory instead of cancelling hit 2024-01-11 18:19:58 +07:00
Xaw3ep 2ac54c712f Attempt to fix collisions 2024-01-11 17:38:45 +07:00
Lysandr0 a2bc2e5c58 Cleanup 2024-01-09 20:19:56 +01:00
skbeh f965f2ad3d Replace usage of java.util.Random
Replace usage of java.util.Random with java.util.concurrent.ThreadLocalRandom,
or java.util.SplittableRandom when setting seed is required. This provides better
performance and randomness.

Also do not manually generate seed when unnecessary since the Java runtime
mixes more bits into the automatically generated one.
2024-01-09 09:44:15 +00:00
Lysandr0 c4bd3f2e20 Refine step-up handling with vDistRel.
Also pass the horizontal (X/Z) motion to the collide method, in order to be able to judge if the player will be able to step-up with this vertical move, in case the current move doesn't fit into NCP's step-up definition (moving from ground to ground with 0.6 motion).
2024-01-08 21:36:59 +01:00
Lysandr0 bd501b6a68 Disambiguate the new headObstruction flag from the old isHeadObstructed method.
The old method's naming convention is now "seekHeadObstruction" because this is what the method essentially does: it uses a given margin (or a correction method, or both) to seek for collisions above, but it doesn't necessarily mean that the player does collide with something.
2024-01-07 23:26:43 +01:00
Lysandr0 e15d614bb8 Ensure that null bounds are returned only for truly passable blocks.
(Fix ported from the other branch)
2024-01-07 19:05:12 +01:00
Lysandr0 fd872fe26c Adjustments for head obstruction, fix first descending move after stepping down a bed for newer clients
Also, re-define head obstruction definition by using the collide method + blindly (and roughly) attempt to support horizontal collisions.
2024-01-07 18:37:33 +01:00
Xaw3ep 610b4b082c Correct height
Idiot me back then
2024-01-07 16:05:54 +07:00
Lysandr0 c163bbe76b Ops...?
Forgot to push this one on remote. Idiot me...
2024-01-05 22:07:07 +01:00
Lysandr0 b7b2a6d12a Ensure to use the bounding box of the "from" position when computing collisions. 2024-01-05 20:56:16 +01:00
Lysandr0 5877736f84 Fiddling around with Minecraft's collision method.
Attempt to actually predict collision movements, instead of resorting to workarounds (at least for the vertical part).

* Experiment with block change tracker and block breaking below...
2024-01-03 19:44:51 +01:00
Xaw3ep 126c135c0b Typo 2023-12-30 13:22:22 +07:00
Xaw3ep 7604b8601c Test collide 2023-12-29 19:55:00 +07:00
Xaw3ep ef4e959dfa Adjust to only add null bound to truly IGN_PASSABLE 2023-12-29 03:59:36 +07:00
Lysandr0 49ad9f9f41 Adjust touch down workaround.
Compare to predicted distance not actual one.
+ fix a compile error
2023-12-28 21:25:12 +01:00
Lysandr0 92f1c8ff78 Merge branch 'master' into hspeed 2023-12-28 17:29:36 +01:00
Lysandr0 15cc6e11e1 More refactoring and simplification for lost-ground workarounds.
Keep them minimal and use the interpolation method to catch most cases + adjust some workarounds.
2023-12-28 15:02:30 +01:00
Lysandr0 1c5d8ebb97 Rework gliding handling for the most part.
Consistency checks are done within the combined listener. The actual checking method is now done in SurvivalFly.
Fireworks are still a pain, however.

Also revert the arm-swing inventory-checking thing of the last commit (my bad ops).
2023-12-28 15:00:55 +01:00
Xaw3ep ae2ab3543f Do sort XZ when Y not possible to pass 2023-12-26 13:48:37 +07:00
Xaw3ep c56a33351d [Breaking] Update to visible
Should be last changes to fix previous known bypasses.
Remove passable_x4 from all trap door because it not the same behavior with gate.
And make passable blocks has no ground will be null bounding box from now on
2023-12-26 13:07:49 +07:00
Xaw3ep 6e88781512 Fully support 1.20.4 2023-12-26 12:33:36 +07:00
Lysandr0 d0015cb7c1 Merge branch 'master' into hspeed 2023-12-21 00:14:57 +01:00
Lysandr0 bd56b867af Handle lost-ground uncertainty in a cleaner way, move some of the vertical uncertanity in its own method.
Instead of proactively calculating speed with thisMove#touchedGroundWorkaround, let lost-ground be treated as an "after failure" check: if the player fails the horizontal prediction and a lost-ground case happened, force-set the ground flag and re-calculate (effect on performance needs be evaluated).
Same thing applies for vertical motion with the PlayerEnvelopes#isTouchDownMove thing.

More:
* At last, get rid of bunnyfly: with a stricter vertical monitoring this should not be needed anymore.

* On respawning: let the player decide if sneaking/sprinting should be reset.

* Clarify some stuff here and there.

* Unbind lost-ground from toIsValid check in AirWorkarounds (move validity is already checked in lost-ground)

* Do still register item-use events/adapters from 1.12 up to 1.17
2023-12-20 21:39:38 +01:00
Lysandr0 682240e8e7 Patch up bouncing (+ some more stuff).
* Move riptide force equation to BridgeEnchant.

* Do check for cached onGround within overloaded methods as well (RichBoundsLocation, prevents abuse with lost-ground + snow shoe cheats)

* Ensure to check for equality in the split move mechanic.

*Ensure to close inventories on swinging one's own arm.
2023-12-20 10:50:43 +01:00
Xaw3ep 785c19dfdc Comments & Javadoc
Also fix minor issue with carpet and close inventory when attack
2023-12-19 18:29:38 +07:00
Xaw3ep 9dc3e81f46 [Bleeding]Add fight.visible
Similar to blockinteract.visible, not a precise ray-cast but likely to provide more compatibility with bedrock later on. Look independent!
* Known bypass:
- Behind the door(at the door block)
- Bottom/behind slab and trapdoor
* Known false positive:
- ...Waiting for report!
* Might-Missing:
- BlockChangeTracker?
Will fix in next build or so, for now just rest a bit for fully update to 1.20.4.
2023-12-18 14:00:17 +07:00
Xaw3ep 349c96b9ef An attempt to avoid getting flag by AV
Don't know why!
2023-12-15 13:48:15 +07:00
Xaw3ep 2d8255400d [Bleeding][Breaking] Rewrite block interact visible 2023-12-14 22:18:30 +07:00
Xaw3ep 7cc3a81631 Merge pull request #328 from Brokkonaut/1.20.4
Quick fix for 1.20.4
2023-12-14 21:30:57 +07:00
Brokkonaut c00fc5c857 Quick fix for 1.20.4 2023-12-13 09:10:26 +01:00
Xaw3ep a212480ca1 Fix crash issue and false flag on leave vehicle 2023-11-22 18:19:41 +07:00
Lysandr0 47000d1061 Force-close inventories on switching items, attempt to fix gravity change when breaking blocks underneath.
(Also, more opsage)
2023-11-13 21:31:13 +01:00
Lysandr0 1da6229bef Resolve most issues related to sneaking.
Properly set the sneaking status with player-poses, instead of shift key presses (see comment in CombinedListener. Could be worthy of a ticket to Spigot).
1.14 sneaking mechanics have been refined, for the most part. There's still one nasty issue that I couldn't manage to fix: trying to jump in 1.5 blocks-high areas… Jump is seemingly undetectable, so we may have to brute-force speed there….

More:
*AirWorkarounds: tighten up touch-down workaround; test for the most frequent workarounds earlier.

* Adjust things (and jump definition) to take crawling into account.

* Just to be sure: seek for literal "releaseUsingItem" name as well when reflectively calling the method.
2023-11-12 21:51:33 +01:00
Lysandr0 1e8ad02740 Cleanup all imports. 2023-11-12 21:51:10 +01:00
Lysandr0 8d7f6573cf Ops. 2023-11-09 15:01:57 +01:00
Lysandr0 dd4492dca2 Revise item-use handling to use Bukkit's HumanEntity#getItemInUse()
After… 12 or so years, Bukkit finally has a method to know if the player is using an item (not just blocking(!)), thus, the adapter is not needed anymore.
(How have we not noticed it this whole time!?)

Also move the resetActiveItem stuff as a service in PlayerData.
2023-11-09 14:48:06 +01:00
Lysandr0 fdb2c7b42a First iteration for Mojang's block collision bug-fix.
+ some formatting and better compatibility with cross-version checking in RichEntityLocation
2023-11-09 14:41:57 +01:00
Lysandr0 50b9eae3fd More progress (implement maybeBackOffFromEdge method).
Works somewhat okay but it still throws false positives, will need more iterations.

More:
* "Properly" handle wall collision. Implementation is not necessarily the most elegant, but it is the most robust and exploit-free, judging from some testings (couldn't reproduce any more false positive with it).

* Adjust jump definition in PlayerEnvelopes.

* Formatting and adjustements for AirWorkarounds (add rule for wrong split move etc...).

* Confine stepdown-from to not having slowfall.

* Get rid of legacy riptide implementation with CreativeFly.

* Check for client-version in the getLookingDirection method (apparently 1.12 and below have a slightly different equation).

* Add a temporary non-vanilla friction library for vDistLiquid only in BlockProperties, which still uses the old style implementation.

* Comments, clarify docs, clarify debug format and style for movement (should be a bit more readable).

* Get rid of Critical's config. options.

* Move elytra gliding consistency checks in the CombinedListener.

* Throw in legacy liquid collision methods (especially for lava's, which is quite inconsistent throughout recent versions).

* Zero drip leaf's AABB if unstable (workaround, needs to be tested)

* Use Spigot's new PlayerSignOpenEvent to handle AutoSign with 1.20 signs.

* Prepare / sketch a first SurvivalFly-based prediction with the elytra.

* Properly return -1 if could not get the firework boost power (BridgeMisc).

* Update ClientVersion up to 1.20.2.

* Bridge 1.13: test if a server may have a built-in raytracing implementation (Bukkit did introduce it in 1.13.2)

* Get rid of jump-phase check.

* Open: use SurvivalFly's prediction to know if the inventory needs to be closed

* Target Spigot's 1.20.2 from now on (poms)
2023-11-03 15:13:34 +01:00
Lysandr0 64bf374fd3 [#322] Return the correct DamageCause for fall damage.
Caused by map/obfuscations changes.
2023-10-18 21:52:45 +02:00
Lysandr0 a3acd8d522 Sketch a first SurvivalFly-compatible riptide prediction, fix a logic issue with the fastclick.chest subcheck. 2023-09-23 13:15:27 +02:00
Lysandr0 edacb1a04f Ops.
Missed that one.
2023-09-20 16:35:12 +02:00
Lysandr0 b099ebd807 Merge branch 'master' into simplify-vdistrel 2023-09-20 16:23:43 +02:00
Lysandr0 a394b9e29a A whole lot of changes.
* Adjust stepping, jumping and bunnyhopping definitions to lost ground.
* Simplify AirWorkarounds (get rid of most of them, favouring a more coherent class).
* Re-add some lost ground cases; distinguish lost ground for vertical VS for horizontal motion (some cases won't apply to vertical but for horizontal and viceversa, see the "missedGroundCollision" comment) and format for much easier debugging (or at least look).
* Get rid of minJumpHeight method in LiftOffEnv.
* Move hasAttackSlowDown flag to the CombinedListener.
* Get rid of -now- unused sfZerovdistrepeat flag.
* Set sneaking, sprinting and use item status in PlayerData. See comments in the CombinedListener class as for why.

* CollisionUtil:
 - Some methods to get entities around players.

* RichEntityLocation:
 - As a bonus: selectively add cross-version compatibility with multi-protocol plugins in several places (honey blocks, berry bushes, levitation [...]).
 - Properly handle on-ground judgement with powder snow.
 - Implement a proper isSlidingDown method.

* RichBoundsLocation:
 - Format, order, remove redundant contraction of the bounding box with liquid checking (+ 0.001), fix bubble column collision and lastly, revert a change brought by @xaw3ep with the bounding box setting: using fullWidth / 2f is imprecise and will lead the isHeadObstructed method to return true when moving alongside walls, for now, the fix has been reverted to the  old resolution of Math.round((fullWidth * 500.0) / 1000).

* MovingListener:
 - Check for sneaking directly in the envelope method for bouncing and get rid of old stairs workaround.

* InventoryUtil:
 - Move the hasArrow method to the InventoryUtil class (+ some formatting).

* SurvivalFly:
 - Get rid of the now useless LIMIT_NEAR_GROUND envelope.
 - Adjust use of head obstruction checking.
 - Rough handling of slimce bounce mechanic; will need some adjustments down the road...
 - Somehow handle powder snow climbing.
 - Attempt to handle "unknown" horizontal movements: if we can't find a match (= a predicted speed having an offset smaller than 0.0001), set in this move the closest predicted speed to the actual one and adjust it through some kind of workaround.

Overall, we're reaching (and probably already stretching) NCP's infrastructure limitations.
This is especially noticeable with the on-ground judgment and collisions in general, which are the two main things that are preventing us from merging the branch in master (at least as a beta version).
Usually, NCP’s on-ground system is enough to get by even with more complex scenarios (i.e.: stepping), however the amount of edge cases to manage is (starting to be-) overwhelming: with predictions, we not only have to deal with lost ground -which already is a huge pain in the ass per se- but we also have to deal with the same issue on the opposite spectrum, or in other words, with “excessive ground” cases.
Just take a look at the LostGround class, PlayerEnvelopes.isJump()/Step() and all comments in AirWorkarounds.



Missing: 

Vertical:
 - In water/lava -> in air transitions
 - Jumping in waterlogged blocks
 - Implement the correct collision logic for 1.20 players (richentitylocation).
 - Fix insidePowderSnow checking (see notes in RichBoundsLoc).
 - Fix split move messing up when jumping in honey blocks.
 - Jumping on the very edge of chest lost ground case (completely misses the ground collision, player is seen as having 0.42 motion in air... Is it a shape issue rather?).
 - Wobbling up on slime blocks/beds (still need some adaptations to it. Getting sporadic false positives).

Horizontal:
 - Still false positives when moving against walls…
 - Lost ground still messing with prediction in general…
 - Still false positives when getting pushed…
 - Still missing that maybeBackOffFromEdge method…

IMPORTANT:
- We need to port / code / workaround Mojang’s new logic for moving along the edges of blocks with nothing else underneath (block properties are now properly applied even on the very edge)
2023-09-20 13:52:42 +02:00
Lysandr0 572a26ae3f Merge pull request #319 from Dreeam-qwq/tabcomplete-players
Add TabComplete players
2023-09-17 07:10:37 +02:00
Dreeam 35bee4cbef Add TabComplete players 2023-09-14 13:05:55 -04:00
Xaw3ep de0486cf6f An attempt to deal with #315, #310, #301 2023-08-12 08:55:20 +07:00
Lysandr0 9c96e3c6d8 Push piled up commits on remote. 2023-07-30 17:47:16 +02:00
Lysandr0 cb92b0eed7 Merge branch 'master' into simplify-vdistrel 2023-07-14 23:04:18 +02:00
Lysandr0 243cbe45d0 Merge master. 2023-07-14 23:03:23 +02:00
Lysandr0 ebd5bb84aa Fix 1.20 hanging signs, attempt to fix most Folia-related issues.
* #305 Another attempt at fixing AutoSign with the editing mechanic.
So far, we do not have a specific event for player-editing, so everything has to be manually detected.
Player-editing-speed cannot be monitored due to PlayerInteractEvents not being fired at all when "opening" a sign.

* Hanging WALL signs have a collision box for their post. Hanging signs don't, so they are treated like a normal sign would (fully passable)

* BlockPlaceListener: cleanup, don't use player#getLocation() for Scaffold; use PlayerMoveData instead

* (+ random cleanup in PassengerUtil)

Folia fix is provided by @xymb-endcrystalme
2023-07-09 21:10:02 +02:00
Lysandr0 0da57d8f77 Move PotionUtil to the utilities.entity package.
The effect is applied to entities after all.
2023-07-09 14:21:23 +02:00
Lysandr0 85f6305c9f Get rid of deprecated code. 2023-07-03 07:50:23 +02:00
Lysandr0 3fc2a499ec Get rid of legacy permissions. 2023-07-02 20:56:51 +02:00
Lysandr0 eeb55ad552 [#305] Do not check for sign hash if the block-placing hash is 0.
Fixes an AutoSign false positive with the new editing mechanic (1.20+ players can now edit signs that have already been placed down. Took long enough, Mojang)
2023-07-01 21:21:38 +02:00
Lysandr0 ebd4c02ec7 Clean-up.
Remove unused methods, unused data, unused variables:

* Get rid of the legacy low-jump check: redundant + less stuff to account for (consequently remove the allow_lowjump flag)

* Get rid of isWaterfall method and everything related to it.

* Get rid of the LiftOffEnvelope.LIMIT_SURFACE envelope

* Get rid of sprinting grace: with a prediction-based check, we need the exact, latency-compensated status, not a simple grace period.

* Get rid of the vEnvHack in AirWorkarounds.

* Get rid of vDistSB: redundancy with vdistrel + less workarounds to care for.

* RichEntityLocation:
 -Ensure that the head obstruction check does not yield true when moving inside powder snow or sliding down a wall of honey blocks
 -onGround: only check for powder snow, if there's other powder snow beneath.
 -Ensure that the isSlidingDown method collects block flags before (prevents some NPEs)
2023-07-01 07:51:21 +02:00
Lysandr0 2475e70d29 Handle powder snow onGround checking in a more clean way.
Well, not so clean, more of a less convoluted way.
We check for boots inside RichEntityLocation, instead of changing the flag on-the-fly in the MovingListener.

Bonus:
 * Remove confusing "|?" tag.
 * Merge upstream.
 * Remove F_GROUND_HEIGHT from powder snow: players are only allowed to stand on top of it.
2023-06-16 21:43:50 +02:00
Lysandr0 d98ccbe81e [#299] Add missing shape definition for calibrated sculk sensor. 2023-06-15 15:26:34 +02:00
Lysandr0 1defbc3305 Fix client-version setting fallback.
+ Re-order some stuff with vdistrel.
2023-06-13 22:15:40 +02:00
Lysandr0 012a1c45fd Better handling for the honey block.
Everything is moved to RichEntityLocation under the isSlidingDown method.
Properly handle sliding vertical speed in vDistRel instead of using magic.
2023-06-13 07:36:28 +02:00
Lysandr0 032731fc5a Merge branch 'hspeed' into simplify-vdistrel 2023-06-11 17:49:11 +02:00
Lysandr0 990a45b4a8 Merge branch 'master' into hspeed 2023-06-11 17:48:10 +02:00
Xaw3ep d6c1621e65 Restore old condition for split move
And fix a small false with breaking budding amethyst.
Just quick fix before I return to darkness
2023-06-11 19:02:48 +07:00
Lysandr0 4817eed02e Minor refactor for moving checks, rename Folia class, integrate Gutenberg as an ordinary check.
Move hard-coded magic into its own package (envelope); move checks.moving.magic class to the moving utilities package; split envelopes methods into its own class (PlayerEnvelopes); BounceUtil -> BounceHandler and to the envelope class; BounceType -> to the checks.moving.model package.

* Renamed Folia class to "SchedulerHelper" (name is up to debate, feel free to add)

* Gutenberg won't check for availability anymore. The event was introduced in 1.5 and NCP doesn't support versions lower than that anymore.

* Move "honeyBlockSidewayCollision" method to PlayerEnvelopes.

* Fix compilation errors in RichBoundsLocation and get rid of unused method.

* Get rid of the "split move" flag: too internal of an option and should never be disabled anyway.

* Clarify docs

* LiftOffEnvelope:
-Get rid of min/max jump distinction.
-Decrease normal jump height down to 1.26.

* SurvivalFly: various adjustments... Key change are:
 -The riddance of vAcc. Useless with the upcoming vDistRel rework;
-Unbind to the horizontal-push-speed mechanic from hard-coded magic. (Please Asofold for the love God why did you not document this kind of stuff... Why was it needed);
-Merge vDistWeb, vDistLevitation, vDistBush into vDistRel, climbables and powder snow are still handled in their respective methods because we are restricted by NCP's current  infrastructure and we cannot predict those two (powder snow in particular)
-Move honeyBlock collision to richboundslocation.

* RichEntityLocation:
-Force legacy players to have vines attached to a solid block to climb up.
-Check for client version for fullHeight setting as well.
-Move liquid pushing stuff to RuchEntityLocation
2023-06-10 22:11:23 +02:00
Lysandr0 1ae66d387b Merge branch 'master' into hspeed 2023-06-10 20:31:43 +02:00
Xaw3ep 25ae0a7cdc Update to support 1.20 2023-06-10 23:45:45 +07:00
Lysandr0 8ef0946234 Merge pull request #295 from Phoenix616/patch-1
Link updated CNCP repo instead of old site
2023-06-03 13:47:05 +02:00
Max Lee 3e64428d79 Link updated CNCP repo instead of old site 2023-06-01 21:54:27 +01:00
Lysandr0 4a985be6cf Merge branch 'hspeed' into simplify-vdistrel 2023-05-10 20:38:12 +02:00
Lysandr0 62b07535ad Rename some lift off envelopes. 2023-05-10 20:01:09 +02:00
Xaw3ep bd229b0621 Sync with local changes
Key changes:
+ Fix split-move system splits the look wrongly
+ Correct the bounding box of berry bush, cobweb, powder snow
+ Correct minor false positives when in liquid
2023-05-10 20:15:42 +07:00
Lysandr0 aaeeec8bf6 Attempt to simplify SurvivalFly (vertical)
Workarounds are just too stratified and convoluted to keep up with them.
Just to debug one of them might take a week or more; so, except for oddSlope, oddGravity and vEnvHacks, all the other ones have been removed.

Changes:
* Get rid of the now unused isDownStream() and isInOrAboveSouldSand() methods.
* Move InputDirection class to the model package.
* Lift off envelope: web jump speed is 0.021
* Check for client version in NoFall, as well as reset data upon sliding on a honey block inside the checking method (not in the collision method in movingutil).
* Prepare a velocity flags to distinguish real velocity from fake entries.
* Implement legacy liquid pushing (not tested).
* Friction/speed factors getting is ignored if flying or gliding (vanilla)
* Integrate FastConsume as an ordinary check (1.5 and above servers have the consume event, no need to test for availability anymore)
* If protocol-hack plugins are not present but protocol lib is, do still set the client version.
* Attempt to catch ominisprint if speed is (apparently) legit.
* Display at least 6 digits when debugging speed h/v (with the speed prediction, this is much needed)
* Revert accidental formatting change to GodMode
*The band-aid "lowjump post" subcheck has been removed as well, because the vDistRel rework will (soon) catch those as well. But first, we need to patch the first-move-after-landing false positive.
* Also get rid of bunnyslope, once and for all.

Missing:
vDistRel: handling of: leaving liquids, noob-towering up, landing-back-on-ground, medium transitions...
vDistPowderSnow: incomplete, due to not knowing how the game handles ascending motion here.
vDistLevitation: works fine with lower levels, but breaks with higher ones (above 20 or so) for whatever reason.

(Was meant to be split into different commits, but I fucked up a bunch of things. Oh well)
2023-05-09 14:13:20 +02:00
Lysandr0 05f7064866 FastConsume not so special anymore, do check for client version in some places.
Integrate FastConsume as an ordinary check without checking for specialities/availability
(PlayerItemConsumeEvent was introduced in 1.5 and we do not support versions lower than that anymore, so the availability check has no reason to still stay).

With the client-version hook, we can now finally check for client version in certain places. This isn't really possible for blocks as they are defined globally, and not per-player. Would require a big refactor to support it.

* Revert GodMode formatting and comments.

* Ensure ClientVersion is not set to UKNOWN if protcol-hack plugins are not present on the server, but ProtocolLib is.

* Document stuff
2023-05-07 18:43:15 +02:00
Xaw3ep 72f76d7f2c Fix false positives with medium transitions
Some blocks like web, berry bush, slime block might not done yet
2023-04-26 23:19:48 +07:00
Xaw3ep a6ef1b5251 Fix random things
Key changes:
+ Fix liquid height return incorrectly
+ Brute-force all input direction
+ Fix split-move system return incorrect pitch and yaw
2023-04-24 23:57:51 +07:00
Lysandr0 62bf94cf08 Merge branch 'master' into hspeed 2023-04-13 18:06:30 +02:00
Lysandr0 53f1642bff Merge master (1) 2023-04-13 17:59:54 +02:00
Xaw3ep dc3a487ca5 Beautify client version 2023-04-13 19:18:48 +07:00
Xaw3ep bef2c4e23b Folia support
First attempt to support Folia; Not fully tested, proceed with caution!
2023-04-13 09:31:40 +07:00
Lysandr0 c1a691baaf Attempt to get the client's protocol ID thorugh CompatNoCheatPlus
This should be done within NoCheatPlus rather.
It is also a bare-bone attempt: you'll need to look up the protocol ID table to know which version the player is on.
Later, some kind of translation method (from protocol to launcher version) might be done.

(PRs to improve this are most welcomed :p)
2023-04-11 20:59:03 +02:00
Xaw3ep fb5efa0d93 Fix #290
Also come with an small change allow using elytra in web and berrybush
2023-04-06 09:09:09 +07:00
Lysandr0 64a70f731c Merge branch 'master' into hspeed 2023-04-04 10:59:55 +02:00
Lysandr0 7d289a0ad1 First version of MC's liquid push mechanic.
Simply going in the same direction of a single stream of water works "fine". Moving around does throw false positives still.
The falling liquid bit needs to be implemented still.

* Also, properly set the aboveStairs property (get rid of the old stair workaround)
2023-04-04 08:18:03 +02:00
Lysandr0 10c50653e8 Cleanup for the chat listener, comments. 2023-04-04 08:18:03 +02:00
Lysandr0 96ac4df374 Update NCP to 1.19.4 and fix Against false positive with frogspawn. 2023-04-04 08:17:43 +02:00
Lysandr0 81cf339560 Some improvements to how NoCheat+ handles inventory-related checks
* Do not check for InventoryType.CREATIVE with the hasInventoryOpen check.

* Only display debug messages for Open if the inventory was actually closed

* Force-close inventories on BlockBreak and BlockPlace events

* Several listeners will now ignore cancelled events (won't register data if the event was cancelled)

* Inventory clicks are now always listened for, even if the click was cancelled (to register the opening time), but checks won't run still.

.
2023-04-04 08:17:43 +02:00
Lysandr0 98e96350d5 [#290] [#271] [Blind] Bump NCP to 1.19.4, fix NoSuchMethod error.
Should be done, more or less (?)

Also catch a false positive with frogspawn placement on water (like lily).
2023-04-01 13:21:07 +02:00
Lysandr0 095dc1a5ba [#289] Skip players trying to place seeds/plants on crops/plants with the Against check 2023-03-23 13:51:08 +01:00
Lysandr0 7b56ee4c40 Fix NPE. 2023-03-10 16:37:06 +01:00
Lysandr0 1c609e7e4a More changes (+)
* Further clarify docs and comments, cleanup.

* Reoder some event-listeners (especially in the movinglistener).

* Net checks: also request a setback on flyingfrequency violations (should prevent server-sided freeze [...]).

* Do still interpret packets for outgoing positions if flyingfrequency is disabled.

* Fix false positives with ImpossibleHit.

* Remove legacy boolean flag for 1.5 inventory tweaks (fastclick).

* Don't allow players to stand on tilted drip leaves (onGround judgement).

* SurvivalFly: reset bunnyhop delay on slopes and stairs, tweak slowfalling handling (only apply slowfall gravity if the player is actually falling [not coming from ground etc...]).

* Remove experimental Improbable feeding with VL frequency hook.

* Rework inventorymove:
Instead of checking during InventoryClickEvent(s), we check players on PlayerMoveEvents and if the inventory is open when it shouldn't be possible, it will be forcibly (and silently) closed, without generating any violation or alert .
This makes the check functionally identical to Open, so it has been merged in it.
Not 100% done. Still needs the speed prediction to function, in order to determine friction speeds.

* Set all config values to build 154 from now on.
2023-03-09 14:28:28 +01:00
Lysandr0 8c1fe17749 Much less leniency for fast-breaking, packed mud assigned to the pickaxe.
With the block-breaking time refactor, we can now be much less forgiving in checking for FastBreak.

Also attempt to fix false positives with packed mud.
2023-02-24 22:47:33 +01:00
Lysandr0 5429c8481e Merge branch 'master' into hspeed 2023-01-20 08:56:07 +01:00
Lysandr0 715491f1ec Comments, cleanup 2023-01-19 20:38:21 +01:00
Xaw3ep a36053faed Merge pull request #277 from Updated-NoCheatPlus/block-hardness-v2
Merge branch block-hardness
2023-01-19 20:49:15 +07:00
Xaw3ep 3ac7a45e67 Quick update to 1.19.3
Mostly aim to get rid of annoying messages on start and fix NoSlow not functioning properly
2023-01-19 20:37:07 +07:00
Lysandr0 2f267b5650 Confine lost-ground cases, fix errors, fixes for SurvivalFly
* LostGround:
 - Swap edgedesc with pyramid and put edgedesc as a special case in vAcc;
 - Confine all Edgeasc cases by having a minimum speed of 0.0001;
 - Confine noobtower by jumPhase between 1 and 7 inclusive;
 - Confine couldstep by speed <= estimatedSpeed * 1.1;
 - Edgeasc2 won't be applied on split move (following asofold's note here);
- All edgeasc cases won't be applied if a lost ground case was applied with the move before;
 - Update Improbable if a lost ground case is applied;
These have not been tested.
They are rather the most plausible confining conditions that I can think of currently; aim is to prevent to easy abuse with NoFall disabled to accumulate fall distance.

* SurvivalFly:
 - Sharpen bunnyhop conditions;
 - Remove omnisprint for the moment;
 - Increase the inaccuracy margin with levitation;
 - Possibly fix bunnyhopping on soul sand and blocking speed in 1.8;
 - Reduce the complexity of split moves workarounds with stuck-speed, courtesy of @xaw3ep 's rework on the mechanic;
 - Lower head obstruction margin for low-jumping;
 - Sharpen levitation handling;
 - Roughly make vAcc work with slowfall.

* Fix NSM errors with some packet listeners;

* Comments, formatting, clarify comments

* Improbable:
 - Increase thresholds for firing violations, since it gets fed by a lot more inputs now;

(Probably forgot some other stuff... Oh well. Happy new year)
2023-01-05 21:10:19 +01:00
Lysandr0 fc37194fd5 Ops.
Fix compilation errors.
2022-11-24 09:58:46 +01:00
Lysandr0 e3300f1e5c Merge branch 'hspeed' of https://github.com/Updated-NoCheatPlus/NoCheatPlus into hspeed 2022-11-24 09:05:05 +01:00
Lysandr0 29f0ecdf36 Get rid of the horizontal buffer, adjustments. 2022-11-24 09:04:15 +01:00
Xaw3ep b36081fc6f I don't know what I'm doing
Just an attempt to fix wrong calculation in the first move after landing. Might wrong, but it give the idea why. Let understand client code different way. moveRelative() -> move() -> friction.
Assume everything after move() is the preparation for the next tick not the current one. So the right order is lastfriction -> moveRelative() -> move().
2022-11-24 04:21:43 +07:00
Xaw3ep d23161e1a6 Full split moves
Split the move properly, some minor adjustments and comments
2022-11-23 09:49:37 +07:00
Lysandr0 fcbe674233 Slowly getting there.
* Harmonize bukkit's walkspeed with attributes;

* Reset Improbable's data on certain events;

* Check for Improbable on fakefall and fakeground;

* SurvivalFly:
 - Unbound liquid workarounds from velocity jump phase, in the hope that it will fix issues regarding waterfalls
 - Throw in a placeholder estimation for the player movement inputs
 - Make the estimation work, for the most part (at least for just walking/sprinting on ground). Lots of issues still remain
 - vDistAir: switch to minJumpGain as maxJumpGain's motion is way too high with jump amplifier
 - Do bunnyfly after the estimation and sharpen bunnyslope
 - On using queued horizontal velocity entries, update Improbable
 - Remove a waterfall workaround (was ineffective)
 - Comments on vDistClimbable
2022-11-21 14:20:58 +01:00
Hulk c26fa72aaf Fix #251 2022-11-20 23:25:34 -06:00
Lysandr0 873139546f More adjustments.
* Fix some typos;
* Don't apply the bunnyhop mechanic on stepping;
* Rename some fields in MovingData;
* On no horizontal distance, also reset x/z allowed dist;
* Fix wrong permission being checked for using items;
* Split moves: Ignore stuck-speed. Do apply block-speed regardless;
* Floats -> doubles and viceversa;
* Re-introduce the bunnyslope mechanic;
* Prevent precision loss with the sprinting multiplier;
* Revert the maxphase detection: doesn't seem to work well (it may come back at a later moment, once there's enough time to test it);
* Potentially fix null pointer in Net_Moving;
* [Bleeding] First approach to an omnidirectional sprinting check.
2022-10-20 08:24:53 +02:00
Lysandr0 72df6a2f97 Ops.
Fix noob-tower conditions due the the new yOnGround value.
2022-09-30 21:27:52 +02:00
Lysandr0 441ab8871a Merge branch 'master' into block-hardness-v2 2022-09-30 19:54:20 +02:00
Lysandr0 b6d5c04d4d Adjustments for hspeed.
Keep track of both axis with the past move tracking. Will be useful to judge velocity and strafe cheats later on.

Also re-introduce NoCheat-style maxphase detection (only for descending and velocity), to be tested, but potentially more useful than the previous implementation.
2022-09-30 12:48:51 +02:00
Lysandr0 47b56fbf88 [Bleeding] Tweak NCP's y parameter for onGround seeking, random formatting for chat checks.
This is a small commit which could  actually change a lot of things.
The previous yOnGround value was too high, causing some moves to be detected as "on ground" earlier than expected.

This will affect all moving checks, including NoFall; workarounds which contain ground conditions may need to get reviewed; lowjump-post will likely be affected, also [To be tested]
2022-09-29 15:15:23 +02:00
Lysandr0 4db7e95dab Get rid of the bunnyvel workaround.
This of course means that exiting moves will now yield false positives. But this will be irrelevant anyway with the hSpeed branch.

Should address #255
2022-09-24 15:51:17 +02:00
Lysandr0 e4e8b0d90c Merge branch 'master' into hspeed 2022-09-19 14:18:37 +02:00
Lysandr0 8430404436 Merge pull request #243 from Dymeth/master
Fixed hidden commands usage from console on PurpurMC
2022-09-19 14:18:05 +02:00
Lysandr0 a9e693c730 (Hopefully) Clarify the VL frequency hook, refine levitation and prevent abuse of it(+)
The hook will now request an Improbable CHECK for too small and too recent repeated violations. This will make the likes of "Hypixel fly" even more expensive to use.

Levitation: the new handling will try to predict the allowed distance, just like vDistRel. Workarounds are in place for all those cases -that have been observed thus far- where the prediction fails.
Stuck-speed remains itchy: predicting speed is nearly impossible, without spending obscene amounts of time.

* NoFall: clear data directly into the checking method with Slowfall and Levitation;

* Throw in a sketch for the future riptide check (CreativeFly)

* Add more detailed about SurvivalFly's internals

* Format, tab->spaces, fix code order for hSpeed

* vDistRel: remove odd jump gain margin (what is it even used for?)

* Fix fuck up in Frequency's VL calculation

* Debug Net_moving

* Merge master

* Track teleports to untracked locations with cause PLUGIN

* Re-re-add headbangbunny, correctly this time :)

* Patch even more 1-block step(s)

* Don't allow jumping motion if the player is stepping down a block

* Extreme move: lower h-speed threshold

* MovingListener, onCancelledMove: fix NCP actually requesting a set-back only if the player was in debug mode (assuming a major oversight by asofold)

Note about the walkspeed-horizontal-fly exploit with slime block: NC+ keeps faking vertical velocity in the "onPreparedBounceSupport" method if altitude does not change.
For the method's calling, there are 2 pre-conditions:
1) The data.verticalBounce field needs to not be null;
2) No new To location where to setback the player to has been requested by checks.
This explains why:
1) Cheaters need to bounce on the block at least one time (otherwise the verticalBounce field will be null);
2) Cheaters cannot do anything else, besides air-walking, nor generate violations (Changing altitude will consume the vertical bounce, which will then yield a vDistRel violation, while going above walkspeed will generate a speed violation, causing SurvivalFly to request a new setback location)
Now, the question is then: why does NC+ need to keep the vertical bounce on not changing altitude? Was it intended to not reset the verticalBounce field or is it an actual bug?
In any case, safer resetting mechanics are required, provided we keep this odd fake velocity mechanic at all, which doesn't really seem to be needed (no tickets have been opened).
2022-09-19 08:50:24 +02:00
Nikolay Mitrofanov f42aafaa14 Fixed commands usage from console on PurpurMC 2022-09-02 02:25:16 +03:00
Lysandr0 c3fc896b3d Patch a (potential) fly exploit with the current config (read on)
Up until now, the default config has been clearing SurvivalFly and CreativeFly's data upon reaching the maximum interval.
When this happens, the setback position is also reset.

This can be exploited to fly and/or speed by generating extremely high VLs, forcing the Fly check to clear its data.
2022-08-28 22:19:58 +02:00
Lysandr0 9562a277ee Forgot about one mechanic. 2022-08-20 13:51:59 +02:00
Lysandr0 4029e6f4db Merge branch 'master' into hspeed 2022-08-20 09:13:56 +02:00
Lysandr0 410f88866e Revert back a few things
* Fix stepping while on climbable;
* oddSlope: skip if in lowjump;
* Revert back BCT changes;
* Revert back speed handling to check for axis individually;
* Potentially fix moving immediately after a teleport causing false positives due to the LiftOffEnvelope being set to UNKNOWN (MovingData);
* Account for attack slowdown;
* Catch criticals with slow fall active;
2022-08-20 09:09:33 +02:00
Hulk cfb83b4904 Patch a fly exploit which abused slime blocks 2022-08-19 15:33:00 -05:00
Lysandr0 b1c6258675 Update bug_report.md 2022-08-13 22:06:29 +02:00
Lysandr0 25242e13a9 Tabs->Spaces. 2022-08-13 17:22:53 +02:00
Lysandr0 6f670ce7c8 [Bleeding] Let Slowfall and Levitation be handled by SurvivalFly.
* Move Bridge1_17 stuff into BridgeMisc;
* Add a "hasGravity" method;
* Patch potential 1-block step bypass with lowvdistsb;
* Fix (for the most part) closing a shulker box while standing on top of it;
* Fix up a bit bubble columns handling;
* Fix false positives when exiting a bush or web from below;
* Cleanup and reduce signature for AirWorkarounds;
* Catch another trapfence lost ground case;
* Remove reminders of the old bunnyfly mechanic: all early-bunnyfly-reset cases can be omitted because those rely on the old condition "if (bunnyfly > 0 && hDistance > hAllowedDistanceBase)".
However with the current implementation, air / bunnyfly distance is already estimated and included;
* Use getLastJoinTime for Net_Moving and Net_KeepAliveFrequency, getting rid of the old listener workaround;
* Keep confining workarounds:
  -W_M_SF_ODDGRAVITY_3: one time use
  -W_M_SF_ODDLIQUID_13: one time use
  -W_M_SF_ODDLIQUID_7: one time use
  -W_M_SF_ODDLIQUID_5: 4 times use max
  -W_M_SF_ODDLIQUID_6: water-bound
  -W_M_SF_ODDLIQUID_12: one time use.
* Don’t ignore PVP and block-move velocity when in bushes and powder snow;
* Distinguish vertical friction factor by media (air, water, lava) and block (stuck-in-block);
* Slowfall:
  - Add workarounds for vDistRel where needed.
 - Adapt checking methods to it (modelling might be a little rough still).
  - Handle honey slide + slowfall.
  - Skip NoFall and fall damage with slowfall.
  - Handle with the BCT breaking blocks below with slowfall (false positives).
  - Skip vAcc: temporary. Needs a proper adaptation.
* Levitation:
  - Add checking method;
  - Add velocity when the effect wears off;
  - Skip NoFall;


Missing:
* InstantBow apparently always triggers with the first crossbow shot (why is it even enabled at all?);
* Major: players can stand on top of tilted drip leaves (!)(to avoid latency-based false positive, we might use the block change tracker system here)
* False positives when falling and breaking a block below with Efficiency enchant: issue with the server not keeping up with the client, might mitigate with the BCT [Does not seem to fix the issue, will need a ghost-block system fix];
* Bubble streams adjacent to each other drag/push: push prevails even if the box is in the column by pixels. Problem: we don’t get told if the column can also push the player;
* vAcc velocity downwards (old TODO);
* vAcc with snowfall (don’t skip, adapt rather);
* Still low-jump false positives when closing a shulker, with slowfall in particular;
* Low-jump false positive after jumping out of water and onto a water lily;
* Liquid modeling with slowfall is still quite rough;
* Levitation will need a refine later;
* Bubble columns ascend -> refine;
2022-08-13 14:46:17 +02:00
Lysandr0 d7fa6c1644 Merge pull request #224 from Toshimichi0915/fastclick
Fix / by zero with the chest subcheck for FastClick.
2022-08-10 16:22:50 +02:00
Toshimichi0915 f56e9a9dbc Fix FastClick NPE 2022-08-06 22:29:12 +09:00
Lysandr0 0c737f3c1e Let lowjump consume vertical velocity.
(Fix is already included in the hSpeed branch)
2022-07-29 00:39:38 +02:00
Xaw3ep 602199256a Fix false positives when leaving liquid 2022-07-28 13:46:57 +07:00
Lysandr0 d98c96c87b Merge branch 'hspeed' of https://github.com/Updated-NoCheatPlus/NoCheatPlus into hspeed 2022-07-23 20:25:42 +02:00
Lysandr0 1b795bb9ea Adjustments to hSpeed. 2022-07-23 20:25:30 +02:00
Xaw3ep 5713f956d9 Fix UseEntity 2022-07-23 14:08:21 +07:00
Lysandr0 c37908eec6 Move use-item data to CombinedData, debug hSpeed to begin testing, adjustments. 2022-07-17 17:54:32 +02:00
Xaw3ep 0fc194a17a Get rid of time map of breaking blocks
Use hardness instead of time map for easier debug, maintain and less false positive.
No time to test this out, put it here first.
2022-07-14 18:18:43 +07:00
Lysandr0 07bdc0ea10 Merge master, remove InstantEat and Items + minor improvements.
With the official drop of 1.4, these checks can be finally removed.

* Critical: use the maximum jump phase (should be stricter)
* Remove misleading "preventmisc" category
* Request an Inventory update on inventory checks VL.
2022-07-11 21:38:31 +02:00
Xaw3ep 91aca1e671 Fix the mud 2022-07-10 18:28:07 +07:00
Lysandr0 552fbb446e Ops. 2022-07-10 09:59:38 +02:00
Lysandr0 3bebafdbe8 Merge branch 'master' into hspeed 2022-07-09 20:18:01 +02:00
Lysandr0 3ea2dc46d8 Adjustments, rename boatsanywhere to boatsOnWaterOnly
* Better server-side lag adaptation for Angle, FlyingFrequency and ToggleFrequency
2022-07-09 20:10:35 +02:00
Xaw3ep 353969053d Step back to 1.5 and ascend to 1.19
! Not fully tested
Key changes include:
+ Update to 1.19
+ Fixed minor critical false
+ Fixed some backward compatibility issues from (1.5 to 1.6.4)
+ Drop 1.4 support
+ Attempt to catch #215
+ Bump version to 3.17.1 to further issue tracking
2022-07-09 16:45:50 +07:00
Lysandr0 d5d16d3db5 Yet another heterogeneous commit.
Lots of changes:
* [Bleeding] Add Net_toggleFrequency on packet level (needs to be tsted and adjusted, currently does not discern action types);
* [Bleeding] Add a quick check for no gravity when in webs;
* Formatting;
* Fix vDistBush + stepping;
* Fix Net_keepAliveFrequency/AttackFrequency/Moving not checking for the respective bypass permission;
* Fix Net_Moving always checking players, even if disabled;
* Fix Extreme_Move only running with CreativeFly;
* Fix low-jump detection not accounting for velocity;
* Fix a disabled Net_FlyingFrequency from crippling all other flying-packet checks;
* Remove redundant WrongTurn adapter;
* Remove legacy Fight_Speed check and keep AttackFrequency only (This means that servers older than 1.6.4 won't have attacking speed protection anymore. We need to put a halt on legacy-versions support at some point 😛);
* Remove legacy and unneeded mechanics: lost-sprint, assume sprint, slowness sprint hack, ground hop;
* Remove bubble-stream-horizontal-velocity workaround;
* Remove unimplemented FlyingFrequencyRedundant config;
* Rename compatibility dev module to -> NCPCompatSpigotCB1_12, since 1.12 is the last version to have a native module on its own;
* Rename NoSlow adapter to UseItemAdapter;
* Adjustments to vDistWeb and vDistBush;
2022-06-25 19:14:48 +02:00
Lysandr0 1e6c8e3780 Formatting for block models, config & checks' data. 2022-06-23 21:31:05 +02:00
Lysandr0 576379cd3e Merge branch 'master' into hspeed 2022-06-08 13:03:33 +02:00
Lysandr0 f8a5169a5a Comment on Scaffold.
God-bridge is a thing apparently + reminder for the future... :)
2022-06-07 21:09:36 +02:00
Lysandr0 804206bf22 Let the whole thing compile for the moment.
Direction factors are commented out for now, just to let the thing compile.

Key changes:
* Revert (!resetTo) condition for lost-ground testing, due to some false positives;
* Formatting;
* Test for block-change activity in more places (vDistWeb/Bush)
* Revert the fix for "too little h-vel validation counter" due to the hSpeed rework.
2022-06-07 20:31:49 +02:00
Lysandr0 13d80f3166 Let NCP load on 1.5 2022-05-30 23:16:33 +02:00
Lysandr0 02159d280d Merge branch 'master' into hspeed 2022-05-20 15:52:31 +02:00
Lysandr0 d2c8e080cd Patch-up previous commit.
+ more comments.

Only things missing for the hSpeed rework are:
* Movement direction handling;
* Fluid pushing speed;
* Stairs auto-jump speed
About stairs, COULD:
Trust the client's onGround status when on stairs, which will offer no protection.
OR
Simulate the auto-jump behaviour when on stairs only, and assume players have it enabled anyway.

Will try to do something about fluid pushing, unless someone else beats me to it (likely going to happen) :)

(Then, with workarounds. . .)
2022-05-20 15:49:03 +02:00
Lysandr0 e2dfa93fa2 Catch a low-jump false positive. 2022-05-16 19:22:14 +02:00
Lysandr0 78e6c4cede Misc changes (mostly lost-ground cases removal)
Very heterogeneous commit.
Key changes:
* Comment out LostGround_Step: not too sure about this one however why is it even considered a lost-ground case if the player did touch the ground (to.isOnGround())?
* Remove LostGround_EdgeAsc7: duplicate code;
* Remove LostrGround_Pyramid: doesn't seem to cause any issue with vertical motion and with the new hSpeed rework, momentum ticks don't exist anymore.
* Remove LostGround_MiniStep: not needed. Jumping around flower pots is fine even without the workaround.
* Remove LostGround_vCollide: again, doesn't seem to be needed anymore.
* Confine LostGround_Micro by head obstruction due to a lantern or currently respawning;
* Better on-ground support for bunnyfly: account for block-change activity where possible;
* Skip block-speed check if the player is in water or in bubble-stream (NMS);
* Implement getMovementSpeed;
* Get rid of hAllowedDistanceBase (not needed anymore) [Might return for later uses i.e.: getting the allowed speed before applying friction];
* Rename methods and get rid of VanillaMath (changed my mind, keep everything in TrigUtil and MathUtil :p)
* Correct a typo in Inventoryutil.
* Fix a rather embarrassing typo (Ground-seeking distance for getBlockFrictionFactor is 0.5000001, not 5000001 :) )
* Support bukkit's /walkspeed command;
* Random clean-up for old checks.

- Note: The 0.1 magic value can be found in Abilities.java (walkingspeed)
2022-05-13 17:53:20 +02:00
Lysandr0 4ae5b45972 Adjustments...
* Format
* Move getEntityPushSpeed to MovingUtil
2022-05-03 21:35:46 +02:00
Lysandr0 46da5e3654 Support entities push-speed, fix compilation errors.
Next, fluid pushing... Will be painful.
2022-04-29 15:55:09 +02:00
Lysandr0 aa13a825da Comments, put back double bunny, more improbable feeding on impossible moves. 2022-04-28 20:39:28 +02:00
Lysandr0 6264b5dc5c Quick refactor for resetFrom, remove "fastedge" lost-ground case, remove outdated fixes, remove workarounds
* The removed air-workarounds point to something that should be tackled differently: breaking a block underneath should cause the block-change tracker to catch such false positive. Why isn't it working here?

* Remove an old lost-ground case, as stated by asofold.

* Quick refactor for resetFrom: block-change activity is tested not only if the player is standing still... (Can't really pinpoint the reason behind such design...)

* Remove isOnIceLegacy thingy...
2022-04-28 16:16:59 +02:00
Lysandr0 dec3253416 Ensure lost-ground activity is tested only if the player didn't actually touch the ground
* Implemented an old TODO by asofold: skip checking for lostground cases if the player did land on ground (resetTo).
(1st step into the lost-ground review).

* Remove an old (likely irrelevant by now) fix (Infinite VLs ...).

To be tested, might have a lot of side-effects.
2022-04-27 21:10:44 +02:00
Lysandr0 664a901de9 Merge branch 'master' into hspeed 2022-04-26 16:10:42 +02:00
Lysandr0 abbd90e943 [Incomplete][Not compiling][Bleeding] First step into the hspeed rework.
Moving some stuff in remote.
* Rework horizontal friction system;
* Cleanup code: remove unused and/or unneeded variables, remove old bunnyhop mechanic;
* Throw in a sketch of the predictive horizontal speed handling [broken, will not compile due to some stuff still missing]

Missing:
* 3d Movement direction handling
* Test everything I guess
* getMovementSpeed stripped only of sprinting speed
* Correct stuff that is going to be inevitably wrong :)
2022-04-26 16:07:24 +02:00
Xaw3ep 2901f792a0 Miscellaneous changes
Key changes are:
- Correct cactus shape
- Further preparation for bedrock compatibility
Fixed #204

.. / .... .- - . / -. -.-. .--.
2022-04-26 06:37:51 +07:00
Lysandr0 e2e0b0dacd [Incomplete] [Bleeding] Throw in more utilities.
Sifted through client code for long enough. These methods should be correct to be put remotely, hopefully.
2022-04-18 11:08:32 +02:00
Lysandr0 4a42adf93b Move more classes around and reorder imports.
Move MovingUtils into... The utilities package
2022-04-13 22:43:23 +02:00
Lysandr0 5883a28948 Fail.
(Remove redundant stuff)
2022-04-13 19:48:18 +02:00
Lysandr0 e1399ddf3b Merge remote-tracking branch 'origin/block-hardness' into hspeed 2022-04-13 15:46:39 +02:00
Lysandr0 320adc16bc Compile fix. 2022-04-13 15:46:01 +02:00
Lysandr0 cbdc63e746 Move class around.
Let math-related utilities have their own package
2022-04-13 15:28:36 +02:00
Lysandr0 dcd5e1f96f Prepare utility methods for the upcoming predictive horizontal speed.
* Also cleanup, remove non-effective fixes for NET_MOVING, skip collision check for stairs due to the new BB rework and check for ground in isOnHoneyBlock, distinguish above soul sand VS in soul sand.
2022-04-13 15:08:04 +02:00
Xaw3ep 0bc27d83e3 Update BlockProperties.java 2022-04-12 22:52:12 +07:00
Xaw3ep 9293cde9ed Yet another cleanup
Key changes include:
+ Correct liquid
+ Reverse `boatanywhere` logic to avoid misunderstanding

Fixes #182
Fixes #169
2022-04-12 22:44:26 +07:00
Lysandr0 a4dda13e8c Multiprotocol plugins are a thing...
Should get the client version in some way. Another reason to hook into PS/VV I guess.
2022-03-30 12:32:55 +02:00
Lysandr0 9069b86c86 Spaghetti.
Formatting/Order.
2022-03-30 09:43:07 +02:00
Lysandr0 c69e62fc18 Merge branch 'Testing' 2022-03-30 09:06:54 +02:00
Xaw3ep 5a7fc17183 Patch boat fly and random clean up 2022-03-29 18:46:25 +07:00
Xaw3ep 95b3405356 Merge pull request #146 from adampoulson/test
improve boat speed checks
2022-03-29 18:44:14 +07:00
Xaw3ep 37c0db896d Eradicates a tiny bug 2022-03-28 08:29:47 +07:00
Lysandr0 8c00cb5936 Let it compile. 2022-03-27 14:51:55 +02:00
Lysandr0 7d7a0a6bad Merge branch 'master' into Testing 2022-03-27 14:44:17 +02:00
Lysandr0 7f13311ec4 Partly fix up the low-jump detection
* Fix low-jump triggering when jumping 1 block up (slope, player touches ground while still ascending causing a setback update [...]);
* Fix noobtowering triggering a low-jump (similar reason as above);
* If in low-jump:
    + deny bunnyfly;
    + feed Improbable;
    + throw a VL;
    + deny buffer regain (do however allow
        use)
2022-03-27 14:18:04 +02:00
Xaw3ep 3dff8c5b78 Forgot climbable 2022-03-27 19:07:28 +07:00
Xaw3ep ae62126479 Restore lost commits (part 2)
Ok ok, you defeated me, but I still have backup, see you next time!

Key changes include:
- Correct most blocks shape(both for legacy and news versions); less misuse workarounds
- Fixes message on death
- Clear redundant patches
2022-03-27 16:31:25 +07:00
Lysandr0 3f5f64396b Merge branch 'master' into Testing 2022-03-07 08:32:07 +01:00
Xaw3ep 2cff2963c9 Restore lost commits (part 1)
Fix #150
Fix #155
And some other forgotten bugs
2022-03-05 18:40:08 +07:00
Lysandr0 78526facf6 Cleanup 2022-03-05 09:44:32 +01:00
Lysandr0 939fe1fa55 Having a look at air workarounds, fix ascending in waterfalls after a bunnyhop, reorganise vDistWeb and vDistBush.
* Add LiftOffEnvelope.LIMIT_SURFACE instead of resorting to more workarounds for vDistSB (keep the waterfall workaround);
* Throw in more comments;
* Adjust horizontal magic values;
* Remove berry bushes compatibility flag with lower clients (We'll blame players for using outdated client versions :))

- Several more workarounds to go: oddLiquid workarounds need to be simplified and reduced too, possibly.
2022-02-23 08:24:40 +01:00
Lysandr0 b58c24e2bf Re-group air workarounds, comment on Extreme move, bug fixes, scrap stepAcc in favour of a new vDistSBLow check.
List of changes:
* Typo;
* Fix momentum ticks never being added after lost ground pyramid;
* Attempt to support bubble column's horizontal bounce effect via velocity (coarse...);
* Allow walk speed on waterlogged blocks when landing or lifting off from ground (provided all conditions are met [no head obstruction, not submerged etc..]);
* Re-group all liquid workarounds into oddLiquid to keep a better overview of all of them and for easier debugging (Also rename for the umpteenth time because I'm an idiot who can't decide);
* Lower y margin for ground collision in liquid (lift-off envelope, should help with hopping in shallow water);
* Add more confined workarounds for moving on the surface with 1.13+ clients. (vDistSB) [Likely not all cases have been covered yet (!) ];
* Allow honey block limit to consume velocity (false positives).
* [Fail] Remove lava workarounds because those cases had been tested with god-mode on... Idiot me.
* Better naming: bunnyhoptick -> momentumTick;
* Conduit assigned to pickaxe only from 1.18 and later.
2022-01-31 19:59:14 +01:00
Lysandr0 b61607a4ba [Bleeding] Changes (read on)
Sf:
* Take care of the last left-over from asofold -> Xaw3ep/CaptainObvious transition: add limits for moving in bubble columns, distinguish drag/push, deny ascension if getting dragged or descend if getting pushed.
* Bunny + headbang: add velocity on certain transitions. Modelling is too much of a hassle here.
* Alter hAcc limit slightly;
* Confine liquid workarounds a bit more;
* Modify speed limits when moving on surface while bouncing on bubble column;
* Deny ascension in liquid if sneaking;
* Waterwalk: fix potential "bypass" by checking with lower hDistance (using 2 moves to prevent false positives).

[Experimental] Sf velocity:
If strict invalidation is set to true, *ALL* horizontal velocity is cleared (queued as well, not only active) with no hDistance. Effects on actual cheats remain to be seen, but this should prevent cheaters from turning on anti-knockback hacks to conveniently collect velocity entries for a one time cheat attempt (longjump). Coarse, would be better to get the location at which a velocity entry was collected/queued and compare it to the location at which the entry was used instead.

Sf, Lava:
* Lava, horizontal move: bunnyhopping on//near lava's 6th level doesn’t slow the player down enough, it also won’t break the player’s sprint like water does. This will cause false positive as NCP will apply the liquid speed limit regardless. Also the bunnyhop mechanic won’t apply due to the change of envelope. Occasional false positives might still appear but it should be *a lot* better now.
* Lava, vertical move:
Add a vDistRel case, rather rare, was able to observe it just one time (not sure if it happens with legacy clients);
Add LiquidWorkaround case: jumping with normal gravity on the lowest lava level.

Block flags:
* Add bouncing flag to beds only from MC 1.12 and on;
* Remove the F_HEIGHT_8SIM_DEC flag from lava only from MC 1.13 and on, re-add it back from 1.16 because Mojang reverted lava movement back to pre 1.13 behaviour; however at the lowest level one can now jump up and down normally: resolved with adding the flag back up.

Blockplace:
* Re-balance Improbable feeding.

Missing:
* Launch effect for bubble streams;
* Sneaking modifier: Odd false positives, not sure what's going on here.
* Bubble columns are still horrendously buggy.
2022-01-14 11:20:50 +01:00
Lysandr0andMarkElf 69a088bdcc Fix conduit breaking times. #188
Co-Authored-By: MarkElf <13339283+MarkElf@users.noreply.github.com>
2022-01-12 20:13:48 +01:00
Lysandr0 1957f6ff0a Trash 11 year old checks. Move bedleave to SurvivalFly. Tweak MorePackets further. 2022-01-05 21:44:06 +01:00
Lysandr0 9582d4260a [Breaking] Move block flags out of BlockProperties.
+ Formatting.
2021-12-27 23:04:51 +01:00
Lysandr0 bee2c1e349 First steps into 1.18
(No new blocks with this update. Thank god)
+ Re-arrange lost ground fencestep
2021-12-18 10:37:42 +01:00
Lysandr0 5b4dc5afe9 See details.
* InAirRules: confine specific workaround to Normal env;
* Readability: iusingitem -> isUsingItem(...) | F_COBWEB2 -> F_BERRY_BUSH | typo | Order in MCAccessBukkitModern;
* Do prevent players from faking critical hits in media where they can be faked;
* Open check: test on player sleep and death;
* Sharpen stepAcc;
* Slopes: skip on jump potions, let lowjump catch the reset;
* Bunny: on slope-jumping, demand distance higher than the y on ground, at least;
* Remove legacy bullshit (awkward snowfix);
* Demand yDistance greater than minimum gravity for maxphase.
* Remove left-overs from previous bunnyhop-related commits (simply increasing speed on slope-jumping should suffice).
* Fix 1.8 chests with ice underneath.
2021-12-16 09:32:28 +01:00
Lysandr0 03dd91c49b Bug fixing, add lostground_edgefence.
* Inventory is closed if player is not air  clicking #180 ;
* Model with lost ground server-sided trapdoor touch miss #178 ;
* Add to lift off envelope minimum jump height;
* Cleanup critical;
* Switch for step-acc, currently disabled as it needs some testing.
* Alter tags.
2021-12-03 13:44:56 +01:00
Lysandr0 d40090def0 Merge branch 'master' of https://github.com/Updated-NoCheatPlus/NoCheatPlus 2021-12-03 13:38:34 +01:00
Lysandr0 28504d4891 Merge pull request #179 from bmack94/master
Fix several edge case involving climbable blocks, webs and bubble streams.
2021-12-02 17:08:54 +01:00
bmack94 ce6d0bd42c move workaround into vDistWeb 2021-12-01 20:08:26 +01:00
Lysandr0 d3594c3d75 [Experimental] Throw in a step-accounting subcheck, action accumulator based hAcc
Idea is simple (and currently bare-bone): on slope-jumping yDistance is added to to the bucket, or subtracted from it if negative. A direction change to descend phase will reset the bucket and start over (Legit players will perform a LEGIT lowjump after jumping up a slope).
If the accumulated jumping distance exceeds legit step height a VL is thrown (Setback distance did not decrease at all/enough: player did not descend enough after stepping up).
Current implementation is rather meant to fill in the gaps left by MorePackets, since continuous stepping will eventually go over its limit, thus it will trigger on early attempts of cheating (1/2 blocks, enough to let the bucket accumulate data).

* Switch hAcc to use ActionAccumulator as base.

* [Not tested] No horizontal distance = no freedom given.
2021-11-30 17:32:16 +01:00
bmack94 3a4a3ae3e0 fix issue with bubblestream & cobweb and climbing vines/ladder & inWeb 2021-11-30 11:01:40 +01:00
Lysandr0 1e2015fa56 Merge pull request #177 from RoccoDev/fix/inventory-item-drop
Don't drop items in MoreInventory
2021-11-29 15:10:12 +01:00
RoccoDev 45b196c47b Don't drop items in MoreInventory
Let Bukkit handle that instead. By closing the player's inventory, we can make sure the drop events are fired in case other plugins want to cancel them. If they do, the items are simply added back to the main inventory.
2021-11-27 00:34:01 +01:00
Lysandr0 c4949ac0ac Spin-off of previous commit, tighten workarounds.
The resetbunny case poses issues with slopes as it can prematurely reset a legit bunnyfly phase, the current workaround does work fine but it's quite convoluted: a more elegant solution could be either to remove resetbunny or relate to fall distance instead of yDistance (?) since the latter can vary too much if colliding with just about anything.
Account for ice slide downs: sprintjump on a single block the trying to fall back down will result in a single speed increase which is now covered by the bunnyhop mechanism (should be :p) .
(Who even bothers to read this stuff?)

* Fix descending in liquid while on climbable on newer servers (absolute distance).
* Possibly fixed #171 .
* Confine slope speed increase to speeds greater than walking.
* Fix lift off envelope not being updated after a powder snow setback.
* Format, comment on NoFall.
* Review some workarounds: confine slime workarounds by actually having been on slime
2021-11-16 13:21:34 +01:00
Lysandr0 3695671d3b [Bleeding] Bunnyhop, bunnyfly, bug fixes.
Several/Major bunny adjustments (+ on the fly bug fixes)

1) Bunnyhop and slopes:
a) Let bunnyhop apply on yDistance
slopes (the jumping envelope is never hit: gravity hits harder here).
b) Grounded acceleration case (air-ground(landing), 0 hDist diff  ->
ground-ground,  0 hDist diff-> ground-ground, sudden mini burst of speed with no yDistance.
For this phase, we simply give players more momentum via bunnyhop ticks and increase speed slightly.
c) Continuous slope-jumping on ice will still fail  as speed  will keep increasing with each hop (Slime and normal ground seems fine)
d) Observed: edge case where bunnyfly speed decreases extremely little (in-air), thus, if the player has recently jumped up a slope and the hDist difference is small enough, the movement is allowed (should be confined more perhaps).

2) Get rid of that bloody sfOnIce legacy counter, at last.

3) Patch unintentional bypass with ice and headobstr.(bunnyhop -> drop speed below allowed to force set allowHop to true and to increase allowed friction speed -> bunnyhop again with higher speed (yOnGround case applies).

4) Cleanup, "simplify" (Where possible. Still too much spaghetti. Perhaps it's time for a rework :p).

5) Headbangbunny:
a) Don't wildcard; model should be decent enough now.
b) Observed: yet another case where clients can reach increasingly higher speed on ground: Touching ground in bunnyfriction with 0.3 speed -> ground-ground acceleration with 0.4 speed (bunnyhop) -> lifting off with increasing speed 0.5 (subsequent bunnyhop).

6) Hotfix for #171 : Allow bunny to consume the buffer.

7) Always clear hAcc on headbang.

8) On the fly:
a) sfVLTime -> sfVLMoveCount: we count moves, not time here.
b) Fix hopping right into a web (vertical).
c) Distinguish body in water VS body out of water when enforcing liquid->liquid speed limit: Magic has been warped for some time, how did we not get buried with reports about this !?
(Revert value to this commit: https://github.com/Updated-NoCheatPlus/NoCheatPlus/commit/c4331e1ffd4c7c17c43dba03f98f6feb875ada5b#diff-4adf02d4661b4aa4c5031880e2dd87200601581264a6d62eb56ce8c4b1606040 ).
d) Don't allow players to stand anywhere between minimum ground height and block height on ladders: fixes some fastladder bypasses (For @xaw3ep  is the Ground_Height flag still necessary? Seems like it's safe to remove)
Also slightly stricter climbable checking (step).

9) Move bunny stuff into its own workaround class (Coherence).

Missing:
1) Transitions stay problematic:
headobstructed -> head free / headobstructed on ice -> headobstructed on normal ground.

2) Bunnyhop while skimming over the edges of blocks. (video: https://www.dropbox.com/s/tdk1rdf9r3xwz5l/Edge_test.mov?dl=0 )
It does look like it's a problem with ice only (likely due to past moves being updated to not being on ice when touching the ground, the "lowjump problem" contributes as well).

3) Random setbacks when moving off from ice. Couldn't nail down the reason, let the buffer deal with this bullshit for now. Hopefully the higher modifier aids a little...

4) Hacc needs adjustments to take into account all illustrated cases.

5) Hop-after-velocity #171
Also applies when stopping to fly in air at high speed and falling. Looks like velocity isn't extended for long enough?
2021-11-10 16:31:30 +01:00
Lysandr0 31bbfcff7d Adjust speed effect calculations
MC formula doesn't match too well with NCP's. Speed is increased by too much.

On the fly:
Comments.
2021-10-29 20:19:09 +02:00
Lysandr0 f1cb04a485 Declutter the moving listener.
Move all the bounce stuff to its own package/class.
2021-10-25 13:04:43 +02:00
Lysandr0 12ae08f21d Comment out climbclick for now.
Can't test it currently.
(Reminder for #170)
2021-10-19 17:59:41 +02:00
Lysandr0 8ea9b33bc9 Ops... 2021-10-19 10:47:58 +02:00
Lysandr0 b9f78ab326 More bunnies (+)
Changes:
* Fix a minor derp in FightListener: Improbable was being fed even with fight.speed disabled;
* isOnBouncyBlock environmental property, accounting for beds too;
* SurvivalFly:
   - Increase hAcc limit for headobstr
      with ice;
   - Move honey block collision to
      MovingUtil;
   - Fix head obstructed + bunny with
      lower block;
   - Reset hAcc in ediblebunny as well
      if head is obstructed;
* Add wasOnIceRecently method. Uses past move tracking;
* Move Extreme_move subcheck for flying packets into its own check. Also (potentially) fix some false positives;
* Remove WrongPacket. Useless;
* Only feed Improbable in Impossiblehit (no check);
* Tweaks for default config.
2021-10-19 10:28:32 +02:00
Lysandr0 7098895eda Last clean-up.
Hopefully... :)
Add more comments and notes.
2021-10-08 22:00:18 +02:00
Lysandr0 6b8087c380 Bunnyslide: switch to a flag, remove unneeded conditions.
Fix slime edge case, cleanup.
2021-10-06 20:50:11 +02:00
Lysandr0 b82b898695 [Bleeding] Kill all bunnies.
Just kidding. Only two more remain.

 Changes:
* Only apply ice/slime properties if the box is at least half on the block (Respect Minecraft's mechanics).
* Adjust use of blocking/sneaking modifiers;
* Model:
 -Bunnyhopping on ice/slime (see below);
 -Generalize and fix bunnyhopping with head obstructed (ice/slime);
 -Let friction apply when walking on
ice;
-Introduced a "bunnyslide" phase alongside bunnyfly, which does the same job except bunnyslide ticks are used to determine by how much bunny friction speed needs to be decreased  when bunnyhopping on slippery blocks.
It will essentially increase friction multipliers, allowing players to have a higher bunny friction speed.
-After a bunnyslide phase has ended we give players a little time window by which the allowed speed is increased, since the client can retain ice-air speed for a bit after sliding back on ground. Done here via increasing bunnyhopTick.
* The legacy sfOnIce counter has been dropped entirely. Kept only for one edge case (head obstructed on ice with trapdoors underneath. We cannot detect server-side if the player is jumping. Thank MC for that :p)

Missing:
* Bunnyhopping with lower blocks and head obstructed;
* Bunnyhopping out of a 2-blocks high area, resulting in a higher in-air speed. This is especially noticeable/severe with ice. Not sure on what direction we should take here (Grace counter? Prolong bunnyslide/fly?)
* At some point, hAcc will kick in with head obstructed... Needs to be adjusted
* False positives with head obstr. and ice/slime might still be present, since I'm not a tryhard and I can't spam space-bar fast enough to see the maximum speed clients can achieve during this scenario :)
* Cleanup, bunnyhop multipliers could be stricter.

Effects on bunnyhop speeding remains to be seen. However this commit should patch ice speeding, rather.
2021-10-06 12:07:12 +02:00
Lysandr0 f56b9375f0 Generalize headbangbunny.
Lift off envelope for stairs: to be implemented.
2021-10-04 08:55:52 +02:00
Lysandr0 01780f936f Merge branch 'master' into ImpossibleHit-WrongPacket 2021-09-21 16:37:14 +02:00
Lysandr0 41c798f26e Catch #160, comments, rename stuff
* Renamed old/confusing F_NEWLIQ to be better reflect what it is supposed to represent.
* More comments !
* Swiftly throw in a method to check  for step-like movements (magic).
* Allow stepping in waterlogged blocks
2021-09-21 16:33:45 +02:00
Lysandr0 fffb1f4fde Having a look at fastclick's chest limit.
Mainly clean things up.
* Cooldown fastclick violations if legit;
* Do feed Improbable for fastclickchest;
* Comments, mainly reminders for the future;
* Update readme;
* Limit bhop speeding on ice;
2021-09-14 10:38:01 +02:00
Lysandr0 83d3da960d Further fiddle with ImpossibleHit.
* Added a method to retrieve a past flying packet, will be useful for #150
2021-09-10 13:25:32 +02:00
Lysandr0 8af2853bdd Forgot about this one. 2021-09-07 22:50:46 +02:00
Lysandr0 fbafbdbbf2 Adjustments to previous commit.
Also fix some fuck ups. More comments.
2021-09-07 21:06:11 +02:00
Lysandr0 4687a96543 Add net.wrongpacket and fight.impossiblehit, convenience method to see if players may have their own inv open
+ Comments/Document stuff and format, as always.
For now wrongpacket only checks for invalid abilities packet;

(Not pushed in master because it contains (rather) important changes and I'd prefer it to be reviewed by @xaw3ep :) )
2021-09-06 09:19:16 +02:00
Lysandr0 0951915aa1 Attempt to catch #154
Commented out the reset condition for now: let the bunnyhop model apply when moving on stairs.
Can't test further conditions to limit it currently.
2021-08-27 17:20:53 +02:00
Lysandr0 a1c652f2ab Fix NPE in MovingData, more bug fixes
* Against: null = air :)
* InventoryMove: safety check for the case users input a too low value;
* Scaffold: only feed Improbable if the placement is scaffold-like;
* Alter config values;
* FastPlace: only feed Improbable for higher violations.
2021-08-24 12:57:39 +02:00
Lysandr0 a5dfaa4c58 Do monitor the yaw speed rate when scaffolding. 2021-08-21 12:56:58 +02:00
Lysandr0 a3ea9dec8d Allow Scaffold/AttackClick to feed Improbable.
* Clear Improbable's data if leaving the server;
* Correct permission for Scaffold;
* Top/InfoCommand: format;
* Restore BlockPlace debug info,
2021-08-19 19:43:05 +02:00
Lysandr0 07fb893d65 Simplify InventoryMove, detect click+attack.
Too tired(+tedious) to fix all false positive for now.
2021-08-18 21:00:48 +02:00
adampoulson 980a58e570 Merge branch 'master' into test 2021-08-18 20:41:49 +04:30
Lysandr0 a684a107f0 Drop client-mods support, changes
The MOTD implementation is severely outdated (it's been a decade since it was first introduced), mostly unused and actually caused more issues than anything (blank message on join) :)

Changes:
* Sweep old Critical workaround for lowjumping;
* InAirRules: match format style, move more workarounds into the class;
* CreativeFly: remove ascending slowfall handling as well as riptide->other model velocity transition;
* Extend riptide model for 1 second after the riptide phase has finished;
* SurvivalFly cleanup, yet again;
* Typos in WRPT;
* Attempt to make MorePackets stricter;
* Order in MovingData.
* Allow movetrace to keep track of aboveStairs property;
* Move setNextFriction to MovingData;
* Inflate MoveTrace to keep track of 4 moves from now on;
2021-08-18 13:30:09 +02:00
adampoulson 79ecc18778 fix a typo 2021-08-17 18:45:20 +04:30
adampoulson ed4e682d9b improve boat speed checks
added speed check for water and ground.
fixed false positives that caused by them.
2021-08-13 02:00:56 +04:30
Lysandr0 7ef94a5339 Update bug_report.md 2021-08-09 16:28:54 +02:00
xaw3ep 7ef4f3a1e5 Too rush 2021-08-08 20:06:01 +07:00
xaw3ep ba59a57dc7 Resolve issues
Fixes #139, #126 by having safer setback ?
Fixes #142 and mostly #141
2021-08-08 15:50:13 +07:00
xaw3ep aeaabcd6a4 Blocks, again
Bugs everywhere!
*Changes:
 + Fix false positive with deepslate
 + Recalculate properly with tool efficiency
 + Correct some minor wall bugs
2021-08-02 23:05:00 +07:00
xaw3ep c995139c3a Random things
Mixed of many fixes
* Change:
 + Fix null model?
 + Comment out IEntityAccessLastPositionAndLook. Nothing need
 + Improve elytra handle?
 + Fix false using shulker in narrow space
2021-08-02 22:53:56 +07:00
Lysandr0 7a00d4a308 Usual cleanup
* Alter one magic value
* Add shulker boxes to the change tracker (not tested)
* Cleanup
* Comment out packet type
2021-07-28 18:07:06 +02:00
xaw3ep 39e2ac9d71 Test blocks, refine for later use 2021-07-25 21:15:37 +07:00
xaw3epandLysandr0 33c9a60d6e [Deficient]Define PowderSnow
Done PowderSnow model. Need reproduce rare cases, fix problem make cauldron flags

Co-Authored-By: Lysandr0 <20213873+Lysandr0@users.noreply.github.com>
2021-07-24 22:55:23 +07:00
Xaw3ep 06562f7109 Merge pull request #131 from netctl223/blue-ice-check-for-vehiclemove
Blue ice check for boats
2021-07-24 22:12:11 +07:00
lordmahan 670b12e5b5 add horizontal distance cap for boats on blue ice 2021-07-24 08:32:19 +04:30
lordmahan 03c889619a add onBlueIce environmental property 2021-07-24 08:28:45 +04:30
lordmahan 732b4aadc2 add blue ice block property 2021-07-24 08:27:48 +04:30
xaw3ep 17675e4d46 Clean up; Add more configs settings
*Changes:
 + Add config to expand world on negative y side (experimental, only for 1.13 and later)
 + Configurable NoSlow activation under SurvivalFly paths
 + Clear out SelfHit projectile related config and disable main check permanently
 + Clear config on dead coral, done by generic setup
 + Bring back moving trace; default max age and max size set to 30, reduces memory consumption
2021-07-22 22:15:04 +07:00
xaw3ep b2d015adc8 Refine some complex blocks. Hide unnecessary logs on startup
* Changes:
+ Implement multi-bounds for complex blocks
+ Hide "Added block-info for Minecraft 1.x.x blocks" logs on startup
+ Restore some NMS-depend features
Still missing conduit, cake, anvil, grindstone but these blocks still work fine so nah.
Still missing model for powder snow, maybe for another day...
2021-07-20 20:32:31 +07:00
Lysandr0 fb52e44fe4 Bug fixes, adjustments.
Fix NoFall applying fall damage if falling from a high enough point into a berry bush. (Regard it as resetCond from now on)

Fix more NPEs.

Lowjump detection: skip yDistance slopes, stairs are still a missing case.
2021-07-19 15:09:42 +02:00
xaw3ep b789af5665 First step to 1.17
Many thanks to @MarkElf and @ASCIIcat for helping this much faster.
Add most 1.17 blocks. Not testing much especially block-breaking duration!
* Missing:
 + Complex shape for bell, hopper, brewing stand, candle cake, grindstone, cauldron.
 + Movement design for powder snow.
 + NMS changes leading resetActiveItem, dealing fall damge as FALL source broke down.
2021-07-18 12:27:18 +07:00
Lysandr0 df1241dd0b Config folder. :p 2021-07-16 09:32:40 +02:00
Lysandr0 4ad4a4e5fc Fix NPE 2021-07-15 21:15:27 +02:00
Lysandr0 b6b1c67277 Merge pull request #117 from Lysandr0/patch-1 2021-07-15 07:12:07 +02:00
Lysandr0 4ab7fdfbbe Note on the custom configs. 2021-07-14 20:16:07 +02:00
Lysandr0 52e6920bce Add all rules to the workaround registry (+)
* All rules in the regulation class are now added to the workaround registry. This will make it easier to debug, especially with bypasses we can now see exactly which rule is exempting the player;
* Bunnyhop+slime block fix;
* Move checkbounceenvelope to the Magic class;
* [BLIND] PassengerUtil: attempt to fix potential exploit;
* Make debug messages a bit more readable;
* [BLIND] Adjust vertical limit in Cf when slowfalling into a berry bush;
* Typos, format.
2021-07-14 14:52:54 +02:00
Lysandr0 9a77cbef0b It's to, not from :) 2021-07-02 19:39:25 +02:00
Lysandr0 447385f6e1 [Blind] Attempt to fix bunnyhopping on ice with lower clients
+ Remove legacy isOnIce method.
2021-07-02 19:35:46 +02:00
Lysandr0 33a3764bbf Debug some the horizontal distance in elytrafly 2021-07-01 16:07:36 +02:00
Lysandr0 21cd344ddb Nvm. 2021-06-29 21:40:23 +02:00
Lysandr0 baf251defe Cleanup, debug, fix reviews.
No lowjump if we are in a "ministep" phase (As reported in Discord #development);

Cleanup, rename some variables.

Skip fakefall check only if actually gliding into a climbable.
2021-06-29 21:33:42 +02:00
Lysandr0 d270be233e Nah.
(Compile error + let Sf handle levitation if fully on ground with extreme levels)
2021-06-27 15:20:32 +02:00
Lysandr0 1a8b79fc36 Do still apply the flyCheck workaround if a riptide phase has ended and the player is still ascending
Also, players cannot take off with elytra when in a berry bush.
2021-06-26 17:47:00 +02:00
Lysandr0 2c252c8384 [Bleeding] Bug fix session.
* Fix gliding into a berry bushes triggering false positives;
* Docs;
* Fix edge case with jump boost and slime bounce;
* Slowfalling: let Sf checking the player if not actually falling;
* Attempt to catch: https://github.com/Updated-NoCheatPlus/NoCheatPlus/pull/117#issuecomment-864390304 ;
* Alter riptide speeds;
* Bunnyhop: headObstructed cases [this is not completed yet, some cases are left uncovered];
* Do not apply the flycheck transition workaround if the player is exposed to slowfalling (not needed);
* Skip NoFall on a riptide phase;
* Alter riptide bounce conditions.
2021-06-26 13:41:53 +02:00
Lysandr0 4a637f86fb Ops 2021-06-20 09:51:52 +02:00
Hulk 0b1588b0c8 fix protocollib dependency 2021-06-17 18:39:02 -05:00
Lysandr0 69bdb60ce5 Merge remote-tracking branch 'upstream/master' into patch-1 2021-06-17 21:30:12 +02:00
Hulk b484d4fb23 patch bypass which allowed players while in "dirty" phase to be exempt from bunnyhop 2021-06-17 14:09:48 -05:00
Lysandr0 d07dd10c93 Inspect command: add bedrock player info, Cf tweaks.
*
2021-06-17 21:09:16 +02:00
Lysandr0 b7de72ab27 [Blind] Do not apply the levitation model if the level is > 127
+ debug messages + fp fix + revert the trident noslow thing.
2021-06-12 22:08:11 +02:00
Lysandr0 f5fe83b0ed Debug velocity added. 2021-06-08 17:25:45 +02:00
Lysandr0 1d4c126785 Riptide+gliding
The only issue left is the gravity one.
Too tedious to research/debug/whatever.
2021-06-07 21:51:07 +02:00
Lysandr0 aa0333bdf4 Revisions (+)
* NoSlow: ensure to also consider the trident, if it has the riptide enchant;
*SurvivalFly: fix an edge case with bunnyhop on ice with jump boost [Slime untested];
* CreativeFly, extreme_move: ensure that players cannot achieve higher than legit speeds (riptide bounce);
* Random comments + commit on BridgeEnchant
* Don't check for crossbow in InstantBow since it will disabled on MC 1.9 and higher anyway.
2021-06-05 21:03:11 +02:00
Lysandr0 d629fbd6f9 Tabs -> spaces. 2021-06-04 21:54:45 +02:00
Lysandr0 547b9d11b6 Comments, bounce+riptide conditions. 2021-06-04 21:42:49 +02:00
Lysandr0 722169edb0 Cleanup, riptide bounce, extreme_move
* Skip extreme move check on riptiding+bouncing phases.
* Allow bounce+riptide
* Typos
* MovingListener cleanup.
2021-06-04 14:35:01 +02:00
Lysandr0 3923b500dd Tackle (most of the) issues related to riptide.
* Account for a special friction case;
* Better Riptide -> other *CF* model transition;
* Better support for Cf->Sf phases.
* Skip vAcc a second after riptiding
* More strict speed values

Missing:
* "Ripglide" (glide+riptide). Can trigger fps.
* EXTREME_MOVE subcheck triggering when:
    - bouncing while riptiding (players can achieve extreme yDistances)
    - Randomly :)
2021-06-02 22:00:08 +02:00
Lysandr0 b7489407c5 [Bleeding] CreativeFly riptide handling
Riptiding is now handled by the CreativeFly check:
* Speed values are random but do work fine at preventing 'trident boost' cheats. (there's probably room for more strictness);
* Riptide takes priority over all models;
* Sweep all legacy code;
* Riptiding will bypass Sf;
* Random comments on LiftOffEnvelope.

Missing:
* Scale the effect depending on the actual enchant level.
* Instead of skipping the elytra checks altogether, calculate the correct speed increase (Riptiding and gliding can done simultaneously);
* Improve riptide->no riptide transitions;
*(Probably more).

Issue:
* vAcc(dirty) still triggers a second after the riptide phase finishes.
2021-06-02 14:15:16 +02:00
Lysandr0 4403723ac5 Move bunnyfriction into a method 2021-05-30 12:53:20 +02:00
Lysandr0 7b4da789bb [Bleeding] Better 'bouncebunny' workaround.
The fix is the same as the ice one.
Increase the actual base speed when bunnyhopping, instead of relying on the horizontal buffer (and setting the distance above limit to 0)
Might need some adjustments...
2021-05-23 16:42:49 +02:00
Lysandr0 23842e1b75 Comments, cleanup 2021-05-19 09:10:15 +02:00
Lysandr0 2e8ae828b5 Max->Min 2021-05-15 11:19:31 +02:00
Lysandr0 9089bd7cbf Update FightListener.java 2021-05-15 11:12:04 +02:00
Lysandr0 365fdac2c4 Update SurvivalFly.java 2021-05-14 11:26:08 +02:00
Lysandr0 bcf0fc4a8f Random changes. 2021-05-13 22:05:22 +02:00
Lysandr0 6d5c8ec4a2 Just skip what's necessary.
Also properly fix the vDistSB fp.
2021-05-02 10:35:43 +02:00
Lysandr0 2f752f7219 Update InAirVerticalRules.java 2021-05-01 20:55:52 +02:00
Lysandr0 4c54b0e15e Ops. 2021-05-01 12:36:13 +02:00
Lysandr0 b8a94ee458 More adjustments.
* Fix vDistSB triggering if lower client versions try to jump out of a berry bush

* MaxPhase: Allow a slight margin of leniency. (0.5 it's too much. It makes the detection virtually useless)
2021-05-01 11:07:21 +02:00
Lysandr0 f2ce81bf8b Update SurvivalFly.java 2021-05-01 09:44:31 +02:00
Lysandr0 4be10fb890 Remove an unused variable, tags. 2021-05-01 09:30:41 +02:00
Lysandr0 a77205007c [Blind] Skip bunny friction phase if a high speed amplifier is present.
Sprint-jumping with a high speed amplifier will actually reduce the player's overall speed, however the bunnyhop mechanic cannot be skipped altogether, due to the fact that the player moves off from the ground (jumpPhase 0) with twice(+-) the ordinary ground speed gain (Observed: hDist: 0.702 (+0.374) / Allowed: 0.562).

This could cause all sort of issues as it has not been tested thoroughly, handle with care :)
2021-04-30 20:30:43 +02:00
Lysandr0 1a29c99b9f Update SurvivalFly.java 2021-04-29 21:34:47 +02:00
Lysandr0 d96610e752 Only count in actually being in soul sand.
Issues remain with the slime block (bounding box):
Walking even just a tiny bit on a slime block will turn the flag to true, while the player walks at ordinary walking speed, causing false positives.
2021-04-29 13:02:20 +02:00
Lysandr0 dc1f705ed6 Compile errors. 2021-04-28 11:27:27 +02:00
Lysandr0 f96008ea3a Move inAirChecks to vDistAir 2021-04-27 21:12:58 +02:00
Lysandr0 795609fe23 Add more lift off envelopes.
* Added preset envelopes for moving in/off a berry bush/honey block (JumpPhase and jumpGain should be correct, jumpHeight needs to be tested, for both)

* SurvivalFly: do not apply the step limit if a player is moving on/in a medium (let the dedicated method handle the respective limit).

* RichBoundsLocation: alter onHoneyBlock logic to allow players to jump at ordinary jump gain on the very edge.

TODO: Better liftOff name (HALF_JUMP etc...) ?
2021-04-27 16:55:07 +02:00
Lysandr0 0e22f6bf7c Add tag for further debugging, comments. 2021-04-16 17:27:38 +02:00
Lysandr0 eb7115bd71 Display tag in console as well. 2021-04-12 20:53:41 +02:00
Lysandr0 4844837775 Missed an "ms". 2021-03-31 21:50:11 +02:00
Lysandr0 77a2dd97b0 Display correct command usage when mistyping an argument. 2021-03-30 21:52:42 +02:00
Lysandr0 b74b66b869 Merge remote-tracking branch 'upstream/master' 2021-03-30 13:29:36 +02:00
xaw3ep 2703135cc0 Documents & Optimise & Fixes
Mainly for small fixes and add document for an easier look back!
* Changes:
 + Small rework of NoSwing for packet inversion
 + Allow honeyblock to jump normally on edge
 + Correct ladder check not working properly
 + A true disable for checks that not so useful for recent versions
 + More and more random comments
* Config changes:
 + Turn off force load chuck on move, prevent crash
 + Active permission cache for all checks
2021-03-28 18:34:32 +07:00
Lysandr0 3723bef21c Uniformity. 2021-03-21 10:23:33 +01:00
Lysandr0 2373174ba0 Minor tweaks for commands. 2021-03-16 09:42:05 +01:00
Lysandr0 2cd1922dc3 Homogenize chatcolor use, minor revisions. 2021-03-10 20:15:16 +01:00
Lysandr0 1287d0e811 Fix ChatColor use in console, tweak LagCmd further. 2021-03-03 20:31:31 +01:00
Lysandr0 401f5f87dd Display more data for the Inspect command. 2021-03-02 20:19:42 +01:00
Lysandr0 44eac16b13 Merge branch 'master' of https://github.com/Lysandr0/NoCheatPlus 2021-03-02 14:25:31 +01:00
Lysandr0 f4d62900e1 Third batch. 2021-03-02 14:25:28 +01:00
Lysandr0 920e5e15e7 LagCommand, adjustments. 2021-03-02 09:01:41 +01:00
Lysandr0 698b5cc56a Second batch. 2021-03-01 21:46:04 +01:00
Lysandr0 2dc45a01b4 Revamp the command section a bit.
It will likely need some adjustments down the road.
2021-03-01 16:20:52 +01:00
xaw3ep 7d873f5e01 Correction
Some more clean up before starting some breaking-bleeding.
* Changes:
- Add a restored version of boat fix was removed in last build
- More compatible on vine block with cross version
- Once again fix berry bush
- Extend velocity existing tick for more leniency
- Simplify workaround, remove redundant, one time hspeed check
- Remove text sent on join (9 years til now, causing more confusion than it works)
2021-02-28 23:04:32 +07:00
Xaw3ep 7ef74117d7 Merge pull request #99 from Lysandr0/master
More invMove and Against fixes.
2021-02-28 22:31:36 +07:00
Lysandr0 efbabce522 Uhm, ops? 2021-02-27 16:47:30 +01:00
Lysandr0 effb084924 Do remove the "self" permission as well. 2021-02-27 16:21:07 +01:00
Lysandr0 51d8efd250 Implement reviews. 2021-02-27 16:14:50 +01:00
Lysandr0 deb1bd56a8 One more Against fix. 2021-02-27 09:13:19 +01:00
Lysandr0 33207d4660 Convenience method for scaffolding block.
Also yet another fix for Against.
(NOTE: null material = air).
2021-02-24 10:08:18 +01:00
Lysandr0 4c9df98e14 Merge remote-tracking branch 'upstream/master' 2021-02-20 15:44:41 +01:00
Lysandr0 b4e282758f Ops... Yet again :)
Maybe I should stop rushing things out
2021-02-18 21:05:49 +01:00
xaw3ep afe95ebb63 Use PlayerMove for main check instead of VehicleUpdate, add LostGround 2021-02-18 23:30:58 +07:00
Xaw3ep 8d1a639b65 Merge pull request #98 from Lysandr0/master
Fixes for InventoryMove and Against
2021-02-18 23:15:00 +07:00
Lysandr0 a2ea05806e Add [model] parameter for CreativeFly. 2021-02-17 11:26:49 +01:00
Lysandr0 0d4ac78b79 Tabs->Spaces 2021-02-16 17:11:18 +01:00
Lysandr0 e98f8851e4 Fixes for InventoryMove and Against
+ random Sf commits.
+ format for the BlockPlace listener
2021-02-16 17:02:09 +01:00
xaw3ep f99936f885 Some more clean up
*Changes:
 + No Net check enabled, no register
 + Fix Cirtical when nearby boat
 + Fix jump boost error on half ground and water
 + Correct a berry bush false positive
 + Some random notes & optimize
2021-02-16 20:15:52 +07:00
Xaw3ep 8e45a98bee Merge pull request #91 from Lysandr0/master
Clean-up and fixes
2021-02-16 16:24:42 +07:00
Lysandr0 e5424e121e Minor compile error. :p 2021-02-12 09:50:03 +01:00
Lysandr0 5624aff987 Wrong variable. 2021-02-11 13:40:34 +01:00
Lysandr0 fb45e3b798 Update SurvivalFly.java 2021-02-11 12:20:45 +01:00
Lysandr0 bc36036556 Adjust use of sneaking/blocking in hSpeed
Testing... Later.
2021-02-10 18:48:05 +01:00
Lysandr0 09214d70f1 Changes for Sf
* Moved more stuff to Magic;
* vDistLiquid: player.isOnGround() -> NCP's logic.
* Use BlockProperties#isLiquid/isAir to check for air/water in the waterwalk checks;
* Commented out the sprinting checks. Should fix TrigUtil#isMovingBackwards instead...
* Format;
2021-02-09 16:34:35 +01:00
Lysandr0 760df0833e Update Magic.java 2021-02-07 17:49:25 +01:00
Lysandr0 d3196c7d60 Cleanup 2021-02-06 11:22:56 +01:00
Lysandr0 92a9f664fd Ops x3 2021-02-04 09:29:20 +01:00
Lysandr0 27bf8b8286 Merge branch 'Patch-1' 2021-02-03 19:28:22 +01:00
Lysandr0 6598084cba Sharpen Magic values. 2021-02-03 10:55:42 +01:00
Lysandr0 57df2668b3 Fix Against check logic. 2021-02-03 09:21:29 +01:00
Lysandr0 d10b419a6f Remove blindsprint for now.
Turns out, the client ignores the blindness effect if it's given while the player is already sprinting.
2021-02-02 20:38:08 +01:00
Lysandr0 9aba4269e0 Fix more false positives
* Allow horizontal bounce friction;
* Attempt to resolve a NoSwing issue. The flag will be reset if the arm has been swung;
* Re-add the F_COBWEB2 flag to berry bush if a multiprotocol plugin is present (thought it would simply add the lowjump flag, but it overrides it to the existing ones apparently).
2021-02-02 11:08:01 +01:00
Lysandr0 8a6cf17694 FPs fixes, move constants to Magic
* [Blind] Reverted the logic changes done to the assumeSprint in the hope to fix combat setbacks...
* Temporarily allow legacy clients to go at swimming speed as well, supporting MultiProtocol plugins.

Missing:
* ViaVersion hook... :p
2021-02-01 19:53:33 +01:00
Lysandr0 d3181cc5eb [Bleeeding] Add and edit horizontal limits
Changes:
* Added onSlimeBlock/BerryBush/HoneyBlock checks for a player move;
* Distinguish bushes from web when checking vertical distance;
* Fixed a false positives when falling from far above on a berry bush;
* Edited several horizontal limits:
   - Account for blocking and sneaking
     when: in water/bush/web/on
     slime/honeyblock/soulsand;
  - Enforce slower speed when moving
     through webs on slime/ice.
* Fixed an InventoryMove false positive.

Missing:
* Accurate Magic constants... Not too sure how to get them.
2021-01-31 15:32:59 +01:00
Lysandr0 259224cace Ops x2 2021-01-31 08:54:41 +01:00
Lysandr0 84a028769f Ops. 2021-01-30 11:48:16 +01:00
Lysandr0 a5a2edd6db Merge branch 'Experimental' into Patch-1 2021-01-29 10:22:53 +01:00
Lysandr0 670ee03204 Sf tweak.
Switch to server comparison to verify the version, instead of checking whether a class/event exists.
2021-01-29 10:08:44 +01:00
Lysandr0 1aab5373af Fix FPs with the sprinting checks, format, comments
* The sprinting checks will be skipped if the current jump phase has been affected by velocity;
* More format and comments.
2021-01-24 20:11:44 +01:00
Lysandr0 400e243187 Tabs -> spaces. 2021-01-24 12:43:46 +01:00
Lysandr0 4ad490abfa Move Sf code around
* Renamed the MagicAir class has been renamed to better match what it is supposed to do;
* Moved all the exemption for vDistAir to InAirVerticalRules;
* Format, comments.
2021-01-24 11:53:34 +01:00
Lysandr0 77da69bb7e Fix minor hSpeed setback
Also order things out, perhaps we should move all these magic values in the Magic class...
2021-01-15 16:32:41 +01:00
Lysandr0 deb18487cb Adjust assumeSprint 2021-01-15 08:16:21 +01:00
Lysandr0 147122f861 Fix NoSuchField error, assumeSprint tweak.
Changes:
* [Blind] Introduced some reset conditions for the assumeSprint workaround in order to confine it more.
* Fixed NSF error on legacy versions with the shulker box fix.
2021-01-13 22:05:47 +01:00
Lysandr0 6f48befc93 Update DefaultConfig.java 2021-01-12 22:46:42 +01:00
Lysandr0 8a74478763 Reorder imports, comments. 2021-01-12 21:18:56 +01:00
Lysandr0 c2676cd232 Fix an issue with the Open check.
Should fix an issue with the open check which would prevent players from opening shulker boxes while standing on them.
+ random touches here and there to the invMove check, untested.
+ random Sf commit.
+ random format for the Inventory listener.

Missing:
+ Sf false positive when descending after opening a shulker box while standing on them. Perhaps the changeBlockTracker should take care of that...
2021-01-11 14:31:58 +01:00
Lysandr0 df88a2c2c7 Update InventoryMove.java 2021-01-08 10:53:25 +01:00
Lysandr0 96047b8e98 Iron things out.
All known false positives should be fixed for good this time.

(The minimum hDistance required will also be scaled according to the current enchant)
2021-01-08 10:45:17 +01:00
Lysandr0 4d91509a43 Fix false positives. 2021-01-06 18:44:58 +01:00
Lysandr0 1e04f50538 InvMove improvements
The invMove check is now unbind from the fly checks and will calculate the needed friction on its own.

* Added a debug option

* Edited the thresholds in the default config, yet again.

* isFlying()... Later.
2021-01-06 08:30:38 +01:00
Lysandr0 fa9e276e20 Missed a variable. 2021-01-03 16:25:18 +01:00
Lysandr0 e7ed68c0c7 Get rid of legacy code, extend invMove.
* Added a condition to check for obvious sprintjumping, which should aid in the moving module.
2021-01-03 16:10:02 +01:00
Lysandr0 280a72d02d Round-up.
* Attempt to workaround some MC bugs.
* More margin leniency.
2021-01-02 10:46:45 +01:00
Lysandr0 f1ec6fc408 Merge branch 'master' into Patch-1 2021-01-01 20:33:13 +01:00
Lysandr0 6076d31418 Configurable fall distance leniency (f.critical)
+ random Sf commit.
2021-01-01 13:22:05 +01:00
Lysandr0 ed4f3c4b36 yet another happy accident. 2021-01-01 11:22:50 +01:00
Lysandr0 1b67972766 Towards a more complex invMove check.
(Really-) Rough attempt at modelling inventory movement.
* Fix 1.13+ players false flagging the check when toggle sneaking while standing still.
* Add liquid/surface model.
* Fix flying players flagging the sprinting check upon coming to a stop

Missing:
* Lava/flying/ice/downstream model
* Sharpen conditions
2021-01-01 11:12:33 +01:00
Lysandr0 5780c62e96 Fine-tuning (+)
Changes:
* Add [reachdistance] placeholder for fight.reach;
* Edit the allowed reach distance to the recommended amount;
* Clear fight.critical violations once the player has been kicked;
* Tweak fastClickChest's violation addition towards the VL counter;
* Throw in a bunch of comments.
* Format
2020-12-29 12:27:32 +01:00
Lysandr0 92ddd08b83 Patch up the Angle check. 2020-12-28 17:17:42 +01:00
Lysandr0 eb55d00b55 Changes for invMove (+)
* Add missing gplv3 header;
* Clean-up
* Restore a bunch of checks
  - Sprint check: confine for speeds greater than walking and skip the check during lost sprint phases.
  - Use mData#isUsingItem instead of player#isBlocking
* Add a cooldown;
* Add isSleeping check, although I'm not really sure if it's possible in the first place to open (and click) in inventories while sleeping or being dead...
* If players have set off the moving module, then increase the violation by the amount of distance covered while clicking.

Missing:
* A chat+click check
* Use the reallySneaking method in SurvivalFly to determine if the player is actually sneaking.
2020-12-28 12:05:42 +01:00
Lysandr0 477e8669f0 Re-organise the critical check. 2020-12-28 11:20:56 +01:00
Lysandr0 a2f405c1a8 SF: stricter checking for some subchecks.
* These checks are meant to block impossibile movements, so they do not need to consume the buffer.
* Be a bit more lax when it comes to the badsprint check.
* Add some comments
2020-12-26 16:11:05 +01:00
Lysandr0 9cf9f14b23 Remove redundant code. 2020-12-23 19:24:51 +01:00
Lysandr0 8dc3066538 Changes for VehicleEnvelope (+)
* Cleanup
* Patch up the liquid checks:
  - Account for all air types when checking the block above the player/vehicle.
  - Do not check the strider for walking on lava since they are allowed to do so.
  - Do check for entities walking on lava (liquidwalk)
2020-12-23 16:07:46 +01:00
Lysandr0 249297fe35 Against check: fix lily pad placement being flagged. 2020-12-23 14:57:07 +01:00
Lysandr0 1819e42e68 Merge branch 'master' into master 2020-12-23 05:49:36 +01:00
Lysandr0 7d35ed49a3 Remove a not-so-useful fix. 2020-12-23 05:29:33 +01:00
Lysandr0 e6391dc370 Ops. 2020-12-22 15:54:33 +01:00
Lysandr0 03e05d84d8 Do prevent players from walking on lava as well. 2020-12-22 15:53:19 +01:00
Lysandr0 dfdb9690aa Convert tabs to spaces.
Also add a missing gplv3 header.
2020-12-22 13:31:30 +01:00
Lysandr0 844c2d6713 Use the correct multiplier for some hSpeed limits. 2020-12-22 10:21:55 +01:00
Lysandr0 79b530c0fb Convert some tabs to spaces. 2020-12-21 15:17:33 +01:00
xaw3ep 163ba53660 Fix errors
An attempt to deal with hard to reproduce issues:
 - DataMan inconsistencies when kick/ban
 - ConcurrentModificationException when kick
Something else included in:
 - Self disable module for SoundDistance (maybe for others to, but later)
 - Corrects broken debug command
 - Fix visible false positives with bamboo
2020-12-20 22:38:09 +07:00
Lysandr0 ad816bacd7 Cleanup a bit Cf as well. 2020-12-20 13:30:39 +01:00
Lysandr0 99bc68b30a Major clean-up for Sf
*Move the hacc, sprinting and waterwalk subchecks into their respective method.
*Cosmetic changes.
2020-12-20 10:21:48 +01:00
xaw3ep 2b5820cd19 Harmonize elytrafly with survivalfly 2020-11-22 23:59:01 +07:00
xaw3ep bb706b7391 Small tweaking
Fixing issues appeared in some recent update:
 + NullPointerException with getSetBackY and resetActiveItem()
 + Weird fall damage with ladder and scaffolding
 + Soulspeed false positive when leaving soul sand /soul soil
2020-11-21 10:41:59 +07:00
Hulk fe11c9d1a8 fix consoleonly commands not correctly blocking commands for ops 2020-11-03 21:15:32 -06:00
xaw3ep 8173938a16 Another fix
*Changes:
 - Utils:
   + Some checks require reset using item can now work properly
   + Fixed fall dead message
   + Removed redundant explosion check
 - Blocks:
   + Set small bounds cut on glass panes by default, fixing false positive
   + Dealing with honeyblock' bounding boxes weirdness, recalculate fall damage when land on top of block
   + Added data fetching for rails(were forgotten during removing legacy data)
 - Config:
   + Made violation reseting actions actually function as it can't work correctly when players are offline
2020-10-19 00:49:16 +07:00
xaw3ep 8210643615 Better calculation of explosion velocity
More compatible with explosion especially on 1.13+, with restriction apply to prevent exploit.
2020-10-08 21:57:54 +07:00
xaw3ep 2ebf5b2334 Minor fix
* Should deal with issues below:
+ Stepping to roughly onto layered snow
+ Riptide hitting entity cause false positives
+ Strider false positives
+ Random infinite SurvivalFly VLs.
2020-10-08 21:35:03 +07:00
xaw3ep c7a2c6a1e0 Get rid of legacy material data 2020-10-08 21:23:43 +07:00
xaw3ep 0c93ad1310 Rework on SlowFalling, Levitation models
More compatible with velocity, more strict
2020-09-27 14:37:43 +07:00
xaw3ep 520a1986b4 Support legacy versions
Support back some old 1.8 versions and 1.7.x. Also fix NoSuchMethodError when using old ProtocolLib
2020-09-27 03:20:48 +07:00
xaw3ep 363353ba34 Add config option to adjust fight.reach
Attempt to calculate reach excluding distance from edge to center of target hitbox when reachprecision is on. More testing is need!
Config suggestion when this mode on: survivaldistance: 4.02 ; cancel on all vl!
2020-09-20 00:30:01 +07:00
xaw3ep bb7406dd58 Restore permission caching behavior feature
Small bug has made it useless since build 1040. Reload config to make it fully work!
2020-09-19 23:34:38 +07:00
xaw3ep 078d16014b More tweaking
Some more adjustments on elytra and piston for more smooth.
Speaking about special movement, do actual work on some others like levitation, slow falling. Maybe just let them tomorrow, quite large plan!
2020-09-07 00:27:20 +07:00
xaw3ep a94246f43f Pistons
Attempt to deal with most of issues related to piston
2020-09-06 11:21:00 +07:00
xaw3ep d42f1d11f2 Utils fix, remove redundant
*Changes:
 + Fix grass_path and thin_glass block bugs
 + Fix errors with inventory checks
 + Remove unused checks
2020-09-06 11:05:27 +07:00
xaw3ep e14c9a0f5d More elytra fix 2020-08-13 18:21:19 +07:00
Xaw3ep 27bab89272 Merge pull request #40 from sgdc3/master
Fix maven structure
2020-08-12 17:51:58 +07:00
xaw3ep 33daf6803a Small tweaking, some issues
* Changes:
 + Minor elytra fix, tags renaming
 + Auto fetch bounds for chain blocks
 + Refine NoSlow cancel items (beta), add config
 + Fine tuning Jesus check
 + Remove 1.5 Step check
 + Adjusting scaffold check config
2020-08-12 17:33:51 +07:00
xaw3ep 1d9d415b40 Small elytra rework 2020-08-10 11:38:32 +07:00
xaw3ep 76fbb0b204 Add config
Make some more things configurable
Changes:
 * Add missing path for horizontal accounting
 * Configurable passable strictness with two hidden confing paths:
     + checks.moving.passable.horizontalmargins
     + checks.moving.passable.verticalmargins
    With default setting: 0.999999.
 * Add config path to apply new vehicle passengers setback (mostly for 1.16 client)
     + checks.moving.vehicle.schedulesetpassenger
 * Change default yongound to 0.025
 * Remove unused default config paths
2020-08-08 09:51:21 +07:00
xaw3ep 1392afb735 Minor blocks fix
Changes:
+ Update piston mining time
+ Small fix on chain
+ Fix weird bug when standing on doors and trapdoors
 + Correct glass pane mining time
2020-08-08 09:11:54 +07:00
xaw3ep 432b4b0a0a Wrong fix
Correct most recent commits didn't fix the issues properly
Changes:
 + Continue block bounds fixing
 + Fix InventoryMove false
 + Compatible with Strider
2020-07-23 17:08:09 +07:00
Gabriele C e5930d300d Fix the maven project structure no-sense 2020-07-20 01:22:25 +02:00
Gabriele C 9396d10a43 Create .gitignore 2020-07-20 00:08:38 +02:00
xaw3ep b5e3525425 Correct blocks bound / utils
* Changes:
 + Optimise, fixes left over issues with waterlogged blocks
 + Correct bounding box of wall, anvil
* Missing:
 + Ground is slab and ladder on side
2020-07-12 00:39:13 +07:00
xaw3epandLysandr0 58a678e65c Time for cleaning
Merge pr https://github.com/Updated-NoCheatPlus/NoCheatPlus/pull/22

Changes:
 + Add tags for further debugging
 + Formatting, remove tabs

Sweep, sweep, cleaning for a better look at the code :)

Co-Authored-By: Lysandr0 <lysandr0@users.noreply.github.com>
2020-07-08 22:23:17 +07:00
xaw3ep dba3d6d21d Update to 1.16 2020-07-08 19:51:46 +07:00
xaw3ep a9e79ca0c2 Add Netherite tools, Soul speed enchant
First past updating to 1.16, a bit testing needed!
2020-06-30 05:47:05 +07:00
Xaw3ep ba5ed1723b Merge pull request #29 from Minebench/pr/dynamic-plugin-version
Add dynamic version and include "Updated" to differentiate the fork
2020-06-30 05:30:32 +07:00
xaw3ep e7cc8e66bb Slight deviation
Fine-tuning and removing redundant checks
2020-06-30 05:18:35 +07:00
xaw3epandGabriele C. 4eeacda376 Fix jenkins build of legacy compatibility modules
Does it works?

Co-Authored-By: Gabriele C. <sgdc3.mail@gmail.com>
2020-06-21 08:57:47 +07:00
xaw3ep b0985fed7a Corrected some checks
*Changes:
- Fix Direction false positive caused from the previous build
- Tweaking some movement checks not to depend on horizontal buffer to work correctly. Given more leniency
*Nice to have:
- Adjust on liquid and sprintback check too
- Rework on visible check, make it more precise
- Rework slowfalling, elytra on creativefly
2020-06-21 08:40:36 +07:00
Phoenix616 932b8572ef Add dynamic version and include "Updated" to differentiate the fork 2020-06-15 22:31:15 +01:00
xaw3ep b8336a93a6 Patch interact direction bypass
Add check to deal with interacted face. It also needs precise block flags to work correctly.
Some false positive seem appear on blocks: hopper, piston, piston_head
2020-05-25 21:22:53 +07:00
xaw3ep bd26244017 Minor bugs fix
Changes:
- More infomation on prepare setting back
- Reduce Passable strictness
- Fix null pointer
2020-05-25 21:07:35 +07:00
xaw3ep b41de9364a Stricter passable check
- Increase raytracing factor to approximately full bounds blocks checking. Might false positives will appear, need carefully testing!
- Attempt fixing problem with anvil and thin blocks like glass pane, iron bars.
2020-05-17 22:39:32 +07:00
xaw3ep a0cb3869a9 Fix some minor issues with NoFall, SurvivalFly
Changes:
- Version compatibility error on NoFall
- Leftover issues with waterfall
2020-05-17 21:59:06 +07:00
xaw3ep be8b6f79f0 Clean up SurvivalFly
Changes:
+ Remove old fixes, duplicate code, remove tab from last merge
+ Smoother NoSlow by not instant speed set, it's get slower time by time
+ Remove SprintBack check due to too much false positives, will recode later
+ Less strict water movement checks
2020-05-16 10:33:44 +07:00
CaptainObvious0 631d6ee33c Update Hopper shape for versions 1.13+ 2020-05-10 22:19:57 -05:00
CaptainObvious0 188d32e205 Scaffold Improvements (Config Updated!)
Rewrite Time sub-check
 - Improvements to Time & Sprint sub-check : False positives should be greatly reduced
 - Check for yaw changes rather than pitch : Better accuracy to determine if the player is quickly rotating between backwards and forwards
 - Each sub-check will now effect the VL added in it's own way
 - VL decay will take longer
 - Checks using time will now use the current tick from TickTask

General:
Cleanup to code
 - Unneeded variables have been removed and those used have been moved to only be created when the sub-check is enabled
 - One method for violations
 - More comments have been added
 - Remove unneeded conditions checked in BlockPlaceListener
 - Keep all blockFaces in a list rather than using a switch statement

 Please be sure to change the config values for time and rotate, since those have been changed.
2020-05-10 19:34:19 -05:00
CaptainObvious0 0fb3084664 Revert back to AND statement 2020-05-10 19:21:19 -05:00
CaptainObvious0 b30eaaa747 Change to OR statement to check for event cancelling 2020-05-10 02:35:14 -05:00
CaptainObvious0 de135cb63e Fire EntityChangeBlockEvent when setting farmland to dirt 2020-05-10 02:27:00 -05:00
CaptainObvious0 4c50fd1df7 Improvements to time and sprint sub-check in Scaffold 2020-05-09 19:24:13 -05:00
CaptainObvious0 765188057b Fix issues with assumeSprint enabled and blindness effect 2020-05-09 18:27:30 -05:00
CaptainObvious0 72f26af2df Fix issue when gliding down vines with Elytra
Don't flag for FakeFall if the player is to/from a climbable. Not sure the issue that would cause NoFall to be out of sync but not going to be concerned since this is the only issue reported.
2020-05-09 17:55:13 -05:00
CaptainObvious0 1aee48a853 Fix issues when descending with Elytra #2 2020-05-09 16:46:22 -05:00
CaptainObvious0 7e0d7e3a7e Fix issues when descending with Elytra 2020-05-09 13:37:05 -05:00
CaptainObvious0 6c5e1f7764 Attempt to fix issue with server-side bow drawn 2020-05-09 13:35:25 -05:00
CaptainObvious0 921af4dd31 Use getPlayerDataSafe for packet checks 2020-05-09 13:32:08 -05:00
CaptainObvious0 295478a5ff Fix blocking breaking with haste effect 2020-05-03 20:02:50 -05:00
CaptainObvious0 b3e0c1738b Fix NullPointer? 2020-05-02 14:19:15 -05:00
CaptainObvious0 fac8a1a73e Fix fall damage on join
Prevent players from avoiding fall damage by logging out mid-fall. When dealDamage is enabled, the NoFall check takes over all fall damage and applies it itself. When a player joins, they are exempt from damage for a certian period of time (noDamageTicks), so attempting to deal damage to the player during that time would not work. Also fixed an issue with NoFall data being reset every time on join, since hasSetBackWorldChanged actually returns the opposite of what it says.
2020-05-02 14:01:37 -05:00
CaptainObvious0 1b77786920 Allow toggling of SelfHit message
Set to true by default, set to false to disable the message "Self-velocity is not allowed!"
2020-04-27 00:29:43 -05:00
CaptainObvious0 03d307af2f Fix issues with FastConsume
Fixes false positive of when a player will start eating directly after switching inventory slots. To fix this, set the last interact time to when the slot was changed.
2020-04-27 00:06:06 -05:00
CaptainObvious0 c2473b1ed1 Fix issues with continuous jumping with a block above 2020-04-26 22:40:41 -05:00
CaptainObvious0 7f10889d39 Merge pull request #2 from Lysandr0/patch-1
Further tweaks for the default configuration.
2020-04-26 21:37:57 -05:00
CaptainObvious0 4666291b73 Fix BunnyHop on Slime Blocks 2020-04-26 14:20:50 -05:00
xaw3ep f437ced44f Slight velocity calculating improvement
Changes:
+ Also calculate vertical velocity for more precise fly checking
+ Increase max horizontal velocity count for more compatible with explosion
+ No prepareCreativeFlyCheck if not checking creativefly
+ Random formatting
Nice to have: Might want to change velocity.activationcounter to lower in order to quicker clearing old velocity and prevent abuse stacking up queue velocity for flying hack
2020-04-26 23:32:25 +07:00
xaw3ep ccd77773b5 Re-fix falses flag when leaving water/lava
Does it fully fix the case with leaving waterfall?
2020-04-26 12:27:47 +07:00
CaptainObvious0 64bb2bc278 Fix hSpeed flag when moving water -> air
watermovect would never reset after the player fully leaves water, so it would continue to set the hAllowedDistance for if the player was still in water.
2020-04-25 23:27:20 -05:00
CaptainObvious0 9ceafc002b Attempt to fix server-side blocking for NoSlow
Reload the players inventory slot to unblock the players sword.
2020-04-24 15:20:58 -05:00
Lysandr0 0b54230d48 Allow players to bypass the badsprint check if they have the sprinting permission
Also use NCP's own logic to determine if the player is actually sprinting
2020-04-24 13:45:25 +02:00
Lysandr0 8a4e2e2dfb Further tweaks for the default configuration.
Relevant:
+Added kick for the Scaffold check
+Reviewed fight actions for F.Direction and Critical
+Added kick action for the Critical check
+Add dried kelp to FastConsume exemption list only from 1.13+
(+Random changes and formatting)
2020-04-24 13:35:37 +02:00
CaptainObvious0 ca43bbe550 Allow skipping a listener if the check is disabled 2020-04-20 21:42:58 -05:00
CaptainObvious0 6309766916 Use McAccess based on server version
Use McAccessBukkitModern for servers 1.13 and above. Use the dedicated CraftBukkit McAccess if the server is 1.12 and below.
2020-04-20 18:43:02 -05:00
CaptainObvious0 880217785e Update SurvivalFly - Fix commit history 2020-04-19 14:26:51 -05:00
CaptainObvious0 f8564980d0 Revert SurvivalFly - Fix commit history 2020-04-19 14:26:01 -05:00
CaptainObvious0 f99afbdb1d Fix jumping in Sweet Berry Bush (MultiProtocol Servers) 2020-04-19 14:17:34 -05:00
CaptainObvious0 0a7848db0f Scaffold Detection Fix
Only check for certain conditions for the sprint check, allowing proper detection for the other checks.
2020-04-18 23:49:42 -05:00
CaptainObvious0 e0ee784d22 InventoryMove improvements
Add detection for players actively moving while clicking in their inventory. Also some small cleanup of InventoryMove/InventoryListener.

hDist_leniency = The max difference between lastMove & thisMove's hDistance.
hDist_min = The minimum hDistance required for the check to activate.
2020-04-18 23:24:22 -05:00
CaptainObvious0 0a3b9a7829 Add more blocks for MultiProtocol servers
Add support for Honey blocks/Shulker boxes/Sweet berry bushes
2020-04-18 14:01:46 -05:00
CaptainObvious0 53439f7e8a Forgot to add Scaffold to staging 2020-04-17 03:02:36 -05:00
CaptainObvious0 90570420b5 Improve Scaffold detection
Add Pitch and ToolSwitch Check. Pitch checks for large pitch differences between placing blocks. ToolSwitch will check if the player is quickly switching the item held. Also improve the conditions of the check to help reduce false positives.
2020-04-17 02:58:38 -05:00
CaptainObvious0 2bd0bd8992 Update hSpeed on stairs based on players walkSpeed 2020-04-16 23:23:01 -05:00
CaptainObvious0 540259d4aa Ensure NoFall is enabled before checking player 2020-04-16 23:09:09 -05:00
CaptainObvious0 4c85fee6f9 Fix movement in lava and add bounce flags to beds 2020-04-16 01:52:51 -05:00
CaptainObvious0 eb4202b5b5 (xaw3ep) Fix elytra false positive with firework boost 2020-04-12 19:32:49 -05:00
CaptainObvious0 3a64a90f42 Update build status and add discord link 2020-04-12 19:17:43 -05:00
CaptainObvious0 69276a1315 Merge testing branch from xaw3ep's fork
All commits after Jan 2 (https://github.com/xaw3ep/NoCheatPlus/commits/testing)
2020-04-12 19:14:59 -05:00
CaptainObvious0 c4331e1ffd Merge fixes from xaw3ep's fork & More
All commits after Jan 2 (https://github.com/xaw3ep/NoCheatPlus/commits/fixes/improve)

Move WrongTurn to the packet level
Improvements to PvE combat in Fight.Direction
2020-04-12 18:38:18 -05:00
CaptainObvious0 95fb0d2494 Prevent sprinting while having blindness effect 2020-04-12 18:07:49 -05:00
CaptainObvious0 7d421b5289 Enforce movement speeds in berry bushes
Similar to cobwebs, just enforce a slower hSpeed and vDist. This does need further testing and seemed to flag when falling onto berry bushes does flag for descend speeds.
2020-04-12 18:05:44 -05:00
CaptainObvious0 c155042a75 Enforce descend speed in webs 2020-04-12 17:58:38 -05:00
CaptainObvious0 56af2482de Fix standing/moving on shulker
Just something that was never fixed when changed to McAccessBukkitModern
2020-04-12 17:53:21 -05:00
CaptainObvious0 5129a2df0a Fix bouncing on beds
checkBounceEnvelope() was getting the incorrect blockY and since beds have a different blockY level, it would always return false even if the block had the bounce flags. Slime blocks are full blocks thus why this would work correlty for slime blocks but not beds.

 For now we can just check if the block is a bed (or at least has the same blockY as a bed) and adjust the blockY that way. This works but in the future if there any blocks that allow a player to bounce it may cause issues.
2020-04-12 17:48:17 -05:00
CaptainObvious0 e5eec8905a Rework Criticals check
Attempt to look for silent jumps by comparing the players fallDistance and the fallDistance calculated by NoFall. Only check if that fall distance is below/equal to the fall disatnce set in the config. Use the jumpPhase to help determine if it was a silent jump as well

This method should reduce the false positives from the old check, by now focusing on silent jumps rather than just crit hits within a fall distance.
2020-04-12 17:43:12 -05:00
CaptainObvious0 71ba3ee690 Remove ClickPattern & FightSync
Checks were easy to false flag and served no real protection against cheating.

Detecting any sort of autoclicker is nearly impossible just because the server never knows the actual click time. Just allow Fight.Speed to handle  high fighting speeds.
2020-04-12 17:39:28 -05:00
CaptainObvious0 3ecc4a89f1 Add tags to Scaffold violations
Allow [tags] to be used in the config to determine which sub-check has flagged. Possible flags: Angle, Time, TimeAvg

TODO:
+ Need to implement pitch/tool switch subchecks
2020-04-12 17:29:34 -05:00
CaptainObvious0 0ac72f653a Rework Scaffold check
Remove old scaffold check and replace with new scaffold check. New scaffold check will check for scaffold like behaviour when placing blocks at the players feet
2020-04-12 17:24:58 -05:00
Xaw3ep 9fd079f24a Merge pull request #31 from xaw3ep/fixes/improve 2020-01-03 00:31:31 +07:00
Xaw3ep aafb786518 Update pom.xml 2020-01-03 00:24:58 +07:00
xaw3ep 1475915222 Filter TemporaryPlayers 2020-01-03 00:05:28 +07:00
Xaw3ep b2e62180bd Merge pull request #30 from xaw3ep/testing 2020-01-02 23:45:28 +07:00
xaw3ep b71c113440 SprintBack
Should be fine for now!
2020-01-02 23:29:04 +07:00
xaw3ep 1ba40eb66c Improves honeyblock movement 2020-01-02 22:34:46 +07:00
xaw3ep 713af9fd47 Limit ice speeding (2) 2020-01-02 20:29:21 +07:00
xaw3ep 3137ce938d Snow fix ? 2020-01-01 00:48:30 +07:00
xaw3ep 1dc8bcff71 Block suspicious position packets
Mostly for preventing from a client spamming sending position packets are far from the server's location!
2019-12-29 22:28:56 +07:00
Xaw3ep f6fab19e99 Limit speed on ice ?
Might be too coarse?
2019-12-29 22:07:47 +07:00
xaw3ep 141bb548a5 Fix tnt jump false
Not sure is it safe or not
2019-12-29 21:42:01 +07:00
xaw3ep 16465bff7f Fixes yaw and pitch sent wrongly by PlayerMoveEvent 2019-12-29 21:01:54 +07:00
xaw3ep 0e9f1f6ba3 Compatible with current ProtocolLib versions 2019-12-29 20:31:49 +07:00
xaw3ep d16be6b8db Fixes some blocks duration
Changed blocks:
Buttons (All)
Rail (All)
BrewStand
Shulker Boxs
Infested Blocks
Sponge
Stone Type (for type of stone)
Gravel
2019-12-21 09:42:16 +07:00
xaw3ep 8433a983c0 Adds ViolationFrequency hook
A hook good at preventing false flags on small Vls and help generate larger on checks given out too small vl.
 * In default config, it will make NCP
Sf won't setback till VL reach to 35,
 * SurvivalFly actions it will look like: vl>35 cancel ....
 * But it can catch if they are using shortfly depend on the flag frequency between moves.
 * Need to set the survivalfly.actions always cancel at vl 0 to make this hook work properly
 * For testing bugs, this hook should be
disabled
2019-12-16 18:33:06 +07:00
xaw3ep cafa7d1015 Fixes conflict with shopkeeper plugin 2019-12-16 17:49:07 +07:00
Xaw3ep 187ee39e31 Fixes a jesus check bug
There also have cave_air and void_air, remember that
2019-12-16 17:37:02 +07:00
Xaw3ep f8ecb8b8e8 1.15 Support 2019-12-15 07:37:43 +07:00
Xaw3ep 8c192a0be9 Bump to 1.15 2019-12-15 07:26:29 +07:00
xaw3ep eaee221150 Update NoSlow.java
- Added HONEY_BOTTLE
- Added SWEET_BERRY_BUSH exemption when it ripe
- Change all tab to space
2019-12-15 07:12:50 +07:00
Xaw3ep 72bd9483cb Compatible with Protocollib4.5.0 for 1.15 2019-12-15 05:51:33 +07:00
Xaw3ep 8daea7978c Merge pull request #23 from Lysandr0/patch-1
Default config overhaul
2019-12-15 05:32:29 +07:00
Lysandr0 97522875e1 Final touches
SurvivalFly: stricter checking for horizontal speed (decreased the default buffer)
InstantBow: much stricter delay time [to be tested]
As suggested by @xaw3ep.
2019-12-14 17:32:25 +01:00
xaw3ep 40daa9bb19 Restore InventoryMove isSwimming check 2019-12-12 10:24:36 +07:00
xaw3ep 01eb504cde Handle movement with HoneyBlock
Also improve bunnyfriction workaround
2019-12-11 23:14:51 +07:00
xaw3ep 74a6a1ffc2 Blocks define for 1.15 2019-12-11 19:08:04 +07:00
xaw3ep 6f557b58fc Bump version to 1.15 2019-12-11 18:49:53 +07:00
xaw3ep 0ba9540700 Add MoreInventory 2019-11-17 11:45:17 +07:00
xaw3ep e7abf96e4b Step fix(4) 2019-11-15 22:31:42 +07:00
Lysandr0 6f748c2fd1 Update DefaultConfig.java 2019-10-31 22:56:34 +01:00
Xaw3ep b891313f80 Merge pull request #26 from xaw3ep/tmp 2019-10-27 14:51:38 +07:00
xaw3ep 097e36f50e Step fix(3)+Revert old sprintback condition 2019-10-27 14:46:10 +07:00
Xaw3ep 4a19cd6b22 Update CreativeFly.java
Little exception
2019-10-27 14:26:52 +07:00
xaw3ep 77559a7b5f FlyNoFlyTransition(Attempt 3)
Fixes fp with elytra and prevent from exploiting the workaround by spamming it
2019-10-27 14:07:42 +07:00
xaw3ep e377abe342 Block workaround
- Fix TrapDoorAboveLadderSpecialCase (1.9-1.14)
- Set Passable for wood_plate (1.8)
2019-10-27 11:17:34 +07:00
Xaw3ep f22055bf81 Bamboo (deficient hitbox) 2019-10-27 10:35:59 +07:00
Lysandr0 90d9aa740f Typos 2019-10-21 09:07:17 +02:00
Lysandr0 ae980a1936 Keep FightSync and ClickPattern disabled by default for now
Obviously, they can be enabled at any time by setting their activation flag to true/default if desired; FightSync might be safer to use live on a server compared to ClickPattern, but it's not recommended with the lack of latency/tps integration overall.
(+Random revisions)
2019-10-20 20:13:55 +02:00
Lysandr0 78190886d8 Fix BlockPlace.NoSwing not applying the correct name for lily pads 2019-10-20 10:53:24 +02:00
Xaw3ep 0b885f1061 Step fix(2) 2019-10-15 18:12:38 +07:00
xaw3ep bec522d41b false positives, bypasses fixes ...
Changes:
- Waterlogged block fixes
- Recode step check
- Slime fix(1/4)
- Fix a jesus fp when moving partly on water and on lowheigh blocks
- Strict NoSlow check
- Some clean up ...
2019-10-14 22:23:42 +07:00
Xaw3ep 5050724f6f Patch elytra+ bypasses
Hmm, forgot to check eyeheight and change y while gliding
2019-10-14 20:30:38 +07:00
Lysandr0 97fdd00a18 Format clean-up 2019-10-11 20:20:51 +02:00
Lysandr0 77eeb66d7e Another batch of random revisions
Relevant: added kick for Scaffold and VehicleMorePackets.
Scaffold seems to be stable/reliable enough for a kick.
2019-10-10 16:59:20 +02:00
Lysandr0 8771c894bf Adjusted some values.
- Against, BlockPlace.Speed, FastHeal, NoSwing, InstantBow, FastClick, AttackFrequency will no longer print notifications to the console.
- BlockPlace.Speed and FastClick will no longer print notifications to the flat file for lower VLs.
- Improbable and Fight.Reach: reduced logging delay by a tiny bit
- Stricter Yawrate check (300 -> 290) [Should be tested with a heavy lag spike scenario (server/client)]
- Fight.Direction -> print notifications to the flat file for vl>10 + removed a cancel flag and increased logging delay for vl>10.
- Fight.Speed will now kick players (and log to both C/F) for higher violations.
- Fixed FightSync actions (missing log destination)
- VehicleEnvelope -> log notifications to the flat file.
- Altered BlockPlace.Speed actions
2019-10-09 19:12:44 +02:00
Lysandr0 fc2d86d87d Compile fix.
Slipped past me... Ops.
2019-10-09 09:05:17 +02:00
Lysandr0 73c14dda4d Update DefaultConfig.java 2019-10-09 08:27:27 +02:00
Lysandr0 1ddfa28470 Update DefaultConfig.java 2019-10-09 08:23:45 +02:00
Lysandr0 2e4cfe5957 Improvements for FastConsume
Adjust item consumption time to something more realistic + exempt DRIED_KELP item (1.13+)
2019-10-09 08:14:55 +02:00
Lysandr0 4138b346bf Minor format clean-up 2019-10-08 18:53:10 +02:00
Lysandr0 18da617e05 Compile fix (?) 2019-10-08 18:18:03 +02:00
Lysandr0 282ef7c6be Default config overhaul
Haven't had the chance to thoroughly test it unfortunately, especially on the combat side. (Might be a bit too sensitive... Or not) 
Some values are taken directly from my own config, others have been changed based on personal experience/testing ;p 

Any opinion/suggestion is very much welcome on this one, as this request can(/may) affect people's opinion on NCP by a lot.
2019-10-08 17:50:56 +02:00
xaw3ep 7910f6c771 Fix Against check 2019-09-23 21:56:15 +07:00
xaw3ep 9af10564b2 Fix InventoryMove not disabling
Also disable to check when players are swimming as they still can open their inv normally
2019-09-23 21:41:21 +07:00
Xaw3ep 7dcf8e4333 Merge pull request #20 from Lysandr0/patch-1
Log actions for the FlyingFrequency check
2019-09-22 15:02:22 +07:00
Lysandr0 a78b7833c6 Log actions for the FlyingFrequency check 2019-09-22 09:28:27 +02:00
xaw3ep 7053d0a0c7 Adds Feather Falling calculating method
Time to make NCP can calculate fall damage when having FeatherFalling enchant for itself.
Need more testing
2019-09-22 14:27:38 +07:00
xaw3ep f5c7d7adc6 Little VehicleEnvelope update
- Adds simple jesus check to vehicle
- Fixes a false-positive when being push-up by piston+slimeblock
2019-09-22 14:11:33 +07:00
xaw3ep 5527a65288 Attempt 2 2019-09-21 10:46:29 +07:00
Xaw3ep 7c83c8af36 Another kb bug
Forgot about waterjump
2019-09-20 20:56:14 +07:00
Xaw3ep 133f480a7b Elytra take off/landing on ground fix ? 2019-09-20 20:43:06 +07:00
Xaw3ep d9ed26a45f 1.8 splash potions bug fix 2019-09-19 17:58:48 +07:00
xaw3ep 9828c7e2be A little bit speed changes
- Fixes fp when bunny hoping after joined server for few seconds and after being flaged by some checks
- Didn't know that getFasterMovementAmplifier also get the speedAmplifier in so I have to get rid of it when useBaseModifiersSprint isn't allowed
2019-09-17 19:52:54 +07:00
Xaw3ep 68f187e38c Dealing with Knockback bugs
Caused by sprintback and watermove(2) sub-check and might be waterjump too.
Exempt sprintback by lower 0.5 in all case won't make it work anymore so I just pass this check when they are not on ground.
2019-09-17 19:13:41 +07:00
xaw3ep 5116bdbdb3 Allow trampling farmland normally 2019-09-16 22:20:48 +07:00
xaw3ep ac6b3dbe43 Redefine berry bush block 2019-09-15 19:04:46 +07:00
Xaw3ep 49d3a119f7 Riptide fix ?
Set allow distance to 20 and prevent from generating Vls silently
2019-09-15 09:20:07 +07:00
Xaw3ep 61b1227596 Reduce 1.13-1.14 direction check false-positives 2019-09-15 09:11:29 +07:00
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
Xaw3ep de08c6d400 Fixed minor anvil bug 2019-07-17 00:20:07 +07:00
Xaw3ep 55263ce969 Update SurvivalFly.java
Forgot to check if player has jump effect and use "to" location for better check.
2019-07-16 22:23:13 +07:00
Xaw3ep 327be7b302 Update SurvivalFly.java
Fixed hanging lantern issue
2019-07-16 13:00:43 +07:00
Xaw3ep 2537611620 Update BlockProperties.java
Just for defining bell properly
2019-07-16 12:51:14 +07:00
Xaw3ep 7c9a081a63 Update MCAccessBukkitModern.java 2019-07-16 12:46:18 +07:00
Xaw3ep 7da9bde43f Add files via upload
Added model for bells
2019-07-16 12:42:48 +07:00
Xaw3ep 52e3ea1556 Update BlocksMC1_14.java
Better bamboo breaking time define
2019-07-16 12:40:57 +07:00
Xaw3ep f599946e3c Update pom.xml 2019-07-15 07:45:12 +07:00
Xaw3ep 693789a448 Update TestConfig.java 2019-07-15 07:38:34 +07:00
Xaw3ep 485f4d2e82 Update TestConfig.java 2019-07-15 07:31:37 +07:00
Xaw3ep e1b554edd0 Update pom.xml 2019-07-15 07:19:50 +07:00
Xaw3ep bd46085c46 Update pom.xml 2019-07-15 07:07:41 +07:00
Xaw3ep 6d4dbb28e8 Update pom.xml 2019-07-15 07:04:53 +07:00
Xaw3ep 4a192f3a1b Update pom.xml 2019-07-15 06:48:23 +07:00
Xaw3ep a3b3d4a482 Update pom.xml 2019-07-15 06:46:03 +07:00
Xaw3ep e44da6266f Update pom.xml 2019-07-15 00:11:22 +07:00
Xaw3ep d737693787 Update BlocksMC1_14.java
Better bamboo, stonecutter, lectern define
2019-07-14 17:12:23 +07:00
Xaw3ep b7b684917e Update MCAccessBukkitModern.java
- Applied model for:
 + bamboo
 + lectern
- Better model for lantern
2019-07-14 16:49:36 +07:00
Xaw3ep 3e0af41412 Better model for lantern
Could probably cause survivalfly false positive (vdistrel+lowjump+ychincfly) when jumping beneath hanging lantern
2019-07-14 16:37:42 +07:00
Xaw3ep a8060ff3d2 Added model for bamboo 2019-07-14 16:27:25 +07:00
Xaw3ep cd5444b794 Fixed 1.14 sneaking 2019-07-14 16:18:26 +07:00
Xaw3ep 770b0b9322 Update BlocksMC1_13.java 2019-07-13 10:21:51 +07:00
Xaw3ep 47f2e0267c Fixed riptide issue
On blocks has height lower 0.5 like snow, carpet,...
2019-07-12 16:19:13 +07:00
Xaw3ep 361c1e8355 Too sleepy? 2019-07-11 00:15:26 +07:00
Xaw3ep cbcef74a54 Moved wall sign setup to 1.8 2019-07-10 17:40:17 +07:00
Xaw3ep 6bb4f682e9 Update BlocksMC1_8.java 2019-07-10 17:37:00 +07:00
Xaw3ep b638d0dff9 Update BlocksMC1_13.java 2019-07-10 17:25:18 +07:00
Xaw3ep 9961dc99b7 Update MCAccessBukkitModern.java 2019-07-09 10:25:02 +07:00
Xaw3ep 5d32ce87af Oops! 2019-07-08 22:56:33 +07:00
Xaw3ep e4761ef731 Update BlocksMC1_13.java
Someone has accidentally put F_GROUND and F_GROUND_HEIGHT flag for seagrass, kelp. Causing minor bugs
Too lazy to fix in BlockProperties class. So I will leave it here temporarily
2019-07-08 22:50:14 +07:00
Xaw3ep 682a5717f5 Apply model for anvil 2019-07-08 12:40:52 +07:00
Xaw3ep c9787ac81b Added model for anvil 2019-07-08 12:36:55 +07:00
Xaw3ep 1cfab2ee1a Update BlocksMC1_13.java 2019-07-08 12:34:04 +07:00
Xaw3ep fb114c3532 Attempt to fix riptide enchantment issue
No longer stuck on the ground when using Riptide enchantment. Sometimes still warn Nofall(fakefall) and CreativeFly(EXTREME_MOVE)
2019-07-08 09:13:06 +07:00
Xaw3ep 5f89bbf462 Update InventoryListener.java
it's quite weird when I didn't receive any error (maybe lag).
2019-07-08 08:07:02 +07:00
Xaw3ep a2ac285c0c Apply model for lantern 2019-07-08 00:21:50 +07:00
Xaw3ep b58049b81a Update InventoryListener.java 2019-07-07 23:29:28 +07:00
Xaw3ep da9f94e566 Fix false positive when using Crossbow
Disabled a method when shoot arrow from Crossbow as it doesn't always need to charge before shooting like bow
2019-07-07 23:00:07 +07:00
Xaw3ep cc50883150 Change composter breaking time 2019-07-07 19:20:50 +07:00
Xaw3ep 8c1408546a Will no longer stuck in composter block 2019-07-07 18:41:16 +07:00
Xaw3ep 8fda3b0d1f Update AutoSign.java
Oops, forgot to add this
2019-07-07 16:11:19 +07:00
Xaw3ep 9cd142e942 Update AutoSign.java
Nevermind, it works again
2019-07-07 15:35:00 +07:00
Xaw3ep e7560fa894 Prevent an error occurred 2019-07-07 13:28:00 +07:00
Xaw3ep e7761cc1e4 Update MCAccessBukkitModern.java 2019-07-07 12:56:02 +07:00
Xaw3ep ae8d5bcd01 Apply model for walls 2019-07-07 12:51:34 +07:00
Xaw3ep e60343cd52 Update BlockPlaceListener.java 2019-07-07 12:12:28 +07:00
Xaw3ep e20b240669 Update BlocksMC1_14.java 2019-07-07 10:24:30 +07:00
Xaw3ep 791fabcaf8 Change flag for walls
Using fence flag can sometimes cause glitch.
2019-07-07 10:02:48 +07:00
Xaw3ep 168eadfec2 Add flag for walls 2019-07-07 09:54:31 +07:00
xaw3ep 6511de888c Update AutoSign.java 2019-07-06 15:40:59 +07:00
xaw3ep 2a84e271d7 Update Passable.java 2019-07-06 15:13:27 +07:00
xaw3ep 6c25848136 Update DefaultComponentFactory.java 2019-07-06 15:05:03 +07:00
xaw3ep ead9915bf3 Update MCAccessFactory.java 2019-07-06 14:53:52 +07:00
xaw3ep c471130756 Add setup for MC1_14 2019-07-06 14:52:00 +07:00
xaw3ep e9516a9bb3 Update BlockProperties.java 2019-07-06 14:43:44 +07:00
xaw3ep 205d7957c3 Update BridgeMaterial.java 2019-07-06 14:23:30 +07:00
xaw3ep ada91e81cf Add blocks define for Minecraft 1.14 2019-07-06 14:13:39 +07:00
xaw3ep 6778416d61 Add some flags for blocks in Minecraft 1.14 2019-07-06 14:00:11 +07:00
xaw3ep 76e51ac36b Having slowfalling will bypass Survivalfly check 2019-07-06 13:51:42 +07:00
xaw3ep 5f7f364061 Fix SlowFalling issue 2019-07-06 13:37:47 +07:00
xaw3ep 8d72767061 Add slowfalling ModelFlying 2019-07-06 13:24:41 +07:00
xaw3ep b7c5c085a9 Add Slow Falling flying mode 2019-07-06 13:11:56 +07:00
xaw3ep 7db23f7cbd Update ConfPaths.java 2019-07-06 12:34:56 +07:00
xaw3ep a4475f5e97 Add slow falling config 2019-07-06 12:30:51 +07:00
xaw3ep c5370ced6f Add slowfalling handling 2019-07-06 12:15:15 +07:00
CaptainObvious0 cf0d6af701 Add remaining block models and define unknown blocks (#49)
* MCAccessBukkitModern - Add models for turtle eggs & clean up code

* BukkitTurtleEgg - Add models per each egg count

* MCAccessBukkitModern - Define blocks that are unknown

* BlockProperties - Add F_GROUND_HEIGHT to anvils

* MCAccessBukkitModern - Finish adding unkown blocks

* DefaultConfig - Move from config modeling to plugin modeling
2019-04-23 20:48:35 -05:00
CaptainObvious0 e28479d6c5 Add models for turtle egg
* MCAccessBukkitModern - Add models for turtle eggs & clean up code

* BukkitTurtleEgg - Add models per each egg count
2019-04-23 19:42:02 -05:00
CaptainObvious0 eb6ba15e50 Merge pull request #44 from Lysandr0/master
Some fixes and additions.
2019-04-23 08:27:28 -05:00
Lysandr0 8a03e8ef12 Fix tags being spammed when switching from Creative to Survival with "disable_creative" set to true 2019-04-23 14:47:00 +02:00
Lysandr0 86c9137c23 Formatting clean-up. 2019-04-23 14:26:15 +02:00
Lysandr0 26524a6436 Oops. (typo) 2019-04-22 00:42:12 +02:00
Lysandr0 d7a4e9be77 Log actions for the ClickPattern check. 2019-04-22 00:16:29 +02:00
Lysandr0 50dc07e8a4 Confine the hotbar skip condition to just Creative mode. 2019-04-22 00:02:07 +02:00
CaptainObvious0 2c295f56dd SurvivalFly - Tempoary Block fix 2019-04-21 12:20:50 -05:00
CaptainObvious0 6b33f681dd SurvivalFly - New block fix 2019-04-20 12:46:14 -05:00
Lysandr0 7eecae02d4 Fix "sprintback" false positive + speed potions. 2019-04-20 13:05:56 +02:00
CaptainObvious0 d2a33779fd ClickPattern - Fix compile error
Need to apply a method for the current version
2019-04-19 15:30:28 -05:00
CaptainObvious0 201dae4c1d DefaultConfig - Add ClickPattern defaults 2019-04-19 15:23:41 -05:00
CaptainObvious0 8b908220ef ConfPaths - ClickPattern config paths 2019-04-19 15:22:41 -05:00
CaptainObvious0 9b4589b264 CheckType - Add ClickPattern 2019-04-19 15:21:26 -05:00
CaptainObvious0 9b75344e3e FightData - Add data for ClickPattern 2019-04-19 15:20:30 -05:00
CaptainObvious0 a3d64dd5c7 FightConfig - Add ClickPattern config values 2019-04-19 15:19:13 -05:00
CaptainObvious0 3e9f405451 FightListener - Add listener for ClickPattern 2019-04-19 15:18:31 -05:00
CaptainObvious0 c8df5b33ed ClickPattern - Add new check [Not Done/Beta]
This check will attempt to find patterns in a players click. It calculates the time between each click, and checks if the difference is the same or near the last click difference. This can be very effective against combat cheats that do not have any cps deviation. 

ToDo: Average difference: Another clicking pattern check by comparing the average click difference and seeing if they are all relatively the same.
2019-04-19 15:17:24 -05:00
Lysandr0 407f8e14f9 Remove redundant comments + formatting. 2019-04-19 21:07:07 +02:00
Lysandr0 d3b53bb68b Remove redundant comments. 2019-04-19 21:04:09 +02:00
Lysandr0 280d537064 Fix Fight.Angle not adding violations correctly. 2019-04-17 09:51:38 +02:00
CaptainObvious0 67b7f49af7 BlocksMC1_13 - Define models for seagrass 2019-04-16 20:04:46 -05:00
CaptainObvious0 6eb88e3106 BlockProperties - Apply flags to LIQUID_BLOCKS 2019-04-16 20:03:05 -05:00
CaptainObvious0 3d85f8dd89 MaterialUtil - Add LIQUID_BLOCKS collection 2019-04-16 20:02:07 -05:00
Lysandr0 d9fb5e1444 Typo :p 2019-04-16 17:25:44 +02:00
Lysandr0 ea685240a3 Fix NCP preventing legit fall damage when teleporting whilst falling 2019-04-16 17:24:44 +02:00
Lysandr0 c800e1cc26 Update DefaultConfig.java 2019-04-16 14:00:10 +02:00
Lysandr0 ab690f7e72 Add a tag for each detection method in the Angle check as well 2019-04-16 13:57:28 +02:00
CaptainObvious0 84a32fbcf8 MCAccessBukkitModern - Add wall_head flags 2019-04-15 20:03:17 -05:00
CaptainObvious0 8dbdeded5e MCAccessBukkitModern - Add Chorus_Plant models 2019-04-15 19:37:23 -05:00
CaptainObvious0 47947fc1c5 BukkitChorusPlant - Add model 2019-04-15 19:35:45 -05:00
CaptainObvious0 235f937056 CompatBukkit/pom - Bukkit -> Spigot repo 2019-04-15 19:34:12 -05:00
Lysandr0 ad6d1ffe91 Add [tags] to the "inventorymove" string 2019-04-16 01:14:36 +02:00
Lysandr0 f6b3ab0a9d Add a tag in each detection for the InventoryMove check 2019-04-16 01:07:38 +02:00
CaptainObvious0 1075d63244 MCAccessBukkitModern - Add ign_passable to cocoa 2019-04-15 16:39:20 -05:00
CaptainObvious0 784aed2a0c MCAccessBukkitModern - Add wall heads [Not Done]
[Not Done] - Needs to have the F_XZ100 flag (like cocoa) but for an odd reason it is not applying the flags by default.
2019-04-14 22:16:25 -05:00
CaptainObvious0 7791cff8a0 MCAccessBukkitModern - Add cocoa model 2019-04-14 21:42:07 -05:00
CaptainObvious0 dd7eebd3a1 BukkitCocoa - Add modeling 2019-04-14 21:39:06 -05:00
CaptainObvious0 25b96ca846 BlockProperties - Add step flags to sea pickle 2019-04-14 20:53:40 -05:00
CaptainObvious0 096bb7ff2d BlocksMC1_13 - Add Sea Pickle break time 2019-04-14 20:49:36 -05:00
CaptainObvious0 f32303cfd7 MCAccessBukkitModern - Add Sea pickle 2019-04-14 20:42:20 -05:00
CaptainObvious0 152859da78 BukkitSeaPickle - Add block models 2019-04-14 20:41:42 -05:00
CaptainObvious0 b44c1eb280 MaterialUtil - Switch to block modeling (Sea_Pickle) 2019-04-14 20:40:42 -05:00
CaptainObvious0 687fcafd3d MCAccessBukkitModern - Add conduit model
Has the same shape as flower pots, but a different height.
2019-04-14 19:49:55 -05:00
Lysandr0 9e5ab88f28 Unbind the "SprintBack" subcheck from the assume sprint workaround. 2019-04-14 23:52:26 +02:00
CaptainObvious0 49a31edc15 README - Add build status 2019-04-13 14:58:02 -05:00
CaptainObvious0 c8077b43a8 BlocksMC1_10 - Magma Block fix 2019-04-13 14:33:08 -05:00
CaptainObvious0 be047840c7 MCAccessCBReflect - 1.13 Block fixes
This will now correctly add 1.13 block models, rather than relying on config flags.
2019-04-13 14:28:48 -05:00
CaptainObvious0 dec9f754e6 SurvivalFly - Snow Fixes 2019-04-12 17:25:06 -05:00
CaptainObvious0 063f9fd116 SurvivalFly - newHDist fix 2019-04-12 16:33:14 -05:00
CaptainObvious0 0d652109d2 FightListener - FightSync fix
Checks if the check is active for the player before checking.
2019-04-12 16:16:00 -05:00
CaptainObvious0 ba3348e02e Magic - Revert new swimming speeds
New swimming speeds cause issues with riptiding, this needs to be fixed before swimming speeds are updated.
2019-04-12 16:05:09 -05:00
CaptainObvious0 c06e2b6468 Merge pull request #29 from Lysandr0/patch-1 [Beta]
Allow WrongTurn to detect illegal negative pitch patterns
2019-04-12 11:52:49 -05:00
Lysandr0 cb6113a36e Update WrongTurn.java 2019-04-12 08:25:05 +02:00
Lysandr0 60647d3a03 Update WrongTurn.java 2019-04-10 01:18:42 +02:00
Lysandr0 e853eacb3a Fix a parse error and delete unused strings 2019-04-09 22:27:46 +02:00
Lysandr0 908751e7b6 Allow WrongTurn to detect illegal negative pitch patterns 2019-04-09 22:08:59 +02:00
CaptainObvious0 a0d75fc566 Magic - Swimming magic speeds updated
Magic speeds should now match swimming speeds. Other magic speeds still need to be updated.
2019-04-08 22:10:05 -05:00
CaptainObvious0 7f65bd12e6 FightSync - Add nullcheck 2019-04-08 20:39:11 -05:00
CaptainObvious0 82e8e389c0 MovingData - newHDist variable (1.13 Block fixes) 2019-04-08 20:29:21 -05:00
CaptainObvious0 16b32cb953 SurvivalFly - 1.13 Block Fixes
Fixes issue where sprinting and jumping over long periods of blocks with lower block margins would flag for hspeed.
2019-04-08 20:28:35 -05:00
CaptainObvious0 a6b09f90a1 MovingData - bedLeaveTime data 2019-04-08 19:43:28 -05:00
CaptainObvious0 7b4a48e8a9 MovingListener - bedLeaveTime variable 2019-04-08 19:42:44 -05:00
CaptainObvious0 69463aff6b SurvivalFly - BedLeave false positive 2019-04-08 19:41:36 -05:00
CaptainObvious0 75eaab9da0 MovingListener - Vanilla Fly + Elytra improvements 2019-04-08 19:16:07 -05:00
CaptainObvious0 34cd09a70c SurvivalFly - Watermove fixes 2019-04-08 18:11:53 -05:00
CaptainObvious0 a628b4597c ConfPaths - DisableCreative (InvMove) 2019-04-08 17:46:23 -05:00
CaptainObvious0 94bb30781a DefaultConfig - DisableCreative (InvMove) 2019-04-08 17:45:36 -05:00
CaptainObvious0 c0fbe776f0 InventoryConfig - Disable Creative (InventoryMove) 2019-04-08 17:44:32 -05:00
CaptainObvious0 3d9d66e199 InventoryMove - Fixes & Config additions 2019-04-08 17:43:41 -05:00
CaptainObvious0 c58ab8e676 InventoryListener - Fixes + Config additions 2019-04-08 17:42:52 -05:00
CaptainObvious0 a2562d1e6e Update issue templates 2019-04-07 19:47:19 -05:00
CaptainObvious0 a6f1119db0 AttackFrequency - Improbable Weight 2019-04-07 19:25:48 -05:00
CaptainObvious0 cf8be9da54 NetConfig - Improbable Weight 2019-04-07 19:25:20 -05:00
CaptainObvious0 13d14b1fc6 FastClick - Improbable Weight 2019-04-07 19:23:49 -05:00
CaptainObvious0 bdf2fc950a InventoryConfig - Improbable Weight 2019-04-07 19:22:22 -05:00
CaptainObvious0 c69b6f8e8b Reach - Improbable Weight 2019-04-07 19:21:22 -05:00
CaptainObvious0 af429a1740 FightListener - Improbable Weight 2019-04-07 19:20:45 -05:00
CaptainObvious0 d45afcf169 FightConfig - Improbable weight 2019-04-07 19:19:33 -05:00
CaptainObvious0 c5e1b47a97 Combined - Improbable weight 2019-04-07 19:18:48 -05:00
CaptainObvious0 9c2c0a5326 CombinedConfig - Improbable Weight 2019-04-07 19:17:59 -05:00
CaptainObvious0 ae34de5ba1 WrongBlock - Improbable weight 2019-04-07 19:17:20 -05:00
CaptainObvious0 3afbbaea79 BlockBreakConfig - Improbable Weight 2019-04-07 19:16:27 -05:00
CaptainObvious0 243dac7aed BlockPlaceListener - Improbable Weight 2019-04-07 19:15:19 -05:00
CaptainObvious0 266a15c4bf BlockPlaceConfig - Improbable Weight 2019-04-07 19:12:42 -05:00
CaptainObvious0 70d58208cc DefaultConfig - Add improbable weights 2019-04-07 19:11:42 -05:00
CaptainObvious0 755514d4c5 ConfPaths - Add improbable weight to each check 2019-04-07 19:07:18 -05:00
CaptainObvious0 3141a08a5e DefaultConfig - FightSync values 2019-04-07 16:10:59 -05:00
CaptainObvious0 82fd3226a4 FightListener - FightSync VL changes
Lower the players VL when their count is reset.
2019-04-07 16:05:23 -05:00
CaptainObvious0 040e7bc73a FightListener - Fix compile error 2019-04-07 15:45:13 -05:00
CaptainObvious0 0a9f832a06 DefaultConfig - FightSync 2019-04-07 15:37:06 -05:00
CaptainObvious0 8a45246d2c ConfPaths - FightSync 2019-04-07 15:34:41 -05:00
CaptainObvious0 5ae32be309 CheckType - Add FightSync + Scaffold 2019-04-07 15:33:17 -05:00
CaptainObvious0 47cf9d9833 UseEntityAdapter - Get packet location (FightSync)
Gets the players location via packets, used for FightSync
2019-04-07 15:32:08 -05:00
CaptainObvious0 391a8af30b FightSync - New check
This check attempts to verify that client and server yaw/pitch data are in sync.
2019-04-07 15:30:40 -05:00
CaptainObvious0 853ce8dba4 FightListener - FightSync Listener 2019-04-07 15:28:26 -05:00
CaptainObvious0 ea3b11a435 NetData - FightSync data 2019-04-07 15:23:46 -05:00
CaptainObvious0 2ffa0c726c NetConfig - FightSync Config 2019-04-07 15:23:05 -05:00
CaptainObvious0 3de05e27c4 DefaultConfig - Scaffold Check 2019-04-06 21:42:47 -05:00
CaptainObvious0 5a42e3fc37 ConfPaths - Scaffold Check 2019-04-06 21:40:24 -05:00
CaptainObvious0 612b073824 BlockPlaceConfig - ScaffoldActions 2019-04-06 21:39:34 -05:00
CaptainObvious0 fec7f4bcbc BlockPlaceData - ScaffoldVL 2019-04-06 21:38:37 -05:00
CaptainObvious0 a00921fafc BlockPlaceListener - Added listener for the scaffold check 2019-04-06 21:37:59 -05:00
CaptainObvious0 73ed92e299 Scaffold - Added check [BETA]
Added new block place check, scaffold. This will check that the player is interacting with the block face they are placing against. 

More sub-checks will be added to catch more scaffold cheats. 

[BETA] - The check is not yet finished and needs more testing.
2019-04-06 21:37:09 -05:00
486 changed files with 39789 additions and 26920 deletions

No files matched your search

+5 -5
View File
@@ -6,13 +6,13 @@ labels: ''
assignees: ''
---
#### *Complete* output of the `ncp version` command (please prefer text here)
### Full output of /ncp version
#### Short description of the issue and how to reproduce (is it random / always happens / side conditions ?)
### Describe the issue
#### Have you made any (noteworthy) changes to the default configuration of NCP?
### How to reproduce the issue
#### Do you run any other special plugins that affect game mechanics next to NC+ (skills, machines, adding/changing blocks, other anti-cheating)?
### Extra links/Videos (Including debug logs)
#### Provide additional information: for bypasses, vulnerabilities and reproducible issues, we request a [debug log. ](https://github.com/Updated-NoCheatPlus/Docs/blob/master/Development/Debugging.md#on-the-fly-debug-output-for-individual-players) Use [GitHub gists](https://gist.github.com/) or [PasteBin](http://pastebin.com/) or similar for errors and huge logs, or attach a (zip-) file here.
### Any possible config options changed or plugins that may cause interference?
@@ -2,7 +2,7 @@
name: Feature/Check Request
about: 'Suggest a feature or check '
title: ''
labels: ''
labels: enhancement
assignees: ''
---
+86
View File
@@ -0,0 +1,86 @@
# Git
*.orig
!.gitignore
# Windows
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
*.stackdump
[Dd]esktop.ini
$RECYCLE.BIN/
*.lnk
# Linux
*~
.fuse_hidden*
.directory
.Trash-*
.nfs*
# MacOS
.DS_Store
.AppleDouble
.LSOverride
._*
# Java
*.class
*.log
*.ctxt
.mtj.tmp/
*.jar
*.war
*.nar
*.ear
hs_err_pid*
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
# Intellij
*.iml
*.java___jb_tmp___
.idea/*
*.ipr
*.iws
/out/
.idea_modules/
# Eclipse
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.project
.externalToolBuilders/
*.launch
.cproject
.classpath
.buildpath
.target
# NetBeans
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
.nb-gradle/
-676
View File
@@ -1,676 +0,0 @@
# Custom NoCheatPlus Config
# Version 3.2
# Type: Auto-Ban
# Config Developed by Captain_Obvious
# Config support can be found here: https://goo.gl/Du4BpY
# Reminder: You must be using the latest build of NoCheatPlus in order to run the config. Link: https://ci.md-5.net/job/NoCheatPlus/
savebackconfig: true
configversion:
notify: false
notifymaxpaths: 5
created: 1104
saved: 1104
logging:
active: true
maxqueuesize: 5000
extended:
status: false
commands:
actions: false
allviolations:
debug: true
debugonly: false
backend:
trace: false
notify: false
backend:
console:
active: true
asynchronous: true
file:
active: false
prefix: ''
filename: nocheatplus.log
ingamechat:
active: true
prefix: '&c&lNCP &7»&r '
subscriptions: false
data:
expiration:
active: true
duration: 75
history: false
consistencychecks:
active: true
interval: 10
maxtime: 2
suppresswarnings: false
protection:
plugins:
hide:
active: true
nopermission:
message: '&c&lNCP &7» &rYou do not have permission to run this command.'
commands:
- '?'
- plugins
- version
- icanhasbukkit
- bukkit:help
- bukkit:?
- about
unknowncommand:
message: '&c&lNCP &7» &rThe server currently runs a custom &cNoCheatPlus Config &rVersion &c3.2'
commands:
- ncp
commands:
consoleonly:
active: true
message: '&c&lNCP &7» &rThis command could cause problems. Please execute in console if you wish to continue.'
commands:
- restart
- stop
- rl
- reload
clients:
motd:
active: true
allowall: false
checks:
blockbreak:
direction:
active: true
actions: cancel vl>10 log:bdirection:0:8:i cancel
fastbreak:
active: true
strict: true
delay: 95
intervalsurvival: 100
grace: 2000
actions: cancel vl>2 log:fastbreak:1:10:i cancel vl>110 cmd:cheatwarn:0:15 log:fastbreak:1:7:i cancel vl>95 cmd:cccheatban:0:2 cancel vl>110 cmd:cheatban:0:2 cancel vl>125 cmd:ccheatban:0:2 cancel vl>1000 cancel log:highvlerror:0:5:i
frequency:
active: true
intervalcreative: 95
intervalsurvival: 49
shortterm:
ticks: 5
limit: 6
actions: cancel vl>12 log:bbfrequency:2:7:i cancel vl>25 cmd:cccheatkick:0:2 cancel vl>35 cancel cmd:kickfrequency:0:2 vl>50 cmd:ccheatkick:0:2 cancel
noswing:
active: false
actions: vl>20 log:noswing:0:12:i
reach:
active: true
actions: cancel vl>5 log:breach:0:10:i cancel
wrongblock:
active: true
level: 10
actions: cancel vl>10 log:bwrong:0:8:i cancel vl>16 cmd:cccheatkick:0:2 cancel vl>25 cancel cmd:kickwb:0:2 vl>35 cmd:ccheatkick:0:2 cancel
blockinteract:
direction:
active: true
actions: vl>5 cancel vl>24 log:bdirection:0:7:i cancel
reach:
active: true
actions: cancel vl>5 log:breach:0:8:i cancel
speed:
active: true
interval: 2000
limit: 52
actions: cancel vl>200 log:bspeed:0:8:i cancel vl>3000 cmd:cccheatban:0:2 cancel vl>4250 cmd:cheatban:0:2 cancel vl>5000 cmd:ccheatban:0:2 cancel
visible:
active: true
actions: vl>4 cancel vl>50 log:bvisible:0:10:i cancel
blockplace:
against:
active: true
actions: cancel
autosign:
active: true
skipempty: false
actions: cancel vl>5 log:bautosign:0:6:i cancel vl>12 cmd:cccheatban:0:2 cancel vl>15 cmd:cheatban:0:2 cancel vl>20 cmd:ccheatban:0:2 cancel
direction:
active: true
actions: cancel vl>10 log:bdirection:0:8:i cancel
fastplace:
active: true
limit: 14
shortterm:
ticks: 12
limit: 5
actions: cancel vl>15 log:fastplace:1:8:i cancel vl>190 cmd:cheatwarn:0:15 log:fastplace:1:6:i cancel vl>225 cmd:cccheatban:0:2 cancel vl>275 cmd:cheatban:0:2 cancel vl>320 cmd:ccheatban:0:2 cancel
reach:
active: true
actions: cancel vl>5 log:breach:0:7:i cancel
noswing:
active: false
exceptions:
- WATER_LILY
- FLINT_AND_STEEL
actions: cancel vl>10 log:noswing:0:7:i cancel
speed:
active: true
interval: 70
actions: cancel vl>150 log:bpspeed:3:5:i cancel vl>400 cmd:cccheatkick:0:2 cancel vl>500 cmd:cheatkick:0:2 cancel vl>600 cmd:ccheatkick:0:2 cancel
preventmisc:
boatsanywhere: true
chat:
captcha:
active: true
skip:
commands: false
characters: abcdefghjkmnpqrtuvwxyzABCDEFGHJKMNPQRTUVWXYZ2346789
length: 4
question: '&c&lNCP &7» &cPlease type ''&6[captcha]&c'' to continue sending messages/commands.'
success: '&c&lNCP &7» &aYou can keep chatting now'
tries: 3
actions: cancel cmd:kickcaptcha:0:2 vl>4 cancel cmd:kickcaptcha:0:2
color:
active: false
actions: log:color:0:6:i cancel
commands:
active: true
exclusions: []
handleaschat:
- /me
- /msg
- /emsg
- /r
- /reply
- /pm
- /epm
- /whisper
- /tell
- /etell
level: 10
shortterm:
ticks: 18
level: 3
actions: cancel cmd:kickcommands:0:2 vl>20 cancel cmd:tempkick1:0:2:i
text:
active: true
allowvlreset: true
frequency:
normal:
minimum: 0.0
factor: 0.9
weight: 6
level: 135
actions: cancel cmd:tellchatnormal:0:2 vl>7 cancel cmd:tellchatnormal:0:2 vl>20 cancel cmd:kickchatnormal:0:2 vl>40 cancel cmd:kickchat5:0:2
shortterm:
minimum: 2.0
factor: 0.7
weight: 3.0
level: 18.0
actions: cancel cmd:kickchatfast:0:6 vl>20 cancel cmd:kickchat1:0:2 vl>40 cancel cmd:kickchat5:0:2
message:
lettercount: 1.0
partition: 1.0
uppercase: 1.2
afterjoin: 1.5
nomoving: 1.5
repeatviolation: 1.2
repeatglobal: 1.0
repeatself: 1.5
words:
lengthav: 1.0
lengthmsg: 1.0
noletter: 0.0
global:
active: true
weight: 1.0
words:
active: false
prefixes:
active: false
similarity:
active: false
player:
active: true
words:
active: false
prefixes:
active: false
similarity:
active: false
warning:
active: true
level: 71
message: '&c&lNCP &7» &cSlow down in chat!'
timeout: 10
relog:
active: true
timeout: 3250
warning:
message: '&cNCP &7» &cYou relogged too fast!'
number: 1
timeout: 60000
kickmessage: Too fast re-login, try with a little delay.
actions: cancel vl>15 cancel cmd:tempkick5:0:2
logins:
active: true
startupdelay: 600
perworldcount: false
seconds: 10
limit: 7
kickmessage: Too many players are logging in at a time! Try again later.
combined:
bedleave:
active: true
actions: cancel log:bedleave:0:7:i cmd:kickbedleave:0:2
enderpearl:
active: true
preventclickblock: true
improbable:
active: true
level: 198
actions: cancel vl>4 log:improbable:0:6:i cancel vl>520 cmd:cccheatban:0:2 cancel vl>600 cmd:cheatban:0:2 cancel vl>720 cmd:ccheatban:0:2 cancel vl>12000 cancel log:highvlerror:0:5:i
invulnerable:
active: true
triggers:
always: false
falldistance: true
initialticks:
join: -1
ignore:
- FALL
modifiers:
all: 0
munchhausen:
active: false
actions: cancel vl>100 cancel log:munchhausen:0:60:i
yawrate:
rate: 105
penalty:
factor: 1.0
minimum: 250
maximum: 2000
improbable: true
fight:
canceldead: true
toolchangepenalty: 150
pvp:
knockbackvelocity: default
yawrate:
active: true
angle:
active: true
threshold: 55
actions: cancel vl>160 log:angle:0:6:i cancel vl>310 cmd:cccheatban:0:2 cancel vl>370 cmd:cheatban:0:2 cancel vl>410 cmd:ccheatban:0:2 cancel
critical:
active: true
cancel:
cancel: 125
dividedamage: 0.08
falldistance: 0.075
actions: vl>2 cancel vl>17 log:critical:0:6:i cancel vl>28 cmd:cccheatban:0:2 cancel vl>35 cmd:cheatban:0:2 cancel vl>45 cmd:ccheatban:0:2 cancel
direction:
active: true
strict: false
penalty: 160
actions: vl>1 cancel vl>6 log:fdirection:0:6:i cancel vl>30 cmd:cheatwarn:0:15 log:fdirection:0:5:i cancel vl>38 cmd:cccheatban:0:2 cancel vl>60 cmd:cheatban:0:2 cancel vl>50 cmd:ccheatban:0:2 cancel
fastheal:
active: true
interval: 4000
buffer: 1000
actions: cancel vl>10 cancel log:fastheal:0:10:i
godmode:
active: true
minage: 1100
maxage: 5000
actions: log:godmode:1:8:i cancel
noswing:
active: true
actions: vl>1 cancel vl>7 log:noswing:0:8:i cancel
reach:
active: true
survivaldistance: 4.2
penalty: 250
reduce: true
reducedistance: 0.9
reducestep: 0.15
actions: vl>1 cancel vl>4 log:freach:0:5:i cancel vl>22 cmd:cccheatban:0:2 cancel vl>28 cmd:cheatban:0:2 cancel vl>34 cmd:ccheatban:0:2 cancel
selfhit:
active: true
actions: log:fselfhit:1:8:i cancel vl>10 cancel cmd:kickselfhit:0:2 vl>15 cmd:ccheatkick:0:2 cancel
speed:
active: true
limit: 13
actions: cancel vl>8 log:fspeed:0:6:i cancel vl>25 cmd:cccheatban:0:2 cancel vl>32 cmd:cheatban:0:2 cancel vl>40 cmd:ccheatban:0:2 cancel
shortterm:
ticks: 8
limit: 6
inventory:
drop:
active: true
limit: 4
timeframe: 15
actions: log:drop:0:6:i cancel vl>6 cancel cmd:cheatkick:0:2
fastclick:
active: true
sparecreative: true
tweaks1_5: true
limit:
shortterm: 3
normal: 9
actions: vl>3 cancel vl>80 log:fastclick:1:8:i cancel
instantbow:
active: true
strict: true
delay: 129
improbable:
feedonly: false
weight: 0.6
actions: cancel vl>15 log:instantbow:2:6:i cancel
instanteat:
active: true
actions: log:instanteat:2:5:i cancel
fastconsume:
active: true
duration: 0.67
whitelist: false
items: []
actions: log:fastconsume:2:8:i cancel
gutenberg:
active: true
actions: cancel log:gutenberg:0:10:i cmd:kickinvaliddata:0:2
items:
active: true
open:
active: true
close: true
cancelother: true
hotfix:
duplication:
fallingblockendportal: true
moving:
creativefly:
active: true
ignoreallowflight: true
ignorecreative: true
model:
creative:
horizontal:
speed: 114
vertical:
ascend:
speed: 97
maxheight: 128
spectator:
horizontal:
speed: 450
vertical:
ascend:
speed: 170
maxheight: 128
gravity: false
ground: false
levitation:
horizontal:
speed: 50
vertical:
ascend:
speed: 10
maxheight: 128
gravity: false
modifiers: false
gravity: false
ground: false
elytra:
horizontal:
speed: 345
modsprint: 1.0
vertical:
ascend:
speed: 0
maxheight: 128
modifiers: false
actions: vl>6 cancel vl>180 cmdc:flyshort:0:6 cancel vl>1750 log:flylong:0:4:i cancel vl>6000 cmd:cheatwarn:0:15 log:flylong:0:4:i cancel vl>7000 cmd:cheatban:0:5 cancel vl>8000 cmd:ccheatban:0:2 cancel
morepackets:
active: true
seconds: 6
epsideal: 20
epsmax: 22
burst:
packets: 20
directviolation: 30
epmviolation: 60
setbackage: 40
actions: cancel vl>25 log:morepackets:2:7:i cancel vl>90 cmd:cccheatkick:0:3 cancel vl>100 cmd:kickpackets:0:3 cancel vl>180 cmd:ccheatkick:0:3 cancel
nofall:
active: true
dealdamage: true
skipallowflight: true
resetonviolation: false
resetonteleport: false
resetonvehicle: true
anticriticals: true
actions: log:nofall:0:7:i cancel vl>4 cancel cmd:cccheatkick:0:12 vl>8 cmd:cheatban:0:2 cancel vl>12 cmd:ccheatban:0:2:ci cancel
passable:
active: true
actions: vl>2 cancel vl>24 log:passable:1:5:i cancel vl>170 cmd:cccheatkick:0:2 cancel vl>200 cancel cmd:cheatkick:0:2 vl>220 cmd:ccheatkick:0:2 cancel
untracked:
teleport:
active: true
command:
active: true
tryteleport: true
prefixes:
- sethome
- home set
- setwarp
- warp set
- setback
- set back
- back set
- spawn
- hub
- tpaccept
- tphere
- tpaccept
- home
- wild
- randomtp
- wildtp
survivalfly:
active: true
extended:
vertical-accounting: true
stepheight: default
hbufmax: 1.0
setbackpolicy:
falldamage: true
voidtovoid: true
actions: vl>45 cancel vl>175 cmdc:flyshort:1:7 cancel vl>1800 log:flylong:0:6:i cancel vl>6800 cancel cmd:cheatwarn:0:15 log:flylong:0:5:i vl>9000 cmd:cccheatban:0:2 cancel vl>1000 cmd:cheatban:0:5 cancel vl>12000 cmd:ccheatban:0:2 cancel vl>25000 cancel log:highvlerror:0:5:i
hover:
active: true
step: 5
ticks: 85
loginticks: 100
falldamage: true
sfviolation: 550
velocity:
activationcounter: 80
activationticks: 140
strictinvalidation: true
splitmoves: default
ignorestance: default
tempkickillegal: true
loadchunks:
join: true
move: true
teleport: true
worldchange: true
sprintinggrace: 2.0
assumesprint: true
speedgrace: 4.0
enforcelocation: default
setback:
method: default
vehicle:
preventdestroyown: true
enforcelocation: default
schedulesetbacks: default
morepackets:
active: true
actions: cancel vl>12 log:morepackets:0:8:i cancel
envelope:
active: default
actions: cancel vl>100 cancel log:vehicleenvelope:0:15:i
message:
illegalplayermove: Illegal move.
illegalvehiclemove: Illegal vehicle move.
net:
attackfrequency:
active: true
limitforseconds:
half: 9
one: 14
two: 39
four: 55
eight: 100
actions: cancel vl>15 cancel log:attackfrequency:0:5:i vl>60 cancel cmd:kickinvaliddata:0:12 vl>75 cmd:cheatban:0:2 cancel vl>95 cmd:ccheatban:0:2 cancel
flyingfrequency:
active: true
seconds: 5
packetspersecond: 60
actions: cancel
reduceredundant:
active: true
seconds: 3
actions: cancel vl>2500 cmd:kickinvaliddata:0:2 cancel
keepalivefrequency:
active: true
actions: cancel vl>10 cancel log:keepalive:0:10:i vl>100 cancel cmd:kickalive:0:2
packetfrequency:
active: default
limitpersecond: 200
seconds: 4
actions: cancel cmd:kickpacketfrequency:0:4 vl>4 cmd:ccheatkick:0:5 cancel
sounddistance:
active: true
maxdistance: 200
superseded:
flying:
cancelwaiting: true
strings:
angle: '&c[player] &7could be using &6KillAura &7VL &c[violations] &7(Combat Hacks)'
attackfrequency: '&c[player] &7could be using &6MultiAura &7VL &c[violations] &7(Combat Hacks)'
ban: ban [player]
ban-ip: ban-ip [ip]
bautosign: '&c[player] &7could be using &6Auto Sign &7VL &c[violations]'
bbfrequency: '&c[player] &7could be using &6Nuker &7VL &c[violations]'
bdirection: '&c[player] &7failed &6Impossible Interact &7VL &c[violations]'
bedleave: '&c[player] &7failed &6Bed Leave &7VL &c[violations]'
bpspeed: '&c[player] &7could be using &6Fast Throw &7VL &c[violations]'
breach: '&c[player] &7could be using &6Block Reach &7VL &c[violations]'
bspeed: '&c[player] &7could be using &6Fast Interact &7VL &c[violations]'
bvisible: '&c[player] &7could be using &6Block Cheats &7VL &c[violations] &7(Block was not in sight)'
bwrong: '&c[player] &7could be using &6Fast Interact &7VL &c[violations] &7(Broke a different block than clicked)'
captcha: '&c[player] &7could be using &6Spam Bots &7VL &c[violations]'
chatnormal: '&c[player] &7could be using &6Spam Bots &7VL &c[violations]'
color: '&c[player] &7could be using &6[check] &7VL &c[violations]'
commands: '&c[player] &7could be &6Spamming &7VL &c[violations]'
combspeed: '&c[player] &7could be using &6[check] &7VL &c[violations]'
critical: '&c[player] &7could be using &6Criticals &7VL &c[violations] &7(Combat Hacks)'
drop: '&c[player] &7could be using &6Fast Drop &7VL &c[violations]'
dropkick: ccmd [player] unless -time_online-<30|-uptime-<80 do /0/ kick [player] &cNCP &7» &cYou dropped too many items!
fastbreak: '&c[player] &7could be using &6Fast Break &7VL &c[violations]'
fastclick: '&c[player] &7could be using &6Fast Click &7VL &c[violations]'
fastconsume: '&c[player] &7could be using &6Fast Eat &7VL &c[violations]'
fastheal: '&c[player] &7could be using &6Regen &7VL &c[violations]'
fastplace: '&c[player] &7could be using &6Fast Place &7VL &c[violations]'
fdirection: '&c[player] &7could be using &6AimBot &7VL &c[violations] &7(Combat Hacks)'
flyshort: ccmd [player] unless -time_online-<30|-uptime-<80 do ncp log stream notify &c[player] &7could be &6Speeding &7VL &c[violations]
flylong: '&c[player] &7could be &6Flying &7VL &c[violations]'
flyfile: '[player] failed [check]: tried to move: [locationfrom] -> [locationto], d=[distance] ([tags]). &7VL [violations].'
freach: '&c[player] &7could be using &6Reach &7VL &c[violations]&7 (Combat Hacks)'
fselfhit: '&c[player] &7could be using &6Self Hit &7VL &c[violations]&7 (Combat Hacks)'
fspeed: '&c[player] &7could be using a &6Macro &7VL &c[violations]&7 (13+ CPS)'
gutenberg: '&c[player] &7could be using &6[check] &7VL &c[violations]'
godmode: '&c[player] &7could be using &6God Mode &7VL &c[violations]'
improbable: '&c[player] &7could be using &6KillAura &7VL &c[violations] &7(Suspicious Activity)'
instantbow: '&c[player] &7could be using &6Instant Bow &7VL &c[violations]'
instanteat: '&c[player] &7could be using &6Instant Eat &7VL &c[violations]'
keepalive: '&c[player] &7could be using &6[check] &7VL &c[violations]'
kick: kick [player]
kickalive: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<40 do /0/ kick [player] &cNCP &7» &cAbnormal Packets! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickattackfrequency: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickbedleave: ccmd [player] unless -time_online-<30 do /0/ kick [player] &cNCP &7» &cAbnormal Packets! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickbspeed: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickcaptcha: kick [player] &cNCP &7» &cPlease enter the captcha
kickchat1: ncp tempkick [player] 1 &cNCP &7» You're not allowed to spam!
kickchat5: ncp tempkick [player] 5 &cNCP &7» You're not allowed to spam!
kickchatfast: kick [player] &cNCP &7» &cYou're not allowed to spam!
kickchatnormal: kick [player] &cNCP &7» &cYou sent too many messages!
kickcommands: ncp tempkick [player] 1 &cNCP &7» You sent too many commands!
kickfly: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickfrequency: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickgod: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickinvaliddata: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &cAbnormal Packets! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickpacketfrequency: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &cAbnormal Packets! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickpackets: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30|-uptime-<80 do /0/ kick [player] &cNCP &7» &cAbnormal Packets! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickselfhit: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickwb: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
knockback: '&c[player] &7could be using &6[check] &7VL &c[violations]&7'
morepackets: '&c[player] &7could be using &6Timer &7VL &c[violations]&7 (Too many packets)'
msgtempdenylogin: You are temporarily denied to join this server.
munchhausen: '&c[player] &7could be using &6[check] &7VL &c[violations]&7'
nofall: '&c[player] &7could be using &6[check] &7VL &c[violations]'
chatfast: c[player] &7could be using &6[check] &7VL &c[violations]&7.
noswing: '&c[player] &7could be using &6[check] &7VL &c[violations]'
passable: '&c[player] &7could be using &6Phase &7VL &c[violations]'
relog: '&c[player] &7relogged too fast &7VL &c[violations]&7.'
tellchatnormal: ncp tell [player] Slow down in chat!
tempkick1: ncp tempkick [player] Please wait 1 minute before logging in
tempkick5: ncp tempkick [player] Please wait 5 minutes before logging in
vehicleenvelope: '&c[player] &7could be using &6[check] &7VL &c[violations]'
cheatwarn: tellraw [player] ["",{"text":"\n§2████████\n§2█§8██§2██§8██§2█\n§2█§8██§2██§8██§2█\n§2███§8██§2███ §fCheating has been detected. Please disable\n§2██§8████§2██ §fand continue to play. If you continue, you\n§2██§8████§2██ §fwill be punished.\n§2██§8█§2██§8█§2██\n§2████████\n","color":"gray","hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"If you are not hacking, you will not be punished.","color":"red"}]}}}]
cccheatkick: ccmd [player] unless -ping->90|-tps-<19.5|-time_online-<30|-uptime-<80 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 90 - TPS > 19.5)
ccheatkick: ccmd [player] unless -time_online-<30|-uptime-<80 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
cheatkick: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30|-uptime-<80 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - High VL, TPS & Ping not checked)
cccheatban: ccmd [player] unless -ping->90|-tps-<19.5|-time_online-<30|-uptime-<80 do /0/ ban [player] &cNCP &7» &rUnfair Advantages /5/ ncp log stream notify?c+console?nc &c&lAUTOBAN:&r &7The player &c[player] &7has been banned due to &6[check] &7(&7VL &c[violations]&7 - Ping < 90 - TPS > 19.5) /40/ tellraw @a ["",{"text":"§8(§cWarning§8) §rA player has been removed from the server for cheating or abuse. Players caught cheating or abusing will be banned. Never turn your back."}]
ccheatban: ccmd [player] unless -time_online-<30|-uptime-<80 do /0/ ban [player] &cNCP &7» &rUnfair Advantages /5/ ncp log stream notify?c+console?nc &c&lAUTOBAN:&r &7The player &c[player] &7may have been banned due to &6[check] &7(&7VL &c[violations]&7 - High VL, TPS & Ping not checked) /40/ tellraw @a ["",{"text":"§8(§cWarning§8) §rA player has been removed from the server for cheating or abuse. Players caught cheating or abusing will be banned. Never turn your back."}]
cheatban: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30|-uptime-<80 do /0/ ban [player] &cNCP &7» &rUnfair Advantages /5/ ncp log stream notify?c+console?nc &c&lAUTOBAN:&r &7The player &c[player] &7has been banned due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2) /40/ tellraw @a ["",{"text":"§8(§cWarning§8) §rA player has been removed from the server for cheating or abuse. Players caught cheating or abusing will be banned. Never turn your back."}]
highvlerror: '&7The player &c[player] &7caused the check &6[check] &7to go up very high to &c[violations]&7. Please investigate this issue.'
compatibility:
managelisteners: false
exemptions:
wildcard:
default:
metadata:
active: true
keys:
- nocheat.exempt
npc:
active: true
bukkitnpc: true
metadata:
active: true
keys:
- NPC
- NCPConfigTracking
remove:
join: true
leave: true
server:
cbdedicated:
enable: true
cbreflect:
enable: true
blocks:
allowinstantbreak:
- LONG_GRASS
overrideflags:
snow: default
piston_moving_piece: default+ign_passable+ground_height
WATER_LILY: default+ign_passable+ground_height+height8_1
'60': default+ign_passable+ground_height+height8_1
'208': solid+ground+height100+ground_height
STEP: solid+ground+xz100+height100+ground_height+ign_passable
changetracker:
active: true
pistons: true
maxageticks: 80
perworld:
maxentries: 1000
-672
View File
@@ -1,672 +0,0 @@
# Custom NoCheatPlus Config
# Version 3.2
# Type: Auto-Kick
# Config Developed by Captain_Obvious
# Config support can be found here: https://goo.gl/Du4BpY
# Reminder: You must be using the latest build of NoCheatPlus in order to run the config. Link: https://ci.md-5.net/job/NoCheatPlus/
savebackconfig: true
configversion:
notify: false
notifymaxpaths: 5
created: 1104
saved: 1104
logging:
active: true
maxqueuesize: 5000
extended:
status: false
commands:
actions: false
allviolations:
debug: true
debugonly: false
backend:
trace: false
notify: false
backend:
console:
active: true
asynchronous: true
file:
active: false
prefix: ''
filename: nocheatplus.log
ingamechat:
active: true
prefix: '&c&lNCP &7»&r ' # This is the NCP prefix used for all notify messages
subscriptions: false
data:
expiration:
active: true
duration: 75
history: false
consistencychecks:
active: true
interval: 10
maxtime: 2
suppresswarnings: false
protection:
plugins:
hide:
active: true
nopermission:
message: '&c&lNCP &7» &rYou do not have permission to run this command.'
commands: # These commands below will be blocked if the player is not opped and will display the message above
- '?'
- plugins
- version
- icanhasbukkit
- bukkit:help
- bukkit:?
- about
unknowncommand:
message: '&c&lNCP &7» &rThe server currently runs a custom &cNoCheatPlus Config &rVersion &c3.2'
commands: # This outputs the message above when users attempt to run the command(s) below
- ncp
commands:
consoleonly:
active: true
message: '&c&lNCP &7» &rThis command could cause problems. Please execute in console if you wish to continue.'
commands: # Blocks all users from using these commands and will display the message above
- restart
- stop
- rl
- reload
clients:
motd:
active: true
allowall: false
checks:
blockbreak:
direction: # This will check if they are looking at the block when breaking
active: true
actions: cancel vl>10 log:bdirection:0:8:i cancel
fastbreak: # This checks to see if a player broke a block too fast
active: true
strict: true
delay: 95
intervalsurvival: 100
grace: 2000
actions: cancel vl>2 log:fastbreak:1:10:i cancel vl>65 cmd:cccheatkick:0:2 cancel vl>75 cmd:cheatkick:0:2 cancel vl>85 cmd:ccheatkick:0:2 cancel vl>1000 cancel log:highvlerror:0:5:ic
frequency: # This checks how many a player broke in a certain amount of time
active: true
intervalcreative: 95
intervalsurvival: 49
shortterm: # 20 ticks is one second, so in 1/4 of a second a player is maxed to 6 blocks
ticks: 5
limit: 6
actions: cancel vl>12 log:bbfrequency:1:7:i cancel vl>18 cmd:cccheatkick:0:2 cancel vl>24 cancel cmd:kickfrequency:0:2 vl>31 cmd:ccheatkick:0:2 cancel
noswing: # This check was disabled, caused too many problems with blocks coming back
active: false
actions: vl>20 log:noswing:0:12:i
reach: # This checks to see if a player broke a block that they could reach
active: true
actions: cancel vl>5 log:breach:0:10:i cancel
wrongblock: # This checks if a player broke the block they first interacted with/clicked
active: true
level: 10
actions: cancel vl>10 log:bwrong:0:8:i cancel vl>16 cmd:cccheatkick:0:2 cancel vl>25 cancel cmd:cheatkick:0:2 vl>35 cmd:ccheatkick:0:2 cancel
blockinteract:
direction: # This checks if a player was looking at a block they interacted with/clicked
active: true
actions: vl>6 cancel vl>24 log:bdirection:0:7:i cancel
reach: # This checks if a player could interact/click the block in reach
active: true
actions: cancel vl>5 log:breach:0:8:i cancel
speed: # This checks if a player is interacting with too many blocks
active: true
interval: 2000
limit: 52
actions: cancel vl>200 log:bspeed:0:8:i cancel vl>2000 cmd:cccheatkick:0:2 cancel vl>3250 cmd:cheatkick:0:2 cancel vl>4000 cmd:ccheatkick:0:2 cancel
visible: # This checks if a block was in sight before the player interacted with it
active: true
actions: vl>4 cancel vl>50 log:bvisible:0:10:i cancel
blockplace:
against: # This checks to see if a player places a block on a surface they couldn't, such as water
active: true
actions: cancel
autosign: # Checks if a player is placing a sign too quickly
active: true
skipempty: false
actions: cancel vl>5 log:bautosign:0:6:i cancel vl>8 cmd:cccheatkick:0:2 cancel vl>10 cmd:cheatkick:0:2 cancel vl>12 cmd:ccheatkick:0:2 cancel
direction: # This checks if a player was looking at where they placed the block
active: true
actions: cancel vl>10 log:bdirection:0:8:i cancel
fastplace: # This checks to see if a player places too many blocks. The limit stands for 2 seconds, so 14 blocks in two seconds is allowed. The shortterm works the same as the frequency check
active: true
limit: 14
shortterm:
ticks: 12
limit: 5
actions: cancel vl>15 log:fastplace:1:8:i cancel vl>155 cmd:cccheatkick:0:2 cancel vl>200 cmd:cheatkick:0:2 cancel vl>250 cmd:ccheatkick:0:2 cancel
reach: # This checks to see if a player placed a block that they could reach
active: true
actions: cancel vl>5 log:breach:0:7:i cancel
noswing: # Check disabled, caused too many issues when placing blocks
active: false
exceptions:
- WATER_LILY
- FLINT_AND_STEEL
actions: cancel vl>10 log:noswing:0:7:i cancel
speed: # This checks the amount of throwable obejects thrown. The interval is the time allowed between each throw (In MS)
active: true
interval: 70
actions: cancel vl>150 log:bpspeed:3:5:i cancel vl>400 cmd:cccheatkick:0:2 cancel vl>500 cmd:cheatkick:0:2 cancel vl>600 cmd:ccheatkick:0:2 cancel
preventmisc:
boatsanywhere: true
chat:
captcha:
active: true
skip:
commands: false
characters: abcdefghjkmnpqrtuvwxyzABCDEFGHJKMNPQRTUVWXYZ2346789
length: 4
question: '&c&lNCP &7» &cPlease type ''&6[captcha]&c'' to continue sending messages/commands.'
success: '&c&lNCP &7» &aYou can keep on chatting now'
tries: 3
actions: cancel cmd:kickcaptcha vl>4 log:captcha:2:5:cf cancel cmd:kickcaptcha:0:2:i
color:
active: false
actions: log:color:0:6:i cancel
commands:
active: true
exclusions: []
handleaschat:
- /me
- /msg
- /emsg
- /r
- /reply
- /pm
- /epm
- /whisper
- /tell
- /etell
level: 8
shortterm:
ticks: 19
level: 3
actions: log:commands:0:5:cf cancel cmd:kickcommands:0:2 vl>20 log:commands:0:5:cf cancel cmd:tempkick1:0:2:i
text: # Advanced chat checks, adjusting may cause problems
active: true
allowvlreset: true
frequency:
normal:
minimum: 0.0
factor: 0.9
weight: 6
level: 135
actions: cancel cmd:tellchatnormal vl>7 log:chatnormal:0:5:c cancel cmd:tellchatnormal:0:2 vl>20 log:chatnormal:0:5:cf cancel cmd:kickchatnormal:0:2 vl>40 log:chatnormal:0:5:cf cancel cmd:kickchat5:0:2
shortterm:
minimum: 2.0
factor: 0.7
weight: 3.0
level: 18.0
actions: log:chatfast:0:5:cf cancel cmd:kickchatfast:0:6 vl>20 log:chatfast:0:5:cf cancel cmd:kickchat1:0:2 vl>40 log:chatfast:0:5:cf cancel cmd:kickchat5:0:2
message:
lettercount: 1.0
partition: 1.0
uppercase: 1.2
afterjoin: 1.5
nomoving: 1.5
repeatviolation: 1.2
repeatglobal: 1.0
repeatself: 1.5
words:
lengthav: 1.0
lengthmsg: 1.0
noletter: 0.0
global:
active: true
weight: 1.0
words:
active: false
prefixes:
active: false
similarity:
active: false
player:
active: true
words:
active: false
prefixes:
active: false
similarity:
active: false
warning:
active: true
level: 70
message: '&c&lNCP &7» &cSlow down in chat!'
timeout: 10
relog: # This checks the amount of time between a quit and a join
active: true
timeout: 3250
warning:
message: '&c&lNCP &7» &cYou relogged too fast!'
number: 1
timeout: 60000
kickmessage: Too fast re-login, try with a little delay.
actions: log:relog:0:15:cf cancel vl>15 log:relog:0:10:cf cancel cmd:tempkick5:0:2
logins: # A simple Anti-Bot defense. Allows 7 players to join in 10 seconds. Adjust to your server size
active: true
startupdelay: 600
perworldcount: false
seconds: 10
limit: 7
kickmessage: Too many players are logging in at a time! Try again later.
combined:
bedleave: # Prevents players from using BedLeave packets to fly or use god mode
active: true
actions: cancel log:bedleave:0:7:i cmd:kickbedleave:0:2 vl>2 cmd:ccheatkick:0:2 cancel
enderpearl: # Prevents players from glitching through areas using enderpearls
active: true
preventclickblock: true
improbable: # Advanced all around server checks. Can be used most commonly to detect KillAura. Works best in groups.
active: true
level: 198
actions: cancel vl>4 log:improbable:0:6:i cancel vl>425 cmd:cccheatkick:0:2 cancel vl>550 cmd:cheatkick:0:2 cancel vl>640 cmd:ccheatkick:0:2 cancel vl>12000 log:highvlerror:0:5:ci cancel
invulnerable: # These values alter the invulnerablity on login
active: true
triggers:
always: false
falldistance: true
initialticks:
join: -1
ignore:
- FALL
modifiers:
all: 0
munchhausen: # Future proof: Prevents players from abusing knockback from fishing rods to fly
active: false
actions: cancel vl>100 cancel log:munchhausen:0:60:i
yawrate: # This checks if a player turns (rate) amount degrees
rate: 105
penalty:
factor: 1.0
minimum: 250
maximum: 2000
improbable: true
fight:
canceldead: true
toolchangepenalty: 150
pvp:
knockbackvelocity: default
yawrate:
active: true
angle: # This checks if a player is hitting 2 or more entities at a time.
active: true
threshold: 55
actions: cancel vl>160 log:angle:0:6:i cancel vl>260 cmd:cccheatkick:0:2 cancel vl>300 cmd:cheatkick:0:4 cancel vl>330 cmd:ccheatkick:0:2 cancel
critical: # This prevents players from faking critical hits
active: true
cancel: # FallDistance checks if a player hit another player under that distance
cancel: 125
dividedamage: 0.08
falldistance: 0.075
actions: vl>2 cancel vl>17 log:critical:0:6:i cancel vl>20 cmd:cccheatkick:0:2 cancel vl>28 cmd:cheatkick:0:2 cancel vl>35 cmd:ccheatkick:0:2 cancel
direction: # Checks to make sure a player is looking at the entity before hitting. Some false positives
active: true
strict: true
penalty: 160
actions: vl>1 cancel vl>6 log:fdirection:0:6:i cancel vl>24 cmd:cccheatkick:0:2 cancel vl>31 cmd:cheatkick:0:2 cancel vl>39 cmd:ccheatkick:0:2 cancel
fastheal: # Prevents players from healing too fast
active: true
interval: 4000
buffer: 1000
actions: cancel vl>10 cancel log:fastheal:0:10:i vl>30 cancel log:fastheal:0:10:i
godmode: # Prevents players from canceling any damage dealt to them
active: true
minage: 1100
maxage: 5000
actions: log:godmode:1:8:i cancel vl>60 log:godmode:1:8:i cancel
noswing: # Prevents players from using the NoSwing cheat, some false positives
active: true
actions: vl>1 cancel vl>7 log:noswing:0:8:i cancel
reach: # Prevents players from hitting an entity out of reach. Lower survival distance for a stricter check, raise for a more leinent check.
active: true
survivaldistance: 4.2
penalty: 250
reduce: true
reducedistance: 0.9
reducestep: 0.15
actions: vl>1 cancel vl>4 log:freach:0:6:i cancel vl>15 cmd:cccheatkick:0:2 cancel vl>22 cmd:cheatkick:0:2 cancel vl>30 cmd:ccheatkick:0:2 cancel
selfhit: # Prevents players from hitting themselves
active: true
actions: log:fselfhit:1:8:i cancel vl>10 cancel cmd:cheatkick:0:2 vl>18 cmd:ccheatkick:0:5 cancel
speed: # Prevents players from hitting too fast
active: true
limit: 13
actions: cancel vl>5 log:fspeed:0:6:i cancel vl>25 cmd:cccheatkick:0:2 cancel vl>30 cmd:cheatkick:0:2 cancel vl>45 cmd:ccheatkick:0:2 cancel
shortterm:
ticks: 8
limit: 6
inventory:
drop: # Prevents players from dropping too many things in a time frame
active: true
limit: 4
timeframe: 15
actions: log:drop:0:6:i cancel vl>6 cancel cmd:cheatkick:0:2
fastclick: # Prevents players from clicking too fast in their inventory
active: true
sparecreative: true
tweaks1_5: true
limit:
shortterm: 3
normal: 9
actions: vl>3 cancel vl>80 log:fastclick:1:7:i cancel
instantbow: # Prevents players from ignoring the bow dragback
active: true
strict: true
delay: 129
improbable:
feedonly: false
weight: 0.6
actions: cancel vl>15 log:instantbow:2:6:i cancel
instanteat: # Prevents players from eating food instantly
active: true
actions: log:instanteat:2:5:i cancel
fastconsume: # Prevents players from eating food too fast
active: true
duration: 0.67
whitelist: false
items: []
actions: log:fastconsume:2:8:i cancel
gutenberg: # Old Minecraft exploit allowed crashing of the server by creating a book with tons of pages.
active: true
actions: cancel log:gutenberg:0:10:i cmd:kickinvaliddata:0:2
items:
active: true
open:
active: true
close: true
cancelother: true
hotfix:
duplication:
fallingblockendportal: true
moving:
creativefly: # Prevents players from moving too fast than allowed
active: true
ignoreallowflight: true
ignorecreative: true
model:
creative:
horizontal:
speed: 114
vertical:
ascend:
speed: 97
maxheight: 128
spectator:
horizontal:
speed: 450
vertical:
ascend:
speed: 170
maxheight: 128
gravity: false
ground: false
levitation:
horizontal:
speed: 50
vertical:
ascend:
speed: 10
maxheight: 128
gravity: false
modifiers: false
gravity: false
ground: false
elytra:
horizontal:
speed: 345
modsprint: 1.0
vertical:
ascend:
speed: 0
maxheight: 128
modifiers: false
actions: vl>6 cancel vl>180 cmdc:flyshort:0:6 cancel vl>3000 log:flylong:0:4:i cancel vl>4250 cmd:cccheatkick:0:2 cancel vl>5000 cmd:cheatkick:0:5 cancel vl>6500 cmd:ccheatkick:0:2 cancel
morepackets: # Checks if a player is spamming packets or sending too many packets
active: true
seconds: 6
epsideal: 20
epsmax: 22
burst:
packets: 20
directviolation: 30
epmviolation: 60
setbackage: 40
actions: cancel vl>30 log:morepackets:2:7:i cancel vl>80 cmd:cccheatkick:0:2 cancel vl>100 cmd:kickpackets:0:2 cancel vl>160 cmd:ccheatkick:0:2 cancel
nofall: # Prevents players from ignoring fall damage
active: true
dealdamage: true
skipallowflight: true
resetonviolation: false
resetonteleport: false
resetonvehicle: true
anticriticals: true
actions: log:nofall:0:7:i cancel vl>4 cancel cmd:cccheatkick:0:2 vl>8 cmd:cheatkick:0:2 cancel vl>12 cmd:ccheatkick:0:5 cancel
passable: # Prevents players from glitching through blocks
active: true
actions: vl>2 cancel vl>30 log:passable:1:7:i cancel vl>170 cmd:cccheatkick:0:2 cancel vl>190 log:passable:0:7:i cancel cmd:cheatkick:0:2 vl>200 cmd:ccheatkick:0:2 cancel
untracked:
teleport:
active: true
command:
active: true
tryteleport: true
prefixes:
- sethome
- home set
- setwarp
- warp set
- setback
- set back
- back set
- spawn
- hub
- tpaccept
- tphere
- tpaccept
- home
- wild
- randomtp
- wildtp
survivalfly: # Prevents players from moving too fast/attempting to fly
active: true
extended:
vertical-accounting: true
stepheight: default
hbufmax: 1.0
setbackpolicy:
falldamage: true
voidtovoid: true
actions: vl>45 cancel vl>175 cmdc:flyshort:1:7 cancel vl>1750 log:flylong:0:6:i cancel vl>5500 cmd:cccheatkick:0:2 cancel vl>7000 cmd:cheatkick:0:5 cancel vl>8000 cmd:ccheatkick:0:2 cancel vl>25000 cancel log:highvlerror:0:2:ic
hover:
active: true
step: 5
ticks: 85
loginticks: 100
falldamage: true
sfviolation: 350
velocity:
activationcounter: 80
activationticks: 140
strictinvalidation: true
splitmoves: default
ignorestance: default
tempkickillegal: true
loadchunks:
join: true
move: true
teleport: true
worldchange: true
sprintinggrace: 2.0
assumesprint: true
speedgrace: 4.0
enforcelocation: default
setback:
method: default
vehicle:
preventdestroyown: true
enforcelocation: default
schedulesetbacks: default
morepackets:
active: true
actions: cancel vl>10 log:morepackets:0:8:i cancel
envelope:
active: default
actions: cancel vl>100 cancel log:vehicleenvelope:0:15:i
message:
illegalplayermove: Illegal move.
illegalvehiclemove: Illegal vehicle move.
net: # Relies on ProtocolLib to work
attackfrequency: # Checks if a player is sending too many attack packets
active: true
limitforseconds:
half: 9
one: 14
two: 39
four: 55
eight: 100
actions: cancel vl>15 cancel log:attackfrequency:0:7:i vl>40 cmd:cccheatkick:0:2 cancel vl>55 cancel cmd:cheatkick:0:2 vl>70 cmd:ccheatkick:0:2 cancel
flyingfrequency: # Checks if a player is spamming packets
active: true
seconds: 5
packetspersecond: 60
actions: cancel
reduceredundant:
active: true
seconds: 3
actions: cancel vl>2500 cmd:kickinvaliddata:0:2 cancel
keepalivefrequency: # Checks if a player is using spamming packets to use regen or godmode, some false positives on join
active: true
actions: cancel vl>10 cancel log:keepalive:0:10:i vl>100 cancel cmd:kickalive:0:2
packetfrequency: # Checks if a player is spamming packets
active: default
limitpersecond: 200
seconds: 4
actions: cancel cmd:kickpacketfrequency:0:2 vl>4 cmd:ccheatkick:0:5 cancel
sounddistance: # Prevents players from abusing an exploit to use render hacks to see far away players during storms
active: true
maxdistance: 150
superseded:
flying:
cancelwaiting: true
strings: # Anything used in the actions of any checks can be defined here
angle: '&c[player] &7could be using &6KillAura &7VL &c[violations] &7(Combat Hacks)'
attackfrequency: '&c[player] &7could be using &6MultiAura &7VL &c[violations] &7(Combat Hacks)'
ban: ban [player]
ban-ip: ban-ip [ip]
bautosign: '&c[player] &7could be using &6Auto Sign &7VL &c[violations]'
bbfrequency: '&c[player] &7could be using &6Nuker &7VL &c[violations]'
bdirection: '&c[player] &7failed &6Impossible Interact &7VL &c[violations]'
bedleave: '&c[player] &7failed &6Bed Leave &7VL &c[violations]'
bpspeed: '&c[player] &7could be using &6Fast Throw &7VL &c[violations]'
breach: '&c[player] &7could be using &6Block Reach &7VL &c[violations]'
bspeed: '&c[player] &7could be using &6Fast Interact &7VL &c[violations]'
bvisible: '&c[player] &7could be using &6Block Cheats &7VL &c[violations] &7(Block out of reach)'
bwrong: '&c[player] &7could be using &6Block Cheats &7VL &c[violations] &(Broke a different block than clicked)'
captcha: '&c[player] &7could be using &6Spam Bots &7VL &c[violations]'
chatnormal: '&c[player] &7could be using &6[check] &7VL &c[violations]'
color: '&c[player] &7could be using &6[check] &7VL &c[violations]'
commands: '&c[player] &7could be using &6[check] &7VL &c[violations]'
combspeed: '&c[player] &7could be using &6[check] &7VL &c[violations]'
critical: '&c[player] &7could be using &6Criticals &7VL &c[violations] &7(Combat Hacks)'
drop: '&c[player] &7could be using &6Fast Drop &7VL &c[violations]'
dropkick: ccmd [player] unless -time_online-<30 do /0/ kick [player] &cNCP &7» &cYou dropped too many items!
fastbreak: '&c[player] &7could be using &6Fast Break &7VL &c[violations]'
fastclick: '&c[player] &7could be using &6Fast Click &7VL &c[violations]'
fastconsume: '&c[player] &7could be using &6Fast Eat &7VL &c[violations]'
fastheal: '&c[player] &7could be using &6Regen &7VL &c[violations]'
fastplace: '&c[player] &7could be using &6Fast Place &7VL &c[violations]'
fdirection: '&c[player] &7could be using &6AimBot &7VL &c[violations] &7(Combat Hacks)'
flyshort: ccmd [player] unless -time_online-<30|-uptime-<80 do ncp log stream notify &c[player] &7could be &6Speeding &7VL &c[violations]
flylong: '&c[player] &7could be &6Flying &7VL &c[violations]'
flyfile: '[player] failed [check]: tried to move: [locationfrom] -> [locationto], d=[distance] ([tags]). &7VL [violations].'
freach: '&c[player] &7could be using &6Reach &7VL &c[violations]&7 (Combat Hacks)'
fselfhit: '&c[player] &7could be using &6Self Hit &7VL &c[violations]&7 (Combat Hacks)'
fspeed: '&c[player] &7could be using a &6Macro &7VL &c[violations]&7 (13+ CPS)'
gutenberg: '&c[player] &7could be using &6[check] &7VL &c[violations]'
godmode: '&c[player] &7could be using &6God Mode &7VL &c[violations]'
improbable: '&c[player] &7could be using &6KillAura&7 &7VL &c[violations] &7(Suspicious Activity)'
instantbow: '&c[player] &7could be using &6Instant Bow &7VL &c[violations]'
instanteat: '&c[player] &7could be using &6Instant Eat &7VL &c[violations]'
keepalive: '&c[player] &7could be using &6[check] &7VL &c[violations]'
kick: kick [player]
kickalive: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &cSent too many packets! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickattackfrequency: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickbedleave: kick [player] &cNCP &7» &cAbnormal Packets! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping & TPS Not checked)
kickbspeed: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickcaptcha: kick [player] &cNCP &7» &cPlease enter the captcha
kickchat1: ncp tempkick [player] 1 &cNCP &7» You're not allowed to spam!
kickchat5: ncp tempkick [player] 5 &cNCP &7» You're not allowed to spam!
kickchatfast: kick [player] &cNCP &7» &cYou're not allowed to spam!
kickchatnormal: kick [player] &cNCP &7» &cYou sent too many messages!
kickcommands: ncp tempkick [player] 1 &cNCP &7» You sent too many commands!
kickfly: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30-time_online-<5 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickfrequency: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickgod: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickinvaliddata: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &cAbnormal Packets! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickpacketfrequency: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &cAbnormal Packets! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickpackets: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &cAbnormal Packets! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickselfhit: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
kickwb: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
knockback: '&c[player] &7could be using &6[check] &7VL &c[violations]&7.'
morepackets: '&c[player] &7could be using &6Timer &7VL &c[violations]&7 (Too many packets)'
msgtempdenylogin: You are temporarily denied to join this server.
munchhausen: '&c[player] &7could be using &6[check] &7VL &c[violations]&7.'
nofall: '&c[player] &7could be using &6[check] &7VL &c[violations]'
chatfast: c[player] &7could be using &6[check] &7VL &c[violations]&7.
noswing: '&c[player] &7could be using &6[check] &7VL &c[violations]'
passable: '&c[player] &7could be using &6Phase &7VL &c[violations]'
relog: '&c[player] &7relogged too fast &7VL &c[violations]&7.'
tellchatnormal: ncp tell [player] Slow down in chat!
tempkick1: ncp tempkick [player] Please wait 1 minute before logging in
tempkick5: ncp tempkick [player] Please wait 5 minutes before logging in
vehicleenvelope: '&c[player] &7could be using &6[check] &7VL &c[violations]'
cheatkick: ccmd [player] unless -ping->151|-tps-<19.2|-time_online-<30|-uptime-<80 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 151 - TPS > 19.2)
ccheatkick: ccmd [player] unless -time_online-<30|-uptime-<80 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - High VL - Skipped Ping & TPS Check)
cccheatkick: ccmd [player] unless -ping->90|-tps-<19.5|-time_online-<30|-uptime-<80 do /0/ kick [player] &cNCP &7» &rSuspicious Server Activity! /5/ ncp log stream notify?c+console?nc &c&lAUTOKICK:&r &7The player &c[player] &7has been kicked due to &6[check] &7(&7VL &c[violations]&7 - Ping < 90 - TPS > 19.5)
highvlerror: '&7The player &c[player] &7caused the check &c[check] &7to go up very high to &6[violations]&7. Please investigate this issue.'
compatibility:
managelisteners: false
exemptions:
wildcard:
default:
metadata:
active: true
keys:
- nocheat.exempt
npc:
active: true
bukkitnpc: true
metadata:
active: true
keys:
- NPC
- NCPConfigTracking
remove:
join: true
leave: true
server:
cbdedicated:
enable: true
cbreflect:
enable: true
blocks: # Allows you to change the block check size to prevent glitching/false positives
allowinstantbreak:
- LONG_GRASS
overrideflags:
snow: default
piston_moving_piece: default+ign_passable+ground_height
WATER_LILY: default+ign_passable+ground_height+height8_1
'60': default+ign_passable+ground_height+height8_1
'208': solid+ground+height100+ground_height
STEP: solid+ground+xz100+height100+ground_height+ign_passable
changetracker:
active: true
pistons: true
maxageticks: 80
perworld:
maxentries: 1000
-680
View File
@@ -1,680 +0,0 @@
# Custom NoCheatPlus Config
# Version 3.2
# Type: Notify Only
# Config Developed by Captain_Obvious
# Config support can be found here: https://goo.gl/Du4BpY
# Reminder: You must be using the latest build of NoCheatPlus in order to run the config. Link: https://ci.md-5.net/job/NoCheatPlus/
savebackconfig: true
configversion:
notify: false
notifymaxpaths: 5
created: 1104
saved: 1104
logging:
active: true
maxqueuesize: 5000
extended:
status: false
commands:
actions: false
allviolations:
debug: true
debugonly: false
backend:
trace: false
notify: false
backend:
console:
active: true
asynchronous: true
file:
active: false
prefix: ''
filename: nocheatplus.log
ingamechat:
active: true
prefix: '&c&lNCP &7»&r '
subscriptions: false
data:
expiration:
active: true
duration: 75
history: false
consistencychecks:
active: true
interval: 10
maxtime: 2
suppresswarnings: false
protection:
plugins:
hide:
active: true
nopermission:
message: '&c&lNCP &7» &rYou do not have permission to run this command.'
commands:
- '?'
- plugins
- version
- icanhasbukkit
- bukkit:help
- bukkit:?
- about
unknowncommand:
message: '&c&lNCP &7» &rThe server currently runs a custom &cNoCheatPlus Config &rVersion &c3.2'
commands:
- ncp
commands:
consoleonly:
active: true
message: '&c&lNCP &7» &rThis command could cause problems. Please execute in console if you wish to continue.'
commands:
- restart
- stop
- rl
- reload
clients:
motd:
active: true
allowall: false
checks:
blockbreak:
direction:
active: true
actions: cancel vl>10 log:notifylvlbb:0:8:i cancel vl>20 log:notifylvlcb:0:8:i cancel
fastbreak:
active: true
strict: true
delay: 95
intervalsurvival: 100
grace: 2000
actions: cancel vl>1 log:notifylvlab:1:9:i cancel vl>3 log:notifylvlbb:1:8:i cancel vl>8 log:notifylvlcb:1:7:i cancel
frequency:
active: true
intervalcreative: 95
intervalsurvival: 49
shortterm:
ticks: 5
limit: 6
actions: cancel vl>2 log:notifylvlab:1:8:i cancel vl>4 log:notifylvlbb:1:7:i cancel vl>8 log:notifylvlcb:1:6:i cancel
noswing:
active: false
actions: vl>20 log:notifylvla:0:12:i
reach:
active: true
actions: cancel vl>5 log:notifylvlab:0:10:i cancel vl>8 log:notifylvlbb:0:8:i cancel vl>12 log:notifylvlcb:0:7:i cancel
wrongblock:
active: true
level: 10
actions: cancel vl>8 log:notifylvlab:0:8:i cancel vl>12 log:notifylvlbb:0:7:i cancel vl>18 log:notifylvlcb:0:6:i cancel
blockinteract:
direction:
active: true
actions: vl>5 cancel vl>24 log:notifylvlb:0:6:i cancel
reach:
active: true
actions: cancel vl>5 log:notifylvlab:0:8:i cancel vl>8 log:notifylvlbb:0:7:i cancel vl>15 log:notifylvlcb:0:6:i cancel
speed:
active: true
interval: 2000
limit: 52
actions: cancel vl>110 log:notifylvlab:0:8:i cancel vl>140 log:notifylvlbb:0:7:i cancel vl>195 log:notifylvlcb:0:6:i cancel
visible:
active: true
actions: vl>4 cancel vl>35 log:notifylvlbb:0:9:i cancel
blockplace:
against:
active: true
actions: cancel
autosign:
active: true
skipempty: false
actions: cancel vl>2 log:notifylvlab:0:8:i cancel vl>4 log:notifylvlbb:0:7:i cancel vl>8 log:notifylvlcb:0:6:i cancel
direction:
active: true
actions: cancel vl>7 log:notifylvlab:0:8:i cancel vl>13 log:notifylvlbb:0:7:i cancel vl>20 log:notifylvlcb:0:6:i cancel
fastplace:
active: true
limit: 14
shortterm:
ticks: 12
limit: 5
actions: cancel vl>12 log:notifylvlab:1:8:i cancel vl>35 log:notifylvlbb:0:7:i cancel vl>75 log:notifylvlcb:0:6:i cancel
reach:
active: true
actions: cancel vl>4 log:notifylvlab:0:7:i cancel vl>12 log:notifylvlbb:0:6:i cancel vl>18 log:notifylvlcb:0:6:i cancel
noswing:
active: false
exceptions:
- WATER_LILY
- FLINT_AND_STEEL
actions: cancel vl>10 log:noswing:0:7:i cancel
speed:
active: true
interval: 70
actions: cancel vl>140 log:notifylvlab:3:5:i cancel vl>180 log:notifylvlbb:1:6:i cancel vl>250 log:notifylvlcb:0:6:i cancel
preventmisc:
boatsanywhere: true
chat:
captcha:
active: true
skip:
commands: false
characters: abcdefghjkmnpqrtuvwxyzABCDEFGHJKMNPQRTUVWXYZ2346789
length: 4
question: '&c&lNCP &7»&r &cPlease type ''&6[captcha]&c'' to continue sending messages/commands.'
success: '&c&lNCP &7»&r &aYou can keep chatting now'
tries: 3
actions: cancel cmd:kickcaptcha vl>4 log:captcha:2:5:i cancel cmd:kickcaptcha:0:2
color:
active: false
actions: log:color:0:6:i cancel
commands:
active: true
exclusions:
- server
- warps
- f
handleaschat:
- /me
- /msg
- /emsg
- /r
- /reply
- /pm
- /epm
- /whisper
- /tell
- /etell
level: 8
shortterm:
ticks: 19
level: 3
actions: log:commands:0:5:i cancel cmd:kickcommands:0:2 vl>20 log:commands:0:5:i cancel cmd:tempkick1:0:2:i
text:
active: true
allowvlreset: true
frequency:
normal:
minimum: 0.0
factor: 0.9
weight: 6
level: 135
actions: cancel cmd:tellchatnormal vl>7 log:chatnormal:0:5:i cancel cmd:tellchatnormal:0:2 vl>20 log:chatnormal:0:5:i cancel cmd:kickchatnormal:0:2 vl>40 log:chatnormal:0:5:i cancel cmd:kickchat5:0:2
shortterm:
minimum: 2.0
factor: 0.7
weight: 3.0
level: 18.0
actions: log:chatfast:0:5:i cancel cmd:kickchatfast:0:6 vl>20 log:chatfast:0:5:i cancel cmd:kickchat1:0:2 vl>40 log:chatfast:0:5:i cancel cmd:kickchat5:0:2
message:
lettercount: 1.0
partition: 1.0
uppercase: 1.2
afterjoin: 1.5
nomoving: 1.5
repeatviolation: 1.2
repeatglobal: 1.0
repeatself: 1.5
words:
lengthav: 1.0
lengthmsg: 1.0
noletter: 0.0
global:
active: true
weight: 1.0
words:
active: false
prefixes:
active: false
similarity:
active: false
player:
active: true
words:
active: false
prefixes:
active: false
similarity:
active: false
warning:
active: true
level: 71
message: '&c&lNCP &7»&r &cSlow down in chat!'
timeout: 10
relog:
active: true
timeout: 3250
warning:
message: '&c&lNCP &7»&r &cYou relogged too fast!'
number: 1
timeout: 60000
kickmessage: Too fast re-login, try with a little delay.
actions: log:relog:0:15:i cancel vl>15 log:relog:0:10:i cancel cmd:tempkick5:0:2
logins:
active: true
startupdelay: 600
perworldcount: false
seconds: 10
limit: 7
kickmessage: Too many players are logging in at a time! Try again later.
combined:
bedleave:
active: true
actions: cancel log:bedleave:0:7:i
enderpearl:
active: true
preventclickblock: true
improbable:
active: true
level: 198
actions: cancel vl>2 log:notifylvla:0:6:i cancel vl>12 log:notifylvlb:0:6:i cancel vl>88 log:notifylvlc:0:6:i cancel
invulnerable:
active: true
triggers:
always: false
falldistance: true
initialticks:
join: -1
ignore:
- FALL
modifiers:
all: 0
munchhausen:
active: false
actions: cancel vl>100 cancel log:munchhausen:0:60:i
yawrate:
rate: 105
penalty:
factor: 1.0
minimum: 250
maximum: 2000
improbable: true
fight:
canceldead: true
toolchangepenalty: 150
pvp:
knockbackvelocity: default
yawrate:
active: true
angle:
active: true
threshold: 55
actions: cancel vl>135 log:notifylvlac:0:6:i cancel vl>170 log:notifylvlbc:0:6:i cancel vl>225 log:notifylvlcc:0:6:i cancel
critical:
active: true
cancel:
cancel: 125
dividedamage: 0.08
falldistance: 0.075
actions: vl>2 cancel vl>16 log:notifylvlac:0:6:i cancel vl>22 log:notifylvlbc:0:6:i cancel vl>28 log:notifylvlcc:0:6:i cancel
direction:
active: true
strict: false
penalty: 160
actions: vl>1 cancel vl>6 log:notifylvlac:0:6:i cancel vl>12 log:notifylvlbc:0:6:i cancel vl>18 log:notifylvlcc:0:6:i cancel
fastheal:
active: true
interval: 4000
buffer: 1000
actions: cancel vl>10 cancel log:notifylvlac:0:10:i vl>15 log:notifylvlbc:0:9:i cancel vl>20 log:notifylvlcc:0:8:i cancel
godmode:
active: true
minage: 1100
maxage: 5000
actions: log:notifylvlac:1:8:i cancel vl>10 log:notifylvlbc:0:7:i cancel vl>20 log:notifylvlcc:0:6:i cancel
noswing:
active: true
actions: vl>1 cancel vl>6 log:notifylvlac:0:8:i cancel vl>12 log:notifylvlbc:0:7:i cancel vl>18 log:notifylvlcc:0:6:i cancel
reach:
active: true
survivaldistance: 4.2
penalty: 250
reduce: true
reducedistance: 0.9
reducestep: 0.15
actions: vl>1 cancel vl>3 log:notifylvlac:0:7:i cancel vl>6 log:notifylvlbc:0:6:i cancel vl>10 log:notifylvlcc:0:6:i cancel
selfhit:
active: true
actions: log:fselfhit:1:8:i cancel
speed:
active: true
limit: 13
actions: cancel vl>8 log:notifylvlac:0:6:i cancel vl>12 log:notifylvlbc:0:6:i cancel vl>16 log:notifylvlcc:0:6:i cancel
shortterm:
ticks: 8
limit: 6
inventory:
drop:
active: true
limit: 4
timeframe: 15
actions: log:drop:0:6:i cancel
fastclick:
active: true
sparecreative: true
tweaks1_5: true
limit:
shortterm: 3
normal: 9
actions: vl>3 cancel vl>75 log:notifylvla:3:8:i cancel vl>160 log:notifylvlb:1:7:i cancel vl>220 log:notifylvlc:1:6:i cancel
instantbow:
active: true
strict: true
delay: 129
improbable:
feedonly: false
weight: 0.6
actions: cancel vl>12 log:notifylvla:2:6:i cancel vl>16 log:notifylvlb:0:6:i cancel vl>20 log:notifylvlc:0:6:i cancel
instanteat:
active: true
actions: log:instanteat:2:5:i cancel
fastconsume:
active: true
duration: 0.67
whitelist: false
items: []
actions: log:fastconsume:2:8:i cancel
gutenberg:
active: true
actions: cancel log:gutenberg:0:10:i
items:
active: true
open:
active: true
close: true
cancelother: true
hotfix:
duplication:
fallingblockendportal: true
moving:
creativefly:
active: true
ignoreallowflight: true
ignorecreative: true
model:
creative:
horizontal:
speed: 114
vertical:
ascend:
speed: 97
maxheight: 128
spectator:
horizontal:
speed: 450
vertical:
ascend:
speed: 170
maxheight: 128
gravity: false
ground: false
levitation:
horizontal:
speed: 50
vertical:
ascend:
speed: 10
maxheight: 128
gravity: false
modifiers: false
gravity: false
ground: false
elytra:
horizontal:
speed: 345
modsprint: 1.0
vertical:
ascend:
speed: 0
maxheight: 128
modifiers: false
actions: vl>6 cancel vl>175 log:notifylvla:0:6:i cancel vl>325 log:notifylvlb:0:5:i cancel vl>680 log:notifylvlc:0:4:i cancel
morepackets:
active: true
seconds: 6
epsideal: 20
epsmax: 22
burst:
packets: 20
directviolation: 30
epmviolation: 60
setbackage: 40
actions: vl>1 cancel vl>25 log:notifylvla:2:7:i cancel vl>40 log:notifylvlb:1:6:i cancel vl>70 log:notifylvlc:0:6:i cancel
nofall:
active: true
dealdamage: true
skipallowflight: true
resetonviolation: false
resetonteleport: false
resetonvehicle: true
anticriticals: true
actions: log:nofall:0:5:i cancel
passable:
active: true
actions: vl>3 cancel vl>25 log:notifylvla:1:7:i cancel vl>40 log:notifylvlb:0:6:i cancel vl>110 log:notifylvlc:0:6:i cancel
untracked:
teleport:
active: true
command:
active: true
tryteleport: true
prefixes:
- sethome
- home set
- setwarp
- warp set
- setback
- set back
- back set
- spawn
- hub
- tpaccept
- tphere
- tpaccept
- home
- wild
- randomtp
- wildtp
survivalfly:
active: true
extended:
vertical-accounting: true
stepheight: default
hbufmax: 1.0
setbackpolicy:
falldamage: true
voidtovoid: true
actions: vl>45 cancel vl>150 log:notifylvla:1:7:i cancel vl>350 log:notifylvlb:0:6:i cancel vl>1360 log:notifylvlc:0:6:i cancel
hover:
active: true
step: 5
ticks: 85
loginticks: 100
falldamage: true
sfviolation: 550
velocity:
activationcounter: 80
activationticks: 140
strictinvalidation: true
splitmoves: default
ignorestance: default
tempkickillegal: true
loadchunks:
join: true
move: true
teleport: true
worldchange: true
sprintinggrace: 2.0
assumesprint: true
speedgrace: 4.0
enforcelocation: default
setback:
method: default
vehicle:
preventdestroyown: true
enforcelocation: default
schedulesetbacks: default
morepackets:
active: true
actions: cancel vl>12 log:morepackets:0:8:i cancel
envelope:
active: default
actions: cancel vl>100 cancel log:vehicleenvelope:0:15:i
message:
illegalplayermove: Illegal move.
illegalvehiclemove: Illegal vehicle move.
net:
attackfrequency:
active: true
limitforseconds:
half: 9
one: 14
two: 39
four: 55
eight: 100
actions: cancel vl>15 cancel log:notifylvlac:0:7:i vl>25 log:notifylvlbc:0:6:i cancel vl>40 log:notifylvlcc:0:6:i cancel
flyingfrequency:
active: true
seconds: 5
packetspersecond: 60
actions: cancel
reduceredundant:
active: true
seconds: 3
actions: cancel
keepalivefrequency:
active: true
actions: cancel vl>10 cancel log:keepalive:0:10:i
packetfrequency:
active: default
limitpersecond: 200
seconds: 4
actions: cancel
sounddistance:
active: true
maxdistance: 150
superseded:
flying:
cancelwaiting: true
strings:
angle: '&c[player] &7could be using &6KillAura &7VL &6[violations] &7(Combat Hacks)'
attackfrequency: '&c[player] &7could be using &6MultiAura &7VL &6[violations] &7(Combat Hacks)'
ban: ban [player]
ban-ip: ban-ip [ip]
bautosign: '&c[player] &7could be using &6Auto Sign &7VL &6[violations]'
bbfrequency: '&c[player] &7could be using &6Nuker &7VL &6[violations]'
bdirection: '&c[player] &7failed &6ImpossibleInteract &7VL &6[violations]'
bedleave: '&c[player] &7failed &6Bed Leave &7VL &6[violations]'
bpspeed: '&c[player] &7could be using &6Fast Throw &7VL &6[violations]'
breach: '&c[player] &7could be using &6Block Reach &7VL &6[violations]'
bspeed: '&c[player] &7could be using &6Fast Interact &7VL &6[violations]'
bvisible: '&c[player] &7could be using &6Block Cheats &7VL &6[violations] &7(Broke a block out of sight)'
bwrong: '&c[player] &7could be using &6Wrong Block &7VL &6[violations] &7(Broke a block other than clicked)'
captcha: '&c[player] &7could be using &6Spam Bots &7VL &6[violations]'
chatnormal: '&c[player] &7could be using &6[check] &7VL &6[violations]'
color: '&c[player] &7could be using &6[check] &7VL &6[violations]'
commands: '&c[player] &7could be &6Spamming &7VL &6[violations]'
combspeed: '&c[player] &7could be using &6[check] &7VL &6[violations]'
critical: '&c[player] &7could be using &6Criticals &7VL &6[violations] &7(Combat Hacks)'
drop: '&c[player] &7could be using &6Fast Drop &7VL &6[violations]'
dropkick: kick [player] &cNCP &7»&r &cYou dropped too many items!
fastbreak: '&c[player] &7could be using &6Fast Break &7VL &6[violations]'
fastclick: '&c[player] &7could be using &6Fast Click &7VL &6[violations]'
fastconsume: '&c[player] &7could be using &6Fast Eat &7VL &6[violations]'
fastheal: '&c[player] &7could be using &6Regen &7VL &6[violations]'
fastplace: '&c[player] &7could be using &6Fast Place &7VL &6[violations]'
fdirection: '&c[player] &7could be using &6AimBot &7VL &6[violations]'
flyshort: '&c[player] &7could be &6Speeding &7VL &6[violations]'
flylong: '&c[player] &7could be &6Flying &7VL &6[violations]'
flyfile: '[player] failed [check]: tried to move: [locationfrom] -> [locationto], d=[distance] ([tags]). &7VL [violations].'
freach: '&c[player] &7could be using &6Reach &7VL &6[violations]&7 (Combat Hacks)'
fselfhit: '&c[player] &7could be using &6Self Hit &7VL &6[violations]&7 (Combat Hacks)'
fspeed: '&c[player] &7could be using a &6Macro &7VL &6[violations]&7 (13+ CPS)'
gutenberg: '&c[player] &7could be using &6[check] &7VL &6[violations]'
godmode: '&c[player] &7could be using &6God Mode &7VL &6[violations]'
improbable: '&c[player] &7could be using &6KillAura &7VL &6[violations] &7(Suspicious Activity)'
instantbow: '&c[player] &7could be using &6Instant Bow &7VL &6[violations]'
instanteat: '&c[player] &7could be using &6Instant Eat &7VL &6[violations]'
keepalive: '&c[player] &7could be using &6[check] &7VL &6[violations]'
kick: kick [player]
kickalive: kick [player] &cNCP &7»&r &cSent too many keep alive packets!
kickattackfrequency: kick [player] &cNCP &7»&r &cToo many clicks!
kickbedleave: kick [player] &cNCP &7»&r &cBed Leave Packets!
kickbspeed: kick [player] &cNCP &7»&r &cInteracted too fast!
kickcaptcha: kick [player] &cNCP &7»&r &cPlease enter the captcha
kickchat1: ncp tempkick [player] 1 &cNCP &7»&r You're not allowed to spam!
kickchat5: ncp tempkick [player] 5 &cNCP &7»&r You're not allowed to spam!
kickchatfast: kick [player] &cNCP &7»&r &cYou're not allowed to spam!
kickchatnormal: kick [player] &cNCP &7»&r &cYou sent too many messages!
kickcommands: ncp tempkick [player] 1 &cNCP &7»&r You sent too many commands!
kickfly: kick [player] &cNCP &7»&r &cYou were in the air too long!
kickfrequency: kick [player] &cNCP &7»&r &cToo many clicks!
kickgod: kick [player] &cNCP &7»&r &cGod Mode Detected!
kickinvaliddata: kick [player] &cNCP &7»&r &cYou sent Invalid Data!
kickpacketfrequency: kick [player] &cNCP &7»&r &cToo many packets.
kickpackets: kick [player] &cNCP &7»&r &cToo many packets sent!
kickselfhit: kick [player] &cNCP &7»&r &cYou hit yourself!
kickwb: kick [player] &cNCP &7»&r &cHitting blocks out of sync!
knockback: '&c[player] &7could be using &6[check] &7VL &6[violations]&'
morepackets: '&c[player] &7could be using &6Timer &7VL &6[violations]&7 (Too many packets)'
msgtempdenylogin: You are temporarily denied to join this server.
munchhausen: '&c[player] &7could be using &6[check] &7VL &6[violations]&7'
nofall: '&c[player] &7failed &6[check] &7VL &6[violations]'
chatfast: '&c[player] &7could be using &6[check] &7VL &6[violations]'
noswing: '&c[player] &7could be using &6[check] &7VL &6[violations]'
passable: '&c[player] &7could be using &6Phase &7VL &6[violations]'
relog: '&c[player] &7relogged too fast &7VL &6[violations]'
tellchatnormal: ncp tell [player] Slow down in chat!
tempkick1: ncp tempkick [player] Please wait 1 minute before logging in
tempkick5: ncp tempkick [player] Please wait 5 minutes before logging in
vehicleenvelope: '&c[player] &7could be using &6[check] &7VL &6[violations]'
notifylvla: '&c[player] &7could be using &6[check] &7VL &a[violations]'
notifylvlb: '&c[player] &7could be using &6[check] &7VL &6[violations]'
notifylvlc: '&c[player] &7could be using &6[check] &7VL &c[violations]'
notifylvlab: '&c[player] &7could be using &6[check] &7VL &a[violations] &7(Block Cheats)'
notifylvlbb: '&c[player] &7could be using &6[check] &7VL &6[violations] &7(Block Cheats)'
notifylvlcb: '&c[player] &7could be using &6[check] &7VL &c[violations] &7(Block Cheats)'
notifylvlac: '&c[player] &7could be using &6[check] &7VL &a[violations] &7(Combat Hacks)'
notifylvlbc: '&c[player] &7could be using &6[check] &7VL &6[violations] &7(Combat Hacks)'
notifylvlcc: '&c[player] &7could be using &6[check] &7VL &c[violations] &7(Combat Hacks)'
compatibility:
managelisteners: false
exemptions:
wildcard:
default:
metadata:
active: true
keys:
- nocheat.exempt
npc:
active: true
bukkitnpc: true
metadata:
active: true
keys:
- NPC
- NCPConfigTracking
remove:
join: true
leave: true
server:
cbdedicated:
enable: true
cbreflect:
enable: true
blocks:
allowinstantbreak:
- LONG_GRASS
overrideflags:
snow: default
piston_moving_piece: default+ign_passable+ground_height
WATER_LILY: default+ign_passable+ground_height+height8_1
'60': default+ign_passable+ground_height+height8_1
'208': solid+ground+height100+ground_height
STEP: solid+ground+xz100+height100+ground_height+ign_passable
changetracker:
active: true
pistons: true
maxageticks: 80
perworld:
maxentries: 1000
+33 -44
View File
@@ -1,51 +1,40 @@
<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>ncpbuildbase</artifactId>
<packaging>jar</packaging>
<name>NCPBuildBase</name>
<version>1.1-SNAPSHOT</version>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
<description>Very basic dependencies that have to be built before commons, no use of Bukkit.
</description>
<artifactId>ncpbuildbase</artifactId>
<version>1.1-SNAPSHOT</version>
<build>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>../NCPBuildBase/src/main/resources</directory>
<includes>
<include>BuildParameters.properties</include>
</includes>
</resource>
</resources>
<name>NCPBuildBase</name>
<description>Very basic dependencies that have to be built before commons, no use of Bukkit.</description>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</build>
<build>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>../NCPBuildBase/src/main/resources</directory>
<includes>
<include>BuildParameters.properties</include>
</includes>
</resource>
</resources>
</build>
</project>
</project>
+27 -39
View File
@@ -1,44 +1,32 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcommons</artifactId>
<packaging>jar</packaging>
<name>NCPCommons</name>
<version>1.1-SNAPSHOT</version>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpbuildbase</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
<description>Common data structures and other, no use of Bukkit.
</description>
<artifactId>ncpcommons</artifactId>
<version>1.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<name>NCPCommons</name>
<description>Common data structures and other, no use of Bukkit.</description>
</project>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpbuildbase</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
@@ -40,10 +40,10 @@ public abstract class AbstractLogNodeDispatcher implements LogNodeDispatcher { /
protected int maxQueueSize = 5000;
/**
* Task id, -1 means the asynchronous task is not running. Synchronize over
* Task id, null means the asynchronous task is not running. Synchronize over
* queueAsynchronous. Must be maintained.
*/
protected int taskAsynchronousID = -1;
protected Object taskAsynchronousID = null;
/**
* Optional implementation for an asynchronous task, using the
* taskAsynchronousID, synchronized over queueAsynchronous.
@@ -57,7 +57,7 @@ public abstract class AbstractLogNodeDispatcher implements LogNodeDispatcher { /
while (i < 3) {
if (runLogsAsynchronous()) {
i = 0;
if (taskAsynchronousID == -1) {
if (!isTaskScheduled(taskAsynchronousID)) {
// Shutdown, hard return;
return;
}
@@ -69,7 +69,7 @@ public abstract class AbstractLogNodeDispatcher implements LogNodeDispatcher { /
} catch (InterruptedException e) {
synchronized (queueAsynchronous) {
// Ensure re-scheduling can happen.
taskAsynchronousID = -1;
taskAsynchronousID = null;
}
// TODO: throw?
return;
@@ -79,7 +79,7 @@ public abstract class AbstractLogNodeDispatcher implements LogNodeDispatcher { /
if (queueAsynchronous.isEmpty()) {
if (i >= 3) {
// Ensure re-scheduling can happen.
taskAsynchronousID = -1;
taskAsynchronousID = null;
}
} else {
i = 0;
@@ -134,10 +134,10 @@ public abstract class AbstractLogNodeDispatcher implements LogNodeDispatcher { /
// Cancel task.
synchronized (queueAsynchronous) {
if (taskAsynchronousID != -1) {
if (isTaskScheduled(taskAsynchronousID)) {
// TODO: Allow queues to set to "no more input" ?
cancelTask(taskAsynchronousID);
taskAsynchronousID = -1;
taskAsynchronousID = null;
} else {
// No need to wait.
ms = 0L;
@@ -184,7 +184,7 @@ public abstract class AbstractLogNodeDispatcher implements LogNodeDispatcher { /
if (queueAsynchronous.add(record) > maxQueueSize) {
reduceQueue(queueAsynchronous);
}
if (taskAsynchronousID == -1) { // Works, due to add being synchronized (not sure it's really better than full sync).
if (!isTaskScheduled(taskAsynchronousID)) { // Works, due to add being synchronized (not sure it's really better than full sync).
scheduleAsynchronous();
}
break;
@@ -242,6 +242,8 @@ public abstract class AbstractLogNodeDispatcher implements LogNodeDispatcher { /
protected abstract void scheduleAsynchronous();
protected abstract void cancelTask(int taskId);
protected abstract void cancelTask(Object taskInfo);
protected abstract boolean isTaskScheduled(Object taskInfo);
}
@@ -43,5 +43,15 @@ public class Misc {
}
list.add(0, item);
}
/**
* Flooring method copied from the BukkitAPI (locToBlock)
* @param num
* @return
*/
public static int floor(double num) {
final int floor = (int) num;
return floor == num ? floor : floor - (int) (Double.doubleToRawLongBits(num) >>> 63);
}
}
@@ -32,12 +32,19 @@ public class StringUtil {
/** Decimal format for "#.###" */
public static final DecimalFormat fdec3 = new DecimalFormat();
/** Decimal format for "#.#" */
/** Decimal format for "#.######" */
public static final DecimalFormat fdec1 = new DecimalFormat();
public static final DecimalFormat fdec6 = new DecimalFormat();
static {
DecimalFormatSymbols sym = fdec6.getDecimalFormatSymbols();
// 6 digits
sym.setDecimalSeparator('.');
fdec6.setDecimalFormatSymbols(sym);
fdec6.setMaximumFractionDigits(6);
fdec6.setMinimumIntegerDigits(1);
// 3 digits.
DecimalFormatSymbols sym = fdec3.getDecimalFormatSymbols();
sym = fdec6.getDecimalFormatSymbols();
sym.setDecimalSeparator('.');
fdec3.setDecimalFormatSymbols(sym);
fdec3.setMaximumFractionDigits(3);
@@ -401,7 +408,7 @@ public class StringUtil {
}
/**
* Format to maximally 3 digits after the comma, always show the sign,
* Format to maximally 6 digits after the comma, always show the sign,
* unless equal.
*
* @param current
@@ -409,7 +416,7 @@ public class StringUtil {
* @return
*/
public static String formatDiff(final double current, final double previous) {
return current == previous ? "0" : ((current > previous ? "+" : "-") + fdec3.format(Math.abs(current - previous)));
return current == previous ? "0" : ((current > previous ? "+" : "-") + fdec6.format(Math.abs(current - previous)));
}
public static boolean startsWithAnyOf(final String input, final String... startsWith) {
@@ -15,7 +15,7 @@
package fr.neatmonster.nocheatplus.utilities;
/**
* Simple parameter/thing validation.
* Simple parameter/thing for recurring validation.
*
* @author asofold
*
@@ -36,5 +36,26 @@ public class Validate {
}
}
}
/**
* Validates that the given double array's length: is a multiple of 6, does contain at least 1 bounding box and is not null.
*
* <p>Currently, this is rather meant to validate double arrays containing multiple bounding boxes, each defined by six consecutive elements
* [minX, minY, minZ, maxX, maxY, maxZ].<br>
*
* @param array The double array to validate.
*
* @throws IllegalArgumentException If the array length is not a multiple of 6, null or empty.
*/
public static void validateAABB(final double[] array) {
if (array == null) {
throw new NullPointerException("The array is null.");
}
if (array.length == 0) {
throw new IllegalArgumentException("The array is empty.");
}
if (array.length % 6 != 0) {
throw new IllegalArgumentException("Array length is not a multiple of 6. Actual length: " + array.length);
}
}
}
@@ -16,7 +16,6 @@ package fr.neatmonster.nocheatplus.utilities.ds.bktree;
import java.util.Collection;
import fr.neatmonster.nocheatplus.utilities.ds.bktree.BKModTree.LookupEntry;
import fr.neatmonster.nocheatplus.utilities.ds.bktree.SimpleTimedBKLevenshtein.STBKLResult;
import fr.neatmonster.nocheatplus.utilities.ds.bktree.TimedBKLevenshtein.SimpleTimedLevenNode;
@@ -17,99 +17,153 @@ package fr.neatmonster.nocheatplus.utilities.ds.count;
import fr.neatmonster.nocheatplus.utilities.StringUtil;
/**
* This class is meant to accumulate actions similar to ActionFrequency. In contrast to ActionFrequency, this class will accumulate values grouped by number of events instead of real-time intervals.
* @author mc_dev
* This class is meant to accumulate actions similar to ActionFrequency.
* In contrast to ActionFrequency, this class will accumulate values grouped by number of events instead of real-time intervals.
* @author asofold
*
*/
public class ActionAccumulator {
/** Event count. */
private final int[] counts;
/** Value accumulation. */
private final float[] buckets;
/** Capacity of each bucket. */
private final int bucketCapacity;
public ActionAccumulator(final int nBuckets, final int bucketCapacity){
this.counts = new int[nBuckets];
this.buckets = new float[nBuckets];
this.bucketCapacity = bucketCapacity;
}
public void add(float value){
if (counts[0] >= bucketCapacity){
shift();
}
counts[0] ++;
buckets[0] += value;
}
private void shift() {
for (int i = buckets.length - 1; i > 0 ; i--){
counts[i] = counts[i - 1];
buckets[i] = buckets[i - 1];
}
counts[0] = 0;
buckets[0] = 0;
}
/** Counter of added events for each bucket. */
private final int[] valueCounter;
/** Value accumulation (sum). */
private final float[] buckets;
/** How many events can a bucket hold. */
private final int bucketCapacity;
/**
* Create a new ActionAccumulator instance
*
* @param nBuckets Number of buckets to hold values with
* @param bucketCapacity How many events can a bucket hold
*/
public ActionAccumulator(final int nBuckets, final int bucketCapacity) {
this.valueCounter = new int[nBuckets];
this.buckets = new float[nBuckets];
this.bucketCapacity = bucketCapacity;
}
/**
* Add value to accumulation (starting to the first bucket, shifting into the other ones if present)
* See shift()
*/
public void add(float value) {
if (valueCounter[0] >= bucketCapacity) {
// First bucket is full, shift data into the next one .
shift();
}
// Each time a value is added, the event counter for this bucket increases.
valueCounter[0]++ ;
// Accumulate the value
buckets[0] += value;
}
/**
* On reaching the maximum capacity of the first bucket,
* shift data into the next one and empty the first (which will be ready to accumulate values again).
*/
private void shift() {
// Start from the last bucket and decrease
for (int bucketIndex = buckets.length - 1; bucketIndex > 0; bucketIndex--) {
// Shift counted events to the next bucket
valueCounter[bucketIndex] = valueCounter[bucketIndex - 1];
// Shift accumulated values to the next bucket
buckets[bucketIndex] = buckets[bucketIndex - 1];
}
// Reset event counter of the first bucket
valueCounter[0] = 0;
// Empty the bucket (accumulated values)
buckets[0] = 0;
}
/**
* Total score.
* @return
*/
public float score(){
float score = 0;
for (int i = 0; i < buckets.length; i++){
score += buckets[i];
}
return score;
}
/**
* Total count.
* @return
*/
public int count(){
int count = 0;
for (int i = 0; i < counts.length; i++){
count += counts[i];
}
return count;
}
public void clear(){
for (int i = 0; i < buckets.length; i++){
counts[i] = 0;
buckets[i] = 0;
}
}
public int bucketCount(final int bucket){
return counts[bucket];
}
public float bucketScore(final int bucket){
return buckets[bucket];
}
public int numberOfBuckets(){
return buckets.length;
}
public int bucketCapacity(){
return bucketCapacity;
}
/**
* Simple display of bucket contents, no class name.
* @return
*/
public String toInformalString(){
StringBuilder b = new StringBuilder(buckets.length * 10);
b.append("|");
for (int i = 0; i < buckets.length; i++){
b.append(StringUtil.fdec3.format(buckets[i]) + "/" + counts[i] + "|");
}
return b.toString();
}
}
/**
* Get the total accumulation value of this accumulator (values of all buckets)
*/
public float score() {
float score = 0;
for (int i = 0; i < buckets.length; i++) {
score += buckets[i];
}
return score;
}
/**
* Get the total events of the whole accumulator (of all buckets)
*/
public int count() {
int globalCounter = 0;
for (int i = 0; i < valueCounter.length; i++) {
globalCounter += valueCounter[i];
}
return globalCounter;
}
/**
* Reset all
*/
public void clear() {
for (int i = 0; i < buckets.length; i++) {
valueCounter[i] = 0;
buckets[i] = 0;
}
}
/**
* Get the events counted for this bucket
* @param bucket
* @return how many events have been added(counted) to the bucket
*/
public int bucketCount(final int bucket) {
return valueCounter[bucket];
}
/**
* Get the accumulation value of this bucket (sum of all values added to this bucket)
* @param bucket
* @return accumulation value of this bucket
*/
public float bucketScore(final int bucket) {
return buckets[bucket];
}
/**
* Get the mean of this bucket
* @param bucket
* @return the mean of this bucket
*/
public float mean(final int bucket) {
return bucketScore(bucket) / bucketCount(bucket);
}
/**
* Get the mean of the whole accumulator
*/
public float mean() {
return score() / count();
}
/**
* How many buckets does the ActionAccumulator instance have
*/
public int numberOfBuckets() {
return buckets.length;
}
/**
* How many events(count) can each bucket of the ActionAccumulator instance have
*/
public int bucketCapacity() {
return bucketCapacity;
}
/**
* Simple display of bucket contents, no class name.
*/
public String toInformalString() {
StringBuilder b = new StringBuilder(buckets.length * 10);
b.append("|");
for (int i = 0; i < buckets.length; i++){
b.append(StringUtil.fdec3.format(buckets[i]) + "/" + valueCounter[i] + "|");
}
return b.toString();
}
}
@@ -139,24 +139,6 @@ public class ActionFrequency {
time = lastUpdate = now;
}
/**
* @deprecated Use instead: score(float).
* @param factor
* @return
*/
public final float getScore(final float factor) {
return score(factor);
}
/**
* @deprecated Use instead: score(float).
* @param factor
* @return
*/
public final float getScore(final int bucket) {
return bucketScore(bucket);
}
/**
* Get a weighted sum score, weight for bucket i: w(i) = factor^i.
* @param factor
@@ -0,0 +1,75 @@
/*
* 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.utilities.ds.map;
import fr.neatmonster.nocheatplus.utilities.Misc;
public class BlockCoord {
private final int x;
private final int y;
private final int z;
/**
* Constructs a BlockCoord with integer coordinates.
*
* @param x The x-coordinate.
* @param y The y-coordinate.
* @param z The z-coordinate.
*/
public BlockCoord(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
/**
* Constructs a BlockCoord from double coordinates by converting them
* to block integer coordinates using the same method as Bukkit's Location#locToBlock().
*
* @param x The x-coordinate.
* @param y The y-coordinate.
* @param z The z-coordinate.
*/
public BlockCoord(double x, double y, double z) {
this.x = Misc.floor(x);
this.y = Misc.floor(y);
this.z = Misc.floor(z);
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getZ() {
return z;
}
@Override
public int hashCode() {
return CoordHash.hashCode3DPrimes(x, y, z);
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
BlockCoord bc = (BlockCoord) obj;
return bc.getX() == x && bc.getY() == y && bc.getZ() == z;
}
}
@@ -14,7 +14,6 @@
*/
package fr.neatmonster.nocheatplus.utilities.ds.prefixtree;
import fr.neatmonster.nocheatplus.utilities.ds.prefixtree.CharPrefixTree.CharLookupEntry;
import fr.neatmonster.nocheatplus.utilities.ds.prefixtree.CharPrefixTree.SimpleCharNode;
import fr.neatmonster.nocheatplus.utilities.ds.prefixtree.SimpleCharPrefixTree.SimpleCharLookupEntry;
@@ -14,7 +14,6 @@
*/
package fr.neatmonster.nocheatplus.utilities.ds.prefixtree;
import fr.neatmonster.nocheatplus.utilities.ds.prefixtree.PrefixTree.LookupEntry;
import fr.neatmonster.nocheatplus.utilities.ds.prefixtree.PrefixTree.SimpleNode;
import fr.neatmonster.nocheatplus.utilities.ds.prefixtree.SimplePrefixTree.SimpleLookupEntry;
@@ -16,7 +16,6 @@ package fr.neatmonster.nocheatplus.utilities.ds.prefixtree;
import fr.neatmonster.nocheatplus.utilities.ds.prefixtree.SimpleTimedCharPrefixTree.SimpleTimedCharLookupEntry;
import fr.neatmonster.nocheatplus.utilities.ds.prefixtree.TimedCharPrefixTree.SimpleTimedCharNode;
import fr.neatmonster.nocheatplus.utilities.ds.prefixtree.TimedCharPrefixTree.TimedCharLookupEntry;
public class SimpleTimedCharPrefixTree extends TimedCharPrefixTree<SimpleTimedCharNode, SimpleTimedCharLookupEntry> {
@@ -14,7 +14,7 @@
*/
package fr.neatmonster.nocheatplus.test;
import static org.junit.Assert.*;
import static org.junit.Assert.fail;
import org.junit.Test;
@@ -14,7 +14,7 @@
*/
package fr.neatmonster.nocheatplus.test;
import static org.junit.Assert.*;
import static org.junit.Assert.fail;
import org.junit.Test;
@@ -14,7 +14,7 @@
*/
package fr.neatmonster.nocheatplus.test;
import static org.junit.Assert.*;
import static org.junit.Assert.fail;
import org.junit.Test;
@@ -21,8 +21,8 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.SplittableRandom;
import org.junit.Test;
@@ -30,8 +30,8 @@ import fr.neatmonster.nocheatplus.utilities.build.BuildParameters;
import fr.neatmonster.nocheatplus.utilities.ds.map.CoordHashMap;
import fr.neatmonster.nocheatplus.utilities.ds.map.CoordMap;
import fr.neatmonster.nocheatplus.utilities.ds.map.CoordMap.Entry;
import fr.neatmonster.nocheatplus.utilities.ds.map.LinkedCoordHashMap.MoveOrder;
import fr.neatmonster.nocheatplus.utilities.ds.map.LinkedCoordHashMap;
import fr.neatmonster.nocheatplus.utilities.ds.map.LinkedCoordHashMap.MoveOrder;
public class TestCoordMap {
@@ -74,7 +74,7 @@ public class TestCoordMap {
private final boolean extraTesting = BuildParameters.testLevel > 0;
private final int suggestedSamples = extraTesting ? 40000 : 1250;
public int[][] getRandomCoords(int n, int max, Random random) {
private static int[][] getRandomCoords(int n, int max, SplittableRandom random) {
final int [][] coords = new int[n][3];
for (int i = 0; i < n; i++){
for (int j = 0; j < 3 ; j++){
@@ -84,7 +84,7 @@ public class TestCoordMap {
return coords;
}
public int[][] getUniqueRandomCoords(int n, int max, Random random) {
private static int[][] getUniqueRandomCoords(int n, int max, SplittableRandom random) {
Set<Pos> present = new HashSet<Pos>();
int failures = 0;
final int [][] coords = new int[n][3];
@@ -311,7 +311,7 @@ public class TestCoordMap {
@Test
public void testIntegrity() {
final Random random = new Random(System.nanoTime() - (System.currentTimeMillis() % 2 == 1 ? 37 : 137));
final SplittableRandom random = new SplittableRandom();
final int n = suggestedSamples; // Number of coordinates.
final int max = 800; // Coordinate maximum.
@@ -333,7 +333,7 @@ public class TestCoordMap {
@Test
public void testLinkedCoordHashMap() {
final Random random = new Random(System.nanoTime() - (System.currentTimeMillis() % 2 == 1 ? 37 : 137));
final SplittableRandom random = new SplittableRandom();
final int n = suggestedSamples; // Number of coordinates.
final int max = 800; // Coordinate maximum.
+27 -40
View File
@@ -1,46 +1,33 @@
<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>ncpcompatbukkit</artifactId>
<packaging>jar</packaging>
<name>NCPCompatBukkit</name>
<version>1.1-SNAPSHOT</version>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.13-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatbukkit</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for using the Bukkit API only.
</description>
<name>NCPCompatBukkit</name>
<description>Compatibility for using the Bukkit API only.</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>
@@ -1,169 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.checks.inventory;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.inventory.ItemStack;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
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.AlmostBoolean;
import fr.neatmonster.nocheatplus.compat.BridgeHealth;
import fr.neatmonster.nocheatplus.components.config.value.OverrideType;
import fr.neatmonster.nocheatplus.components.registry.feature.INotifyReload;
import fr.neatmonster.nocheatplus.logging.StaticLog;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.stats.Counters;
import fr.neatmonster.nocheatplus.utilities.InventoryUtil;
import fr.neatmonster.nocheatplus.utilities.TickTask;
/**
* Quick replacement for InstantEat, partly reusing InstantEat data.<br>
* This check is added by fr.neatmonster.nocheatplus.compat.DefaultComponentFactory.
* @author mc_dev
*
*/
public class FastConsume extends Check implements Listener, INotifyReload {
public static void testAvailability(){
if (!PlayerItemConsumeEvent.class.getSimpleName().equals("PlayerItemConsumeEvent")){
throw new RuntimeException("This exception should not even get thrown.");
}
}
private final Counters counters = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstance(Counters.class);
private final int idCancelDead = counters.registerKey("cancel.dead");
public FastConsume() {
super(CheckType.INVENTORY_FASTCONSUME);
// Overrides the instant-eat check.
disableInstantEat();
}
private void disableInstantEat() {
// TODO: Do this kind of thing via registries later on.
//ConfigManager.setForAllConfigs(ConfPaths.INVENTORY_INSTANTEAT_CHECK, false);
NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().overrideCheckActivation(
CheckType.INVENTORY_INSTANTEAT, AlmostBoolean.NO,
OverrideType.PERMANENT, true);
StaticLog.logInfo("Inventory checks: FastConsume is available, disabled InstantEat.");
}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onItemConsume(final PlayerItemConsumeEvent event){
final Player player = event.getPlayer();
if (player.isDead() && BridgeHealth.getHealth(player) <= 0.0) {
// Eat after death.
event.setCancelled(true);
counters.addPrimaryThread(idCancelDead, 1);
return;
}
final IPlayerData pData = DataManager.getPlayerData(player);
if (!pData.isCheckActive(type, player)) {
return;
}
final InventoryData data = pData.getGenericInstance(InventoryData.class);
final long time = System.currentTimeMillis();
if (check(player, event.getItem(), time, data, pData)){
event.setCancelled(true);
DataManager.getPlayerData(player).requestUpdateInventory();
}
}
private boolean check(final Player player, final ItemStack stack,
final long time, final InventoryData data, final IPlayerData pData){
// Uses the instant-eat data for convenience.
// Consistency checks...
if (stack == null){ // || stack.getType() != data.instantEatFood){
// TODO: Strict version should prevent other material (?).
return false;
}
final long ref = data.instantEatInteract == 0 ? 0 : Math.max(data.instantEatInteract, data.lastClickTime);
if (time < ref){
// Time ran backwards.
data.instantEatInteract = data.lastClickTime = time;
return false;
}
// Check exceptions.
final InventoryConfig cc = pData.getGenericInstance(InventoryConfig.class);
final Material mat = stack == null ? null : stack.getType();
if (mat != null){
if (cc.fastConsumeWhitelist){
if (!cc.fastConsumeItems.contains(mat)){
return false;
}
}
else if (cc.fastConsumeItems.contains(mat)){
return false;
}
}
// Actually check.
final long timeSpent = ref == 0 ? 0 : (time - ref); // Not interact = instant.
final long expectedDuration = cc.fastConsumeDuration;
boolean cancel = false;
if (timeSpent < expectedDuration){
// TODO: Might have to do a specialized check for lag spikes here instead.
final float lag = TickTask.getLag(expectedDuration, true);
if (timeSpent * lag < expectedDuration){
final double difference = (expectedDuration - timeSpent * lag) / 100.0;
data.instantEatVL += difference;
final ViolationData vd = new ViolationData(this, player, data.instantEatVL, difference, cc.fastConsumeActions);
vd.setParameter(ParameterName.FOOD, "" + mat);
if (data.instantEatFood != mat){
vd.setParameter(ParameterName.TAGS, "inconsistent(" + data.instantEatFood + ")");
}
else{
vd.setParameter(ParameterName.TAGS, "");
}
if (executeActions(vd).willCancel()){
cancel = true;
}
}
}
else{
data.instantEatVL *= 0.6;
}
// Reset interaction.
if (cancel) {
// Fake interaction to prevent violation loops with false positives.
final ItemStack actualStack = InventoryUtil.getFirstConsumableItemInHand(player);
data.instantEatFood = actualStack == null ? null : actualStack.getType();
// TODO: Allows some abuse: 1. try instantly eat (cancelled) 2. consume item directly when needed.
}
else {
if (pData.isDebugActive(type)) {
debug(player, "PlayerItemConsumeEvent, reset fastconsume: " + data.instantEatFood);
}
data.instantEatFood = null;
}
data.instantEatInteract = time;
return cancel;
}
@Override
public void onReload() {
disableInstantEat();
}
}
@@ -1,64 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.checks.inventory;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerEditBookEvent;
import org.bukkit.inventory.meta.BookMeta;
import fr.neatmonster.nocheatplus.checks.Check;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
public class Gutenberg extends Check implements Listener {
public static void testAvailability(){
if (!PlayerEditBookEvent.class.getSimpleName().equals("PlayerEditBookEvent")){
throw new RuntimeException("This exception should not even get thrown.");
}
}
public Gutenberg() {
super(CheckType.INVENTORY_GUTENBERG);
}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEditBook(final PlayerEditBookEvent event) {
final Player player = event.getPlayer();
if (!isEnabled(player)) {
return;
}
final IPlayerData pData = DataManager.getPlayerData(player);
final InventoryConfig cc = pData.getGenericInstance(InventoryConfig.class);
final InventoryData data = pData.getGenericInstance(InventoryData.class);
final BookMeta newMeta = event.getNewBookMeta();
final int pages = newMeta.getPageCount();
if (pages <= cc.gutenbergPageLimit) {
// Legitimate.
return;
}
// Violation.
final int vl = pages - cc.gutenbergPageLimit;
data.gutenbergVL += vl;
if (executeActions(player, data.gutenbergVL, vl, cc.gutenbergActions).willCancel()) {
event.setCancelled(true);
}
}
}
@@ -26,7 +26,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityPortalEnterEvent;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
import fr.neatmonster.nocheatplus.compat.bukkit.BridgeMaterial;
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
import fr.neatmonster.nocheatplus.logging.Streams;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
@@ -20,7 +20,11 @@ import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.map.MaterialUtil;
public class BlockCacheBukkit extends BlockCache {
@@ -38,6 +42,7 @@ public class BlockCacheBukkit extends BlockCache {
this.world = world;
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
this.minBlockY = BlockProperties.getMinWorldY();
}
return this;
}
@@ -52,13 +57,16 @@ public class BlockCacheBukkit extends BlockCache {
@Override
public int fetchData(final int x, final int y, final int z) {
// TODO: consider setting type id and data at once.
return world.getBlockAt(x, y, z).getData();
return Bridge1_13.hasIsSwimming() ? 0 : world.getBlockAt(x, y, z).getData();
}
@Override
public double[] fetchBounds(final int x, final int y, final int z){
// minX, minY, minZ, maxX, maxY, maxZ
Material mat = getType(x, y, z);
long flags = BlockFlags.getBlockFlags(mat);
if (flags == BlockFlags.F_IGN_PASSABLE) {
return null;
}
// TODO: Want to maintain a list with manual entries or at least half / full blocks ?
// Always return full bounds, needs extra adaption to BlockProperties (!).
return new double[]{0D, 0D, 0D, 1D, 1D, 1D};
@@ -70,17 +78,14 @@ public class BlockCacheBukkit extends BlockCache {
// TODO: Probably check other ids too before doing this ?
for (final Entity other : entity.getNearbyEntities(2.0, 2.0, 2.0)){
final EntityType type = other.getType();
if (type != EntityType.BOAT){ // && !(other instanceof Minecart))
continue;
if (!MaterialUtil.isBoat(type) && type != EntityType.SHULKER){ // && !(other instanceof Minecart))
continue;
}
final double locY = entity.getLocation(useLoc).getY();
useLoc.setWorld(null);
if (Math.abs(locY - minY) < 0.7){
// TODO: A "better" estimate is possible, though some more tolerance would be good.
return true;
}
else return false;
}
// TODO: A "better" estimate is possible, though some more tolerance would be good.
return Math.abs(locY - minY) < 0.7;
}
}
catch (Throwable t){
// Ignore exceptions (Context: DisguiseCraft).
@@ -96,5 +101,4 @@ public class BlockCacheBukkit extends BlockCache {
super.cleanup();
world = null;
}
}
@@ -18,8 +18,11 @@ import java.util.Map;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitShapeModel;
import fr.neatmonster.nocheatplus.utilities.map.MaterialUtil;
/**
@@ -29,22 +32,21 @@ import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitShapeModel;
*
*/
public class BlockCacheBukkitModern extends BlockCacheBukkit {
private Map<Material, BukkitShapeModel> shapeModels;
public BlockCacheBukkitModern(Map<Material, BukkitShapeModel> shapeModels) {
super(null);
this.shapeModels = shapeModels;
}
public BlockCacheBukkitModern(World world) {
super(world);
}
@Override
public int fetchData(int x, int y, int z) {
Material mat = getType(x, y, z);
final BukkitShapeModel shapeModel = shapeModels.get(mat);
if (shapeModel != null) {
final int data = shapeModel.getFakeData(this, world, x, y, z);
@@ -54,30 +56,37 @@ public class BlockCacheBukkitModern extends BlockCacheBukkit {
}
return super.fetchData(x, y, z);
}
@Override
public double[] fetchBounds(int x, int y, int z) {
// minX, minY, minZ, maxX, maxY, maxZ
// TODO: Fetch what's possible to fetch/guess (...).
// TODO: Consider to store the last used block/stuff within BlockCacheBukkit already.
//final Block block = world.getBlockAt(x, y, z);
//final BlockState state = block.getState();
//final MaterialData materialData = state.getData();
//final BlockData blockData = state.getBlockData();
Material mat = getType(x, y, z);
final BukkitShapeModel shapeModel = shapeModels.get(mat);
if (shapeModel == null) {
return super.fetchBounds(x, y, z);
}
else {
return shapeModel.getShape(this, world, x, y, z);
}
return shapeModel.getShape(this, world, x, y, z);
}
// TODO: Might refine standsOnEntity as well.
}
@Override
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ) {
try {
// TODO: Probably check vehicle ids too before doing this ?
for (final Entity vehicle : entity.getNearbyEntities(0.1, 2.0, 0.1)) {
final EntityType type = vehicle.getType();
if (!MaterialUtil.isBoat(type) && type != EntityType.SHULKER) { // && !(vehicle instanceof Minecart))
continue;
}
final double vehicleY = vehicle.getLocation(useLoc).getY() + vehicle.getHeight();
final double entityY = entity.getLocation(useLoc).getY();
useLoc.setWorld(null);
// TODO: A "better" estimate is possible, though some more tolerance would be good.
return vehicleY < entityY + 0.1 && Math.abs(vehicleY - entityY) < 0.7;
}
} catch (Throwable t) {
// Ignore exceptions (Context: DisguiseCraft).
}
return false;
}
}
@@ -16,15 +16,26 @@ package fr.neatmonster.nocheatplus.compat.bukkit;
import java.util.UUID;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.attribute.AttributeModifier.Operation;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
import fr.neatmonster.nocheatplus.compat.AttribUtil;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
import fr.neatmonster.nocheatplus.compat.versions.ClientVersion;
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
import fr.neatmonster.nocheatplus.components.modifier.IAttributeAccess;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
import fr.neatmonster.nocheatplus.utilities.map.MaterialUtil;
import fr.neatmonster.nocheatplus.utilities.math.MathUtil;
import fr.neatmonster.nocheatplus.utilities.moving.Magic;
public class BukkitAttributeAccess implements IAttributeAccess {
@@ -67,20 +78,208 @@ public class BukkitAttributeAccess implements IAttributeAccess {
private double getMultiplier(final AttributeModifier mod) {
return AttribUtil.getMultiplier(operationToInt(mod.getOperation()), mod.getAmount());
}
@Override
public double getSpeedAttributeMultiplier(final Player player) {
final AttributeInstance attrInst = player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
public float getMovementSpeed(final Player player) {
// / by 2 to get the base value 0.1f
return (player.getWalkSpeed() / 2f) * (float) getSpeedMultiplier(player);
}
@Override
public double getSpeedMultiplier(final Player player) {
final AttributeInstance attrInst = BridgeBukkitAPI.getSpeedAttributeInstance(player);
final double val = attrInst.getValue() / attrInst.getBaseValue();
final AttributeModifier mod = getModifier(attrInst, AttribUtil.ID_SPRINT_BOOST);
return mod == null ? val : (val / getMultiplier(mod));
}
@Override
public double getSprintAttributeMultiplier(final Player player) {
final AttributeInstance attrInst = player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
public double getSprintMultiplier(final Player player) {
final AttributeInstance attrInst = BridgeBukkitAPI.getSpeedAttributeInstance(player);
final AttributeModifier mod = getModifier(attrInst, AttribUtil.ID_SPRINT_BOOST);
return mod == null ? 1.0 : getMultiplier(mod);
}
@Override
public double getGravity(Player player) {
double gravity;
final PlayerMoveData thisMove = DataManager.getPlayerData(player).getGenericInstance(MovingData.class).playerMoves.getCurrentMove();
if (!BridgeMisc.hasGravity(player)) {
return 0.0;
}
if (ServerVersion.isLowerThan("1.20.5")) {
// Doesn't exist. Calculate manually.
gravity = thisMove.yDistance <= 0.0 && !Double.isInfinite(Bridge1_13.getSlowfallingAmplifier(player)) ? Magic.SLOW_FALL_GRAVITY : Magic.DEFAULT_GRAVITY;
}
else {
final AttributeInstance attrInst = BridgeBukkitAPI.getGravityAttributeInstance(player);
// Fail-safe.
if (attrInst == null) {
gravity = thisMove.yDistance <= 0.0 && !Double.isInfinite(Bridge1_13.getSlowfallingAmplifier(player)) ? Magic.SLOW_FALL_GRAVITY : Magic.DEFAULT_GRAVITY;
}
else gravity = MathUtil.clamp(attrInst.getValue(), -1.0, 1.0);
if (thisMove.yDistance <= 0.0 && !Double.isInfinite(Bridge1_13.getSlowfallingAmplifier(player))) {
gravity = Math.min(gravity, Magic.SLOW_FALL_GRAVITY);
}
}
return gravity;
}
@Override
public double getSafeFallDistance(Player player) {
if (ServerVersion.isLowerThan("1.20.5")) {
// Doesn't exist. Calculate manually.
return Magic.FALL_DAMAGE_DIST;
}
final AttributeInstance attrInst = BridgeBukkitAPI.getSafeFallAttributeInstance(player);
// Fail-safe
if (attrInst == null) return Magic.FALL_DAMAGE_DIST;
return MathUtil.clamp(attrInst.getValue(), -1024.0, 1024.0);
}
@Override
public double getFallDamageMultiplier(Player player) {
if (ServerVersion.isLowerThan("1.20.5")) {
// Doesn't exist. Calculate manually.
return 1.0;
}
final AttributeInstance attrInst = BridgeBukkitAPI.getFallMultAttributeInstance(player);
// Fail-safe
if (attrInst == null) return 1.0;
return MathUtil.clamp(attrInst.getValue(), 1.0, 100.0);
}
@Override
public double getBreakingSpeedMultiplier(Player player) {
if (ServerVersion.isLowerThan("1.20.5")) {
// Doesn't exist. Calculate manually.
return 1.0;
}
final AttributeInstance attrInst = BridgeBukkitAPI.getBreakSpeedAttributeInstance(player);
// Fail-safe
if (attrInst == null) return 1.0;
return MathUtil.clamp(attrInst.getValue(), 1.0, 1024.0);
}
@Override
public double getJumpGainMultiplier(Player player) {
if (ServerVersion.isLowerThan("1.20.5")) {
// Doesn't exist. Calculate manually.
return 1.0;
}
final AttributeInstance attrInst = BridgeBukkitAPI.getJumpPowerAttributeInstance(player);
// Fail-safe
if (attrInst == null) return 1.0;
final double val = attrInst.getValue() / attrInst.getBaseValue();
return MathUtil.clamp(val, 0.0, 76.19047619047619); // MathUtil.clamp(attrInst.getValue(), 0.0, 32.0);
}
@Override
public double getPlayerSneakingFactor(Player player) {
// Not available. 1.21 and above only.
return Magic.SNEAK_MULTIPLIER + BridgeEnchant.getSwiftSneakIncrement(player);
}
@Override
public double getPlayerMaxBlockReach(Player player) {
if (ServerVersion.isLowerThan("1.20.5")) {
// Doesn't exist. Calculate manually.
return 4.5;
}
final AttributeInstance attrInst = BridgeBukkitAPI.getBlockInteractionRangeAttributeInstance(player);
// Fail-safe
if (attrInst == null) return 4.5;
return MathUtil.clamp(attrInst.getValue(), 0.0, 64.0);
}
@Override
public double getPlayerMaxAttackReach(Player player) {
if (ServerVersion.isLowerThan("1.20.5")) {
// Doesn't exist. Calculate manually.
return 3.0;
}
final AttributeInstance attrInst = BridgeBukkitAPI.getEntityInteractionRangeAttributeInstance(player);
// Fail-safe
if (attrInst == null) return 3.0;
return MathUtil.clamp(attrInst.getValue(), 0.0, 64.0);
}
@Override
public double getMaxStepUp(Player player) {
if (ServerVersion.isLowerThan("1.20.5")) {
// Does not exist, calculate manually.
if (player.isInsideVehicle()) {
if (player.getVehicle() != null && MaterialUtil.isBoat(player.getVehicle().getType())) {
// Boats are unable to step.
return 0.0;
}
// All other vehicles have a step value of 1.0
return 1.0;
}
final MovingConfig cc = DataManager.getPlayerData(player).getGenericInstance(MovingConfig.class);
return cc.sfStepHeight;
}
final AttributeInstance attrInst = BridgeBukkitAPI.getStepHeightAttributeInstance(player);
if (attrInst == null) {
// Fail-safe.
if (player.isInsideVehicle()) {
if (player.getVehicle() != null && MaterialUtil.isBoat(player.getVehicle().getType())) {
return 0.0;
}
return 1.0;
}
final MovingConfig cc = DataManager.getPlayerData(player).getGenericInstance(MovingConfig.class);
return cc.sfStepHeight;
}
return MathUtil.clamp(attrInst.getValue(), 0.0, 10.0);
}
@Override
public float getWaterMovementEfficiency(Player player) {
final IPlayerData pData = DataManager.getPlayerData(player);
if (pData.getClientVersion().isLowerThan(ClientVersion.V_1_8)) {
// Doesn't exist.
return 0f;
}
final float depthStrider = BridgeEnchant.getDepthStriderLevel(player);
if (pData.getClientVersion().isLowerThan(ClientVersion.V_1_21)) {
// Use the legacy method.
return depthStrider;
}
if (ServerVersion.isLowerThan("1.21")) {
// Simulate what ViaVersion does for newer (1.21 clients) on older (1.21-) servers.
return depthStrider / 3.0f;
}
// Unsupported. Only since 1.21.
return depthStrider;
}
@Override
public float getMovementEfficiency(Player player) {
// Not available. 1.21 and above only.
return 0.0f;
}
@Override
public double getSubmergedMiningSpeedMultiplier(Player player) {
// Not available. 1.21 and above only.
return 1.0;
}
@Override
public double getMiningEfficiency(Player player) {
// Not available. 1.21 and above only.
return 0.0;
}
@Override
public double getEntityScale(Player player) {
if (ServerVersion.isLowerThan("1.20.5")) {
return 1.0;
}
final AttributeInstance attrInst = BridgeBukkitAPI.getScaleAttributeInstance(player);
// Fail-safe.
if (attrInst == null) return 1.0;
return MathUtil.clamp(attrInst.getValue(), 0.0625, 16.0);
}
}
@@ -25,7 +25,6 @@ import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
import fr.neatmonster.nocheatplus.logging.StaticLog;
import fr.neatmonster.nocheatplus.utilities.StringUtil;
import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
public class MCAccessBukkit extends MCAccessBukkitBase implements BlockPropertiesSetup {
@@ -42,10 +41,10 @@ public class MCAccessBukkit extends MCAccessBukkitBase implements BlockPropertie
}
else if (guessItchyBlock(mat)) {
// Uncertain bounding-box, allow passing through.
long flags = BlockProperties.F_IGN_PASSABLE;
long flags = BlockFlags.F_IGN_PASSABLE;
if ((BlockFlags.hasAnyFlag(flags, BlockFlags.SOLID_GROUND))) {
// Block can be ground, so allow standing on any height.
flags |= BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT;
flags |= BlockFlags.F_GROUND | BlockFlags.F_GROUND_HEIGHT;
}
/*
* TODO: Might have to set all blocks to ground here, rather
@@ -32,10 +32,10 @@ import org.bukkit.entity.Slime;
import org.bukkit.potion.PotionEffectType;
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
import fr.neatmonster.nocheatplus.compat.BridgeHealth;
import fr.neatmonster.nocheatplus.compat.MCAccess;
import fr.neatmonster.nocheatplus.utilities.PotionUtil;
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
import fr.neatmonster.nocheatplus.utilities.entity.PotionUtil;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
@@ -75,17 +75,17 @@ public class MCAccessBukkitBase implements MCAccess {
return false;
}
// Fully solid/ground blocks.
final long flags = BlockProperties.getBlockFlags(mat);
final long flags = BlockFlags.getBlockFlags(mat);
/*
* Skip fully passable blocks (partially passable blocks may be itchy,
* though slabs will be easy to handle).
*/
if (BlockFlags.hasAnyFlag(flags, BlockProperties.F_IGN_PASSABLE)) {
if (BlockFlags.hasAnyFlag(flags, BlockFlags.F_IGN_PASSABLE)) {
// TODO: Blocks with min_height may actually be ok, if xz100 and some height are set.
if (BlockFlags.hasNoFlags(flags,
BlockProperties.F_GROUND_HEIGHT
| BlockProperties.F_GROUND
| BlockProperties.F_SOLID)) {
BlockFlags.F_GROUND_HEIGHT
| BlockFlags.F_GROUND
| BlockFlags.F_SOLID)) {
// Explicitly passable.
return false;
}
@@ -94,11 +94,10 @@ public class MCAccessBukkitBase implements MCAccess {
return true;
}
}
long testFlags1 = (BlockProperties.F_SOLID | BlockProperties.F_XZ100);
long testFlags2 = (BlockProperties.F_HEIGHT100
| BlockProperties.F_HEIGHT16_15);
if (BlockFlags.hasAllFlags(flags, testFlags1)
&& BlockFlags.hasAnyFlag(flags, testFlags2)) {
long testFlags1 = (BlockFlags.F_SOLID | BlockFlags.F_XZ100);
long testFlags2 = (BlockFlags.F_HEIGHT100);
if (BlockFlags.hasAllFlags(flags, testFlags1) && BlockFlags.hasAnyFlag(flags, testFlags2)) {
// Solid blocks with explicitly set bounds.
return false;
}
@@ -114,9 +113,9 @@ public class MCAccessBukkitBase implements MCAccess {
@Override
public String getMCVersion() {
// Bukkit API.
// Bukkit API. Versions lower than MC 1.13 have their own module.
// TODO: maybe output something else.
return "1.4.6-1.11.2|?"; // uh oh
return "1.13-1.20"; // uh oh
}
@Override
@@ -175,12 +174,16 @@ public class MCAccessBukkitBase implements MCAccess {
// TODO: For height too. [Automatize most by spawning + checking?]
// Values taken from 1.7.10.
final EntityType type = entity.getType();
Double width = BridgeEntityType.LEGACY_ENTITY_WIDTH.get(type);
if (width != null) {
return width;
}
switch(type){
// TODO: case COMPLEX_PART:
case ENDER_SIGNAL: // this.a(0.25F, 0.25F);
case FIREWORK: // this.a(0.25F, 0.25F);
case FISHING_HOOK: // this.a(0.25F, 0.25F);
case DROPPED_ITEM: // this.a(0.25F, 0.25F);
//case ENDER_SIGNAL: // this.a(0.25F, 0.25F);
//case FIREWORK: // this.a(0.25F, 0.25F);
//case FISHING_HOOK: // this.a(0.25F, 0.25F);
//case DROPPED_ITEM: // this.a(0.25F, 0.25F);
case SNOWBALL: // (projectile) this.a(0.25F, 0.25F);
return 0.25;
case CHICKEN: // this.a(0.3F, 0.7F);
@@ -190,7 +193,7 @@ public class MCAccessBukkitBase implements MCAccess {
case WITHER_SKULL: // this.a(0.3125F, 0.3125F);
return 0.3125f;
case GHAST: // this.a(4.0F, 4.0F);
case SNOWMAN: // this.a(0.4F, 1.8F);
//case SNOWMAN: // this.a(0.4F, 1.8F);
return 0.4f;
case ARROW: // this.a(0.5F, 0.5F);
case BAT: // this.a(0.5F, 0.9F);
@@ -200,7 +203,6 @@ public class MCAccessBukkitBase implements MCAccess {
return 0.5f;
case PLAYER: // FAST RETURN
case ZOMBIE:
case PIG_ZOMBIE:
case SKELETON:
case CREEPER:
case ENDERMAN:
@@ -213,24 +215,24 @@ public class MCAccessBukkitBase implements MCAccess {
case CAVE_SPIDER: // this.a(0.7F, 0.5F);
return 0.7f;
case COW: // this.a(0.9F, 1.3F);
case MUSHROOM_COW: // this.a(0.9F, 1.3F);
//case MUSHROOM_COW: // this.a(0.9F, 1.3F);
case PIG: // this.a(0.9F, 0.9F);
case SHEEP: // this.a(0.9F, 1.3F);
case WITHER: // this.a(0.9F, 4.0F);
return 0.9f;
case SQUID: // this.a(0.95F, 0.95F);
return 0.95f;
case PRIMED_TNT: // this.a(0.98F, 0.98F);
return 0.98f;
//case PRIMED_TNT: // this.a(0.98F, 0.98F);
// return 0.98f;
case FIREBALL: // (EntityFireball) this.a(1.0F, 1.0F);
return 1.0f;
case IRON_GOLEM: // this.a(1.4F, 2.9F);
case SPIDER: // this.a(1.4F, 0.9F);
return 1.4f;
case BOAT: // this.a(1.5F, 0.6F);
return 1.5f;
case ENDER_CRYSTAL: // this.a(2.0F, 2.0F);
return 2.0f;
// case BOAT: // this.a(1.5F, 0.6F);
// return 1.5f;
//case ENDER_CRYSTAL: // this.a(2.0F, 2.0F);
// return 2.0f;
case GIANT: // this.height *= 6.0F; this.a(this.width * 6.0F, this.length * 6.0F);
return 3.6f; // (Better than nothing.)
case ENDER_DRAGON: // this.a(16.0F, 8.0F);
@@ -245,6 +247,9 @@ public class MCAccessBukkitBase implements MCAccess {
default:
break;
}
if (MaterialUtil.isBoat(entity.getType())) {
return ServerVersion.isHigherThan("1.8") ? 1.3964844f : 1.4f;
}
// Check by instance for minecarts (too many).
if (entity instanceof Minecart) {
return 0.98f; // this.a(0.98F, 0.7F);
@@ -252,8 +257,8 @@ public class MCAccessBukkitBase implements MCAccess {
// Latest Bukkit API.
try {
switch (type) {
case LEASH_HITCH: // hanging: this.a(0.5F, 0.5F);
return 0.5f;
//case LEASH_HITCH: // hanging: this.a(0.5F, 0.5F);
// return 0.5f;
case HORSE: // this.a(1.4F, 1.6F);
return 1.4f;
// 1.8
@@ -310,7 +315,7 @@ public class MCAccessBukkitBase implements MCAccess {
@Override
public double getJumpAmplifier(final Player player) {
return PotionUtil.getPotionEffectAmplifier(player, PotionEffectType.JUMP);
return PotionUtil.getPotionEffectAmplifier(player, BridgePotionEffect.JUMP_BOOST);
}
@Override
@@ -377,6 +382,11 @@ public class MCAccessBukkitBase implements MCAccess {
return AlmostBoolean.NO; // Assumption.
}
@Override
public boolean resetActiveItem(Player player) {
return false; // Assumption.
}
// @Override
// public void correctDirection(Player player) {
// // TODO: Consider using reflection (detect CraftPlayer, access EntityPlayer + check if possible (!), use flags for if valid or invalid.)
@@ -18,106 +18,172 @@ import java.util.HashMap;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
import fr.neatmonster.nocheatplus.compat.blocks.init.BlockInit;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitAnvil;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitBamboo;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitBell;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitCake;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitCauldron;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitChorusPlant;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitCocoa;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitDirectionalCentered;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitDoor;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitDripLeaf;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitDripStone;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitEndPortalFrame;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitFence;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitFetchableBound;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitFetchableBounds;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitGate;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitGrindStone;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitHopper;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitLadder;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitLantern;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitLevelled;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitPiston;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitPistonHead;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitPowderSnow;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitRail;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitSeaPickle;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitShapeModel;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitShulkerBox;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitSlab;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitSnow;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitStairs;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitStatic;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitTrapDoor;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitTurtleEgg;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitWall;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitWallHead;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitWaterPlant;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectBase;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectDamageSource;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectDamageSources;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectLivingEntity;
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.map.MaterialUtil;
public class MCAccessBukkitModern extends MCAccessBukkit {
protected ReflectBase reflectBase = null;
protected ReflectDamageSource reflectDamageSource = null;
protected ReflectDamageSources reflectDamageSources = null;
protected ReflectLivingEntity reflectLivingEntity = null;
protected final Map<Material, BukkitShapeModel> shapeModels = new HashMap<Material, BukkitShapeModel>();
// Blocks that can be fetched automatically from the Bukkit API
private static final BukkitShapeModel MODEL_AUTO_FETCH = new BukkitFetchableBounds();
private static final BukkitShapeModel MODEL_AUTO_FETCH_LEGACY = new BukkitFetchableBound();
// Blocks that are formed from multiple bounding boxes
private static final BukkitShapeModel MODEL_BREWING_STAND = new BukkitStatic(
// Bottom rod
0.0625, 0.0, 0.0625, 0.9375, 0.125, 0.9375,
// Rod
0.4375, 0.125, 0.4375, 0.5625, 0.875, 0.5625
);
private static final BukkitShapeModel MODEL_CANDLE_CAKE = new BukkitStatic(
// Cake
0.0625, 0.0, 0.0625, 0.9375, 0.5, 0.9375,
// Candle
0.4375, 0.5, 0.4375, 0.5625, 0.875, 0.5625
);
private static final BukkitShapeModel MODEL_LECTERN = new BukkitStatic(
// Post
0.0, 0.0, 0.0, 1.0, 0.125, 1.0,
// Lectern
0.25, 0.125, 0.25, 0.75, 0.875, 0.75
);
private static final BukkitShapeModel MODEL_HOPPER = new BukkitHopper();
private static final BukkitShapeModel MODEL_CAULDRON = new BukkitCauldron(0.1875, 0.125, 0.8125, 0.0625);
private static final BukkitShapeModel MODEL_COMPOSTER = new BukkitCauldron(0.0, 0.125, 1.0, 0.125);
private static final BukkitShapeModel MODEL_PISTON_HEAD = new BukkitPistonHead();
private static final BukkitShapeModel MODEL_BELL = new BukkitBell();
private static final BukkitShapeModel MODEL_ANVIL = new BukkitAnvil();
private static final BukkitShapeModel MODEL_GRIND_STONE = new BukkitGrindStone();
// Blocks that change shape based on interaction or redstone.
private static final BukkitShapeModel MODEL_DOOR = new BukkitDoor();
private static final BukkitShapeModel MODEL_TRAP_DOOR = new BukkitTrapDoor();
private static final BukkitShapeModel MODEL_GATE = new BukkitGate(
0.375, 1.5);
private static final BukkitShapeModel MODEL_GATE = new BukkitGate(0.375, 1.5);
private static final BukkitShapeModel MODEL_SHULKER_BOX = new BukkitShulkerBox();
private static final BukkitShapeModel MODEL_CHORUS_PLANT = new BukkitChorusPlant();
private static final BukkitShapeModel MODEL_DRIP_LEAF = new BukkitDripLeaf();
// Blocks with different heights based on whatever.
private static final BukkitShapeModel MODEL_END_PORTAL_FRAME = new BukkitEndPortalFrame();
private static final BukkitShapeModel MODEL_SEA_PICKLE = new BukkitSeaPickle();
private static final BukkitShapeModel MODEL_COCOA = new BukkitCocoa();
private static final BukkitShapeModel MODEL_TURTLE_EGG = new BukkitTurtleEgg();
private static final BukkitShapeModel MODEL_POWDER_SNOW = new BukkitPowderSnow();
// Blocks that have a different shape, based on how they have been placed.
private static final BukkitShapeModel MODEL_CAKE = new BukkitCake();
private static final BukkitShapeModel MODEL_SLAB = new BukkitSlab();
private static final BukkitShapeModel MODEL_STAIRS= new BukkitStairs();
private static final BukkitShapeModel MODEL_END_ROD = new BukkitDirectionalCentered(
0.375, 1.0, false);
private static final BukkitShapeModel MODEL_STAIRS = new BukkitStairs();
private static final BukkitShapeModel MODEL_SNOW = new BukkitSnow();
private static final BukkitShapeModel MODEL_PISTON = new BukkitPiston();
private static final BukkitShapeModel MODEL_LEVELLED = new BukkitLevelled();
private static final BukkitShapeModel MODEL_LADDER = new BukkitLadder();
private static final BukkitShapeModel MODEL_RAIL = new BukkitRail();
private static final BukkitShapeModel MODEL_END_ROD = new BukkitDirectionalCentered(0.375, 1.0, false);
// Blocks that have a different shape with neighbor blocks (bukkit takes care though).
private static final BukkitShapeModel MODEL_THIN_FENCE = new BukkitFence(
0.4375, 1.0);
private static final BukkitShapeModel MODEL_THICK_FENCE = new BukkitFence(
0.375, 1.5);
private static final BukkitShapeModel MODEL_THIN_FENCE = new BukkitFence(0.4375, 1.0);
private static final BukkitShapeModel MODEL_THICK_FENCE = new BukkitFence(0.375, 1.5);
private static final BukkitShapeModel MODEL_THICK_FENCE2 = new BukkitWall(0.25, 1.5, 0.3125); // .75 .25 0 max: .25 .75 .5
private static final BukkitShapeModel MODEL_WALL_HEAD = new BukkitWallHead();
// Static blocks (various height and inset values).
private static final BukkitShapeModel MODEL_LILY_PAD = new BukkitStatic(
0.09375);
private static final BukkitShapeModel MODEL_FLOWER_POT = new BukkitStatic(
0.33, 0.375); // TODO: XZ really?
private static final BukkitShapeModel MODEL_GROUND_HEAD= new BukkitStatic(
0.25, 0.5); // TODO: XZ-really? 275 ?
private static final BukkitShapeModel MODEL_SINGLE_CHEST = new BukkitStatic(
0.062, .875); // TODO: 0.0625?
private static final BukkitShapeModel MODEL_CAMPFIRE = new BukkitStatic(0.0, 0.4375);
private static final BukkitShapeModel MODEL_BAMBOO = new BukkitBamboo();
private static final BukkitShapeModel MODEL_POINTED_DRIPSTONE = new BukkitDripStone();
private static final BukkitShapeModel MODEL_WATER_PLANTS = new BukkitWaterPlant();
private static final BukkitShapeModel MODEL_LILY_PAD = new BukkitStatic(0.0625, 0.09375);
private static final BukkitShapeModel MODEL_FLOWER_POT = new BukkitStatic(0.3125, 0.375);
private static final BukkitShapeModel MODEL_LANTERN = new BukkitLantern();
private static final BukkitShapeModel MODEL_CONDUIT = new BukkitStatic(0.3125, 0.3125, 0.3125, 0.6875, 0.6875, 0.6875);
private static final BukkitShapeModel MODEL_GROUND_HEAD = new BukkitStatic(0.25, 0.5);
private static final BukkitShapeModel MODEL_SINGLE_CHEST = new BukkitStatic(0.0625, 0.875);
private static final BukkitShapeModel MODEL_HONEY_BLOCK = new BukkitStatic(0.0625, 0.9375);
private static final BukkitShapeModel MODEL_SCULK_SHRIEKER = new BukkitStatic(0.0, 0.5);
// Static blocks with full height sorted by inset.
private static final BukkitShapeModel MODEL_INSET16_1_HEIGHT100 = new BukkitStatic(
0.0625, 1.0);
private static final BukkitShapeModel MODEL_INSET16_1_HEIGHT100 = new BukkitStatic(0.0625, 1.0);
// Static blocks with full xz-bounds sorted by height.
private static final BukkitShapeModel MODEL_XZ100_HEIGHT16_1 = new BukkitStatic(
0.0625);
private static final BukkitShapeModel MODEL_XZ100_HEIGHT8_1 = new BukkitStatic(
0.125);
private static final BukkitShapeModel MODEL_XZ100_HEIGHT8_3 = new BukkitStatic(
0.375);
private static final BukkitShapeModel MODEL_XZ100_HEIGHT16_9 = new BukkitStatic(
0.5625);
private static final BukkitShapeModel MODEL_XZ100_HEIGHT4_3 = new BukkitStatic(
0.75);
private static final BukkitShapeModel MODEL_XZ100_HEIGHT8_7 = new BukkitStatic(
0.875);
private static final BukkitShapeModel MODEL_XZ100_HEIGHT16_15 = new BukkitStatic(
0.9375);
/*
* TODO:
* LADDER,
* CONDUIT,
* CHORUS_FLOWER, CHORUS_PLANT, COCOA,
* TURTLE_EGG, SEA_PICKLE,
* VINE,
* CAKE,
*/
// TODO: anvils, dead coral fans
// TODO: Liquid (all leveled).
private static final BukkitShapeModel MODEL_XZ100_HEIGHT16_1 = new BukkitStatic(0.0625);
private static final BukkitShapeModel MODEL_XZ100_HEIGHT8_1 = new BukkitStatic(0.125);
private static final BukkitShapeModel MODEL_XZ100_HEIGHT8_3 = new BukkitStatic(0.375);
private static final BukkitShapeModel MODEL_XZ100_HEIGHT16_9 = new BukkitStatic(0.5625);
private static final BukkitShapeModel MODEL_XZ100_HEIGHT4_3 = new BukkitStatic(0.75);
private static final BukkitShapeModel MODEL_XZ100_HEIGHT16_15 = new BukkitStatic(0.9375);
private static final BukkitShapeModel MODEL_XZ100_HEIGHT8_7 = new BukkitStatic(0.875);
public MCAccessBukkitModern() {
super();
// TODO: Generic setup via Bukkit interface existence/relations, +- fetching methods.
BlockInit.assertMaterialExists("OAK_LOG");
BlockInit.assertMaterialExists("CAVE_AIR");
try {
this.reflectBase = new ReflectBase();
this.reflectDamageSource = new ReflectDamageSource(this.reflectBase);
this.reflectLivingEntity = new ReflectLivingEntity(this.reflectBase, null, this.reflectDamageSource);
// Can be null
this.reflectDamageSources = new ReflectDamageSources(this.reflectBase, this.reflectDamageSource);
}
catch (ClassNotFoundException ex) {}
}
@Override
public String getMCVersion() {
return "1.13|?";
return "1.13-1.21";
}
@Override
@@ -132,81 +198,165 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
@Override
public void setupBlockProperties(final WorldConfigProvider<?> worldConfigProvider) {
/*
* TODO: Incomplete blocks bounds still use workarounds(not affect movement):
* All fences, glass pane, iron bar, chorus plant, hopper
*
* Legacy blocks still use workarounds(not affect movement):
* All fences, glass pane, iron bar, chorus plant, hopper, cauldron
*
* Scaffolding(affect fall dmg)
*
*/
// 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 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);
BlockFlags.setBlockFlags(Material.COCOA, blockFix);
BlockFlags.setBlockFlags(Material.TURTLE_EGG, blockFix);
BlockFlags.setBlockFlags(Material.CHORUS_PLANT, blockFix);
BlockFlags.setBlockFlags(Material.CREEPER_WALL_HEAD, blockFix);
BlockFlags.setBlockFlags(Material.ZOMBIE_WALL_HEAD, blockFix);
BlockFlags.setBlockFlags(Material.PLAYER_WALL_HEAD, blockFix);
BlockFlags.setBlockFlags(Material.DRAGON_WALL_HEAD, blockFix);
BlockFlags.setBlockFlags(Material.WITHER_SKELETON_WALL_SKULL, blockFix);
BlockFlags.setBlockFlags(Material.SKELETON_WALL_SKULL, blockFix);
// Directly keep blocks as is.
for (final Material mat : new Material[] {
Material.CAULDRON,
BridgeMaterial.COBWEB,
Material.HOPPER,
BridgeMaterial.MOVING_PISTON,
Material.SNOW
}) {
BridgeMaterial.COBWEB,
BridgeMaterial.MOVING_PISTON,
Material.SNOW,
Material.BEACON,
Material.VINE,
Material.CHORUS_FLOWER}) {
processedBlocks.add(mat);
}
for (final Material mat : BridgeMaterial.getAllBlocks(
"light", "glow_lichen", "big_dripleaf_stem",
// TODO: Not fully tested
"scaffolding")) {
processedBlocks.add(mat);
}
// Candle
for (Material mat : MaterialUtil.ALL_CANDLES) {
addModel(mat, MODEL_AUTO_FETCH);
}
// Amethyst
for (Material mat : MaterialUtil.AMETHYST) {
addModel(mat, MODEL_AUTO_FETCH);
}
// new flower, and others
for (Material mat : BridgeMaterial.getAllBlocks(
"azalea", "flowering_azalea",
"sculk_sensor", "frogspawn",
"sniffer_egg", "decorated_pot", "pitcher_crop", "calibrated_sculk_sensor", "bubble_column",
"closed_eyeblossom", "open_eyeblossom", "pale_hanging_moss", "resin_clump")) {
addModel(mat, MODEL_AUTO_FETCH);
}
// *WALL* hanging signs have a collision box. Simple hanging signs don't, so they are treated as an ordinary sign.
for (Material mat : MaterialUtil.WALL_HANGING_SIGNS) {
// Only the post has an actual collision box, the rest is all hit box.
addModel(mat, MODEL_AUTO_FETCH);
}
for (Material mat : BridgeMaterial.getAllBlocks(
"stonecutter", "chain")) {
addModel(mat, MODEL_AUTO_FETCH_LEGACY);
}
// Camp fire
for (Material mat : BridgeMaterial.getAllBlocks(
"campfire", "soul_campfire")) {
addModel(mat, MODEL_CAMPFIRE);
}
// Cauldron
for (Material mat : MaterialUtil.CAULDRON) {
BlockFlags.setBlockFlags(mat, BlockFlags.SOLID_GROUND);
addModel(mat, MODEL_CAULDRON);
}
//Anvil
for (Material mat : new Material[] {
Material.ANVIL,
Material.CHIPPED_ANVIL,
Material.DAMAGED_ANVIL}) {
addModel(mat, MODEL_ANVIL);
}
// Lily pad
addModel(BridgeMaterial.LILY_PAD, MODEL_LILY_PAD);
// End portal frame.
addModel(BridgeMaterial.END_PORTAL_FRAME, MODEL_END_PORTAL_FRAME);
// End rod.
addModel(Material.END_ROD, MODEL_END_ROD);
// Cake
addModel(BridgeMaterial.CAKE, MODEL_CAKE);
// 1/16 inset at full height.
for (Material mat : new Material[] {
Material.CACTUS,
Material.DRAGON_EGG
}) {
addModel(mat, MODEL_INSET16_1_HEIGHT100);
// End Rod / Lightning Rod.
for (Material mat : MaterialUtil.RODS) {
addModel(mat, MODEL_END_ROD);
}
// 1/8 height.
// Hoppers - min height changed in 1.13+
addModel(Material.HOPPER, MODEL_HOPPER);
// Ladder
addModel(Material.LADDER, MODEL_LADDER);
// BrewingStand
addModel(Material.BREWING_STAND, MODEL_BREWING_STAND);
// 1/16 inset at full height blocks.
addModel(Material.DRAGON_EGG, MODEL_INSET16_1_HEIGHT100);
addModel(Material.CACTUS, MODEL_HONEY_BLOCK);
// 1/8 height blocks.
for (Material mat : new Material[] {
BridgeMaterial.REPEATER,
Material.COMPARATOR
}) {
BridgeMaterial.REPEATER,
Material.COMPARATOR }) {
addModel(mat, MODEL_XZ100_HEIGHT8_1);
}
// 3/8 height.
// 3/8 height blocks.
for (Material mat : new Material[] {
Material.DAYLIGHT_DETECTOR
}) {
Material.DAYLIGHT_DETECTOR}) {
addModel(mat, MODEL_XZ100_HEIGHT8_3);
}
// 3/4 height.
// 3/4 height blocks.
for (Material mat : new Material[] {
BridgeMaterial.ENCHANTING_TABLE
}) {
BridgeMaterial.ENCHANTING_TABLE}) {
addModel(mat, MODEL_XZ100_HEIGHT4_3);
}
// All candle cakes
for (Material mat : MaterialUtil.ALL_CANDLE_CAKE) {
addModel(mat, MODEL_CANDLE_CAKE);
}
// 7/8 height.
for (Material mat : new Material[] {
Material.BREWING_STAND // TODO: base is 1/8, center 0.875 - needs multi-cuboid.
}) {
Material.SOUL_SAND}) {
addModel(mat, MODEL_XZ100_HEIGHT8_7);
}
// 16/15 height, full xz bounds.
for (Material mat : new Material[] {
Material.GRASS_PATH, BridgeMaterial.FARMLAND
}) {
BridgeMaterial.GRASS_PATH,
BridgeMaterial.FARMLAND}) {
addModel(mat, MODEL_XZ100_HEIGHT16_15);
}
// Thin fence: Glass panes, iron bars.
for (final Material mat : MaterialUtil.addBlocks(
MaterialUtil.GLASS_PANES, BridgeMaterial.IRON_BARS)) {
MaterialUtil.GLASS_PANES,
BridgeMaterial.IRON_BARS)) {
addModel(mat, MODEL_THIN_FENCE);
}
@@ -223,9 +373,7 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
// Chests.
// TOOD: Might add a facing/directional extension for double chests.
for (Material mat : BridgeMaterial.getAllBlocks(
"chest", "trapped_chest",
"ender_chest"
)) {
"chest", "trapped_chest", "ender_chest")) {
addModel(mat, MODEL_SINGLE_CHEST);
}
@@ -238,7 +386,31 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
for (Material mat : MaterialUtil.FLOWER_POTS) {
addModel(mat, MODEL_FLOWER_POT);
}
// Turtle Eggs.
for (Material mat : new Material[] {
Material.TURTLE_EGG}) {
addModel(mat, MODEL_TURTLE_EGG);
}
// Conduit
for (Material mat : new Material[] {
Material.CONDUIT}) {
addModel(mat, MODEL_CONDUIT);
}
// Cocoa
for (Material mat : new Material[] {
Material.COCOA}) {
addModel(mat, MODEL_COCOA);
}
// Sea Pickles
for (Material mat : new Material[] {
Material.SEA_PICKLE}) {
addModel(mat, MODEL_SEA_PICKLE);
}
// Carpets.
for (final Material mat : MaterialUtil.CARPETS) {
addModel(mat, MODEL_XZ100_HEIGHT16_1);
@@ -249,6 +421,11 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
addModel(mat, MODEL_GROUND_HEAD);
}
// Heads on walls.
for (final Material mat : MaterialUtil.HEADS_WALL) {
addModel(mat, MODEL_WALL_HEAD);
}
// Doors.
for (final Material mat : MaterialUtil.ALL_DOORS) {
addModel(mat, MODEL_DOOR);
@@ -258,27 +435,173 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
for (final Material mat : MaterialUtil.ALL_TRAP_DOORS) {
addModel(mat, MODEL_TRAP_DOOR);
}
// Chorus Plant.
for (Material mat : new Material[] {
Material.CHORUS_PLANT}) {
addModel(mat, MODEL_CHORUS_PLANT);
}
// Lantern.
for (Material mat : BridgeMaterial.getAllBlocks(
"lantern", "soul_lantern")) {
addModel(mat, MODEL_LANTERN);
}
// Piston.
for (Material mat : BridgeMaterial.getAllBlocks(
"piston", "sticky_piston", "piston_base", "piston_sticky_base")) {
addModel(mat, MODEL_PISTON);
}
// Piston Head.
addModel(BridgeMaterial.PISTON_HEAD, MODEL_PISTON_HEAD);
// Snow.
addModel(Material.SNOW, MODEL_SNOW);
// Levelled blocks.
for (Material mat : MaterialUtil.WATER) {
addModel(mat, MODEL_LEVELLED);
}
for (Material mat : MaterialUtil.LAVA) {
addModel(mat, MODEL_LEVELLED);
}
// All water plants
for (Material mat : MaterialUtil.WATER_PLANTS) {
addModel(mat, MODEL_WATER_PLANTS);
}
// Rails.
for (final Material mat : MaterialUtil.RAILS) {
addModel(mat, MODEL_RAIL);
}
// Walls.
for (Material mat : MaterialUtil.ALL_WALLS) {
BlockFlags.setBlockFlags(mat, BlockFlags.SOLID_GROUND | BlockFlags.F_VARIABLE);
addModel(mat, MODEL_THICK_FENCE2);
}
// Lectern.
Material mt = BridgeMaterial.getBlock("lectern");
if (mt != null) addModel(mt, MODEL_LECTERN);
// PowderSnow.
mt = BridgeMaterial.getBlock("powder_snow");
if (mt != null) addModel(mt, MODEL_POWDER_SNOW);
// Bamboo.
mt = BridgeMaterial.getBlock("bamboo");
if (mt != null) addModel(mt, MODEL_BAMBOO);
// Dripstone.
mt = BridgeMaterial.getBlock("pointed_dripstone");
if (mt != null) addModel(mt, MODEL_POINTED_DRIPSTONE);
// Bell.
mt = BridgeMaterial.getBlock("bell");
if (mt != null) addModel(mt, MODEL_BELL);
// Composter.
mt = BridgeMaterial.getBlock("composter");
if (mt != null) addModel(mt, MODEL_COMPOSTER);
// Honey Block.
mt = BridgeMaterial.getBlock("honey_block");
if (mt != null) addModel(mt, MODEL_HONEY_BLOCK);
// Big DripLeaf.
mt = BridgeMaterial.getBlock("big_dripleaf");
if (mt != null) addModel(mt, MODEL_DRIP_LEAF);
// Grindstone.
mt = BridgeMaterial.getBlock("grindstone");
if (mt != null) addModel(mt, MODEL_GRIND_STONE);
// Sculk Shrieker
mt = BridgeMaterial.getBlock("sculk_shrieker");
if (mt != null) addModel(mt, MODEL_SCULK_SHRIEKER);
// Mud
mt = BridgeMaterial.getBlock("mud");
if (mt != null) addModel(mt, MODEL_XZ100_HEIGHT8_7);
// Heavy core
mt = BridgeMaterial.getBlock("heavy_core");
if (mt != null) addModel(mt, MODEL_GROUND_HEAD);
// Sort to processed by flags.
for (final Material mat : Material.values()) {
final long flags = BlockProperties.getBlockFlags(mat);
final long flags = BlockFlags.getBlockFlags(mat);
// Stairs.
if (BlockFlags.hasAnyFlag(flags, BlockProperties.F_STAIRS)) {
if (BlockFlags.hasAnyFlag(flags, BlockFlags.F_STAIRS)) {
addModel(mat, MODEL_STAIRS);
}
// Fences, cobblestone wall.
if (BlockFlags.hasAnyFlag(flags, BlockProperties.F_THICK_FENCE)) {
if (BlockFlags.hasAnyFlag(flags, BlockProperties.F_PASSABLE_X4)) {
// Fences.
if (BlockFlags.hasAnyFlag(flags, BlockFlags.F_THICK_FENCE)) {
if (BlockFlags.hasAnyFlag(flags, BlockFlags.F_PASSABLE_X4)) {
// TODO: Perhaps another model flag.
addModel(mat, MODEL_GATE);
}
else {
addModel(mat, MODEL_THICK_FENCE);
}
else addModel(mat, MODEL_THICK_FENCE);
}
}
super.setupBlockProperties(worldConfigProvider);
}
private Object getHandle(Player player) {
// TODO: CraftPlayer check (isAssignableFrom)?
if (this.reflectLivingEntity == null || this.reflectLivingEntity.obcGetHandle == null) {
return null;
}
return ReflectionUtil.invokeMethodNoArgs(this.reflectLivingEntity.obcGetHandle, player);
}
private boolean canDealFallDamage() {
return this.reflectLivingEntity != null && this.reflectLivingEntity.nmsDamageEntity != null
&& (this.reflectDamageSource.nmsFALL != null || this.reflectDamageSources != null);
}
@Override
public AlmostBoolean dealFallDamageFiresAnEvent() {
return canDealFallDamage() ? AlmostBoolean.YES : AlmostBoolean.NO;
}
@Override
public void dealFallDamage(Player player, double damage) {
if (canDealFallDamage()) {
Object handle = getHandle(player);
if (handle != null) {
// Direct accessing DamageSource
Object damageSource = this.reflectDamageSource.nmsFALL;
if (damageSource == null) {
// Fail, second attempt
damageSource = this.reflectDamageSources.getDamageSource(handle);
if (damageSource == null) {
// Fail, deal generic damage
BridgeHealth.damage(player, damage);
// Disable class to prevent continuous damage
reflectDamageSources = null;
return;
}
}
ReflectionUtil.invokeMethod(this.reflectLivingEntity.nmsDamageEntity, handle, damageSource, (float) damage);
}
}
else BridgeHealth.damage(player, damage);
}
@Override
public boolean resetActiveItem(Player player) {
if (this.reflectLivingEntity != null && this.reflectLivingEntity.nmsclearActiveItem != null) {
Object handle = getHandle(player);
if (handle != null) {
ReflectionUtil.invokeMethodNoArgs(this.reflectLivingEntity.nmsclearActiveItem, handle);
return true;
}
}
return false;
}
}
@@ -0,0 +1,249 @@
/*
* 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;
import org.bukkit.NamespacedKey;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.attribute.AttributeModifier.Operation;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
import fr.neatmonster.nocheatplus.compat.AttribUtil;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
import fr.neatmonster.nocheatplus.compat.versions.ClientVersion;
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
import fr.neatmonster.nocheatplus.components.modifier.IAttributeAccess;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
import fr.neatmonster.nocheatplus.utilities.map.MaterialUtil;
import fr.neatmonster.nocheatplus.utilities.math.MathUtil;
import fr.neatmonster.nocheatplus.utilities.moving.Magic;
public class NSBukkitAttributeAccess implements IAttributeAccess {
public NSBukkitAttributeAccess() {
if (ReflectionUtil.getClass("org.bukkit.attribute.AttributeInstance") == null) {
throw new RuntimeException("Service not available.");
}
}
private int operationToInt(final Operation operation) {
switch (operation) {
case ADD_NUMBER:
return 0;
case ADD_SCALAR:
return 1;
case MULTIPLY_SCALAR_1:
return 2;
default:
throw new RuntimeException("Unknown operation: " + operation);
}
}
/**
* The first modifier with the given id that can be found, or null if none
* is found.
*
* @param attrInst
* @param id
* @return
*/
private AttributeModifier getModifier(final AttributeInstance attrInst, final NamespacedKey id) {
for (final AttributeModifier mod : attrInst.getModifiers()) {
if (id.equals(mod.getKey())) {
return mod;
}
}
return null;
}
private double getMultiplier(final AttributeModifier mod) {
return AttribUtil.getMultiplier(operationToInt(mod.getOperation()), mod.getAmount());
}
@Override
public double getSpeedMultiplier(final Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.MOVEMENT_SPEED);
final double val = attrInst.getValue() / attrInst.getBaseValue();
final AttributeModifier mod = getModifier(attrInst, AttribUtil.NSID_SPRINT_BOOST);
return mod == null ? val : (val / getMultiplier(mod));
}
@Override
public double getSprintMultiplier(final Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.MOVEMENT_SPEED);
final AttributeModifier mod = getModifier(attrInst, AttribUtil.NSID_SPRINT_BOOST);
return mod == null ? 1.0 : getMultiplier(mod);
}
@Override
public float getMovementSpeed(final Player player) {
// / by 2 to get the base value 0.1f
return (player.getWalkSpeed() / 2f) * (float) getSpeedMultiplier(player);
}
@Override
public double getGravity(final Player player) {
double gravity;
if (!BridgeMisc.hasGravity(player)) {
return 0.0;
}
final PlayerMoveData thisMove = DataManager.getPlayerData(player).getGenericInstance(MovingData.class).playerMoves.getCurrentMove();
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.GRAVITY);
// Fail-safe.
if (attrInst == null) {
gravity = thisMove.yDistance <= 0.0 && !Double.isInfinite(Bridge1_13.getSlowfallingAmplifier(player)) ? Magic.SLOW_FALL_GRAVITY : Magic.DEFAULT_GRAVITY;
}
else gravity = MathUtil.clamp(attrInst.getValue(), -1.0, 1.0);
if (thisMove.yDistance <= 0.0 && !Double.isInfinite(Bridge1_13.getSlowfallingAmplifier(player))) {
gravity = Math.min(gravity, Magic.SLOW_FALL_GRAVITY);
}
return gravity;
}
@Override
public double getSafeFallDistance(final Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.SAFE_FALL_DISTANCE);
// Fail-safe
if (attrInst == null) return Magic.FALL_DAMAGE_DIST;
return MathUtil.clamp(attrInst.getValue(), -1024.0, 1024.0);
}
@Override
public double getFallDamageMultiplier(final Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.FALL_DAMAGE_MULTIPLIER);
// Fail-safe
if (attrInst == null) return 1.0;
return MathUtil.clamp(attrInst.getValue(), 1.0, 100.0);
}
@Override
public double getBreakingSpeedMultiplier(final Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.BLOCK_BREAK_SPEED);
// Fail-safe
if (attrInst == null) return 1.0;
return MathUtil.clamp(attrInst.getValue(), 1.0, 1024.0);
}
@Override
public double getJumpGainMultiplier(final Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.JUMP_STRENGTH);
// Fail-safe
if (attrInst == null) return 1.0;
// Convert it to a multiplier, because we use our own handling for jumping motion.
final double toMultiplier = attrInst.getValue() / attrInst.getBaseValue();
return MathUtil.clamp(toMultiplier, 0.0, 76.19047619047619); // MathUtil.clamp(attrInst.getValue(), 0.0, 32.0);
}
@Override
public double getPlayerSneakingFactor(final Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.SNEAKING_SPEED);
// Fail-safe.
if (attrInst == null) return Magic.SNEAK_MULTIPLIER + BridgeEnchant.getSwiftSneakIncrement(player);
return MathUtil.clamp(attrInst.getValue(), 0.0, 1.0);
}
@Override
public double getPlayerMaxBlockReach(final Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.INTERACTION_RANGE);
// Fail-safe
if (attrInst == null) return 4.5;
return MathUtil.clamp(attrInst.getValue(), 0.0, 64.0);
}
@Override
public double getPlayerMaxAttackReach(final Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.ATTACK_RANGE);
// Fail-safe
if (attrInst == null) return 3.0;
return MathUtil.clamp(attrInst.getValue(), 0.0, 64.0);
}
@Override
public double getMaxStepUp(final Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.STEP_HEIGHT);
if (attrInst == null) {
// Fail-safe.
if (player.isInsideVehicle()) {
if (player.getVehicle() != null && MaterialUtil.isBoat(player.getVehicle().getType())) {
return 0.0;
}
return 1.0;
}
final MovingConfig cc = DataManager.getPlayerData(player).getGenericInstance(MovingConfig.class);
return cc.sfStepHeight;
}
return MathUtil.clamp(attrInst.getValue(), 0.0, 10.0);
}
@Override
public float getMovementEfficiency(Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.MOVEMENT_EFFICIENCY);
// Fail-safe.
if (attrInst == null) return 0.0f;
return (float) MathUtil.clamp(attrInst.getValue(), 0.0, 1.0);
}
@Override
public float getWaterMovementEfficiency(Player player) {
final IPlayerData pData = DataManager.getPlayerData(player);
if (pData.getClientVersion().isLowerThan(ClientVersion.V_1_8)) {
// Doesn't exist.
return 0f;
}
final float depthStrider = BridgeEnchant.getDepthStriderLevel(player);
if (pData.getClientVersion().isLowerThan(ClientVersion.V_1_21)) {
// Use the legacy method.
return depthStrider;
}
if (ServerVersion.isLowerThan("1.21")) {
// Simulate what ViaVersion does for newer (1.21 clients) on older (1.21-) servers.
return depthStrider / 3.0f;
}
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.WATER_MOVEMENT_EFFICIENCY);
if (attrInst == null) return 0.0f;
return (float) MathUtil.clamp(attrInst.getValue(), 0.0f, 1.0f);
}
@Override
public double getSubmergedMiningSpeedMultiplier(Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.SUBMERGED_MINING_SPEED);
// Fail-safe.
if (attrInst == null) return 1.0;
return MathUtil.clamp(attrInst.getValue(), 0.0, 20.0);
}
@Override
public double getMiningEfficiency(Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.MINING_EFFICIENCY);
// Fail-safe.
if (attrInst == null) return 0.0;
return MathUtil.clamp(attrInst.getValue(), 0.0, 1024.0);
}
@Override
public double getEntityScale(Player player) {
final AttributeInstance attrInst = player.getAttribute(BridgeAttribute.SCALE);
// Fail-safe.
if (attrInst == null) return 1.0;
return MathUtil.clamp(attrInst.getValue(), 0.0625, 16.0);
}
}
@@ -35,8 +35,7 @@ public abstract class AbstractBukkitCentered implements BukkitShapeModel {
private final double length;
protected final boolean invertFace;
public AbstractBukkitCentered(double inset, double length,
boolean invertFace) {
public AbstractBukkitCentered(double inset, double length, boolean invertFace) {
// TODO: Might add a signature to specify minY and maxY (attach NWSE only).
this.minDist = inset;
this.maxDist = 1.0 - inset;
@@ -47,47 +46,34 @@ public abstract class AbstractBukkitCentered implements BukkitShapeModel {
protected abstract BlockFace getFacing(BlockData blockData);
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
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();
final BlockFace facing = invertFace
? getFacing(blockData).getOppositeFace()
: getFacing(blockData);
// TODO: Evaluate if (some) faces need to be inverted.
// End rod facing: the direction it points to.
switch (facing) {
case EAST:
return new double[] {0.0, minDist, minDist,
length, maxDist, maxDist};
case WEST:
return new double[] {1.0 - length, minDist, minDist,
1.0, maxDist, maxDist};
case SOUTH:
return new double[] {minDist, minDist, 0.0,
maxDist, maxDist, length};
case NORTH:
return new double[] {minDist, minDist, 1.0 - length,
maxDist, maxDist, 1.0};
case DOWN:
return new double[] {minDist, 1.0 - length, minDist,
maxDist, 1.0, maxDist};
case UP:
return new double[] {minDist, 0.0, minDist,
maxDist, length, maxDist};
default:
break;
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
final BlockFace facing = invertFace ? getFacing(blockData).getOppositeFace() : getFacing(blockData);
// TODO: Evaluate if (some) faces need to be inverted.
// End rod facing: the direction it points to.
switch (facing) {
case EAST:
return new double[] {0.0, minDist, minDist, length, maxDist, maxDist};
case WEST:
return new double[] {1.0 - length, minDist, minDist, 1.0, maxDist, maxDist};
case SOUTH:
return new double[] {minDist, minDist, 0.0, maxDist, maxDist, length};
case NORTH:
return new double[] {minDist, minDist, 1.0 - length, maxDist, maxDist, 1.0};
case DOWN:
return new double[] {minDist, 1.0 - length, minDist, maxDist, 1.0, maxDist};
case UP:
return new double[] {minDist, 0.0, minDist, maxDist, length, maxDist};
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) {
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
}
@@ -0,0 +1,63 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitAnvil implements BukkitShapeModel {
@Override
public double[] getShape(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockData blockData = block.getBlockData();
if (blockData instanceof Directional) {
BlockFace face = ((Directional) blockData).getFacing();
switch (face) {
case NORTH:
case SOUTH:
return new double[] {
// Bottom
0.125, 0.0, 0.125, 0.875, 0.25, 0.875,
// Top
0.1875, 0.625, 0.0, 0.8125, 1.0, 1.0
// Body... maybe not need
};
case WEST:
case EAST:
return new double[] {
// Bottom
0.125, 0.0, 0.125, 0.875, 0.25, 0.875,
// Top
0.0, 0.625, 0.1875, 1.0, 1.0, 0.8125
// Body... maybe not need
};
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;
}
}
@@ -0,0 +1,66 @@
/*
* 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 fr.neatmonster.nocheatplus.utilities.location.LocUtil;
import org.bukkit.World;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Bamboo;
public class BukkitBamboo implements BukkitShapeModel {
@Override
public double[] getShape(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
if (blockCache.getPlayerData() != null && blockCache.getPlayerData().isBedrockPlayer()) {
final Block block = world.getBlockAt(x, y, z);
final BlockData blockData = block.getBlockData();
if (blockData instanceof Bamboo) {
Bamboo b = (Bamboo) blockData;
double thickness = 0.125;
if (b.getAge() > 0) thickness += 0.0625;
long a = LocUtil.randomSeedBedrock(x, 0, z);
long a1 = a * 2863311531L;
long rdx = (a1 >> 32) & 0xFFFFFFFFL;
//long rax = a1 & 0xFFFFFFFFL;
rdx >>=3;rdx *=3;
rdx = (rdx << 2) & 0xFFFFFFFFL;
double xOffset = a - rdx + 1;
a >>=8;
long a2 = a;
a *= 2863311531L;
rdx = (a >> 32) & 0xFFFFFFFFL;
rdx >>=3;rdx *=3;
rdx = (rdx << 2) & 0xFFFFFFFFL;
double zOffset = a2 - rdx +1;
xOffset *= 0.0625;
zOffset *= 0.0625;
return new double[] {xOffset, 0, zOffset, xOffset + thickness, 1.0, zOffset + thickness};
}
}
long i = LocUtil.randomSeedJava(x, 0, z);
final double xOffset = (((i & 15L) / 15.0F) - 0.5D) * 0.5D;
final double zOffset = (((i >> 8 & 15L) / 15.0F) - 0.5D) * 0.5D;
return new double[] {0.40625 + xOffset, 0.0, 0.40625 + zOffset, 0.59375 + xOffset, 1.0, 0.59375 + zOffset};
}
@Override
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
@@ -0,0 +1,126 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Bell;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitBell implements BukkitShapeModel {
@Override
public double[] getShape(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockData blockData = block.getBlockData();
if (blockData instanceof Bell) {
Bell b = (Bell) blockData;
BlockFace face = b.getFacing();
switch (b.getAttachment()) {
case CEILING:
return new double[] {0.25, 1 - 0.75, 0.25, 0.75, 1.0, 0.75};
case DOUBLE_WALL:
switch (face) {
case NORTH:
case SOUTH:
return new double[] {
// Bottom bell
0.25, 0.25, 0.25, 0.75, 0.375, 0.75,
// Body
0.3125, 0.375, 0.3125, 0.6875, 0.8125, 0.6875,
// Stick holding the bell
0.4375, 0.8125, 0.0, 0.5625, 0.9375, 1.0
//0.0, 0.8125, 0.4375, 1.0, 0.9375, 0.5625
};
case WEST:
case EAST:
return new double[] {
// Bottom bell
0.25, 0.25, 0.25, 0.75, 0.375, 0.75,
// Body
0.3125, 0.375, 0.3125, 0.6875, 0.8125, 0.6875,
// Stick holding the bell
0.0, 0.8125, 0.4375, 1.0, 0.9375, 0.5625
};
default:
break;
}
break;
case FLOOR:
switch (face) {
case NORTH:
case SOUTH:
return new double[] {0.0, 0.0, 0.25, 1.0, 1.0, 0.75};
case WEST:
case EAST:
return new double[] {0.25, 0.0, 0.0, 0.75, 1.0, 1.0};
default:
break;
}
break;
case SINGLE_WALL:
switch (face) {
case NORTH:
return new double[] {
// Bottom bell
0.25, 0.25, 0.25, 0.75, 0.375, 0.75,
// Body
0.3125, 0.375, 0.3125, 0.6875, 0.8125, 0.6875,
// Stick holding the bell
0.4375, 0.8125, 0.0, 0.5625, 0.9375, 0.8125
};
case SOUTH:
return new double[] {
// Bottom bell
0.25, 0.25, 0.25, 0.75, 0.375, 0.75,
// Body
0.3125, 0.375, 0.3125, 0.6875, 0.8125, 0.6875,
// Stick holding the bell
0.4375, 0.8125, 0.1875, 0.5625, 0.9375, 1.0
};
case WEST:
return new double[] {
// Bottom bell
0.25, 0.25, 0.25, 0.75, 0.375, 0.75,
// Body
0.3125, 0.375, 0.3125, 0.6875, 0.8125, 0.6875,
// Stick holding the bell
0.0, 0.8125, 0.4375, 0.8125, 0.9375, 0.5625
};
case EAST:
return new double[] {
// Bottom bell
0.25, 0.25, 0.25, 0.75, 0.375, 0.75,
// Body
0.3125, 0.375, 0.3125, 0.6875, 0.8125, 0.6875,
// Stick holding the bell
0.1875, 0.8125, 0.4375, 1.0, 0.9375, 0.5625
};
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;
}
}
@@ -0,0 +1,48 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Cake;
import org.bukkit.util.BoundingBox;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitCake 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);
if (Bridge1_13.hasBoundingBox()) {
BoundingBox bd = block.getBoundingBox();
return new double[] {bd.getMinX()-x, bd.getMinY()-y, bd.getMinZ()-z, bd.getMaxX()-x, bd.getMaxY()-y, bd.getMaxZ()-z};
}
final BlockData blockData = block.getState().getBlockData();
if (blockData instanceof Cake) {
final Cake cake = (Cake) blockData;
return new double[] {0.0625 + cake.getBites() * 0.125, 0.0, 0.0625, 0.9375, 0.5, 0.9375};
}
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,45 @@
/*
* 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 fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitCauldron implements BukkitShapeModel {
private final double[] bounds;
public BukkitCauldron(double minY, double sideWidth, double sideHeight, double coreHeight) {
bounds = new double[] {
// Core
sideWidth, minY, sideWidth, 1 - sideWidth, minY + coreHeight, 1 - sideWidth,
// 4 side
0.0, minY, 0.0, 1.0, minY + sideHeight, sideWidth,
0.0, minY, 1.0 - sideWidth, 1.0, minY + sideHeight, 1.0,
0.0, minY, 0.0, sideWidth, minY + sideHeight, 1.0,
1.0 - sideWidth, minY, 0.0, 1.0, minY + sideHeight, 1.0
};
}
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
return bounds;
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
return 0;
}
}
@@ -0,0 +1,73 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.MultipleFacing;
import org.bukkit.util.BoundingBox;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitChorusPlant implements BukkitShapeModel {
@Override
public double[] getShape(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
if (Bridge1_13.hasBoundingBox()) {
BoundingBox bd = block.getBoundingBox();
return new double[] {bd.getMinX()-x, 0.1875, bd.getMinZ()-z, bd.getMaxX()-x, bd.getMaxY()-y, bd.getMaxZ()-z};
}
final BlockData blockData = block.getBlockData();
double[] res = new double[] {0.187, 0.188, 0.187, 1.0 - 0.187, 0.8125, 1.0 - 0.187};
if (blockData instanceof MultipleFacing) {
final MultipleFacing chorusplant = (MultipleFacing) blockData;
for (final BlockFace face : chorusplant.getFaces()) {
switch (face) {
//case DOWN:
// res[1]=0.0;
// break;
case UP:
res[4]=1.0;
break;
case SOUTH:
res[5]=1.0;
break;
case NORTH:
res[2]=0.0;
break;
case WEST:
res[0]=0.0;
break;
case EAST:
res[3]=1.0;
break;
default:
break;
}
}
}
return res;
}
@Override
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
@@ -0,0 +1,96 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.type.Cocoa;
import org.bukkit.util.BoundingBox;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitCocoa implements BukkitShapeModel {
@Override
public double[] getShape(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
if (Bridge1_13.hasBoundingBox()) {
BoundingBox bd = block.getBoundingBox();
return new double[] {bd.getMinX()-x, bd.getMinY()-y, bd.getMinZ()-z, bd.getMaxX()-x, bd.getMaxY()-y, bd.getMaxZ()-z};
}
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof Cocoa && blockData instanceof Directional) {
BlockFace face = ((Directional) blockData).getFacing();
final Cocoa cocoa = (Cocoa) blockData;
switch (cocoa.getAge()) {
case 0: // .625 .4375 .0625 max: .375 .75 .3125
switch (face) {
case NORTH:
return new double[] {0.375, 0.4375, 0.0, 0.625, 0.75, 0.315};
case SOUTH:
return new double[] {0.375, 0.4375, 0.685, 0.625, 0.75, 1.0};
case WEST:
return new double[] {0.0, 0.4375, 0.375, 0.315, 0.75, 0.625};
case EAST:
return new double[] {0.685, 0.4375, 0.375, 1.0, 0.75, 0.625};
default:
break;
}
break;
case 1: // .6875 .3125 .0625 max: .3125 .75 .4375
switch (face) {
case NORTH:
return new double[] {0.3125, 0.3125, 0.0, 0.6875, 0.75, 0.4375};
case SOUTH:
return new double[] {0.3125, 0.3125, 0.5625, 0.6875, 0.75, 1.0};
case WEST:
return new double[] {0.0, 0.3125, 0.3125, 0.4375, 0.75, 0.6875};
case EAST:
return new double[] {0.5625, 0.3125, 0.3125, 1.0, 0.75, 0.6875};
default:
break;
}
break;
case 2: // .75 .1875 .0625 max: .25 .75 .5625
switch (face) {
case NORTH:
return new double[] {0.25, 0.1875, 0.0, 0.75, 0.75, 0.5625};
case SOUTH:
return new double[] {0.25, 0.1875, 0.4375, 0.75, 0.75, 1.0};
case WEST:
return new double[] {0.0, 0.1875, 0.25, 0.5625, 0.75, 0.75};
case EAST:
return new double[] {0.4375, 0.1875, 0.25, 1.0, 0.75, 0.75};
default:
break;
}
//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;
}
}
@@ -30,9 +30,6 @@ public class BukkitDirectionalCentered extends AbstractBukkitCentered {
if (blockData instanceof Directional) {
return ((Directional) blockData).getFacing();
}
else {
return BlockFace.SELF;
}
return BlockFace.SELF;
}
}
}
@@ -34,9 +34,7 @@ public class BukkitDoor implements BukkitShapeModel {
* @return The block face of the block the door is standing on, indicating
* where the door is.
*/
private static final BlockFace getWhereTheDoorIsFace(
final BlockFace facing, final Hinge hinge,
final boolean isOpen) {
private static final BlockFace getWhereTheDoorIsFace(final BlockFace facing, final Hinge hinge, final boolean isOpen) {
// For idiots:
/*
* Facing: Door is closing the opposite side of the block, so the
@@ -45,9 +43,6 @@ public class BukkitDoor implements BukkitShapeModel {
/*
* Hinge: Looking into the facing direction, hinge is left or right.
*/
// Bukkit.getServer().broadcastMessage("hinge=" + hinge
// + " / facing=" + facing
// + " / open=" + isOpen);
// Let's play north and south:
switch (facing) {
case NORTH:
@@ -55,49 +50,33 @@ public class BukkitDoor implements BukkitShapeModel {
if (hinge == Hinge.LEFT) {
return BlockFace.WEST;
}
else {
return BlockFace.EAST;
}
}
else {
return BlockFace.SOUTH;
return BlockFace.EAST;
}
return BlockFace.SOUTH;
case SOUTH:
if (isOpen) {
if (hinge == Hinge.LEFT) {
return BlockFace.EAST;
}
else {
return BlockFace.WEST;
}
}
else {
return BlockFace.NORTH;
return BlockFace.WEST;
}
return BlockFace.NORTH;
case EAST:
if (isOpen) {
if (hinge == Hinge.LEFT) {
return BlockFace.NORTH;
}
else {
return BlockFace.SOUTH;
}
}
else {
return BlockFace.WEST;
return BlockFace.SOUTH;
}
return BlockFace.WEST;
case WEST:
if (isOpen) {
if (hinge == Hinge.LEFT) {
return BlockFace.SOUTH;
}
else {
return BlockFace.NORTH;
}
}
else {
return BlockFace.EAST;
return BlockFace.NORTH;
}
return BlockFace.EAST;
default:
// Invalid
return BlockFace.SELF;
@@ -108,8 +87,7 @@ public class BukkitDoor implements BukkitShapeModel {
private static final double doorWidthOpen = 0.1875;
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
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();
@@ -117,28 +95,24 @@ public class BukkitDoor implements BukkitShapeModel {
final Door door = (Door) blockData;
final boolean isOpen = door.isOpen();
final double doorWidth = doorWidthOpen; // isOpen ? doorWidthOpen : doorWidthClosed;
switch(getWhereTheDoorIsFace(door.getFacing(),
door.getHinge(), isOpen)) {
case NORTH:
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, doorWidth};
case SOUTH:
return new double[] {0.0, 0.0, 1.0 - doorWidth, 1.0, 1.0, 1.0};
case EAST:
return new double[] {1.0 - doorWidth, 0.0, 0.0, 1.0, 1.0, 1.0};
case WEST:
return new double[] {0.0, 0.0, 0.0, doorWidth, 1.0, 1.0};
default:
break;
switch (getWhereTheDoorIsFace(door.getFacing(), door.getHinge(), isOpen)) {
case NORTH:
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, doorWidth};
case SOUTH:
return new double[] {0.0, 0.0, 1.0 - doorWidth, 1.0, 1.0, 1.0};
case EAST:
return new double[] {1.0 - doorWidth, 0.0, 0.0, 1.0, 1.0, 1.0};
case WEST:
return new double[] {0.0, 0.0, 0.0, doorWidth, 1.0, 1.0};
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) {
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
@@ -0,0 +1,53 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.BigDripleaf;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitDripLeaf implements BukkitShapeModel {
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockData blockData = block.getState().getBlockData();
double[] res = {0.0, 0.6875, 0.0, 1.0, 0.9375, 1.0};
if (blockData instanceof BigDripleaf) {
final BigDripleaf dripLeaf = (BigDripleaf) blockData;
switch(dripLeaf.getTilt()) {
case PARTIAL:
res[4] -= 0.125;
return res;
case UNSTABLE:
// WORKAROUND: Zero this bounding box if the tilt is unstable [NCP should take care of ground judgement then]
return new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
case NONE:
return res;
default:
break;
}
}
return null;
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
return 0;
}
}
@@ -0,0 +1,87 @@
/*
* 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 fr.neatmonster.nocheatplus.utilities.location.LocUtil;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
import fr.neatmonster.nocheatplus.utilities.math.MathUtil;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.PointedDripstone;
public class BukkitDripStone implements BukkitShapeModel {
private static final double[] TIP_MERGE = {0.3125, 0.0, 0.3125, 0.6875, 1.0, 0.6875};
private static final double[] TIP_DOWN = {0.3125, 0.3125, 0.3125, 0.6875, 1.0, 0.6875};
private static final double[] TIP_UP = {0.3125, 0.0, 0.3125, 0.6875, 0.6875, 0.6875};
private static final double[] FRUSTUM = {0.25, 0.0, 0.25, 0.75, 1.0, 0.75};
private static final double[] MIDDLE = {0.1875, 0.0, 0.1875, 0.8125, 1.0, 0.8125};
private static final double[] BASE = {0.125, 0.0, 0.125, 0.875, 1.0, 0.875};
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockData blockData = block.getBlockData();
if (blockData instanceof PointedDripstone) {
boolean bedrock = blockCache.getPlayerData() != null && blockCache.getPlayerData().isBedrockPlayer();
final long randomseed = bedrock ? LocUtil.randomSeedBedrock(x, 0, z) : LocUtil.randomSeedJava(x, 0, z);
double xOffset = MathUtil.clamp(calcOffset(randomseed, false, bedrock), -0.125, 0.125);
double zOffset = MathUtil.clamp(calcOffset(randomseed, true, bedrock), -0.125, 0.125);
PointedDripstone pds = (PointedDripstone) blockData;
switch (pds.getThickness()) {
case TIP_MERGE:
return offset(TIP_MERGE, xOffset, 0, zOffset);
case TIP:
if (pds.getVerticalDirection() == BlockFace.DOWN) {
return offset(TIP_DOWN, xOffset, 0, zOffset);
} else {
return offset(TIP_UP, xOffset, 0, zOffset);
}
case FRUSTUM:
return offset(FRUSTUM, xOffset, 0, zOffset);
case MIDDLE:
return offset(MIDDLE, xOffset, 0, zOffset);
default:
return offset(BASE, xOffset, 0, zOffset);
}
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
return 0;
}
private float calcOffset(long x, boolean shift, boolean bedrock) {
if (shift) x >>=8;
x &= 0xFL;
float b = x;
if (bedrock) {
b *= 0.0333333f;
b -= 0.25f;
} else {
b /= 15f;
b -= 0.5f;
b *= 0.5f;
}
return b;
}
private double[] offset(double[] input, double x, double y, double z) {
return new double[] {input[0] + x, input[1] + y, input[2] + z, input[3] + x, input[4] + y, input[5] + z};
}
}
@@ -25,33 +25,23 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitEndPortalFrame implements BukkitShapeModel {
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
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 EndPortalFrame) {
return ((EndPortalFrame) blockData).hasEye()
? new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0}
: new double[] {0.0, 0.0, 0.0, 1.0, 0.8125, 1.0};
}
else {
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
return getShape(((EndPortalFrame) blockData).hasEye());
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
private double[] getShape(boolean hasEye) {
return hasEye ? new double[] {0.0, 0.0, 0.0, 1.0, 0.8125, 1.0, 0.25, 0.8125, 0.25, 0.75, 1.0, 0.75}
: new double[] {0.0, 0.0, 0.0, 1.0, 0.8125, 1.0};
}
@Override
public int getFakeData(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof EndPortalFrame) {
return ((EndPortalFrame) blockData).hasEye() ? 0x4 : 0;
}
else {
return 0;
}
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
}
@@ -40,13 +40,10 @@ public class BukkitFence implements BukkitShapeModel {
}
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
public double[] getShape(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
// 13749998807909
// 86250001192093
// 0.1375, 0.8625
final Block block = world.getBlockAt(x, y, z);
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
@@ -77,15 +74,11 @@ public class BukkitFence implements BukkitShapeModel {
}
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) {
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
}
@@ -0,0 +1,36 @@
/*
* 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.util.BoundingBox;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitFetchableBound implements BukkitShapeModel {
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
final Block block = world.getBlockAt(x, y, z);
BoundingBox box = block.getBoundingBox();
return new double[] {box.getMinX()-x, box.getMinY()-y, box.getMinZ()-z, box.getMaxX()-x, box.getMaxY()-y, box.getMaxZ()-z};
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
return 0;
}
}
@@ -0,0 +1,50 @@
/*
* 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.util.BoundingBox;
import org.bukkit.util.VoxelShape;
import fr.neatmonster.nocheatplus.utilities.collision.AxisAlignedBBUtils;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitFetchableBounds implements BukkitShapeModel {
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
final Block block = world.getBlockAt(x, y, z);
final VoxelShape blockshape = block.getCollisionShape();
double[] res = {};
for (BoundingBox box : blockshape.getBoundingBoxes()) {
res = add(res, AxisAlignedBBUtils.toArray(box));
}
if (res.length == 0) return null;
return res;
}
private double[] add(final double[] array1, final double[] array2) {
final double[] newArray = new double[array1.length + array2.length];
System.arraycopy(array1, 0, newArray, 0, array1.length);
System.arraycopy(array2, 0, newArray, array1.length, array2.length);
return newArray;
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
return 0;
}
}
@@ -40,8 +40,7 @@ public class BukkitGate implements BukkitShapeModel {
}
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
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();
@@ -63,17 +62,13 @@ public class BukkitGate implements BukkitShapeModel {
}
@Override
public int getFakeData(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof Openable) {
return ((Openable) blockData).isOpen() ? 0x4 : 0;
}
else {
return 0;
}
return 0;
}
}
}
@@ -0,0 +1,113 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Grindstone;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitGrindStone implements BukkitShapeModel {
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockData blockData = block.getState().getBlockData();
if (blockData instanceof Grindstone) {
final Grindstone grindstone = (Grindstone) blockData;
final BlockFace facing = grindstone.getFacing();
switch (grindstone.getAttachedFace()) {
case CEILING:
switch (facing) {
case NORTH:
case SOUTH:
return new double[] {0.125, 0.5625, 0.375, 0.25, 1.0, 0.625,
0.75, 0.5625, 0.375, 0.875, 1.0, 0.625,
0.125, 0.1875, 0.3125, 0.25, 0.5625, 0.6875,
0.75, 0.1875, 0.3125, 0.875, 0.5625, 0.6875,
0.25, 0.0, 0.125, 0.75, 0.75, 0.875};
case EAST:
case WEST:
return new double[] {0.375, 0.5625, 0.125, 0.625, 1.0, 0.25,
0.375, 0.5625, 0.75, 0.625, 1.0, 0.875,
0.3125, 0.1875, 0.125, 0.6875, 0.5625, 0.25,
0.3125, 0.1875, 0.75, 0.6875, 0.5625, 0.875,
0.125, 0.0, 0.25, 0.875, 0.75, 0.75};
default:
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
case FLOOR:
switch (facing) {
case NORTH:
case SOUTH:
return new double[] {0.125, 0.0, 0.375, 0.25, 0.4375, 0.625,
0.75, 0.0, 0.375, 0.875, 0.4375, 0.625,
0.125, 0.4375, 0.3125, 0.25, 0.8125, 0.6875,
0.75, 0.4375, 0.3125, 0.875, 0.8125, 0.6875,
0.25, 0.25, 0.125, 0.75, 1.0, 0.875};
case EAST:
case WEST:
return new double[] {0.375, 0.0, 0.125, 0.625, 0.4375, 0.25,
0.375, 0.0, 0.75, 0.625, 0.4375, 0.875,
0.3125, 0.4375, 0.125, 0.6875, 0.8125, 0.25,
0.3125, 0.4375, 0.75, 0.6875, 0.8125, 0.875,
0.125, 0.25, 0.25, 0.875, 1.0, 0.75};
default:
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
case WALL:
switch (facing) {
case NORTH:
return new double[] {0.125, 0.375, 0.4375, 0.25, 0.625, 1.0,
0.75, 0.375, 0.4375, 0.875, 0.625, 1.0,
0.125, 0.3125, 0.1875, 0.25, 0.6875, 0.5625,
0.75, 0.3125, 0.1875, 0.875, 0.6875, 0.5625,
0.25, 0.125, 0.0, 0.75, 0.875, 0.75};
case SOUTH:
return new double[] {0.125, 0.375, 0.0, 0.25, 0.625, 0.4375,
0.75, 0.375, 0.0, 0.875, 0.625, 0.4375,
0.125, 0.3125, 0.4375, 0.25, 0.6875, 0.8125,
0.75, 0.3125, 0.4375, 0.875, 0.6875, 0.8125,
0.25, 0.125, 0.25, 0.75, 0.875, 1.0};
case EAST:
return new double[] {0.0, 0.375, 0.125, 0.5625, 0.625, 0.25,
0.0, 0.375, 0.75, 0.5625, 0.625, 0.875,
0.4375, 0.3125, 0.125, 0.8125, 0.6875, 0.25,
0.4375, 0.3125, 0.75, 0.8125, 0.6875, 0.875,
0.25, 0.125, 0.25, 1.0, 0.875, 0.75};
case WEST:
return new double[] {0.4375, 0.375, 0.125, 1.0, 0.625, 0.25,
0.4375, 0.375, 0.75, 1.0, 0.625, 0.875,
0.1875, 0.3125, 0.125, 0.5625, 0.6875, 0.25,
0.1875, 0.3125, 0.75, 0.5625, 0.6875, 0.875,
0.0, 0.125, 0.25, 0.75, 0.875, 0.75};
default:
break;
}
}
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
return 0;
}
}
@@ -0,0 +1,126 @@
/*
* 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 BukkitHopper implements BukkitShapeModel {
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockData blockData = block.getBlockData();
if (blockData instanceof Directional) {
Directional b = (Directional) blockData;
BlockFace face = b.getFacing();
switch (face) {
case NORTH:
return new double[] {
// Standing inside
0.0, 0.625, 0.0, 1.0, 0.6875, 1.0,
// Middle
0.25, 0.25, 0.25, 0.75, 0.625, 0.75,
// Bottom
0.375, 0.25, 0.0, 0.625, 0.5, 0.25,
// Top
0.0, 0.6875, 0.0, 1.0, 1.0, 1.0
// 4 sides of hopper (top)
//0.0, 0.6875, 0.0, 1.0, 1.0, 0.125,
//0.0, 0.6875, 0.875, 1.0, 1.0, 1.0,
//0.0, 0.6875, 0.0, 0.125, 1.0, 1.0,
//0.875, 0.6875, 0.0, 1.0, 1.0, 1.0,
};
case SOUTH:
return new double[] {
// Standing inside
0.0, 0.625, 0.0, 1.0, 0.6875, 1.0,
// Middle
0.25, 0.25, 0.25, 0.75, 0.625, 0.75,
// Bottom
0.375, 0.25, 0.75, 0.625, 0.5, 1.0,
// Top
0.0, 0.6875, 0.0, 1.0, 1.0, 1.0
// 4 sides of hopper (top)
//0.0, 0.6875, 0.0, 1.0, 1.0, 0.125,
//0.0, 0.6875, 0.875, 1.0, 1.0, 1.0,
//0.0, 0.6875, 0.0, 0.125, 1.0, 1.0,
//0.875, 0.6875, 0.0, 1.0, 1.0, 1.0,
};
case WEST:
return new double[] {
// Standing inside
0.0, 0.625, 0.0, 1.0, 0.6875, 1.0,
// Middle
0.25, 0.25, 0.25, 0.75, 0.625, 0.75,
// Bottom
0.0, 0.25, 0.375, 0.25, 0.5, 0.625,
// Top
0.0, 0.6875, 0.0, 1.0, 1.0, 1.0
// 4 sides of hopper (top)
//0.0, 0.6875, 0.0, 1.0, 1.0, 0.125,
//0.0, 0.6875, 0.875, 1.0, 1.0, 1.0,
//0.0, 0.6875, 0.0, 0.125, 1.0, 1.0,
//0.875, 0.6875, 0.0, 1.0, 1.0, 1.0,
};
case EAST:
return new double[] {
// Standing inside
0.0, 0.625, 0.0, 1.0, 0.6875, 1.0,
// Middle
0.25, 0.25, 0.25, 0.75, 0.625, 0.75,
// Bottom
0.75, 0.25, 0.375, 1.0, 0.5, 0.625,
// Top
0.0, 0.6875, 0.0, 1.0, 1.0, 1.0
// 4 sides of hopper (top)
//0.0, 0.6875, 0.0, 1.0, 1.0, 0.125,
//0.0, 0.6875, 0.875, 1.0, 1.0, 1.0,
//0.0, 0.6875, 0.0, 0.125, 1.0, 1.0,
//0.875, 0.6875, 0.0, 1.0, 1.0, 1.0,
};
case DOWN:
return new double[] {
// Standing inside
0.0, 0.625, 0.0, 1.0, 0.6875, 1.0,
// Middle
0.25, 0.25, 0.25, 0.75, 0.625, 0.75,
// Bottom
0.375, 0.0, 0.375, 0.625, 0.25, 0.625,
// Top
0.0, 0.6875, 0.0, 1.0, 1.0, 1.0
// 4 sides of hopper (top)
//0.0, 0.6875, 0.0, 1.0, 1.0, 0.125,
//0.0, 0.6875, 0.875, 1.0, 1.0, 1.0,
//0.0, 0.6875, 0.0, 0.125, 1.0, 1.0,
//0.875, 0.6875, 0.0, 1.0, 1.0, 1.0,
};
default:
break;
}
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, 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.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.util.BoundingBox;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitLadder 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);
BoundingBox box = block.getBoundingBox();
return new double[] {box.getMinX()-x, box.getMinY()-y, box.getMinZ()-z, box.getMaxX()-x, box.getMaxY()-y, box.getMaxZ()-z};
}
@Override
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof Directional) {
final Directional ladder = (Directional) blockData;
switch(ladder.getFacing()) {
case EAST:
return 5;
case NORTH:
return 6;
case SOUTH:
return 3;
case WEST:
return 4;
default:
break;
}
}
return 0;
}
}
@@ -0,0 +1,45 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Lantern;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitLantern implements BukkitShapeModel {
private double xz = 0.3125;
@Override
public double[] getShape(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockData blockData = block.getBlockData();
if (blockData instanceof Lantern) {
Lantern lantern = (Lantern) blockData;
if (lantern.isHanging())
return new double[] {xz, 0.0625, xz, 1-xz, 0.5, 1-xz, 0.375, 0.5, 0.375, 0.625, 0.625, 0.625};
}
return new double[] {xz, 0.0, xz, 1.0-xz, 0.4375, 1.0-xz, 0.375, 0.4375, 0.375, 0.625, 0.5625, 0.625};
}
@Override
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
@@ -0,0 +1,50 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Levelled;
import org.bukkit.block.data.Waterlogged;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
public class BukkitLevelled implements BukkitShapeModel {
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
final Block blockAbove = world.getBlockAt(x, y + 1, z);
final BlockData blockDataAbove = blockAbove.getBlockData();
if ((BlockFlags.getBlockFlags(world.getBlockAt(x, y, z).getType()) & BlockFlags.F_WATER) != 0
&& (blockDataAbove instanceof Waterlogged && ((Waterlogged)blockDataAbove).isWaterlogged())) {
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
return new double[] {0.0, 0.0, 0.0, 1.0, 8 / 9f, 1.0};
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof Levelled) {
return ((Levelled)blockData).getLevel();
}
return 0;
}
}
@@ -0,0 +1,78 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Piston;
import org.bukkit.util.BoundingBox;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitPiston 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);
if (Bridge1_13.hasBoundingBox()) {
BoundingBox bd = block.getBoundingBox();
return new double[] {bd.getMinX()-x, bd.getMinY()-y, bd.getMinZ()-z, bd.getMaxX()-x, bd.getMaxY()-y, bd.getMaxZ()-z};
}
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
double[] res = new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
if (blockData instanceof Piston) {
final Piston piston = (Piston) blockData;
if (!piston.isExtended()) {
return res;
}
final BlockFace face = piston.getFacing();
switch (face) {
case NORTH:
res[2] = 0.25;
break;
case SOUTH:
res[5] = 0.75;
break;
case WEST:
res[0] = 0.25;
break;
case EAST:
res[3] = 0.75;
break;
case UP:
res[4] = 0.75;
break;
case DOWN:
res[1] = 0.25;
break;
default:
break;
}
return res;
}
return res;
}
@Override
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
@@ -0,0 +1,88 @@
/*
* 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 BukkitPistonHead implements BukkitShapeModel {
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockData blockData = block.getBlockData();
if (blockData instanceof Directional) {
Directional b = (Directional) blockData;
BlockFace face = b.getFacing();
switch (face) {
case UP:
return new double[] {
// Shaft
0.375, 0.0, 0.375, 0.625, 1.0, 0.625,
// Plank
0.0, 0.75, 0.0, 1.0, 1.0, 1.0
};
case DOWN:
return new double[] {
// Shaft
0.375, 0.0, 0.375, 0.625, 1.0, 0.625,
// Plank
0.0, 0.0, 0.0, 1.0, 0.25, 1.0
};
case NORTH:
return new double[] {
// Shaft
0.375, 0.375, 0.0, 0.625, 0.625, 1.0,
// Plank
0.0, 0.0, 0.0, 1.0, 1.0, 0.25
};
case SOUTH:
return new double[] {
// Shaft
0.375, 0.375, 0.0, 0.625, 0.625, 1.0,
// Plank
0.0, 0.0, 0.75, 1.0, 1.0, 1.0
};
case WEST:
return new double[] {
// Shaft
0.0, 0.375, 0.375, 1.0, 0.625, 0.625,
// Plank
0.0, 0.0, 0.0, 0.25, 1.0, 1.0
};
case EAST:
return new double[] {
// Shaft
0.0, 0.375, 0.375, 1.0, 0.625, 0.625,
// Plank
0.75, 0.0, 0.0, 1.0, 1.0, 1.0
};
default:
break;
}
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
return 0;
}
}
@@ -0,0 +1,47 @@
/*
* 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 fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitPowderSnow implements BukkitShapeModel {
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
IPlayerData pData = blockCache.getPlayerData();
if (pData != null) {
MovingData data = pData.getGenericInstance(MovingData.class);
// TODO: Make NoFall no dealing damage on this block
if (data.lastY > (y + 1 - 1e-5) && data.hasLeatherBoots && !pData.isShiftKeyPressed()) {
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
// Give up, too hard to properly implement, workaround instead
//if (data.noFallFallDistance > 2.5) {
// return new double[] {0.0, 0.0, 0.0, 1.0, 0.9, 1.0};
//}
}
return new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
return 0;
}
}
@@ -0,0 +1,42 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Rail;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitRail implements BukkitShapeModel {
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof Rail) {
return ((Rail)blockData).getShape().name().startsWith("ASCENDING") ? 2 : 0;
}
return 0;
}
}
@@ -0,0 +1,61 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.SeaPickle;
import org.bukkit.util.BoundingBox;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitSeaPickle implements BukkitShapeModel {
@Override
public double[] getShape(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
if (Bridge1_13.hasBoundingBox()) {
BoundingBox bd = block.getBoundingBox();
return new double[] {bd.getMinX()-x, bd.getMinY()-y, bd.getMinZ()-z, bd.getMaxX()-x, bd.getMaxY()-y, bd.getMaxZ()-z};
}
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof SeaPickle) {
final SeaPickle pick = (SeaPickle) blockData;
switch (pick.getPickles()) {
case 1: // .375 , 0 , .375 max: .625 , 375 , .625
return new double[] {0.375, 0.0, 0.375, 0.625, 0.375, 0.625};
case 2: // .1875 , 0 , .1875 max: .8125 , .375 , .8125
return new double[] {0.1875, 0.0, 0.1875, 0.8125, 0.375, 0.8125};
case 3: // .125 0 .125 max: .875 .375 .875
return new double[] {0.125, 0.0, 0.125, 0.875, 0.375, 0.875};
case 4: // .125 0 .125 max: .875 .4375 .875
return new double[] {0.125, 0.0, 0.125, 0.875, 0.4375, 0.875};
default:
break;
}
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
@Override
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
@@ -24,8 +24,7 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitShulkerBox implements BukkitShapeModel {
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
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();
@@ -40,9 +39,7 @@ public class BukkitShulkerBox implements BukkitShapeModel {
}
@Override
public int getFakeData(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
}
@@ -25,8 +25,7 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitSlab implements BukkitShapeModel {
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
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();
@@ -48,9 +47,7 @@ public class BukkitSlab implements BukkitShapeModel {
}
@Override
public int getFakeData(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
}
@@ -0,0 +1,61 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Snow;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitSnow implements BukkitShapeModel {
private static final double[][] SNOW_LAYERS = {
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
{0.0, 0.0, 0.0, 1.0, 0.125, 1.0},
{0.0, 0.0, 0.0, 1.0, 0.250, 1.0},
{0.0, 0.0, 0.0, 1.0, 0.375, 1.0},
{0.0, 0.0, 0.0, 1.0, 0.5, 1.0},
{0.0, 0.0, 0.0, 1.0, 0.625, 1.0},
{0.0, 0.0, 0.0, 1.0, 0.75, 1.0},
{0.0, 0.0, 0.0, 1.0, 0.875, 1.0},
{0.0, 0.0, 0.0, 1.0, 1.0, 1.0}
};
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
// TODO: Backward Handling
final Block block = world.getBlockAt(x, y, z);
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof Snow) {
return SNOW_LAYERS[((Snow)blockData).getLayers() - 1];
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof Snow) {
return ((Snow)blockData).getLayers() - 1;
}
return 0;
}
}
@@ -14,65 +14,193 @@
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.IntStream;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.Bisected;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Bisected.Half;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Stairs;
import fr.neatmonster.nocheatplus.utilities.collision.Axis;
import fr.neatmonster.nocheatplus.utilities.collision.AxisAlignedBBUtils;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitStairs implements BukkitShapeModel {
// Taken from NMS - StairBlock.java
private final double[] topslabs = new double[] {0.0, 0.5, 0.0, 1.0, 1.0, 1.0};
private final double[] bottomslabs = new double[] {0.0, 0.0, 0.0, 1.0, 0.5, 1.0};
private final double[] octet_nnn = new double[] {0.0, 0.0, 0.0, 0.5, 0.5, 0.5};
private final double[] octet_nnp = new double[] {0.0, 0.0, 0.5, 0.5, 0.5, 1.0};
private final double[] octet_pnn = new double[] {0.5, 0.0, 0.0, 1.0, 0.5, 0.5};
private final double[] octet_pnp = new double[] {0.5, 0.0, 0.5, 1.0, 0.5, 1.0};
private final double[] octet_npn = new double[] {0.0, 0.5, 0.0, 0.5, 1.0, 0.5};
private final double[] octet_npp = new double[] {0.0, 0.5, 0.5, 0.5, 1.0, 1.0};
private final double[] octet_ppn = new double[] {0.5, 0.5, 0.0, 1.0, 1.0, 0.5};
private final double[] octet_ppp = new double[] {0.5, 0.5, 0.5, 1.0, 1.0, 1.0};
private final double[][] top_stairs = makeshape(topslabs, octet_nnn, octet_pnn, octet_nnp, octet_pnp);
private final double[][] bottom_stairs = makeshape(bottomslabs, octet_npn, octet_ppn, octet_npp, octet_ppp);
private final int[] shape_by_state = new int[]{12, 5, 3, 10, 14, 13, 7, 11, 13, 7, 11, 14, 8, 4, 1, 2, 4, 1, 2, 8};
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
// TODO: With fake data, this could simply return full bounds.
// final Block block = world.getBlockAt(x, y, z);
// final BlockState state = block.getState();
// final BlockData blockData = state.getBlockData();
//
// if (blockData instanceof Stairs) {
// final Stairs stairs = (Stairs) blockData;
// final Half half = stairs.getHalf();
// //final Shape shape = stairs.getShape();
// // TODO: Refine later, with sub shapes.
// switch (half) {
// case BOTTOM:
// return new double[] {0.0, 0.0, 0.0, 1.0, 0.5, 1.0};
// case TOP:
// return new double[] {0.0, 0.5, 0.0, 1.0, 1.0, 1.0};
// default:
// break;
//
// }
// }
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.getState().getBlockData();
if (blockData instanceof Stairs) {
final Stairs stairs = (Stairs) blockData;
final Half half = stairs.getHalf();
switch (half) {
case BOTTOM:
return bottom_stairs[shape_by_state[getShapeStateIndex(stairs)]];
case TOP:
return top_stairs[shape_by_state[getShapeStateIndex(stairs)]];
}
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
@Override
public int getFakeData(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
//final Block block = world.getBlockAt(x, y, z);
//final BlockState state = block.getState();
//final BlockData blockData = state.getBlockData();
if (blockData instanceof Bisected) {
final Bisected stairs = (Bisected) blockData;
final Half half = stairs.getHalf();
//final Shape shape = stairs.getShape();
// TODO: Refine later, with sub shapes.
switch (half) {
case TOP:
return 0x4;
default:
break;
}
}
//if (blockData instanceof Bisected) {
// final Bisected stairs = (Bisected) blockData;
// final Half half = stairs.getHalf();
// switch (half) {
// case TOP:
// return 0x4;
// default:
// break;
// }
//}
return 0;
}
private double[][] makeshape(double[] slab, double[] octet_nn, double[] octet_pn, double[] octet_np, double[] octet_pp) {
return IntStream
.range(0, 16)
.mapToObj((flags) -> makeStairShape(flags, slab, octet_nn, octet_pn, octet_np, octet_pp))
.toArray(double[][]::new);
}
private double[] makeStairShape(int flags, double[] slab, double[] octet_nn, double[] octet_pn, double[] octet_np, double[] octet_pp) {
double[] res = slab;
if ((flags & 1) != 0) {
res = merge(res, octet_nn);
}
if ((flags & 2) != 0) {
res = merge(res, octet_pn);
}
if ((flags & 4) != 0) {
res = merge(res, octet_np);
}
if ((flags & 8) != 0) {
res = merge(res, octet_pp);
}
return res;
}
private int getShapeStateIndex(Stairs stair) {
return stair.getShape().ordinal() * 4 + directionToValue(stair.getFacing());
}
private int directionToValue(BlockFace face) {
switch (face) {
default:
case UP:
case DOWN:
return -1;
case NORTH:
return 2;
case SOUTH:
return 0;
case WEST:
return 1;
case EAST:
return 3;
}
}
// TODO: Poorly designed, Will recode better version later
private double[] merge(double[] bounds, double[] octet) {
double[] res = bounds;
final double minX = octet[0];
final double minY = octet[1];
final double minZ = octet[2];
final double maxX = octet[3];
final double maxY = octet[4];
final double maxZ = octet[5];
for (int i = 2; i <= AxisAlignedBBUtils.getNumberOfAABBs(bounds); i++) {
final double tminX = bounds[i*6-6];
final double tminY = bounds[i*6-5];
final double tminZ = bounds[i*6-4];
final double tmaxX = bounds[i*6-3];
final double tmaxY = bounds[i*6-2];
final double tmaxZ = bounds[i*6-1];
if (sameshape(minX, minY, minZ, maxX, maxY, maxZ, tminX, tminY, tminZ, tmaxX, tmaxY, tmaxZ)) {
final List<Axis> a = getRelative(minX, minY, minZ, maxX, maxY, maxZ, tminX, tminY, tminZ, tmaxX, tmaxY, tmaxZ);
if (a.size() == 1) {
Axis axis = a.get(0);
switch (axis) {
case X_AXIS:
res[i*6-6] = Math.min(tminX, minX);
res[i*6-3] = Math.max(tmaxX, maxX);
return res;
//case Y_AXIS:
// break;
case Z_AXIS:
res[i*6-4] = Math.min(tminZ, minZ);
res[i*6-1] = Math.max(tmaxZ, maxZ);
return res;
default:
break;
}
}
}
}
return add(res, octet);
}
private double[] add(final double[] array1, final double[] array2) {
final double[] newArray = new double[array1.length + array2.length];
System.arraycopy(array1, 0, newArray, 0, array1.length);
System.arraycopy(array2, 0, newArray, array1.length, array2.length);
return newArray;
}
private List<Axis> getRelative(double minX, double minY, double minZ, double maxX, double maxY, double maxZ,
double tminX, double tminY, double tminZ, double tmaxX, double tmaxY, double tmaxZ) {
final List<Axis> list = new ArrayList<Axis>();
if (minX == tmaxX || maxX == tminX) {
list.add(Axis.X_AXIS);
}
if (minY == tmaxY || maxY == tminY) {
list.add(Axis.Y_AXIS);
}
if (minZ == tmaxZ || maxZ == tminZ) {
list.add(Axis.Z_AXIS);
}
return list;
}
private boolean sameshape(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, double tminX,
double tminY, double tminZ, double tmaxX, double tmaxY, double tmaxZ) {
final double dx = maxX - minX;
final double dy = maxY - minY;
final double dz = maxZ - minZ;
final double tdx = tmaxX - tminX;
final double tdy = tmaxY - tminY;
final double tdz = tmaxZ - tminZ;
return dx == tdx && dy == tdy && dz == tdz;
}
}
@@ -20,12 +20,7 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitStatic implements BukkitShapeModel {
private final double minX;
private final double minY;
private final double minZ;
private final double maxX;
private final double maxY;
private final double maxZ;
private final double[] bounds;
/**
* Initialize with the given height and with full xz-bounds.
@@ -46,27 +41,25 @@ public class BukkitStatic implements BukkitShapeModel {
this(xzInset, 0.0, xzInset, 1.0 - xzInset, height, 1.0 - xzInset);
}
public BukkitStatic(double minX, double minY, double minZ,
double maxX, double maxY, double maxZ) {
this.minX = minX;
this.minY = minY;
this.minZ = minZ;
this.maxX = maxX;
this.maxY = maxY;
this.maxZ = maxZ;
/**
* Initialize with the given bounds
*
*/
public BukkitStatic(double ...bounds) {
if (bounds.length % 6 != 0) {
throw new IllegalArgumentException("The length must be a multiple of 6");
}
this.bounds = bounds;
}
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
return new double[] {minX, minY, minZ, maxX, maxY, maxZ};
public double[] getShape(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return bounds;
}
@Override
public int getFakeData(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
}
@@ -19,7 +19,6 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.Bisected.Half;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Openable;
import org.bukkit.block.data.type.TrapDoor;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
@@ -30,15 +29,14 @@ public class BukkitTrapDoor implements BukkitShapeModel {
private static final double openWidth = 0.1875;
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
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 TrapDoor) {
final TrapDoor trapDoor = (TrapDoor) blockData;
if (trapDoor.isOpen()) {
switch(trapDoor.getFacing()) {
switch (trapDoor.getFacing()) {
case NORTH:
return new double[] {0.0, 0.0, 1.0 - openWidth, 1.0, 1.0, 1.0};
case SOUTH:
@@ -51,28 +49,34 @@ public class BukkitTrapDoor implements BukkitShapeModel {
break;
}
}
else {
return trapDoor.getHalf() == Half.BOTTOM
? new double[] {0.0, 0.0, 0.0, 1.0, closedHeight, 1.0}
: new double[] {0.0, 1.0 - closedHeight, 0.0, 1.0, 1.0, 1.0};
}
return trapDoor.getHalf() == Half.BOTTOM ? new double[] {0.0, 0.0, 0.0, 1.0, closedHeight, 1.0}
: new double[] {0.0, 1.0 - closedHeight, 0.0, 1.0, 1.0, 1.0};
}
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) {
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof Openable) {
return ((Openable) blockData).isOpen() ? 0x4 : 0;
}
else {
return 0;
if (blockData instanceof TrapDoor) {
final TrapDoor trapDoor = (TrapDoor) blockData;
if (trapDoor.isOpen()) {
switch(trapDoor.getFacing()) {
case EAST:
return 3;
case NORTH:
return 4;
case SOUTH:
return 5;
case WEST:
return 6;
default:
break;
}
}
}
return 0;
}
}
}
@@ -0,0 +1,59 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.TurtleEgg;
import org.bukkit.util.BoundingBox;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitTurtleEgg implements BukkitShapeModel {
@Override
public double[] getShape(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
if (Bridge1_13.hasBoundingBox()) {
BoundingBox bd = block.getBoundingBox();
return new double[] {bd.getMinX()-x, bd.getMinY()-y, bd.getMinZ()-z, bd.getMaxX()-x, bd.getMaxY()-y, bd.getMaxZ()-z};
}
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof TurtleEgg) {
final TurtleEgg egg = (TurtleEgg) blockData;
switch (egg.getEggs()) {
case 1: // .8125 0.0 .1875 max: .25 .4375 .75
return new double[] {0.23, 0.0, 0.23, 0.75, 0.4375, 0.75};
case 2: // .9375 .0 .0625 max: 0.0625 .4375 .9375
case 3:
case 4:
return new double[] {0.0625, 0.0, 0.0625, 0.9375, 0.4375, 0.9375};
default:
break;
}
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
@Override
public int getFakeData(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
return 0;
}
}
@@ -0,0 +1,154 @@
/*
* 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 org.bukkit.block.data.type.Wall;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitWall implements BukkitShapeModel {
private final double minXZ;
private final double maxXZ;
private final double height;
private final double sideInset;
private final double[] east;
private final double[] north;
private final double[] west;
private final double[] south;
private final double[] eastwest;
private final double[] southnorth;
public BukkitWall(double inset, double height) {
this(inset, 1.0 - inset, height, 0.0);
}
public BukkitWall(double inset, double height, double sideInset) {
this(inset, 1.0 - inset, height, sideInset);
}
public BukkitWall(double minXZ, double maxXZ, double height, double sideInset) {
this.minXZ = minXZ;
this.maxXZ = maxXZ;
this.height = height;
this.sideInset = sideInset;
east = new double[] {maxXZ, 0.0, sideInset, 1.0, height, 1.0 - sideInset};
north = new double[] {sideInset, 0.0, 0.0, 1.0 - sideInset, height, minXZ};
west = new double[] {0.0, 0.0, sideInset, minXZ, height, 1.0 - sideInset};
south = new double[] {sideInset, 0.0, maxXZ, 1.0 - sideInset, height, 1.0};
eastwest = new double[] {0.0, 0.0, sideInset, 1.0, height, 1.0 - sideInset};
southnorth = new double[] {sideInset, 0.0, 0.0, 1.0 - sideInset, height, 1.0};
}
@Override
public double[] getShape(final BlockCache blockCache, final World world, final int x, final int y, final int z) {
// Relevant: https://bugs.mojang.com/browse/MC-9565
final Block block = world.getBlockAt(x, y, z);
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof MultipleFacing) {
MultipleFacing fence = (MultipleFacing) blockData;
double[] res = new double[] {minXZ, 0.0, minXZ, maxXZ, height, maxXZ};
Set<BlockFace> faces = fence.getFaces();
if (!faces.contains(BlockFace.UP) && faces.size() == 2) {
if (faces.contains(BlockFace.SOUTH)) {
return new double[] {sideInset, 0.0, 0.0, 1.0 - sideInset, height, 1.0};
}
if (faces.contains(BlockFace.WEST)) {
return new double[] {0.0, 0.0, sideInset, 1.0, height, 1.0 - sideInset};
}
}
for (final BlockFace face : fence.getFaces()) {
switch (face) {
case EAST:
res = add(res, east);
break;
case NORTH:
res = add(res, north);
break;
case WEST:
res = add(res, west);
break;
case SOUTH:
res = add(res, south);
break;
default:
break;
}
}
return res;
}
else if (blockData instanceof Wall) {
final Wall wall = (Wall) blockData;
if (wall.isUp()) {
double[] res = new double[] {minXZ, 0.0, minXZ, maxXZ, height, maxXZ};
if (!wall.getHeight(BlockFace.WEST).equals(Wall.Height.NONE)) {
res = add(res, west);
}
if (!wall.getHeight(BlockFace.EAST).equals(Wall.Height.NONE)) {
res = add(res, east);
}
if (!wall.getHeight(BlockFace.NORTH).equals(Wall.Height.NONE)) {
res = add(res, north);
}
if (!wall.getHeight(BlockFace.SOUTH).equals(Wall.Height.NONE)) {
res = add(res, south);
}
return res;
}
else {
double[] res = null;
if (!wall.getHeight(BlockFace.WEST).equals(Wall.Height.NONE)
&& !wall.getHeight(BlockFace.EAST).equals(Wall.Height.NONE)) {
if (res == null) {
res = eastwest;
}
}
if (!wall.getHeight(BlockFace.NORTH).equals(Wall.Height.NONE)
&& !wall.getHeight(BlockFace.SOUTH).equals(Wall.Height.NONE)) {
if (res == null) {
res = southnorth;
}
else res = add(res, southnorth);
}
if (res != null) {
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;
}
private double[] add(final double[] array1, final double[] array2) {
final double[] newArray = new double[array1.length + array2.length];
System.arraycopy(array1, 0, newArray, 0, array1.length);
System.arraycopy(array2, 0, newArray, array1.length, array2.length);
return newArray;
}
}
@@ -0,0 +1,54 @@
/*
* 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;
}
}
@@ -0,0 +1,40 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Waterlogged;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitWaterPlant implements BukkitShapeModel {
@Override
public double[] getShape(BlockCache blockCache, World world, int x, int y, int z) {
final Block blockAbove = world.getBlockAt(x, y + 1, z);
final BlockData blockDataAbove = blockAbove.getBlockData();
if (blockDataAbove instanceof Waterlogged && ((Waterlogged)blockDataAbove).isWaterlogged()) {
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
return new double[] {0.0, 0.0, 0.0, 1.0, 8 / 9f, 1.0};
}
@Override
public int getFakeData(BlockCache blockCache, World world, int x, int y, int z) {
return 0;
}
}
@@ -17,6 +17,7 @@ package fr.neatmonster.nocheatplus.compat.cbreflect;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
import fr.neatmonster.nocheatplus.compat.bukkit.BlockCacheBukkit;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectHelper;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectHelper.ReflectFailureException;
@@ -44,6 +45,9 @@ public class BlockCacheCBReflect extends BlockCacheBukkit {
@Override
public double[] fetchBounds(int x, int y, int z) {
final org.bukkit.Material mat = getType(x, y, z);
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
if (shape != null) return shape;
try {
return helper.nmsWorld_fetchBlockShape(this.nmsWorld, this.getType(x, y, z), x, y, z);
}
@@ -22,7 +22,7 @@ import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
import fr.neatmonster.nocheatplus.compat.bukkit.BlockCacheBukkit;
import fr.neatmonster.nocheatplus.compat.bukkit.MCAccessBukkitBase;
import fr.neatmonster.nocheatplus.compat.bukkit.MCAccessBukkit;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectHelper;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectHelper.ReflectFailureException;
import fr.neatmonster.nocheatplus.compat.versions.GenericVersion;
@@ -31,7 +31,7 @@ import fr.neatmonster.nocheatplus.logging.Streams;
import fr.neatmonster.nocheatplus.utilities.location.LocUtil;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class MCAccessCBReflect extends MCAccessBukkitBase {
public class MCAccessCBReflect extends MCAccessBukkit {
protected final ReflectHelper helper;
@@ -49,7 +49,7 @@ public class MCAccessCBReflect extends MCAccessBukkitBase {
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.INIT, "The Minecraft version could not be detected, Compat-CB-Reflect might or might not work.");
this.knownSupportedVersion = false;
}
else if (GenericVersion.compareVersions(mcVersion, "1.4.5") < 0) {
else if (GenericVersion.compareVersions(mcVersion, "1.5") < 0) {
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.INIT, "The Minecraft version seems to be older than what Compat-CB-Reflect can support.");
this.knownSupportedVersion = false;
}
@@ -70,8 +70,7 @@ public class MCAccessCBReflect extends MCAccessBukkitBase {
@Override
public String getMCVersion() {
// Potentially all :p.
return "1.4.5-1.12.2|?";
return "1.5-1.12.2";
}
@Override
@@ -146,17 +146,7 @@ public class ReflectAttributeAccess implements IAttributeAccess {
throw new RuntimeException("Not available.");
}
}
@Override
public double getSpeedAttributeMultiplier(Player player) {
return getSpeedAttributeMultiplier(player, true);
}
@Override
public double getSprintAttributeMultiplier(Player player) {
return nmsAttributeInstance_getSprintAttributeModifierMultiplier(getMovementSpeedAttributeInstance(player));
}
/**
* Get the speed attribute (MOVEMENT_SPEED) for a player.
* @param handle EntityPlayer
@@ -165,9 +155,9 @@ public class ReflectAttributeAccess implements IAttributeAccess {
private Object getMovementSpeedAttributeInstance(Player player) {
return ReflectionUtil.invokeMethod(this.reflectPlayer.nmsGetAttributeInstance, getHandle(player), this.reflectGenericAttributes.nmsMOVEMENT_SPEED);
}
/**
*
*
* @param player
* @param removeSprint If to calculate away the sprint boost modifier.
* @return
@@ -188,7 +178,7 @@ public class ReflectAttributeAccess implements IAttributeAccess {
}
}
}
/**
* (Not an existing method.)
* @param attributeInstance
@@ -202,10 +192,95 @@ public class ReflectAttributeAccess implements IAttributeAccess {
return AttribUtil.getMultiplier((Integer) ReflectionUtil.invokeMethodNoArgs(this.reflectAttributeModifier.nmsGetOperation, mod), (Double) ReflectionUtil.invokeMethodNoArgs(this.reflectAttributeModifier.nmsGetValue, mod));
}
}
private Object getHandle(Player player) {
Object handle = ReflectionUtil.invokeMethodNoArgs(this.reflectPlayer.obcGetHandle, player);
return handle;
}
@Override
public double getSpeedMultiplier(Player player) {
return getSpeedAttributeMultiplier(player, true);
}
@Override
public float getMovementSpeed(final Player player) {
// / by 2 to get the base value 0.1f
return (player.getWalkSpeed() / 2f) * (float) getSpeedMultiplier(player);
}
@Override
public double getSprintMultiplier(Player player) {
return nmsAttributeInstance_getSprintAttributeModifierMultiplier(getMovementSpeedAttributeInstance(player));
}
@Override
public double getGravity(Player player) {
return Double.MAX_VALUE;
}
@Override
public double getSafeFallDistance(Player player) {
return Double.MAX_VALUE;
}
@Override
public double getFallDamageMultiplier(Player player) {
return Double.MAX_VALUE;
}
@Override
public double getBreakingSpeedMultiplier(Player player) {
return Double.MAX_VALUE;
}
@Override
public double getJumpGainMultiplier(Player player) {
return Double.MAX_VALUE;
}
@Override
public double getPlayerSneakingFactor(Player player) {
return Double.MAX_VALUE;
}
@Override
public double getPlayerMaxBlockReach(Player player) {
return Double.MAX_VALUE;
}
@Override
public double getPlayerMaxAttackReach(Player player) {
return Double.MAX_VALUE;
}
@Override
public double getMaxStepUp(Player player) {
return Double.MAX_VALUE;
}
@Override
public float getMovementEfficiency(Player player) {
return Float.MAX_VALUE;
}
@Override
public float getWaterMovementEfficiency(Player player) {
return Float.MAX_VALUE;
}
@Override
public double getSubmergedMiningSpeedMultiplier(Player player) {
return Double.MAX_VALUE;
}
@Override
public double getMiningEfficiency(Player player) {
return Double.MAX_VALUE;
}
@Override
public double getEntityScale(Player player) {
return Double.MAX_VALUE;
}
}
@@ -42,7 +42,7 @@ public class ReflectBase {
clazz = ServerVersion.getNMSMinecraftServer().getClass();
name = clazz.getPackage().getName();
if (name.equals("net.minecraft.server") || name.indexOf("net.") == 0 && name.indexOf(".minecraft.") != -1 && name.indexOf(".server.") != -1) {
nmsPackageName = name;
nmsPackageName = name.contains("v1_") ? name : "net.minecraft.world.entity";
} else {
nmsPackageName = null;
}
@@ -17,10 +17,11 @@ package fr.neatmonster.nocheatplus.compat.cbreflect.reflect;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.bukkit.Material;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectHelper.ReflectFailureException;
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
import org.bukkit.Material;
/**
* Reflection for block shape getting (latest).
@@ -14,6 +14,8 @@
*/
package fr.neatmonster.nocheatplus.compat.cbreflect.reflect;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
@@ -55,6 +57,7 @@ public class ReflectBlockSix implements IReflectBlock {
/** (static) */
public final Method nmsGetById;
public final Object nmsById;
public final Method nmsGetMaterial;
public final boolean useBlockPosition;
@@ -75,6 +78,11 @@ public class ReflectBlockSix implements IReflectBlock {
final Class<?> clazz = Class.forName(base.nmsPackageName + ".Block");
// byID (static)
nmsGetById = ReflectionUtil.getMethod(clazz, "getById", int.class);
final Class<?> blockArray = Array.newInstance(clazz, 0).getClass();
final Field byIdField = ReflectionUtil.getField(clazz, "byId", blockArray);
nmsById = byIdField == null ? null : ReflectionUtil.get(byIdField, blockArray, null);
// getMaterial
nmsGetMaterial = ReflectionUtil.getMethodNoArgs(clazz, "getMaterial");
// updateShape
@@ -215,6 +223,9 @@ public class ReflectBlockSix implements IReflectBlock {
@SuppressWarnings("deprecation")
@Override
public Object nms_getByMaterial(final Material id) {
if (this.nmsById != null) {
return Array.get(nmsById, id.getId());
}
if (this.nmsGetById == null) {
fail();
}
@@ -258,7 +269,7 @@ public class ReflectBlockSix implements IReflectBlock {
@Override
public boolean isFetchBoundsAvailable() {
return nmsGetById != null && nmsUpdateShape != null && nmsGetMinX != null;
return (nmsGetById != null || nmsById != null) && nmsUpdateShape != null && nmsGetMinX != null;
}
}
@@ -20,15 +20,22 @@ import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
public class ReflectDamageSource {
public final Class<?> nmsClass;
public Class<?> nmsClass;
public final Object nmsFALL;
public Object nmsFALL;
public ReflectDamageSource(ReflectBase base) throws ClassNotFoundException {
Class<?> nmsClass = Class.forName(base.nmsPackageName + ".DamageSource");
this.nmsClass = nmsClass;
Field field = ReflectionUtil.getField(nmsClass, "FALL", nmsClass);
nmsFALL = field == null ? null : ReflectionUtil.get(field, nmsClass, null);
try {
Class<?> nmsClass = Class.forName(base.nmsPackageName + ".DamageSource");
this.nmsClass = nmsClass;
Field field = ReflectionUtil.getField(nmsClass, "FALL", nmsClass);
nmsFALL = field == null ? null : ReflectionUtil.get(field, nmsClass, null);
} catch (ClassNotFoundException e) {
Class<?> nmsClass = Class.forName("net.minecraft.world.damagesource.DamageSource");
this.nmsClass = nmsClass;
Field field = ReflectionUtil.getField(nmsClass, "k", nmsClass);
nmsFALL = field == null ? null : ReflectionUtil.get(field, nmsClass, null);
}
}
}
@@ -0,0 +1,70 @@
/*
* 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.cbreflect.reflect;
import java.lang.reflect.Method;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
public class ReflectDamageSources {
public Class<?> nmsClass;
public Method nmsDamageSources;
public Method nmsfall;
public ReflectDamageSources(ReflectBase base, ReflectDamageSource reflectDamageSource) throws ClassNotFoundException {
this(base, reflectDamageSource, Class.forName(base.nmsPackageName + ".Entity"));
}
public ReflectDamageSources(ReflectBase base, ReflectDamageSource reflectDamageSource, Class<?> nmsEntityClass) throws ClassNotFoundException {
nmsClass = Class.forName("net.minecraft.world.damagesource.DamageSources");
nmsfall = ReflectionUtil.getMethodNoArgs(nmsClass, "k", reflectDamageSource.nmsClass);
// 1.19 Entity.damageSources()
nmsDamageSources = ReflectionUtil.getMethodNoArgs(nmsEntityClass, "dG", nmsClass);
// 1.20
if (nmsDamageSources == null) {
nmsDamageSources = ReflectionUtil.getMethodNoArgs(nmsEntityClass, "dJ", nmsClass);
}
// 1.20.2
if (nmsDamageSources == null) {
nmsDamageSources = ReflectionUtil.getMethodNoArgs(nmsEntityClass, "dM", nmsClass);
}
// 1.20.4
if (nmsDamageSources == null) {
nmsDamageSources = ReflectionUtil.getMethodNoArgs(nmsEntityClass, "dN", nmsClass);
}
// 1.20.5-1.20.6
if (nmsDamageSources == null) {
nmsDamageSources = ReflectionUtil.getMethodNoArgs(nmsEntityClass, "dQ", nmsClass);
}
// 1.21
if (nmsDamageSources == null) {
nmsDamageSources = ReflectionUtil.getMethodNoArgs(nmsEntityClass, "dP", nmsClass);
nmsfall = ReflectionUtil.getMethodNoArgs(nmsClass, "l", reflectDamageSource.nmsClass);
}
// 1.21.2-1.21.3
if (nmsDamageSources == null) {
nmsDamageSources = ReflectionUtil.getMethodNoArgs(nmsEntityClass, "dX", nmsClass);
nmsfall = ReflectionUtil.getMethodNoArgs(nmsClass, "l", reflectDamageSource.nmsClass);
}
}
public Object getDamageSource(Object handle) {
if (nmsDamageSources == null || nmsfall == null) return null;
Object damageSources = ReflectionUtil.invokeMethodNoArgs(nmsDamageSources, handle);
return ReflectionUtil.invokeMethodNoArgs(nmsfall, damageSources);
}
}
@@ -40,6 +40,11 @@ public class ReflectEntity extends ReflectGetHandleBase<Entity> {
public final Method nmsDamageEntity;
private final Method nmsDamageEntityNew;
@MostlyHarmless()
public final Method nmsclearActiveItem;
public final boolean nmsDamageEntityInt;
public ReflectEntity(ReflectBase base, ReflectAxisAlignedBB reflectAxisAlignedBB, ReflectDamageSource damageSource) throws ClassNotFoundException {
@@ -59,13 +64,17 @@ public class ReflectEntity extends ReflectGetHandleBase<Entity> {
nmsDead = ReflectionUtil.getField(nmsClass, "dead", boolean.class);
// damageEntity(...)
nmsDamageEntity = ReflectionUtil.getMethod(nmsClass, "damageEntity",
new Class<?>[]{damageSource.nmsClass, float.class}, new Class<?>[]{damageSource.nmsClass, int.class});
// boolean hurt(net.minecraft.world.damagesource.DamageSource,float) -> a
nmsDamageEntityNew = ReflectionUtil.getMethod(nmsClass, "a", new Class<?>[]{damageSource.nmsClass, float.class});
nmsDamageEntity = nmsDamageEntityNew != null ? nmsDamageEntityNew :
ReflectionUtil.getMethod(nmsClass, "damageEntity",
new Class<?>[]{damageSource.nmsClass, float.class}, new Class<?>[]{damageSource.nmsClass, int.class});
if (nmsDamageEntity != null) {
nmsDamageEntityInt = nmsDamageEntity.getParameterTypes()[1] == int.class;
} else {
nmsDamageEntityInt = true; // Uncertain.
}
nmsclearActiveItem = seekClearActiveItemMethod(nmsClass);
// getBoundingBox
if (reflectAxisAlignedBB == null) {
@@ -76,6 +85,24 @@ public class ReflectEntity extends ReflectGetHandleBase<Entity> {
}
}
private Method seekClearActiveItemMethod(Class<?> nmsClass) {
// void releaseUsingItem() -> fE(1.21.2-1.21.3)
// fw(1.21-1.21.1)
// fA(1.20.5-1.20.6)
// fs(1.20.4)
// fr(1.20.2)
// fn(1.20)
// fj(1.19-19.4)
// eR(???)
// clearActiveItem(1.13-???)
String[] methodname = {"fE", "fw", "fA", "fs", "fr", "fn", "fj", "eR", "clearActiveItem", "releaseUsingItem"};
for (String name : methodname) {
Method method = ReflectionUtil.getMethodNoArgs(nmsClass, name);
if (method != null) return method;
}
return null;
}
@Override
protected void fail() {
// Unused.
@@ -0,0 +1,287 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>ncpcompataggregated</artifactId>
<version>1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>NCPCompatAggregated</name>
<description>Aggregator for the NMS compat modules.</description>
<!-- Profile based activation of modules and dependencies. -->
<profiles>
<profile>
<id>all</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_12_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<!-- ... -->
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3043</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3026</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2922</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<!-- Legacy, usupported
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2882</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2808</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2794</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2763</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2691</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2645</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2602</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2545</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2512</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
-->
</dependencies>
</profile>
<profile>
<id>spigot1_12_r1</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_12_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_11_r1</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_10_r1</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_9_r2</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_9_r1</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_8_r3</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_7_r4</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>cblegacy</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3043</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3026</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2922</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2882</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2808</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2794</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2763</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2691</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2645</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<!-- Legacy, unsupported
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2602</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2545</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2512</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
-->
</dependencies>
</profile>
</profiles>
</project>
+28 -40
View File
@@ -1,46 +1,34 @@
<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>ncpcompatcb2645</artifactId>
<packaging>jar</packaging>
<name>NCPCompatCB2645</name>
<version>1.1-SNAPSHOT</version>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatcb2645</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for CB 2645 (MC 1.5).
</description>
<name>NCPCompatCB2645</name>
<description>Compatibility for CB2645 (MC 1.5).</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.5-R0.1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/craftbukkit-1.5-R0.1-20130317.180842-21.jar</systemPath>
</dependency>
</dependencies>
</project>
</project>
@@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.v1_5_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_5_R1.entity.CraftEntity;
import org.bukkit.entity.Entity;
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
import net.minecraft.server.v1_5_R1.AxisAlignedBB;
import net.minecraft.server.v1_5_R1.EntityBoat;
@@ -109,10 +110,13 @@ public class BlockCacheCB2645 extends BlockCache {
public double[] fetchBounds(final int x, final int y, final int z){
// TODO: change api for this / use nodes (!)
final org.bukkit.Material mat = getType(x, y, z);
@SuppressWarnings("deprecation")
final int id = getType(x, y, z).getId();
final int id = mat.getId();
final net.minecraft.server.v1_5_R1.Block block = net.minecraft.server.v1_5_R1.Block.byId[id];
if (block == null) return null;
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
if (shape != null) return shape;
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
// minX, minY, minZ, maxX, maxY, maxZ
@@ -183,6 +183,11 @@ public class MCAccessCB2645 implements MCAccess {
return AlmostBoolean.NO;
}
@Override
public boolean resetActiveItem(Player player) {
return false;
}
// @Override
// public void correctDirection(final Player player) {
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
+28 -40
View File
@@ -1,46 +1,34 @@
<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>ncpcompatcb2691</artifactId>
<packaging>jar</packaging>
<name>NCPCompatCB2691</name>
<version>1.1-SNAPSHOT</version>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.5.1-R0.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatcb2691</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for CB2691 (1.5.1-R0.1 beta release).
</description>
<name>NCPCompatCB2691</name>
<description>Compatibility for CB2691 (MC 1.5.1-R0.2 beta release).</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.5.1-R0.2</version>
<scope>system</scope>
<systemPath>${basedir}/libs/craftbukkit-1.5.1-R0.2-SNAPSHOT.jar</systemPath>
</dependency>
</dependencies>
</project>
</project>
@@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.v1_5_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_5_R2.entity.CraftEntity;
import org.bukkit.entity.Entity;
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
import net.minecraft.server.v1_5_R2.AxisAlignedBB;
import net.minecraft.server.v1_5_R2.EntityBoat;
@@ -109,10 +110,13 @@ public class BlockCacheCB2691 extends BlockCache {
public double[] fetchBounds(final int x, final int y, final int z){
// TODO: change api for this / use nodes (!)
final org.bukkit.Material mat = getType(x, y, z);
@SuppressWarnings("deprecation")
final int id = getType(x, y, z).getId();
final int id = mat.getId();
final net.minecraft.server.v1_5_R2.Block block = net.minecraft.server.v1_5_R2.Block.byId[id];
if (block == null) return null;
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
if (shape != null) return shape;
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
// minX, minY, minZ, maxX, maxY, maxZ
@@ -185,6 +185,11 @@ public class MCAccessCB2691 implements MCAccess{
return AlmostBoolean.NO;
}
@Override
public boolean resetActiveItem(Player player) {
return false;
}
// @Override
// public void correctDirection(final Player player) {
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
+28 -40
View File
@@ -1,46 +1,34 @@
<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>ncpcompatcb2763</artifactId>
<packaging>jar</packaging>
<name>NCPCompatCB2763</name>
<version>1.1-SNAPSHOT</version>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.5.2-R1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatcb2763</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for CB 2763 (MC 1.5.2).
</description>
<name>NCPCompatCB2763</name>
<description>Compatibility for CB2763 (MC 1.5.2).</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.5.2-R1.0</version>
<scope>system</scope>
<systemPath>${basedir}/libs/craftbukkit-1.5.2-R1.0.jar</systemPath>
</dependency>
</dependencies>
</project>
</project>
@@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.v1_5_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftEntity;
import org.bukkit.entity.Entity;
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
import net.minecraft.server.v1_5_R3.AxisAlignedBB;
import net.minecraft.server.v1_5_R3.EntityBoat;
@@ -107,11 +108,13 @@ public class BlockCacheCB2763 extends BlockCache {
@Override
public double[] fetchBounds(final int x, final int y, final int z){
// TODO: change api for this / use nodes (!)
final org.bukkit.Material mat = getType(x, y, z);
final int id = iBlockAccess.getTypeId(x, y, z);
final net.minecraft.server.v1_5_R3.Block block = net.minecraft.server.v1_5_R3.Block.byId[id];
if (block == null) return null;
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
if (shape != null) return shape;
block.updateShape(iBlockAccess, x, y, z); // TODO: use THIS instead of world.
// minX, minY, minZ, maxX, maxY, maxZ
@@ -184,6 +184,11 @@ public class MCAccessCB2763 implements MCAccess{
return AlmostBoolean.NO;
}
@Override
public boolean resetActiveItem(Player player) {
return false;
}
// @Override
// public void correctDirection(final Player player) {
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
+28 -40
View File
@@ -1,46 +1,34 @@
<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>ncpcompatcb2794</artifactId>
<packaging>jar</packaging>
<name>NCPCompatCB2794</name>
<version>1.1-SNAPSHOT</version>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.6.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatcb2794</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for CB 2794 (MC 1.6.1).
</description>
<name>NCPCompatCB2794</name>
<description>Compatibility for CB2794 (MC 1.6.1).</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.6.1-R0.1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/craftbukkit-1.6.1-R0.1-SNAPSHOT.jar</systemPath>
</dependency>
</dependencies>
</project>
</project>
@@ -23,6 +23,10 @@ import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
import net.minecraft.server.v1_6_R1.AttributeInstance;
import net.minecraft.server.v1_6_R1.AttributeModifier;
import net.minecraft.server.v1_6_R1.GenericAttributes;
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.utilities.moving.Magic;
public class AttributeAccess implements IAttributeAccess {
@@ -33,25 +37,106 @@ public class AttributeAccess implements IAttributeAccess {
}
@Override
public double getSpeedAttributeMultiplier(Player player) {
public double getSpeedMultiplier(Player player) {
final AttributeInstance attr = ((CraftLivingEntity) player).getHandle().a(GenericAttributes.d);
double val = attr.e() / attr.b();
final AttributeModifier mod = attr.a(AttribUtil.ID_SPRINT_BOOST);
if (mod == null) {
return val;
} else {
}
else {
return val / AttribUtil.getMultiplier(mod.c(), mod.d());
}
}
@Override
public double getSprintAttributeMultiplier(Player player) {
public float getMovementSpeed(final Player player) {
// / by 2 to get the base value 0.1f
return (player.getWalkSpeed() / 2f) * (float) getSpeedMultiplier(player);
}
@Override
public double getSprintMultiplier(Player player) {
final AttributeModifier mod = ((CraftLivingEntity) player).getHandle().a(GenericAttributes.d).a(AttribUtil.ID_SPRINT_BOOST);
if (mod == null) {
return 1.0;
} else {
}
else {
return AttribUtil.getMultiplier(mod.c(), mod.d());
}
}
////////////////////////////////////////////////////////////////
// Modern attributes. Not available for legacy versions. //
////////////////////////////////////////////////////////////////
@Override
public double getGravity(Player player) {
return Magic.DEFAULT_GRAVITY;
}
@Override
public double getSafeFallDistance(Player player) {
return Magic.FALL_DAMAGE_DIST;
}
@Override
public double getFallDamageMultiplier(Player player) {
return 1.0;
}
@Override
public double getBreakingSpeedMultiplier(Player player) {
return 1.0;
}
@Override
public double getJumpGainMultiplier(Player player) {
return 1.0;
}
@Override
public double getPlayerSneakingFactor(Player player) {
return Magic.SNEAK_MULTIPLIER;
}
@Override
public double getPlayerMaxBlockReach(Player player) {
return 4.5;
}
@Override
public double getPlayerMaxAttackReach(Player player) {
return 3.0;
}
@Override
public double getMaxStepUp(Player player) {
final MovingConfig cc = DataManager.getPlayerData(player).getGenericInstance(MovingConfig.class);
return cc.sfStepHeight;
}
@Override
public float getMovementEfficiency(Player player) {
return 0.0f;
}
@Override
public float getWaterMovementEfficiency(Player player) {
return 0.0f;
}
@Override
public double getSubmergedMiningSpeedMultiplier(Player player) {
return 1.0;
}
@Override
public double getMiningEfficiency(Player player) {
return 0.0;
}
@Override
public double getEntityScale(Player player) {
return 1.0;
}
}
@@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.v1_6_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_6_R1.entity.CraftEntity;
import org.bukkit.entity.Entity;
import fr.neatmonster.nocheatplus.compat.blocks.LegacyBlocks;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
import net.minecraft.server.v1_6_R1.AxisAlignedBB;
import net.minecraft.server.v1_6_R1.EntityBoat;
@@ -109,10 +110,13 @@ public class BlockCacheCB2794 extends BlockCache {
public double[] fetchBounds(final int x, final int y, final int z){
// TODO: change api for this / use nodes (!)
final org.bukkit.Material mat = getType(x, y, z);
@SuppressWarnings("deprecation")
final int id = getType(x, y, z).getId();
final int id = mat.getId();
final net.minecraft.server.v1_6_R1.Block block = net.minecraft.server.v1_6_R1.Block.byId[id];
if (block == null) return null;
final double[] shape = LegacyBlocks.getShape(this, mat, x, y, z, true);
if (shape != null) return shape;
block.updateShape(iBlockAccess, x, y, z);
// minX, minY, minZ, maxX, maxY, maxZ
@@ -187,4 +187,9 @@ public class MCAccessCB2794 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
return false;
}
}
+28 -40
View File
@@ -1,46 +1,34 @@
<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>ncpcompatcb2808</artifactId>
<packaging>jar</packaging>
<name>NCPCompatCB2808</name>
<version>1.1-SNAPSHOT</version>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.6.2-R1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatcb2808</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for CB2808 (MC 1.6.2).
</description>
<name>NCPCompatCB2808</name>
<description>Compatibility for CB2808 (MC 1.6.2).</description>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.6.2-R0.1</version>
<scope>system</scope>
<systemPath>${basedir}/libs/craftbukkit-1.6.2-R0.1-SNAPSHOT.jar</systemPath>
</dependency>
</dependencies>
</project>
</project>
Loaded 100 of 486 files, more files were not shown because too many files have changed in this diff. Show more