Author SHA1 Message Date
xaw3ep 009c8d00c6 ffffffffff
Done, but not work well with recent versions; packet inversion?
2021-07-26 20:26:23 +07:00
xaw3ep aee5ed158e Parts
Put it here, syncing with local
2021-07-26 09:57:25 +07: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
230 changed files with 18748 additions and 10880 deletions

No files matched your search

+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/
+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>
+26 -39
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.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-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.17.1-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>
@@ -20,7 +20,9 @@ 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.BlockProperties;
public class BlockCacheBukkit extends BlockCache {
@@ -38,6 +40,7 @@ public class BlockCacheBukkit extends BlockCache {
this.world = world;
if (world != null) {
this.maxBlockY = world.getMaxHeight() - 1;
this.minBlockY = BlockProperties.getMinWorldY();
}
return this;
}
@@ -52,7 +55,7 @@ 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
@@ -70,7 +73,7 @@ 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))
if (type != EntityType.BOAT && type != EntityType.SHULKER){ // && !(other instanceof Minecart))
continue;
}
final double locY = entity.getLocation(useLoc).getY();
@@ -97,4 +100,4 @@ public class BlockCacheBukkit extends BlockCache {
world = null;
}
}
}
@@ -116,7 +116,7 @@ public class MCAccessBukkitBase implements MCAccess {
public String getMCVersion() {
// Bukkit API.
// TODO: maybe output something else.
return "1.4.6-1.11.2|?"; // uh oh
return "1.4.6-1.15.2|?"; // uh oh
}
@Override
@@ -200,7 +200,6 @@ public class MCAccessBukkitBase implements MCAccess {
return 0.5f;
case PLAYER: // FAST RETURN
case ZOMBIE:
case PIG_ZOMBIE:
case SKELETON:
case CREEPER:
case ENDERMAN:
@@ -377,6 +376,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,25 +18,18 @@ import java.util.HashMap;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
import fr.neatmonster.nocheatplus.compat.BridgeHealth;
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
import fr.neatmonster.nocheatplus.compat.blocks.init.BlockInit;
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.BukkitEndPortalFrame;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitFence;
import fr.neatmonster.nocheatplus.compat.bukkit.model.BukkitGate;
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.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.*;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectBase;
import fr.neatmonster.nocheatplus.compat.cbreflect.reflect.ReflectDamageSource;
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;
@@ -44,8 +37,38 @@ import fr.neatmonster.nocheatplus.utilities.map.MaterialUtil;
public class MCAccessBukkitModern extends MCAccessBukkit {
protected ReflectBase reflectBase = null;
protected ReflectDamageSource reflectDamageSource = null;
protected ReflectLivingEntity reflectLivingEntity = null;
protected final Map<Material, BukkitShapeModel> shapeModels = new HashMap<Material, BukkitShapeModel>();
// Blocks that can automatic fetch bounding box from API
private static final BukkitShapeModel MODEL_AUTO_FETCH = new BukkitFetchableBound();
// Blocks that form from multi-bounds
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.8749, 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(
0.0, 0.0, 0.0, 1.0, 0.125, 1.0,
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();
// 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();
@@ -61,8 +84,13 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
private static final BukkitShapeModel MODEL_TURTLE_EGG = new BukkitTurtleEgg();
// Blocks that have a different shape, based on how they have been placed.
private static final BukkitShapeModel MODEL_CAKE = new BukkitCake();
private static final BukkitShapeModel MODEL_SLAB = new BukkitSlab();
private static final BukkitShapeModel MODEL_STAIRS= new BukkitStairs();
private static final BukkitShapeModel MODEL_STAIRS = new BukkitStairs();
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);
@@ -71,26 +99,28 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
0.4375, 1.0);
private static final BukkitShapeModel MODEL_THICK_FENCE = new BukkitFence(
0.375, 1.5);
private static final BukkitShapeModel MODEL_THICK_FENCE2 = new BukkitFence(
0.25, 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 BukkitStatic(
0.75, 0.25, 0.0, 0.25, 0.75, 0.5);
private static final BukkitShapeModel MODEL_WALL_HEAD = new BukkitWallHead();
// Static blocks (various height and inset values).
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_LILY_PAD = new BukkitStatic(
0.09375);
private static final BukkitShapeModel MODEL_FLOWER_POT = new BukkitStatic(
0.33, 0.375); // TODO: XZ really?
private static final BukkitShapeModel MODEL_LANTERN = new BukkitStatic(
0.33, 0.5625); // TODO: XZ really?
private static final BukkitShapeModel MODEL_LANTERN = new BukkitLantern();
private static final BukkitShapeModel MODEL_CONDUIT = new BukkitStatic(
0.33, 0.6875);
private static final BukkitShapeModel MODEL_GROUND_HEAD= new BukkitStatic(
0.25, 0.5); // TODO: XZ-really? 275 ?
private static final BukkitShapeModel MODEL_SINGLE_CHEST = new BukkitStatic(
0.062, .875); // TODO: 0.0625?
0.0625, 0.875);
private static final BukkitShapeModel MODEL_HONEY_BLOCK = new BukkitStatic(
0.0625, 0.9375);
// Static blocks with full height sorted by inset.
private static final BukkitShapeModel MODEL_INSET16_1_HEIGHT100 = new BukkitStatic(
@@ -108,33 +138,31 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
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,
* CONDUIT
*/
// TODO: anvils, dead coral fans
// TODO: Liquid (all leveled).
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);
} catch(ClassNotFoundException ex) {
}
}
@Override
public String getMCVersion() {
return "1.13.2-1.14|?";
return "1.13-1.17|?";
}
@Override
@@ -153,49 +181,90 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
// TODO: Also consider removing flags (passable_x4 etc).
// Variables for repeated flags (Temporary flags, these should be fixed later so that they are not added here)
final long headFlags = BlockFlags.SOLID_GROUND | BlockProperties.F_XZ100 | BlockProperties.F_IGN_PASSABLE;
final long blockFix = BlockFlags.SOLID_GROUND | BlockProperties.F_XZ100 | BlockProperties.F_IGN_PASSABLE;
final long blockFix = BlockFlags.SOLID_GROUND;
// Adjust flags for individual blocks.
BlockProperties.setBlockFlags(Material.CAULDRON,
BlockFlags.SOLID_GROUND | BlockProperties.F_GROUND_HEIGHT
| BlockProperties.F_MIN_HEIGHT4_1);
BlockProperties.setBlockFlags(Material.COCOA, blockFix);
BlockProperties.setBlockFlags(Material.TURTLE_EGG, BlockProperties.F_IGN_PASSABLE | BlockFlags.SOLID_GROUND | BlockProperties.F_GROUND | BlockProperties.F_XZ100);
BlockProperties.setBlockFlags(Material.TURTLE_EGG, blockFix);
BlockProperties.setBlockFlags(Material.CHORUS_PLANT, blockFix);
BlockProperties.setBlockFlags(Material.CREEPER_WALL_HEAD, headFlags);
BlockProperties.setBlockFlags(Material.ZOMBIE_WALL_HEAD, headFlags);
BlockProperties.setBlockFlags(Material.PLAYER_WALL_HEAD, headFlags);
BlockProperties.setBlockFlags(Material.DRAGON_WALL_HEAD, headFlags);
BlockProperties.setBlockFlags(Material.WITHER_SKELETON_WALL_SKULL, headFlags);
BlockProperties.setBlockFlags(Material.SKELETON_WALL_SKULL, headFlags);
BlockProperties.setBlockFlags(Material.CREEPER_WALL_HEAD, blockFix);
BlockProperties.setBlockFlags(Material.ZOMBIE_WALL_HEAD, blockFix);
BlockProperties.setBlockFlags(Material.PLAYER_WALL_HEAD, blockFix);
BlockProperties.setBlockFlags(Material.DRAGON_WALL_HEAD, blockFix);
BlockProperties.setBlockFlags(Material.WITHER_SKELETON_WALL_SKULL, blockFix);
BlockProperties.setBlockFlags(Material.SKELETON_WALL_SKULL, blockFix);
// Directly keep blocks as is.
for (final Material mat : new Material[] {
Material.CAULDRON,
BridgeMaterial.COBWEB,
Material.HOPPER,
BridgeMaterial.MOVING_PISTON,
Material.SNOW,
Material.CAKE,
Material.BEACON,
Material.LADDER,
Material.VINE,
Material.ANVIL,
Material.CHIPPED_ANVIL,
Material.DAMAGED_ANVIL,
Material.CHORUS_FLOWER
}) {
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",
"big_dripleaf", "sculk_sensor", "pointed_dripstone",
"stonecutter", "chain"
)) {
addModel(mat, MODEL_AUTO_FETCH);
}
// Camp fire
for (Material mat : BridgeMaterial.getAllBlocks(
"campfire", "soul_campfire"
)) {
addModel(mat, MODEL_CAMPFIRE);
}
// Cauldron
for (Material mat : MaterialUtil.CAULDRON) {
BlockProperties.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);
// End Rod / Lightning Rod.
for (Material mat : MaterialUtil.RODS) {
addModel(mat, MODEL_END_ROD);
}
// Hoppers - min height changed in 1.13+
addModel(Material.HOPPER, MODEL_HOPPER);
// Ladder
addModel(Material.LADDER, MODEL_LADDER);
// 1/16 inset at full height.
for (Material mat : new Material[] {
@@ -227,16 +296,20 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
addModel(mat, MODEL_XZ100_HEIGHT4_3);
}
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.BREWING_STAND
}) {
addModel(mat, MODEL_XZ100_HEIGHT8_7);
addModel(mat, MODEL_BREWING_STAND);
}
// 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);
}
@@ -335,9 +408,59 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
}
//Lantern
Material mt = Material.getMaterial("LANTERN");
if (mt != null) addModel(mt, MODEL_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);
// Levelled blocks
for (Material mat : BridgeMaterial.getAllBlocks(
"snow", "water", "lava"
)) {
addModel(mat, MODEL_LEVELLED);
}
// Rails
for (final Material mat : MaterialUtil.RAILS) {
addModel(mat, MODEL_RAIL);
}
// Walls
for (Material mat : MaterialUtil.ALL_WALLS) {
addModel(mat, MODEL_THICK_FENCE2);
}
// Lectern
Material mt = BridgeMaterial.getBlock("lectern");
if (mt != null) addModel(mt, MODEL_LECTERN);
// Bamboo
mt = BridgeMaterial.getBlock("bamboo");
if (mt != null) addModel(mt, MODEL_BAMBOO);
// Bell
mt = BridgeMaterial.getBlock("bell");
if (mt != null) addModel(mt, MODEL_BELL);
// 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);
// Sort to processed by flags.
for (final Material mat : Material.values()) {
final long flags = BlockProperties.getBlockFlags(mat);
@@ -355,13 +478,49 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
addModel(mat, MODEL_THICK_FENCE);
}
}
// Walls
if (BlockFlags.hasAnyFlag(flags, BlockProperties.F_THICK_FENCE2)) {
addModel(mat, MODEL_THICK_FENCE2);
}
}
super.setupBlockProperties(worldConfigProvider);
}
private Object getHandle(Player player) {
// TODO: CraftPlayer check (isAssignableFrom)?
if (this.reflectLivingEntity == null || this.reflectLivingEntity.obcGetHandle == null) {
return null;
}
Object handle = ReflectionUtil.invokeMethodNoArgs(this.reflectLivingEntity.obcGetHandle, player);
return handle;
}
private boolean canDealFallDamage() {
return this.reflectLivingEntity != null && this.reflectLivingEntity.nmsDamageEntity != null && this.reflectDamageSource.nmsFALL != 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)
ReflectionUtil.invokeMethod(this.reflectLivingEntity.nmsDamageEntity, handle, this.reflectDamageSource.nmsFALL, (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,67 @@
/*
* 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,52 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import java.text.DecimalFormat;
import org.bukkit.World;
import org.bukkit.block.Block;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitBamboo implements BukkitShapeModel {
//private DecimalFormat df = new DecimalFormat("#.000");
//private final double xz = 0.375;
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
//final Block block = world.getBlockAt(x, y, z);
//double minX = Math.abs(block.getBoundingBox().getMinX()) - Math.abs((int) block.getBoundingBox().getMinX());
//double minZ = Math.abs(block.getBoundingBox().getMinZ()) - Math.abs((int) block.getBoundingBox().getMinZ());
//minX = Double.parseDouble(df.format(minX));
//minZ = Double.parseDouble(df.format(minZ));
//return new double[] {1.0 - minX + 0.09, 0.0, minZ + 0.09, 1.0 - minX + xz - 0.09, 1.0, minZ + xz - 0.09}; (1)
//return new double[] {minX + 0.09, 0.0, 1.0 - minZ + 0.09, minX + xz - 0.09, 1.0, 1.0 - minZ + xz - 0.09}; (2)
// (1) + (2) =>
//return new double[] {1.0 - minX + 0.09, 0.0, 1.0 - minZ + 0.09, 1.0 - minX + xz - 0.09, 1.0, 1.0 - minZ + xz - 0.09};
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,125 @@
/*
* 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 hold 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 hold 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 hold 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 hold 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 hold 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 hold 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,51 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import 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,46 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import 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;
}
}
@@ -14,15 +14,14 @@
*/
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.util.BoundingBox;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitChorusPlant implements BukkitShapeModel {
@@ -32,16 +31,41 @@ public class BukkitChorusPlant implements BukkitShapeModel {
final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
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;
}
}
}
double minX = Math.abs(block.getBoundingBox().getMinX()) - Math.abs((int) block.getBoundingBox().getMinX());
double minY = Math.abs(block.getBoundingBox().getMinY()) - Math.abs((int) block.getBoundingBox().getMinY());
double minZ = Math.abs(block.getBoundingBox().getMinZ()) - Math.abs((int) block.getBoundingBox().getMinZ());
double maxX = Math.abs(block.getBoundingBox().getMaxX()) - Math.abs((int) block.getBoundingBox().getMaxX());
double maxY = Math.abs(block.getBoundingBox().getMaxY()) - Math.abs((int) block.getBoundingBox().getMaxY());
double maxZ = Math.abs(block.getBoundingBox().getMaxZ()) - Math.abs((int) block.getBoundingBox().getMaxZ());
return new double[] {minX, minY, minZ, maxX, maxY, maxZ};
return res;
}
@Override
@@ -16,10 +16,14 @@ 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 {
@@ -28,20 +32,58 @@ public class BukkitCocoa implements BukkitShapeModel {
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) {
if (blockData instanceof Cocoa && blockData instanceof Directional) {
BlockFace face = ((Directional) blockData).getFacing();
final Cocoa cocoa = (Cocoa) blockData;
switch (cocoa.getAge()) {
case 0: // .625 .4375 .0625 max: .375 .75 .3125
return new double[] {0.625, 0.4375, 0.0625, 0.375, 0.75, 0.3125};
case 1: // .6875 .3125 .0625 max: .3125 .75 .4375
return new double[] {0.6875, 0.3125, 0.0625, 0.3125, 0.75, 0.4375};
case 2: // .75 .1875 .0625 max: .25 .75 .5625
return new double[] {0.75, 0.1875, 0.0625, 0.25, 0.75, 0.5625};
default:
switch (face) {
case NORTH:
return new double[] {0.375, 0.4375, 0.0, 0.625, 0.75, 0.315};
case SOUTH:
return new double[] {0.375, 0.4375, 0.685, 0.625, 0.75, 1.0};
case WEST:
return new double[] {0.0, 0.4375, 0.375, 0.315, 0.75, 0.625};
case EAST:
return new double[] {0.685, 0.4375, 0.375, 1.0, 0.75, 0.625};
default:
break;
}
break;
case 1: // .6875 .3125 .0625 max: .3125 .75 .4375
switch (face) {
case NORTH:
return new double[] {0.3125, 0.3125, 0.0, 0.6875, 0.75, 0.4375};
case SOUTH:
return new double[] {0.3125, 0.3125, 0.5625, 0.6875, 0.75, 1.0};
case WEST:
return new double[] {0.0, 0.3125, 0.3125, 0.4375, 0.75, 0.6875};
case EAST:
return new double[] {0.5625, 0.3125, 0.3125, 1.0, 0.75, 0.6875};
default:
break;
}
break;
case 2: // .75 .1875 .0625 max: .25 .75 .5625
switch (face) {
case NORTH:
return new double[] {0.25, 0.1875, 0.0, 0.75, 0.75, 0.5625};
case SOUTH:
return new double[] {0.25, 0.1875, 0.4375, 0.75, 0.75, 1.0};
case WEST:
return new double[] {0.0, 0.1875, 0.25, 0.5625, 0.75, 0.75};
case EAST:
return new double[] {0.4375, 0.1875, 0.25, 1.0, 0.75, 0.75};
default:
break;
}
}
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
@@ -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,127 @@
/*
* 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,56 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
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) {
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();
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,49 @@
/*
* 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,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 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.type.Snow;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitLevelled 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 Snow) {
return ((Snow)blockData).getLayers() - 1;
}
if (blockData instanceof Levelled) {
return ((Levelled)blockData).getLevel();
}
return 0;
}
}
@@ -0,0 +1,79 @@
/*
* 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,83 @@
/*
* 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,43 @@
/*
* 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;
}
}
@@ -19,7 +19,9 @@ 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 {
@@ -28,20 +30,24 @@ public class BukkitSeaPickle implements BukkitShapeModel {
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: // .625 , 0 , .375 max: .375 , 375 , .625
return new double[] {0.625, 0.0, 0.375, 0.375, 0.375, 0.625};
case 2: // .8125 , 0 , .1875 max: .1875 , .375 , .8125
return new double[] {0.8125, 0.0, 0.1875, 0.1875, 0.375, 0.8125};
case 3: // .875 0 .125 max: .125 .375 .875
return new double[] {0.875, 0.0, 0.125, 0.125, 0.375, 0.875};
case 4: // .875 0 .125 max: .125 .4375 .875
return new double[] {0.875, 0.0, 0.125, 0.125, 0.4375, 0.875};
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;
}
@@ -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,21 +41,22 @@ 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};
return bounds;
}
@Override
@@ -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;
@@ -67,12 +66,23 @@ public class BukkitTrapDoor implements BukkitShapeModel {
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;
}
}
@@ -19,7 +19,9 @@ 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 {
@@ -28,6 +30,10 @@ public class BukkitTurtleEgg implements BukkitShapeModel {
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();
@@ -35,11 +41,11 @@ public class BukkitTurtleEgg implements BukkitShapeModel {
final TurtleEgg egg = (TurtleEgg) blockData;
switch (egg.getEggs()) {
case 1: // .8125 0.0 .1875 max: .25 .4375 .75
return new double[] {0.8125, 0.0, 0.1875, 0.25, 0.4375, 0.75};
return new double[] {0.23, 0.0, 0.23, 0.75, 0.4375, 0.75};
case 2: // .9375 .0 .0625 max: 0.0625 .4375 .9375
case 3:
case 4:
return new double[] {0.9375, 0.0, 0.0625, 0.0625, 0.4375, 0.9375};
return new double[] {0.0625, 0.0, 0.0625, 0.9375, 0.4375, 0.9375};
default:
break;
}
@@ -0,0 +1,130 @@
/*
* 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;
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};
}
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof MultipleFacing) {
final MultipleFacing fence = (MultipleFacing) blockData;
double[] res = new double[] {minXZ, 0.0, minXZ, maxXZ, height, maxXZ};
final Set<BlockFace> a = fence.getFaces();
if (!a.contains(BlockFace.UP) && a.size() == 2) {
if (a.contains(BlockFace.SOUTH)) {
return new double[] {sideInset, 0.0, 0.0, 1.0 - sideInset, height, 1.0};
}
if (a.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 {
if (!wall.getHeight(BlockFace.WEST).equals(Wall.Height.NONE) && !wall.getHeight(BlockFace.EAST).equals(Wall.Height.NONE)) {
return new double[] {0.0, 0.0, sideInset, 1.0, height, 1.0 - sideInset};
}
if (!wall.getHeight(BlockFace.NORTH).equals(Wall.Height.NONE) && !wall.getHeight(BlockFace.SOUTH).equals(Wall.Height.NONE)) {
return new double[] {sideInset, 0.0, 0.0, 1.0 - sideInset, height, 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) {
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,57 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitWallHead implements BukkitShapeModel {
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockData blockData = block.getBlockData();
if (blockData instanceof Directional) {
BlockFace face = ((Directional) blockData).getFacing();
switch (face) {
case NORTH:
return new double[] {0.25, 0.25, 0.5, 0.75, 0.75, 1.0};
case SOUTH:
return new double[] {0.25, 0.25, 0.0, 0.75, 0.75, 0.5};
case WEST:
return new double[] {0.5, 0.25, 0.25, 1.0, 0.75, 0.75};
case EAST:
return new double[] {0.0, 0.25, 0.25, 0.5, 0.75, 0.75};
default:
break;
}
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
@Override
public int getFakeData(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
return 0;
}
}
@@ -53,7 +53,7 @@ public class MCAccessCBReflect extends MCAccessBukkitModern {
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.INIT, "The Minecraft version seems to be older than what Compat-CB-Reflect can support.");
this.knownSupportedVersion = false;
}
else if (GenericVersion.compareVersions(mcVersion, "1.12.2") > 0) {
else if (GenericVersion.compareVersions(mcVersion, "1.14.4") > 0) {
this.knownSupportedVersion = false;
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.INIT, "The Minecraft version seems to be more recent than the one Compat-CB-Reflect has been built with - this might work, but there could be incompatibilities.");
} else {
@@ -71,7 +71,7 @@ public class MCAccessCBReflect extends MCAccessBukkitModern {
@Override
public String getMCVersion() {
// Potentially all :p.
return "1.4.5-1.13|?";
return "1.7-1.14.4|?";
}
@Override
@@ -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;
}
@@ -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);
}
}
}
@@ -40,6 +40,9 @@ public class ReflectEntity extends ReflectGetHandleBase<Entity> {
public final Method nmsDamageEntity;
@MostlyHarmless()
public final Method nmsclearActiveItem;
public final boolean nmsDamageEntityInt;
public ReflectEntity(ReflectBase base, ReflectAxisAlignedBB reflectAxisAlignedBB, ReflectDamageSource damageSource) throws ClassNotFoundException {
@@ -66,6 +69,7 @@ public class ReflectEntity extends ReflectGetHandleBase<Entity> {
} else {
nmsDamageEntityInt = true; // Uncertain.
}
nmsclearActiveItem = ReflectionUtil.getMethodNoArgs(nmsClass, "clearActiveItem");
// getBoundingBox
if (reflectAxisAlignedBB == null) {
@@ -0,0 +1,298 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>ncpcompataggregated</artifactId>
<version>1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>NCPCompatAggregated</name>
<description>Aggregator for the NMS compat modules.</description>
<!-- Profile based activation of modules and dependencies. -->
<profiles>
<profile>
<id>all</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<!-- ... -->
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3043</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3026</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2922</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<!-- Legacy, usupported
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2882</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2808</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2794</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2763</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2691</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2645</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2602</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2545</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2512</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
-->
</dependencies>
</profile>
<profile>
<id>cbdev</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_12_r1</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_11_r1</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_10_r1</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_9_r2</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_9_r1</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_8_r3</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_7_r4</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<!-- Legacy, unsupported
<profile>
<id>cblegacy</id>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3043</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3026</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2922</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2882</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2808</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2794</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2763</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2691</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2645</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2602</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2545</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2512</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
-->
</profiles>
</project>
@@ -187,4 +187,9 @@ public class MCAccessCB2794 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
return false;
}
}
@@ -188,4 +188,9 @@ public class MCAccessCB2808 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
return false;
}
}
@@ -189,4 +189,9 @@ public class MCAccessCB2882 implements MCAccess{
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
return false;
}
}
+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>ncpcompatcb2922</artifactId>
<packaging>jar</packaging>
<name>NCPCompatCB2922</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.7.2-R0.4-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatcb2922</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for CB2922 (MC 1.7.2).
</description>
<name>NCPCompatCB2922</name>
<description>Compatibility for CB2922 (MC 1.7.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.7.2-R0.4-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>
@@ -189,4 +189,9 @@ public class MCAccessCB2922 implements MCAccess{
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
return false;
}
}
+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>ncpcompatcb3026</artifactId>
<packaging>jar</packaging>
<name>NCPCompatCB3026</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.7.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatcb3026</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for CB3026 (MC 1.7.5).
</description>
<name>NCPCompatCB3026</name>
<description>Compatibility for CB3026 (MC 1.7.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.7.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>
@@ -189,4 +189,9 @@ public class MCAccessCB3026 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
return false;
}
}
+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>ncpcompatcb3043</artifactId>
<packaging>jar</packaging>
<name>NCPCompatCB3043</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.7.9-R0.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatcb3043</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for CB3043 (MC 1.7.10).
</description>
<name>NCPCompatCB3043</name>
<description>Compatibility for CB3043 (MC 1.7.9).</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.7.9-R0.2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>
@@ -208,4 +208,9 @@ public class MCAccessCB3043 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
return false;
}
}
+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>ncpcompatcb3100</artifactId>
<packaging>jar</packaging>
<name>NCPCompatCB3100</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.7.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for CraftBukkit build 3100 (MC 1.7.10).
</description>
<name>NCPCompatCB3100</name>
<description>Compatibility for CraftBukkit build 3100 (MC 1.7.10).</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.7.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>
@@ -214,4 +214,10 @@ public class MCAccessCB3100 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
((CraftPlayer) player).getHandle().bA();
return true;
}
}
+36 -45
View File
@@ -1,52 +1,43 @@
<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>ncpcompatcbdev</artifactId>
<packaging>jar</packaging>
<name>NCPCompatCBDev</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.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for the development version (latest of the supported Minecraft versions).
<name>NCPCompatCBDev</name>
<description>
Compatibility for the development version (latest of the supported Minecraft versions).
To add a new compat module the pom.xml file within NCPCompatNonFree has to be modified:
- Add as module within the profile with id 'all'.
- Add as dependency within the profile with id 'all'.
- (Add a new profile with both the module and dependency set.)
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
To add a new compat module the pom.xml file within NCPCompatNonFree has to be modified:
- Add as module within the profile with id 'all'.
- Add as dependency within the profile with id 'all'.
- (Add a new profile with both the module and dependency set.)
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory,
AttributeAccessFactory).
</description>
</project>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -275,4 +275,10 @@ public class MCAccessCBDev implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
((CraftPlayer) player).getHandle().clearActiveItem();
return true;
}
}
@@ -1,52 +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>ncpcompatspigotcb1_10_r1</artifactId>
<packaging>jar</packaging>
<name>NCPCompatSpigotCB1_10_R1</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.10-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for SpigotCB1_10_R1.
<name>NCPCompatSpigotCB1_10_R1</name>
<description>Compatibility for SpigotCB1_10_R1.</description>
To add a new compat module the pom.xml file within NCPCompatNonFree has to be modified:
- Add as module within the profile with id 'all'.
- Add as dependency within the profile with id 'all'.
- (Add a new profile with both the module and dependency set.)
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.10.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>
@@ -270,4 +270,10 @@ public class MCAccessSpigotCB1_10_R1 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
((CraftPlayer) player).getHandle().clearActiveItem();
return true;
}
}
@@ -1,52 +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>ncpcompatspigotcb1_11_r1</artifactId>
<packaging>jar</packaging>
<name>NCPCompatSpigotCB1_11_R1</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.11.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for SpigotCB1_11_R1.
<name>NCPCompatSpigotCB1_11_R1</name>
<description>Compatibility for SpigotCB1_11_R1.</description>
To add a new compat module the pom.xml file within NCPCompatNonFree has to be modified:
- Add as module within the profile with id 'all'.
- Add as dependency within the profile with id 'all'.
- (Add a new profile with both the module and dependency set.)
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
</project>
@@ -275,4 +275,10 @@ public class MCAccessSpigotCB1_11_R1 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
((CraftPlayer) player).getHandle().clearActiveItem();
return true;
}
}
@@ -1,45 +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>ncpcompatspigotcb1_8_r1</artifactId>
<packaging>jar</packaging>
<name>NCPCompatSpigotCB1_8_R1</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.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for Minecraft 1.8 with CraftBukkit/Spigot (R1).</description>
<name>NCPCompatSpigotCB1_8_R1</name>
<description>Compatibility for Minecraft 1.8 with CraftBukkit/Spigot (R1).</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.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>
@@ -214,4 +214,10 @@ public class MCAccessSpigotCB1_8_R1 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
((CraftPlayer) player).getHandle().bU();
return true;
}
}
@@ -1,45 +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>ncpcompatspigotcb1_8_r2</artifactId>
<packaging>jar</packaging>
<name>NCPCompatSpigotCB1_8_R2</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.8.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for Minecraft 1.8.3 with CraftBukkit/Spigot (1_8_R2).</description>
<name>NCPCompatSpigotCB1_8_R2</name>
<description>Compatibility for Minecraft 1.8.3 with CraftBukkit/Spigot (1_8_R2).</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.8.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>
@@ -214,4 +214,10 @@ public class MCAccessSpigotCB1_8_R2 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
((CraftPlayer) player).getHandle().bU();
return true;
}
}
@@ -1,42 +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>ncpcompatspigotcb1_8_r3</artifactId>
<packaging>jar</packaging>
<name>NCPCompatSpigotCB1_8_R3</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.8.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<description>Compatibility for Minecraft 1.8.4-1.8.6 with CraftBukkit/Spigot (1_8_R3).</description>
</project>
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
<version>1.1-SNAPSHOT</version>
<name>NCPCompatSpigotCB1_8_R3</name>
<description>Compatibility for Minecraft 1.8.4-1.8.6 with CraftBukkit/Spigot (1_8_R3).</description>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -234,4 +234,10 @@ public class MCAccessSpigotCB1_8_R3 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
((CraftPlayer) player).getHandle().bU();
return true;
}
}
@@ -1,45 +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>ncpcompatspigotcb1_9_r1</artifactId>
<packaging>jar</packaging>
<name>NCPCompatSpigotCB1_9_R1</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.9-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for Minecraft 1.9-1.9.3 with CraftBukkit/Spigot (1_9_R1).</description>
<name>NCPCompatSpigotCB1_9_R1</name>
<description>Compatibility for Minecraft 1.9-1.9.3 with CraftBukkit/Spigot (1_9_R1).</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.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.9-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>
@@ -268,4 +268,10 @@ public class MCAccessSpigotCB1_9_R1 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
((CraftPlayer) player).getHandle().clearActiveItem();
return true;
}
}
@@ -1,45 +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>ncpcompatspigotcb1_9_r2</artifactId>
<packaging>jar</packaging>
<name>NCPCompatSpigotCB1_9_R2</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.9.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Compatibility for Minecraft 1.9.4 with CraftBukkit/Spigot (1_9_R2).</description>
<name>NCPCompatSpigotCB1_9_R2</name>
<description>Compatibility for Minecraft 1.9.4 with CraftBukkit/Spigot (1_9_R2).</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.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.9.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>
@@ -270,4 +270,10 @@ public class MCAccessSpigotCB1_9_R2 implements MCAccess {
// // Consider setting the lastYaw here too.
// }
@Override
public boolean resetActiveItem(Player player) {
((CraftPlayer) player).getHandle().clearActiveItem();
return true;
}
}
+151 -381
View File
@@ -1,381 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<name>NCPCompatNonFree</name>
<description>Combine compatibility modules with dependencies that can't be obtained from a public maven repository, such as CraftBukkit or Spigot builds, hence &quot;NonFree&quot;.
To add a new compat module:
- Add as module within the profile with id 'all'.
- Add as dependency within the profile with id 'all'.
- (Add a new profile with both the module and dependency set.)
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
<!-- Profile based activation of modules and dependencies. -->
<profiles>
<profile>
<id>all</id>
<modules>
<module>NCPCompatCB2512</module>
<module>NCPCompatCB2545</module>
<module>NCPCompatCB2602</module>
<module>NCPCompatCB2645</module>
<module>NCPCompatCB2691</module>
<module>NCPCompatCB2763</module>
<module>NCPCompatCB2794</module>
<module>NCPCompatCB2808</module>
<module>NCPCompatCB2882</module>
<module>NCPCompatCB2922</module>
<module>NCPCompatCB3026</module>
<module>NCPCompatCB3043</module>
<module>NCPCompatCB3100</module>
<module>NCPCompatSpigotCB1_8_R1</module>
<module>NCPCompatSpigotCB1_8_R2</module>
<module>NCPCompatSpigotCB1_8_R3</module>
<module>NCPCompatSpigotCB1_9_R1</module>
<module>NCPCompatSpigotCB1_9_R2</module>
<module>NCPCompatSpigotCB1_10_R1</module>
<module>NCPCompatSpigotCB1_11_R1</module>
<!-- ... -->
<module>NCPCompatCBDev</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<!-- ... -->
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3043</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3026</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2922</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2882</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2808</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2794</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2763</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2691</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2645</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2602</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2545</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2512</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>cbdev</id>
<modules>
<module>NCPCompatCBDev</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<!-- ... -->
<profile>
<id>spigot1_12_r1</id>
<modules>
<module>NCPCompatCBDev</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_11_r1</id>
<modules>
<module>NCPCompatSpigotCB1_11_R1</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_10_r1</id>
<modules>
<module>NCPCompatSpigotCB1_10_R1</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_9_r2</id>
<modules>
<module>NCPCompatSpigotCB1_9_R2</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_9_r1</id>
<modules>
<module>NCPCompatSpigotCB1_9_R1</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_8_r3</id>
<modules>
<module>NCPCompatSpigotCB1_8_R3</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_7_r4</id>
<modules>
<module>NCPCompatCB3100</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>cblegacy</id>
<modules>
<module>NCPCompatCB2512</module>
<module>NCPCompatCB2545</module>
<module>NCPCompatCB2602</module>
<module>NCPCompatCB2645</module>
<module>NCPCompatCB2691</module>
<module>NCPCompatCB2763</module>
<module>NCPCompatCB2794</module>
<module>NCPCompatCB2808</module>
<module>NCPCompatCB2882</module>
<module>NCPCompatCB2922</module>
<module>NCPCompatCB3026</module>
<module>NCPCompatCB3043</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3043</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3026</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2922</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2882</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2808</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2794</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2763</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2691</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2645</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2602</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2545</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2512</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>NCPCompatNonFree</name>
<description>
Combine compatibility modules with dependencies that can't be obtained from a public maven repository,
such as CraftBukkit or Spigot builds, hence &quot;NonFree&quot;.
To add a new compat module:
- Add as module within the profile with id 'all'.
- Add as dependency within the profile with id 'all'.
- (Add a new profile with both the module and dependency set.)
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory,
AttributeAccessFactory).
</description>
<modules>
<module>NCPCompatAggregated</module>
</modules>
<!-- Profile based activation of modules and dependencies. -->
<profiles>
<profile>
<id>all</id>
<modules>
<!-- Legacy, unsupported
<module>NCPCompatCB2512</module>
<module>NCPCompatCB2545</module>
<module>NCPCompatCB2602</module>
<module>NCPCompatCB2645</module>
<module>NCPCompatCB2691</module>
<module>NCPCompatCB2763</module>
<module>NCPCompatCB2794</module>
<module>NCPCompatCB2808</module>
<module>NCPCompatCB2882</module>
-->
<module>NCPCompatCB2922</module>
<module>NCPCompatCB3026</module>
<module>NCPCompatCB3043</module>
<module>NCPCompatCB3100</module>
<module>NCPCompatSpigotCB1_8_R1</module>
<module>NCPCompatSpigotCB1_8_R2</module>
<module>NCPCompatSpigotCB1_8_R3</module>
<module>NCPCompatSpigotCB1_9_R1</module>
<module>NCPCompatSpigotCB1_9_R2</module>
<module>NCPCompatSpigotCB1_10_R1</module>
<module>NCPCompatSpigotCB1_11_R1</module>
<!-- Latest -->
<module>NCPCompatCBDev</module>
</modules>
</profile>
<profile>
<id>cbdev</id>
<modules>
<module>NCPCompatCBDev</module>
</modules>
</profile>
<profile>
<id>spigot1_12_r1</id>
<modules>
<module>NCPCompatCBDev</module>
</modules>
</profile>
<profile>
<id>spigot1_11_r1</id>
<modules>
<module>NCPCompatSpigotCB1_11_R1</module>
</modules>
</profile>
<profile>
<id>spigot1_10_r1</id>
<modules>
<module>NCPCompatSpigotCB1_10_R1</module>
</modules>
</profile>
<profile>
<id>spigot1_9_r2</id>
<modules>
<module>NCPCompatSpigotCB1_9_R2</module>
</modules>
</profile>
<profile>
<id>spigot1_9_r1</id>
<modules>
<module>NCPCompatSpigotCB1_9_R1</module>
</modules>
</profile>
<profile>
<id>spigot1_8_r3</id>
<modules>
<module>NCPCompatSpigotCB1_8_R3</module>
</modules>
</profile>
<profile>
<id>spigot1_7_r4</id>
<modules>
<module>NCPCompatCB3100</module>
</modules>
</profile>
<!-- Legacy, unsupported
<profile>
<id>cblegacy</id>
<modules>
<module>NCPCompatCB2512</module>
<module>NCPCompatCB2545</module>
<module>NCPCompatCB2602</module>
<module>NCPCompatCB2645</module>
<module>NCPCompatCB2691</module>
<module>NCPCompatCB2763</module>
<module>NCPCompatCB2794</module>
<module>NCPCompatCB2808</module>
<module>NCPCompatCB2882</module>
<module>NCPCompatCB2922</module>
<module>NCPCompatCB3026</module>
<module>NCPCompatCB3043</module>
</modules>
</profile>
-->
</profiles>
<repositories>
<repository>
<id>nms-repo</id>
<url>https://repo.codemc.org/repository/nms/</url>
</repository>
</repositories>
</project>
-86
View File
@@ -1,86 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfreejar</artifactId>
<version>1.2-SNAPSHOT</version>
<name>NCPCompatNonFreeJar</name>
<description>Create a jar from NCPCompatNonFree.</description>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<type>pom</type>
</dependency>
</dependencies>
<!-- Profile based activation of jar file build -->
<profiles>
<profile>
<id>nonfree_build</id>
<distributionManagement>
<repository>
<id>md_5-releases</id>
<url>https://repo.md-5.net/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>md_5-snapshots</id>
<url>https://repo.md-5.net/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<!-- Building -->
<build>
<defaultGoal>clean package</defaultGoal>
<directory>../../target</directory> <!-- Build it two levels up, because it is the one we care about -->
<finalName>NCPCompatNonFree</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>fr.neatmonster:*</include>
</includes>
<!-- Clearly not sure about excludes... -->
<!-- <excludes> <exclude>fr.neatmonster:nocheatplus-parent</exclude>
</excludes> -->
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<!-- <skip>true</skip> -->
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
+42 -52
View File
@@ -1,59 +1,49 @@
<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>ncpcompatprotocollib</artifactId>
<packaging>jar</packaging>
<name>NCPCompatProtocolLib</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>
<repositories>
<repository>
<id>dmulloy2-repo</id>
<url>http://repo.dmulloy2.net/content/groups/public/</url>
</repository>
</repositories>
<artifactId>ncpcompatprotocollib</artifactId>
<version>1.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.12-pre2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib-API</artifactId>
<version>4.3.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<name>NCPCompatProtocolLib</name>
<description>
Features using the plugin ProtocolLib:
https://dev.bukkit.org/bukkit-plugins/protocollib/
</description>
<description>Features using the plugin ProtocolLib:
https://dev.bukkit.org/bukkit-plugins/protocollib/</description>
<repositories>
<repository>
<id>dmulloy2-repo</id>
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
</repository>
</repositories>
<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.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.5.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
</project>
@@ -68,6 +68,9 @@ public class CatchAllAdapter extends BaseAdapter {
@Override
public void onPacketReceiving(PacketEvent event) {
try {
if (event.isPlayerTemporary()) return;
} catch(NoSuchMethodError e) {}
final Player player = event.getPlayer();
if (player == null) {
counters.add(ProtocolLibComponent.idNullPlayer, 1);
@@ -35,6 +35,7 @@ public class DebugAdapter extends BaseAdapter {
@Override
public void onPacketReceiving(PacketEvent event) {
if (event.isPlayerTemporary()) return;
final Player player = event.getPlayer();
if (DataManager.getPlayerDataSafe(player).isDebugActive(CheckType.NET)) {
debug(player, "packet: " + event.getPacketType());
@@ -0,0 +1,111 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.checks.net.protocollib;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.reflect.StructureModifier;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
public class Fight extends BaseAdapter{
private static PacketType[] initPacketTypes() {
final List<PacketType> types = new LinkedList<PacketType>(Arrays.asList(
//PacketType.Play.Client.ARM_ANIMATION,
PacketType.Play.Server.EXPLOSION
));
return types.toArray(new PacketType[types.size()]);
}
public Fight(Plugin plugin) {
super(plugin, ListenerPriority.MONITOR, initPacketTypes());
}
//@Override
//public void onPacketReceiving(final PacketEvent event) {
// handleAnmationPacket(event);
//}
@Override
public void onPacketSending(final PacketEvent event) {
handleVelocityPacket(event);
}
private void handleVelocityPacket(PacketEvent event) {
if (event.isPlayerTemporary()) return;
if (event.getPacketType() != PacketType.Play.Server.EXPLOSION) return;
final Player player = event.getPlayer();
if (player == null) {
counters.add(ProtocolLibComponent.idNullPlayer, 1);
return;
}
final PacketContainer packet = event.getPacket();
final StructureModifier<Float> floats = packet.getFloat();
if (floats.size() != 4) {
// TODO : Warning
return;
}
//final Float strength = floats.read(0);
final Float velX = floats.read(1);
final Float velY = floats.read(2);
final Float velZ = floats.read(3);
if (Math.abs(velX) == 0.0 && Math.abs(velZ) == 0.0 && Math.abs(velY) == 0.0) return;
final IPlayerData pData = DataManager.getPlayerData(player);
if (!pData.isCheckActive(CheckType.MOVING, player)) return;
final MovingData data = pData.getGenericInstance(MovingData.class);
// Process velocity.
data.shouldApplyExplosionVelocity = true;
data.explosionVelAxisX += velX;
data.explosionVelAxisY += velY;
data.explosionVelAxisZ+= velZ;
}
//public void handleAnmationPacket(final PacketEvent event) {
// final Player player = event.getPlayer();
// final FightData data = DataManager.getGenericInstance(player, FightData.class);
// TODO: Count temporary player as well?
// if (event.isPlayerTemporary()) return;
// if (event.getPacketType() != PacketType.Play.Client.ARM_ANIMATION) {
//data.noSwingPacket = false;
//data.noSwingArmSwung = false;
// return;
// }
// if (player == null) {
// counters.add(ProtocolLibComponent.idNullPlayer, 1);
// return;
// }
// data.noSwingPacket = true;
// data.noSwingArmSwung = true;
//}
}
@@ -57,7 +57,10 @@ public class KeepAliveAdapter extends BaseAdapter {
@Override
public void onPacketReceiving(final PacketEvent event) {
final long time = System.currentTimeMillis();
try {
if (event.isPlayerTemporary()) return;
} catch(NoSuchMethodError e) {}
final long time = System.currentTimeMillis();
final Player player = event.getPlayer();
if (player == null) {
counters.add(ProtocolLibComponent.idNullPlayer, 1);
@@ -66,6 +69,7 @@ public class KeepAliveAdapter extends BaseAdapter {
}
// Always update last received time.
final IPlayerData pData = DataManager.getPlayerDataSafe(player);
if (pData == null) return;
final NetData data = pData.getGenericInstance(NetData.class);
data.lastKeepAliveTime = time;
final NetConfig cc = pData.getGenericInstance(NetConfig.class);
@@ -21,6 +21,7 @@ import java.util.LinkedList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -34,6 +35,7 @@ import com.comphenix.protocol.reflect.StructureModifier;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.checks.net.FlyingFrequency;
import fr.neatmonster.nocheatplus.checks.net.NetConfig;
import fr.neatmonster.nocheatplus.checks.net.NetData;
@@ -41,6 +43,7 @@ import fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;
import fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying.PACKET_CONTENT;
import fr.neatmonster.nocheatplus.checks.net.model.TeleportQueue.AckReference;
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
import fr.neatmonster.nocheatplus.logging.StaticLog;
import fr.neatmonster.nocheatplus.logging.Streams;
import fr.neatmonster.nocheatplus.players.DataManager;
@@ -50,6 +53,7 @@ import fr.neatmonster.nocheatplus.utilities.CheckUtils;
import fr.neatmonster.nocheatplus.utilities.StringUtil;
import fr.neatmonster.nocheatplus.utilities.ds.count.ActionFrequency;
import fr.neatmonster.nocheatplus.utilities.location.LocUtil;
import fr.neatmonster.nocheatplus.utilities.location.TrigUtil;
import fr.neatmonster.nocheatplus.worlds.IWorldData;
/**
@@ -72,6 +76,8 @@ public class MovingFlying extends BaseAdapter {
public static final int indexStance = 3;
public static final int indexYaw = 0;
public static final int indexPitch = 1;
private final Plugin plugin = Bukkit.getPluginManager().getPlugin("NoCheatPlus");
private static PacketType[] initPacketTypes() {
final List<PacketType> types = new LinkedList<PacketType>(Arrays.asList(
@@ -82,7 +88,7 @@ public class MovingFlying extends BaseAdapter {
));
// Add confirm teleport.
// PacketPlayInTeleportAccept
PacketType confirmType = ProtocolLibComponent.findPacketTypeByName(Protocol.PLAY, Sender.CLIENT, "PacketPlayInTeleportAccept");
PacketType confirmType = ProtocolLibComponent.findPacketTypeByName(Protocol.PLAY, Sender.CLIENT, "TeleportAccept");
if (confirmType != null) {
StaticLog.logInfo("Confirm teleport packet available (via name): " + confirmType);
types.add(confirmType);
@@ -105,7 +111,7 @@ public class MovingFlying extends BaseAdapter {
private long packetMismatchLogFrequency = 60000; // Every minute max, good for updating :).
private final HashSet<PACKET_CONTENT> validContent = new LinkedHashSet<PACKET_CONTENT>();
private final PacketType confirmTeleportType = ProtocolLibComponent.findPacketTypeByName(Protocol.PLAY, Sender.CLIENT, "PacketPlayInTeleportAccept");
private final PacketType confirmTeleportType = ProtocolLibComponent.findPacketTypeByName(Protocol.PLAY, Sender.CLIENT, "TeleportAccept");
private boolean acceptConfirmTeleportPackets = confirmTeleportType != null;
public MovingFlying(Plugin plugin) {
@@ -123,7 +129,12 @@ public class MovingFlying extends BaseAdapter {
@Override
public void onPacketReceiving(final PacketEvent event) {
try {
if (event.isPlayerTemporary()) return;
} catch(NoSuchMethodError e) {
if (event.getPlayer() == null) return;
if (DataManager.getPlayerDataSafe(event.getPlayer()) == null) return;
}
if (event.getPacketType().equals(confirmTeleportType)) {
if (acceptConfirmTeleportPackets) {
onConfirmTeleportPacket(event);
@@ -223,6 +234,49 @@ public class MovingFlying extends BaseAdapter {
}
return;
}
// TODO: Should let it here?
// Work as ExtremeMove but for packet sent!
if (packetData.hasPos) {
final MovingData Mdata = pData.getGenericInstance(MovingData.class);
final Location loc1 = player.getLocation();
final Location loc2 = new Location(null, packetData.getX(), packetData.getY(), packetData.getZ());
final double xzdist = TrigUtil.distance(loc1, loc2);
final double ydist = Math.abs(loc1.getY() - loc2.getY());
// Vertical move.
if (ydist > 100.0) {
++data.diffpacketVLs;
}
// Horizontal move.
else if (xzdist > 100.0) {
++data.diffpacketVLs;
} else data.diffpacketVLs *= 0.98;
if (data.diffpacketVLs > 7) {
cancel = true;
}
if (data.diffpacketVLs > 15) {
// Player might be freezed by canceling, set back might turn it to normal
data.diffpacketVLs = 0.0;
int task = -1;
task = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin,
(Runnable)new Runnable() {
@Override
public void run() {
// Mask player teleport as a set back.
Mdata.prepareSetBack(loc1);
player.teleport(LocUtil.clone(loc1),
BridgeMisc.TELEPORT_CAUSE_CORRECTION_OF_POSITION);
}
});
if (task == -1) {
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.STATUS, "Failed to schedule set back task. Player: " + player.getName() + " , set back: " + loc1);
}
Mdata.resetTeleported(); // Cleanup, just in case.
}
}
switch(data.teleportQueue.processAck(packetData)) {
case WAITING: {
if (pData.isDebugActive(this.checkType)) {
@@ -0,0 +1,272 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.checks.net.protocollib;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.data.Ageable;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.plugin.Plugin;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerDigType;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.compat.BridgeEnchant;
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
import fr.neatmonster.nocheatplus.components.registry.order.RegistrationOrder.RegisterMethodWithOrder;
import fr.neatmonster.nocheatplus.event.mini.MiniListener;
import fr.neatmonster.nocheatplus.logging.StaticLog;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.InventoryUtil;
public class NoSlow extends BaseAdapter {
private final static String dftag = "system.nocheatplus.noslow";
private final static MiniListener<?>[] miniListeners = new MiniListener<?>[] {
new MiniListener<PlayerItemConsumeEvent>() {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
@RegisterMethodWithOrder(tag = dftag)
@Override
public void onEvent(final PlayerItemConsumeEvent event) {
onItemConsume(event);
}
},
new MiniListener<PlayerInteractEvent>() {
@EventHandler(priority = EventPriority.LOWEST)
@RegisterMethodWithOrder(tag = dftag)
@Override
public void onEvent(final PlayerInteractEvent event) {
onItemInteract(event);
}
},
new MiniListener<InventoryOpenEvent>() {
@EventHandler(priority = EventPriority.LOWEST)
@RegisterMethodWithOrder(tag = dftag)
@Override
public void onEvent(final InventoryOpenEvent event) {
onInventoryOpen(event);
}
},
new MiniListener<PlayerItemHeldEvent>() {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@RegisterMethodWithOrder(tag = dftag)
@Override
public void onEvent(final PlayerItemHeldEvent event) {
onChangeSlot(event);
}
},
new MiniListener<BlockPlaceEvent>() {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
@RegisterMethodWithOrder(tag = dftag)
@Override
public void onEvent(final BlockPlaceEvent event) {
onPlace(event);
}
}
};
private static int timeBetweenRL = 70;
private static PacketType[] initPacketTypes() {
final List<PacketType> types = new LinkedList<PacketType>(Arrays.asList(
PacketType.Play.Client.BLOCK_DIG
));
return types.toArray(new PacketType[types.size()]);
}
public NoSlow(Plugin plugin) {
super(plugin, ListenerPriority.LOW, initPacketTypes());
final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
for (final MiniListener<?> listener : miniListeners) {
api.addComponent(listener, false);
}
}
@Override
public void onPacketReceiving(final PacketEvent event) {
if (event.isPlayerTemporary()) return;
handleDiggingPacket(event);
}
private static void onItemConsume(final PlayerItemConsumeEvent e){
final Player p = e.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(p);
final MovingData data = pData.getGenericInstance(MovingData.class);
data.isusingitem = false;
}
private static void onInventoryOpen(final InventoryOpenEvent e){
if (e.isCancelled()) return;
final Player p = (Player) e.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(p);
final MovingData data = pData.getGenericInstance(MovingData.class);
data.isusingitem = false;
}
private static void onItemInteract(final PlayerInteractEvent e){
// TODO: Add trident (Check for rain and verify if the player is exposed to it at all, might not be worth doing it...)
if (e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
final Player p = e.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(p);
final MovingData data = pData.getGenericInstance(MovingData.class);
// Reset
data.offhanduse = false;
Block b = e.getClickedBlock();
if (p.getGameMode() == GameMode.CREATIVE) {
data.isusingitem = false;
return;
}
if (b != null && (
b.getType().toString().endsWith("DOOR")
|| b.getType().toString().endsWith("GATE")
|| b.getType().toString().endsWith("BUTTON")
|| b.getType().toString().endsWith("LEVER")
|| (b.getType().name().startsWith("SWEET_BERRY_BUSH") && ((Ageable) b.getBlockData()).getAge() > 1)
)) {
data.isusingitem = false;
return;
}
if (e.hasItem()) {
ItemStack item = e.getItem();
Material m = item.getType();
if (Bridge1_9.hasElytra() && p.hasCooldown(m)) return;
if (InventoryUtil.isConsumable(item)) {
// pre1.9 splash potion
if (!Bridge1_9.hasElytra() && item.getDurability() > 16384) return;
if (m == Material.POTION || m == Material.MILK_BUCKET || m.toString().endsWith("_APPLE") || m.name().startsWith("HONEY_BOTTLE")) {
data.isusingitem = true;
data.offhanduse = Bridge1_9.hasGetItemInOffHand() && e.getHand() == EquipmentSlot.OFF_HAND;
return;
}
if (item.getType().isEdible() && p.getFoodLevel() < 20) {
data.isusingitem = true;
data.offhanduse = Bridge1_9.hasGetItemInOffHand() && e.getHand() == EquipmentSlot.OFF_HAND;
return;
}
}
if (m.toString().equals("BOW") && hasArrow(p.getInventory())) {
data.isusingitem = true;
data.offhanduse = Bridge1_9.hasGetItemInOffHand() && e.getHand() == EquipmentSlot.OFF_HAND;
return;
}
if (m.name().equals("SHIELD")) {
data.offhanduse = e.getHand() == EquipmentSlot.OFF_HAND;
return;
}
if (m.toString().equals("CROSSBOW")) {
if (item.getItemMeta().serialize().get("charged").equals(false) && hasArrow(p.getInventory())) {
data.isusingitem = true;
data.offhanduse = e.getHand() == EquipmentSlot.OFF_HAND;
}
}
} else data.isusingitem = false;
}
private static void onChangeSlot(final PlayerItemHeldEvent e) {
final Player p = e.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(p);
final MovingData data = pData.getGenericInstance(MovingData.class);
if (data.changeslot) {
p.getInventory().setHeldItemSlot(data.olditemslot);
data.changeslot = false;
}
data.isusingitem = false;
}
private static void onPlace(final BlockPlaceEvent e) {
final Player p = e.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(p);
final MovingData data = pData.getGenericInstance(MovingData.class);
if (InventoryUtil.isConsumable(e.getItemInHand())) data.isusingitem = false;
}
private static boolean hasArrow(PlayerInventory i) {
if (Bridge1_9.hasElytra()) {
Material m = i.getItemInOffHand().getType();
return i.contains(Material.ARROW) || m.toString().endsWith("ARROW") || i.contains(Material.TIPPED_ARROW) || i.contains(Material.SPECTRAL_ARROW);
}
return i.contains(Material.ARROW);
}
private void handleDiggingPacket(PacketEvent event)
{
if(event.getPacketType() != PacketType.Play.Client.BLOCK_DIG) return;
Player p = event.getPlayer();
if (p == null) {
counters.add(ProtocolLibComponent.idNullPlayer, 1);
return;
}
final IPlayerData pData = DataManager.getPlayerDataSafe(p);
if (pData == null) {
StaticLog.logWarning("Failed to fetch player data with " + event.getPacketType() + " for: " + p.toString());
return;
}
final MovingData data = pData.getGenericInstance(MovingData.class);
PlayerDigType digtype = event.getPacket().getPlayerDigTypes().read(0);
// DROP_ALL_ITEMS when dead?
if (digtype == PlayerDigType.DROP_ALL_ITEMS || digtype == PlayerDigType.DROP_ITEM) data.isusingitem = false;
//Advanced check
if(digtype == PlayerDigType.RELEASE_USE_ITEM) {
data.isusingitem = false;
long now = System.currentTimeMillis();
if (data.time_rl_item != 0) {
if (now < data.time_rl_item) {
data.time_rl_item = now;
return;
}
if (data.time_rl_item + timeBetweenRL > now) {
data.isHackingRI = true;
}
}
data.time_rl_item = now;
}
}
/**
* Set Minimum time between RELEASE_USE_ITEM packet is sent.
* If time lower this value, A check will flag
* Should be set from 51-100. Larger number, more protection more false-positive
*
* @param milliseconds
*/
public static void setuseRLThreshold(int time) {
timeBetweenRL = time;
}
}
@@ -27,6 +27,7 @@ import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.net.NetData;
import fr.neatmonster.nocheatplus.checks.net.model.CountableLocation;
import fr.neatmonster.nocheatplus.logging.StaticLog;
import fr.neatmonster.nocheatplus.logging.Streams;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
@@ -53,12 +54,23 @@ public class OutgoingPosition extends BaseAdapter {
@Override
public void onPacketSending(PacketEvent event) {
if (event.isCancelled()) {
try {
if (event.isPlayerTemporary()) return;
} catch(NoSuchMethodError e) {}
if (event.isCancelled()) {
return;
}
final long time = System.currentTimeMillis();
final Player player = event.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(player);
if (player == null) {
counters.add(ProtocolLibComponent.idNullPlayer, 1);
return;
}
final IPlayerData pData = DataManager.getPlayerDataSafe(player);
if (pData == null) {
StaticLog.logWarning("Failed to fetch player data with " + event.getPacketType() + " for: " + player.toString());
return;
}
// TODO: In future multiple checks might use this (!)
if (pData.isCheckActive(CheckType.NET_FLYINGFREQUENCY, player)) {
interpretPacket(player, event.getPacket(), time,
@@ -87,7 +87,7 @@ public class ProtocolLibComponent implements IDisableListener, INotifyReload, Jo
// INSTANCE ----
private final List<PacketAdapter> registeredPacketAdapters = new LinkedList<PacketAdapter>();
private static final List<PacketAdapter> registeredPacketAdapters = new LinkedList<PacketAdapter>();
public ProtocolLibComponent(Plugin plugin) {
register(plugin);
@@ -98,8 +98,12 @@ public class ProtocolLibComponent implements IDisableListener, INotifyReload, Jo
}
private void register(Plugin plugin) {
StaticLog.logInfo("Adding packet level hooks for ProtocolLib (MC " + ProtocolLibrary.getProtocolManager().getMinecraftVersion().getVersion() + ")...");
final IWorldDataManager worldMan = NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager();
if (!worldMan.isActiveAnywhere(CheckType.NET)) {
StaticLog.logInfo("No packet level checks activated.");
return;
}
StaticLog.logInfo("Adding packet level hooks for ProtocolLib (MC " + ProtocolLibrary.getProtocolManager().getMinecraftVersion().getVersion() + ")...");
//Special purpose.
if (ConfigManager.isTrueForAnyConfig(ConfPaths.NET + ConfPaths.SUB_DEBUG) || ConfigManager.isTrueForAnyConfig(ConfPaths.CHECKS_DEBUG) ) {
// (Debug logging. Only activates if debug is set for checks or checks.net, not on the fly.)
@@ -127,12 +131,19 @@ public class ProtocolLibComponent implements IDisableListener, INotifyReload, Jo
if (worldMan.isActiveAnywhere(CheckType.NET_SOUNDDISTANCE)) {
register("fr.neatmonster.nocheatplus.checks.net.protocollib.SoundDistance", plugin);
}
if (worldMan.isActiveAnywhere(CheckType.NET_WRONGTURN)) {
register("fr.neatmonster.nocheatplus.checks.net.protocollib.WrongTurnAdapter", plugin);
}
if (ServerVersion.compareMinecraftVersion("1.9") < 0) {
if (worldMan.isActiveAnywhere(CheckType.NET_PACKETFREQUENCY)) {
register("fr.neatmonster.nocheatplus.checks.net.protocollib.CatchAllAdapter", plugin);
}
}
if (ServerVersion.compareMinecraftVersion("1.8") >= 0) {
if (ConfigManager.isTrueForAnyConfig(ConfPaths.MOVING_SURVIVALFLY_EXTENDED_NOSLOW))
register("fr.neatmonster.nocheatplus.checks.net.protocollib.NoSlow", plugin);
register("fr.neatmonster.nocheatplus.checks.net.protocollib.Fight", plugin);
}
if (!registeredPacketAdapters.isEmpty()) {
List<String> names = new ArrayList<String>(registeredPacketAdapters.size());
for (PacketAdapter adapter : registeredPacketAdapters) {
@@ -203,6 +214,24 @@ public class ProtocolLibComponent implements IDisableListener, INotifyReload, Jo
registeredPacketAdapters.clear();
}
protected static void unregister(PacketAdapter adapter) {
final ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
try {
protocolManager.removePacketListener(adapter);
api.removeComponent(adapter); // Bit heavy, but consistent.
registeredPacketAdapters.remove(adapter);
List<String> names = new ArrayList<String>(registeredPacketAdapters.size());
for (PacketAdapter adaptern : registeredPacketAdapters) {
names.add(adaptern.getClass().getSimpleName());
}
api.setFeatureTags("packet-listeners", names);
StaticLog.logInfo("Unregistered packet level hook:" + adapter.getClass().getName());
} catch (Throwable t) {
StaticLog.logWarning("Failed to unregister packet level hook: " + adapter.getClass().getName());
}
}
@Override
public void playerJoins(final Player player) {
if (!registeredPacketAdapters.isEmpty()) {
@@ -140,8 +140,13 @@ public class SoundDistance extends BaseAdapter {
}
}
@Override
public void onPacketSending(final PacketEvent event) {
private void handleSoundPacket(final PacketEvent event) {
try {
if (event.isPlayerTemporary()) return;
} catch(NoSuchMethodError e) {
if (event.getPlayer() == null) return;
if (DataManager.getPlayerDataSafe(event.getPlayer()) == null) return;
}
final PacketContainer packetContainer = event.getPacket();
// Compare sound effect name.
@@ -169,5 +174,15 @@ public class SoundDistance extends BaseAdapter {
}
useLoc.setWorld(null);
}
@Override
public void onPacketSending(final PacketEvent event) {
try {
handleSoundPacket(event);
} catch(Throwable t) {
t.printStackTrace();
ProtocolLibComponent.unregister(this);
}
}
}
@@ -45,7 +45,7 @@ public class UseEntityAdapter extends BaseAdapter {
final Method methodName_legacy;
/**
*
*
* @param versionDetail
* @throws RuntimeException
* if not matching/supported.
@@ -123,18 +123,21 @@ public class UseEntityAdapter extends BaseAdapter {
@Override
public void onPacketReceiving(final PacketEvent event) {
try {
if (event.isPlayerTemporary()) return;
} catch(NoSuchMethodError e) {}
final long time = System.currentTimeMillis();
final Player player = event.getPlayer();
if (player == null) {
// TODO: Warn once?
return;
}
final IPlayerData pData = DataManager.getPlayerData(player);
final IPlayerData pData = DataManager.getPlayerDataSafe(player);
if (pData == null) return;
final NetData data = pData.getGenericInstance(NetData.class);
// Always set last received time.
data.lastKeepAliveTime = time;
data.lastHitLocation = player.getLocation();
// Quick return, if no checks are active.
if (!pData.isCheckActive(CheckType.NET_ATTACKFREQUENCY, player)) {
@@ -183,7 +186,7 @@ public class UseEntityAdapter extends BaseAdapter {
// AttackFrequency
if (isAttack) {
final NetConfig cc = pData.getGenericInstance(NetConfig.class);
if (attackFrequency.isEnabled(player, pData)
if (attackFrequency.isEnabled(player, pData)
&& attackFrequency.check(player, time, data, cc, pData)) {
cancel = true;
}
@@ -201,4 +204,4 @@ public class UseEntityAdapter extends BaseAdapter {
return actionName == null ? 0 : (INTERPRETED | ("ATTACK".equals(actionName) ? ATTACK : 0));
}
}
}
@@ -0,0 +1,74 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.checks.net.protocollib;
import java.util.Arrays;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.reflect.StructureModifier;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.net.NetConfig;
import fr.neatmonster.nocheatplus.checks.net.NetData;
import fr.neatmonster.nocheatplus.checks.net.WrongTurn;
import fr.neatmonster.nocheatplus.config.ConfPaths;
import fr.neatmonster.nocheatplus.config.ConfigManager;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
public class WrongTurnAdapter extends BaseAdapter {
private final WrongTurn wrongTurn = new WrongTurn();
public WrongTurnAdapter(Plugin plugin) {
super(plugin, ListenerPriority.LOW, PacketType.Play.Client.LOOK, PacketType.Play.Client.POSITION_LOOK);
if (ConfigManager.isTrueForAnyConfig(ConfPaths.NET_WRONGTURN_ACTIVE)) {
NCPAPIProvider.getNoCheatPlusAPI().addFeatureTags("checks", Arrays.asList(WrongTurn.class.getSimpleName()));
}
}
@Override
public void onPacketReceiving(final PacketEvent event) {
final Player player = event.getPlayer();
try {
if (event.isPlayerTemporary()) return;
} catch(NoSuchMethodError e) {
if (player == null) return;
if (DataManager.getPlayerDataSafe(event.getPlayer()) == null) return;
}
if (player == null) {
counters.add(ProtocolLibComponent.idNullPlayer, 1);
return;
}
final StructureModifier<Float> floats = event.getPacket().getFloat();
final float pitch = floats.read(1);
final IPlayerData pData = DataManager.getPlayerData(player);
final NetData data = pData.getGenericInstance(NetData.class);
final NetConfig cc = pData.getGenericInstance(NetConfig.class);
if (pData.isCheckActive(CheckType.NET_WRONGTURN, player) && wrongTurn.check(player, pitch, data, cc)) {
event.setCancelled(true); // Is it a good idea to cancel or should we just reset the players pitch?
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
+35 -38
View File
@@ -1,45 +1,42 @@
<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>ncpcore</artifactId>
<packaging>jar</packaging>
<name>NCPCore</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.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcommons</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
<artifactId>ncpcore</artifactId>
<version>1.1-SNAPSHOT</version>
<description>Core components and checks implementations. This contains about everything, just not the component/compat factories and not the plugin itself. NCPCore allows to add more modules/components that use check-specific classes to be added in the factories on NCPPlugin level.
</description>
<name>NCPCore</name>
<description>
Core components and checks implementations. This contains about everything, just not the
component/compat factories and not the plugin itself. NCPCore allows to add more modules/components that use
check-specific classes to be added in the factories on NCPPlugin level.
</description>
<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.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcommons</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
@@ -37,7 +37,8 @@ public enum ParameterName {
TAGS("tags"),
UUID("uuid"),
VIOLATIONS("violations"),
WORLD("world");
WORLD("world"),
MODEL("model");
/**
* Gets the parameter associated to the text.
@@ -72,15 +72,16 @@ public enum CheckType {
FIGHT(CheckTypeType.CHECK, CheckType.ALL, Permissions.FIGHT),
FIGHT_ANGLE(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_ANGLE),
FIGHT_CLICKPATTERN(CheckTypeType.CHECK, FIGHT),
FIGHT_CRITICAL(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_CRITICAL),
FIGHT_DIRECTION(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_DIRECTION),
FIGHT_FASTHEAL(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_FASTHEAL),
FIGHT_GODMODE(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_GODMODE),
FIGHT_HITBOX(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_DIRECTION),
FIGHT_NOSWING(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_NOSWING),
FIGHT_REACH(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_REACH),
FIGHT_SELFHIT(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_SELFHIT),
FIGHT_SPEED(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_SPEED),
FIGHT_VISIBLE(CheckTypeType.CHECK, FIGHT, Permissions.FIGHT_VISIBLE),
FIGHT_WRONGTURN(CheckTypeType.CHECK, FIGHT, null),
INVENTORY(CheckTypeType.GROUP, CheckType.ALL, Permissions.INVENTORY),
@@ -90,7 +91,8 @@ public enum CheckType {
INVENTORY_GUTENBERG(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_GUTENBERG),
INVENTORY_INSTANTBOW(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_INSTANTBOW),
INVENTORY_INSTANTEAT(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_INSTANTEAT),
INVENTORY_MOVE(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_MOVE),
INVENTORY_INVENTORYMOVE(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_INVENTORYMOVE),
INVENTORY_MOREINVENTORY(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_MOREINVENTORY),
INVENTORY_ITEMS(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_ITEMS),
INVENTORY_OPEN(CheckTypeType.CHECK, INVENTORY, Permissions.INVENTORY_OPEN),
@@ -106,11 +108,11 @@ public enum CheckType {
NET(CheckTypeType.GROUP, CheckType.ALL, Permissions.NET),
NET_ATTACKFREQUENCY(CheckTypeType.CHECK, NET, Permissions.NET_ATTACKFREQUENCY),
NET_FIGHTSYNC(CheckTypeType.CHECK, NET, Permissions.NET_FLYINGFREQUENCY),
NET_FLYINGFREQUENCY(CheckTypeType.CHECK, NET, Permissions.NET_FLYINGFREQUENCY),
NET_KEEPALIVEFREQUENCY(CheckTypeType.CHECK, NET, Permissions.NET_KEEPALIVEFREQUENCY),
NET_PACKETFREQUENCY(CheckTypeType.CHECK, NET, Permissions.NET_PACKETFREQUENCY),
NET_SOUNDDISTANCE(CheckTypeType.CHECK, NET), // Can not exempt players from this one.
NET_WRONGTURN(CheckTypeType.CHECK, NET, Permissions.NET_WRONGTURN),
;
@@ -62,7 +62,7 @@ public class BlockBreakData extends ACheckData implements IDataOnReload {
public int frequencyShortTermTick;
// Data of the no swing check.
public boolean noSwingArmSwung = true;
public int noSwingCount = 0;
// Data of the reach check.
public double reachDistance;
@@ -132,6 +132,8 @@ public class BlockBreakListener extends CheckListener {
final Player player = event.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(player);
if (!pData.isCheckActive(CheckType.BLOCKBREAK, player)) return;
// Illegal enchantments hotfix check.
// TODO: Legacy / encapsulate fully there.
if (Items.checkIllegalEnchantmentsAllHands(player, pData)) {
@@ -153,7 +155,7 @@ public class BlockBreakListener extends CheckListener {
final Block block = event.getBlock();
boolean cancelled = false;
if (BlockProperties.isScaffolding(block.getType())) return;
// Do the actual checks, if still needed. It's a good idea to make computationally cheap checks first, because
// it may save us from doing the computationally expensive checks.
@@ -220,7 +222,7 @@ public class BlockBreakListener extends CheckListener {
|| bdata.isPassedCheck(CheckType.BLOCKINTERACT_VISIBLE))) {
skippedRedundantChecks ++;
}
else if (directionEnabled && direction.check(player, loc, eyeHeight, block,
else if (directionEnabled && direction.check(player, loc, eyeHeight, block, null,
flyingHandle, data, cc, pData)) {
cancelled = true;
}
@@ -232,7 +234,7 @@ public class BlockBreakListener extends CheckListener {
}
// Destroying liquid blocks.
if (!cancelled && BlockProperties.isLiquid(block.getType())
if (!cancelled && BlockProperties.isLiquid(block.getType()) && !BlockProperties.isNewLiq(block.getType())
&& !pData.hasPermission(Permissions.BLOCKBREAK_BREAK_LIQUID, player)
&& !NCPExemptionManager.isExempted(player, CheckType.BLOCKBREAK_BREAK)){
cancelled = true;
@@ -300,7 +302,8 @@ public class BlockBreakListener extends CheckListener {
public void onPlayerAnimation(final PlayerAnimationEvent event) {
// Just set a flag to true when the arm was swung.
// debug(player, "Animation");
DataManager.getPlayerData(event.getPlayer()).getGenericInstance(BlockBreakData.class).noSwingArmSwung = true;
final BlockBreakData data = DataManager.getPlayerData(event.getPlayer()).getGenericInstance(BlockBreakData.class);
data.noSwingCount = Math.max(data.noSwingCount - 1, 0);
}
/**
@@ -318,6 +321,9 @@ public class BlockBreakListener extends CheckListener {
// Return if it is not left clicking a block.
// (Allows right click to be ignored.)
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKBREAK, event.getPlayer())) return;
isInstaBreak = AlmostBoolean.NO;
if (event.getAction() != Action.LEFT_CLICK_BLOCK) {
return;
@@ -343,6 +349,9 @@ public class BlockBreakListener extends CheckListener {
@EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)
public void onBlockDamage(final BlockDamageEvent event) {
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKBREAK, event.getPlayer())) return;
if (!event.isCancelled() && event.getInstaBreak()) {
// Keep MAYBE.
if (isInstaBreak != AlmostBoolean.MAYBE) {
@@ -400,6 +409,9 @@ public class BlockBreakListener extends CheckListener {
@EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)
public void onItemHeld(final PlayerItemHeldEvent event) {
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKBREAK, event.getPlayer())) return;
// Reset clicked block.
// TODO: Not for 1.5.2 and before?
final Player player = event.getPlayer();
@@ -409,4 +421,4 @@ public class BlockBreakListener extends CheckListener {
}
}
}
}
@@ -45,13 +45,12 @@ public class NoSwing extends Check {
boolean cancel = false;
// Did they swing their arm before?
if (data.noSwingArmSwung) {
// "Consume" the flag.
data.noSwingArmSwung = false;
if (++data.noSwingCount <= 1) {
// Reward with lowering of the violation level.
data.noSwingVL *= 0.9D;
} else {
// They failed, increase violation level.
data.noSwingCount = 0;
data.noSwingVL += 1D;
// Execute whatever actions are associated with this check and the violation level and find out if we should
@@ -34,6 +34,7 @@ import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
import fr.neatmonster.nocheatplus.checks.net.FlyingQueueHandle;
import fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.compat.BridgeHealth;
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
@@ -145,6 +146,9 @@ public class BlockInteractListener extends CheckListener {
final Player player = event.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(player);
final BlockInteractData data = pData.getGenericInstance(BlockInteractData.class);
if (!pData.isCheckActive(CheckType.BLOCKINTERACT, player)) return;
data.resetLastBlock();
// Early cancel for interact events with dead players and other.
final int cancelId;
@@ -186,7 +190,10 @@ public class BlockInteractListener extends CheckListener {
if (block == null) {
data.resetLastBlock();
blockChecks = false;
}
}
// else if (BlockProperties.isScaffolding(block.getType())) { // null check included in BlockProperties.
// blockChecks = false;
// }
else {
data.setLastBlock(block, action);
}
@@ -205,6 +212,9 @@ public class BlockInteractListener extends CheckListener {
if (stack != null && stack.getType() == Material.ENDER_PEARL) {
checkEnderPearlRightClickBlock(player, block, face, event, previousLastTick, data, pData);
}
if (BlockProperties.isScaffolding(stack.getType())) {
blockChecks = false;
}
break;
default:
data.setPlayerInteractEventResolution(event);
@@ -249,7 +259,7 @@ public class BlockInteractListener extends CheckListener {
// Second the direction check
if (!cancelled && direction.isEnabled(player, pData)
&& direction.check(player, loc, eyeHeight, block, flyingHandle,
&& direction.check(player, loc, eyeHeight, block, face, flyingHandle,
data, cc, pData)) {
cancelled = true;
}
@@ -345,6 +355,9 @@ public class BlockInteractListener extends CheckListener {
final IPlayerData pData = DataManager.getPlayerData(player);
final BlockInteractData data = pData.getGenericInstance(BlockInteractData.class);
data.setPlayerInteractEventResolution(event);
if (!pData.isCheckActive(CheckType.MOVING, player)) return;
/*
* TODO: BlockDamageEvent fires before BlockInteract/MONITOR level,
* BlockBreak after (!). Thus resolution is set on LOWEST already,
@@ -373,8 +386,9 @@ public class BlockInteractListener extends CheckListener {
if (stack != null && BridgeMisc.maybeElytraBoost(player, stack.getType())) {
final int power = BridgeMisc.getFireworksPower(stack);
final MovingData mData = pData.getGenericInstance(MovingData.class);
final int ticks = Math.max((1 + power) * 20, 30);
final int ticks = Math.max((1 + power) * (power < 2 ? 20 : 15), 30);
mData.fireworksBoostDuration = ticks;
mData.fireworksBoostTickNeedCheck = ticks - 1;
// Expiration tick: not general latency, rather a minimum margin for sudden congestion.
mData.fireworksBoostTickExpire = TickTask.getTick() + ticks;
// TODO: Invalidation mechanics: by tick/time well ?
@@ -422,7 +436,7 @@ public class BlockInteractListener extends CheckListener {
builder.append(") block: ");
builder.append(block.getWorld().getName() + "/" + LocUtil.simpleFormat(block));
builder.append(" type: " + block.getType());
builder.append(" data: " + BlockProperties.getData(block));
if (!Bridge1_13.hasIsSwimming()) builder.append(" data: " + BlockProperties.getData(block));
builder.append(" face: " + face);
}
@@ -433,4 +447,4 @@ public class BlockInteractListener extends CheckListener {
debug(player, builder.toString());
}
}
}
@@ -28,6 +28,8 @@ import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
/**
* Check if the placing is legitimate in terms of surrounding materials.
* @author mc_dev
@@ -35,57 +37,81 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
*/
public class Against extends Check {
/**
* Instanties a new Against check.
*
*/
public Against() {
super(CheckType.BLOCKPLACE_AGAINST);
}
/**
* Checks a player
* @param player
* @param block
* @param placedMat the material placed.
* @param blockAgainst
* @param isInteractBlock
* @param data
* @param cc
* @param pData
*
*/
public boolean check(final Player player, final Block block, final Material placedMat,
final Block blockAgainst, final boolean isInteractBlock,
final BlockPlaceData data, final BlockPlaceConfig cc, final IPlayerData pData) {
final Block blockAgainst, final boolean isInteractBlock,
final BlockPlaceData data, final BlockPlaceConfig cc, final IPlayerData pData) {
boolean violation = false;
/*
* TODO: Make more precise (workarounds like BridgeMisc.LILY_PAD,
* general points, such as action?).
*/
// Workaround for signs on cactus and similar.
final BlockInteractData bdata = pData.getGenericInstance(BlockInteractData.class); // TODO: pass as argument.
final BlockInteractData bIData = pData.getGenericInstance(BlockInteractData.class); // TODO: pass as argument.
final Material againstType = blockAgainst.getType();
if (bdata.isConsumedCheck(this.type) && !bdata.isPassedCheck(this.type)) {
final Material matAgainst = bIData.getLastType();
if (pData.isDebugActive(type)) {
debug(player, "Player placed (" + placedMat + ") against (" + blockAgainst.toString() +"/"+ matAgainst + "). againstType: " + againstType);
}
if (bIData.isConsumedCheck(this.type) && !bIData.isPassedCheck(this.type)) {
// TODO: Awareness of repeated violation probably is to be implemented below somewhere.
violation = true;
if (pData.isDebugActive(type)) {
debug(player, "Cancel due to block having been consumed by this check.");
}
}
else if (BlockProperties.isAir(againstType)) {
// Attempt to workaround blocks like cactus.
final Material matAgainst = bdata.getLastType();
if (isInteractBlock && !BlockProperties.isAir(matAgainst) && ! BlockProperties.isLiquid(matAgainst)) {
else if (BlockProperties.isActuallyAir(matAgainst)) {
if (isInteractBlock && !BlockProperties.isAir(matAgainst) && !BlockProperties.isLiquid(matAgainst)) {
// Block was placed against something (e.g. cactus), allow it.
}
else if (!pData.hasPermission(Permissions.BLOCKPLACE_AGAINST_AIR, player)) {
else if (!pData.hasPermission(Permissions.BLOCKPLACE_AGAINST_AIR, player)
&& placedMat != BridgeMaterial.LILY_PAD) {
violation = true;
}
}
else if (BlockProperties.isLiquid(againstType)) {
// TODO: F_PLACE_AGAINST_WATER|LIQUID...
else if (BlockProperties.isLiquid(matAgainst)) {
if ((placedMat != BridgeMaterial.LILY_PAD
|| !BlockProperties.isLiquid(block.getRelative(BlockFace.DOWN).getType()))
&& !pData.hasPermission(Permissions.BLOCKPLACE_AGAINST_LIQUIDS, player)) {
|| !BlockProperties.isLiquid(block.getRelative(BlockFace.DOWN).getType()))
&& !BlockProperties.isNewLiq(bIData.getLastType())
&& !pData.hasPermission(Permissions.BLOCKPLACE_AGAINST_LIQUIDS, player)) {
violation = true;
}
}
// Handle violation and return.
bdata.addConsumedCheck(this.type);
bIData.addConsumedCheck(this.type);
if (violation) {
data.againstVL += 1.0;
final ViolationData vd = new ViolationData(this, player, data.againstVL, 1, cc.againstActions);
vd.setParameter(ParameterName.BLOCK_TYPE, placedMat.toString());
vd.setParameter(ParameterName.BLOCK_TYPE, matAgainst == null ? null : matAgainst.toString());
return executeActions(vd).willCancel();
}
else {
data.againstVL *= 0.99; // Assume one false positive every 100 blocks.
bdata.addPassedCheck(this.type);
bIData.addPassedCheck(this.type);
return false;
}
}
@@ -69,7 +69,9 @@ public class AutoSign extends Check {
s = s.replace("WALL_", "");
mat = Material.getMaterial(s);
}
if (s.equals("SIGN_POST")) {
mat = Material.getMaterial("SIGN");
}
if (data.autoSignPlacedHash != BlockPlaceListener.getBlockPlaceHash(block, mat)){
tags.add("block_mismatch");
return handleViolation(player, maxEditTime, data, cc);
@@ -50,8 +50,15 @@ public class BlockPlaceConfig extends ACheckConfig {
public final ActionList noSwingActions;
public final ActionList reachActions;
public final ActionList scaffoldActions;
public final boolean scaffoldAngle;
public final boolean scaffoldTime;
public final int scaffoldTimeAvg;
public final boolean scaffoldSprint;
public final boolean scaffoldRotate;
public final int scaffoldRotateDiff;
public final boolean scaffoldToolSwitch;
public final long speedInterval;
public final boolean speedImprobableFeedOnly;
@@ -90,8 +97,15 @@ public class BlockPlaceConfig extends ACheckConfig {
noSwingActions = config.getOptimizedActionList(ConfPaths.BLOCKPLACE_NOSWING_ACTIONS, Permissions.BLOCKPLACE_NOSWING);
reachActions = config.getOptimizedActionList(ConfPaths.BLOCKPLACE_REACH_ACTIONS, Permissions.BLOCKPLACE_REACH);
scaffoldActions = config.getOptimizedActionList(ConfPaths.BLOCKPLACE_SCAFFOLD_ACTIONS, Permissions.BLOCKPLACE_REACH);
scaffoldAngle = config.getBoolean(ConfPaths.BLOCKPLACE_SCAFFOLD_ANGLE);
scaffoldTime = config.getBoolean(ConfPaths.BLOCKPLACE_SCAFFOLD_TIME_ACTIVE);
scaffoldTimeAvg = config.getInt(ConfPaths.BLOCKPLACE_SCAFFOLD_TIME_AVG);
scaffoldSprint = config.getBoolean(ConfPaths.BLOCKPLACE_SCAFFOLD_SPRINT);
scaffoldRotate = config.getBoolean(ConfPaths.BLOCKPLACE_SCAFFOLD_ROTATE_ACTIVE);
scaffoldRotateDiff = config.getInt(ConfPaths.BLOCKPLACE_SCAFFOLD_ROTATE_DIFFERENCE);
scaffoldToolSwitch = config.getBoolean(ConfPaths.BLOCKPLACE_SCAFFOLD_TOOLSWITCH);
speedInterval = config.getLong(ConfPaths.BLOCKPLACE_SPEED_INTERVAL);
speedImprobableFeedOnly = config.getBoolean(ConfPaths.BLOCKPLACE_SPEED_IMPROBABLE_FEEDONLY);
@@ -108,4 +122,4 @@ public class BlockPlaceConfig extends ACheckConfig {
*/
}
}
}
@@ -14,6 +14,9 @@
*/
package fr.neatmonster.nocheatplus.checks.blockplace;
import java.util.ArrayList;
import java.util.List;
import fr.neatmonster.nocheatplus.checks.access.ACheckData;
import fr.neatmonster.nocheatplus.utilities.ds.count.ActionFrequency;
@@ -37,13 +40,22 @@ public class BlockPlaceData extends ACheckData {
/** Using Material.SIGN . */
public long autoSignPlacedHash = 0;
// Scaffold data
public List<Long> placeTick = new ArrayList<>();
public long sneakTime = 0;
public long sprintTime = 0;
public float lastYaw = 0;
public int lastSlot = 0;
public long currentTick = 0;
public boolean cancelNextPlace = false;
// Data of the fast place check.
public final ActionFrequency fastPlaceBuckets = new ActionFrequency(2, 1000);
public int fastPlaceShortTermTick = 0;
public int fastPlaceShortTermCount = 0;
// Data of the no swing check.
public boolean noSwingArmSwung = true;
public int noSwingCount = 0;
// Data of the reach check.
public double reachDistance;
@@ -52,4 +64,4 @@ public class BlockPlaceData extends ACheckData {
public boolean speedLastRefused;
public long speedLastTime;
}
}
@@ -14,9 +14,7 @@
*/
package fr.neatmonster.nocheatplus.checks.blockplace;
import java.util.List;
import java.util.Set;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -34,20 +32,19 @@ import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.checks.CheckListener;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractData;
import fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractListener;
import fr.neatmonster.nocheatplus.checks.combined.Combined;
import fr.neatmonster.nocheatplus.checks.combined.CombinedConfig;
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
import fr.neatmonster.nocheatplus.checks.net.FlyingQueueHandle;
import fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
@@ -65,6 +62,9 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.map.MaterialUtil;
import fr.neatmonster.nocheatplus.worlds.WorldFactoryArgument;
import java.util.Arrays;
import java.util.List;
/**
* Central location to listen to events that are relevant for the block place checks.
*
@@ -111,10 +111,10 @@ public class BlockPlaceListener extends CheckListener {
/** The reach check. */
private final Reach reach = addCheck(new Reach());
/** The scaffold check. */
/** The scaffold check. */
private final Scaffold Scaffold = addCheck(new Scaffold());
/** The speed check. */
/** The speed check. */
private final Speed speed = addCheck(new Speed());
/** For temporary use: LocUtil.clone before passing deeply, call setWorld(null) after use. */
@@ -126,11 +126,13 @@ public class BlockPlaceListener extends CheckListener {
private final Class<?> blockMultiPlaceEvent = ReflectionUtil.getClass("org.bukkit.event.block.BlockMultiPlaceEvent");
private final boolean hasGetReplacedState = ReflectionUtil.getMethodNoArgs(BlockPlaceEvent.class, "getReplacedState", BlockState.class) != null;
public final List<BlockFace> faces;
@SuppressWarnings("unchecked")
public BlockPlaceListener() {
super(CheckType.BLOCKPLACE);
final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
faces = Arrays.asList(new BlockFace[] {BlockFace.SOUTH, BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH});
api.register(api.newRegistrationContext()
// BlockPlaceConfig
.registerConfigWorld(BlockPlaceConfig.class)
@@ -162,10 +164,11 @@ public class BlockPlaceListener extends CheckListener {
* @param event
* the event
*/
@EventHandler(
ignoreCancelled = true, priority = EventPriority.LOWEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onBlockPlace(final BlockPlaceEvent event) {
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKPLACE, event.getPlayer())) return;
final Block block = event.getBlockPlaced();
final Block blockAgainst = event.getBlockAgainst();
// Skip any null blocks.
@@ -185,9 +188,8 @@ public class BlockPlaceListener extends CheckListener {
final ItemStack stack = event.getItemInHand();
placedMat = BlockProperties.isAir(stack) ? Material.AIR : stack.getType();
}
else {
placedMat = Bridge1_9.getItemInMainHand(player).getType(); // Safety first.
}
else placedMat = Bridge1_9.getItemInMainHand(player).getType(); // Safety first.
boolean cancelled = false;
final IPlayerData pData = DataManager.getPlayerData(player); // TODO: Use for data + config getting etc.
@@ -199,11 +201,14 @@ public class BlockPlaceListener extends CheckListener {
final boolean isInteractBlock = !bdata.getLastIsCancelled() && bdata.matchesLastBlock(tick, blockAgainst);
int skippedRedundantChecks = 0;
final boolean debug = pData.isDebugActive(CheckType.BLOCKPLACE);
final BlockFace placedFace = event.getBlock().getFace(blockAgainst);
final Block blockPlaced = event.getBlockPlaced();
final double distance = player.getLocation().distance(blockPlaced.getLocation());
boolean shouldCheck;
final boolean shouldSkipSome;
if (blockMultiPlaceEvent != null && event.getClass() == blockMultiPlaceEvent) {
if (placedMat == Material.BEDROCK
|| Bridge1_9.hasEndCrystalItem() && placedMat == Bridge1_9.END_CRYSTAL_ITEM) {
if (placedMat == Material.BEDROCK || Bridge1_9.hasEndCrystalItem() && placedMat == Bridge1_9.END_CRYSTAL_ITEM) {
shouldSkipSome = true;
}
else {
@@ -212,9 +217,9 @@ public class BlockPlaceListener extends CheckListener {
}
shouldSkipSome = false;
}
}
}
else {
shouldSkipSome = false;
shouldSkipSome = BlockProperties.isScaffolding(placedMat);
}
if (placedMat.toString().endsWith("SIGN")) {
@@ -225,34 +230,55 @@ public class BlockPlaceListener extends CheckListener {
}
// Don't run checks, if a set back is scheduled.
if (!cancelled && pData.isPlayerSetBackScheduled()) {
if (pData.isPlayerSetBackScheduled()) {
cancelled = true;
}
// Fast place check.
if (!cancelled && fastPlace.isEnabled(player, pData)) {
if (fastPlace.check(player, block, tick, data, cc, pData)) {
cancelled = true;
}
else if (cc.fastPlaceImprobableWeight > 0.0f) {
if (cc.fastPlaceImprobableFeedOnly) {
Improbable.feed(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis());
} else if (Improbable.check(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis(), "blockplace.fastplace", pData)) {
cancelled = true;
}
if (cc.fastPlaceImprobableFeedOnly) {
Improbable.feed(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis());
}
else if (Improbable.check(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis(), "blockplace.fastplace", pData)) {
cancelled = true;
}
}
}
// No swing check (player doesn't swing their arm when placing a lily pad).
if (!cancelled && !cc.noSwingExceptions.contains(placedMat)
&& noSwing.isEnabled(player, pData) && noSwing.check(player, data, cc)) {
&& noSwing.isEnabled(player, pData) && noSwing.check(player, data, cc)) {
// Consider skipping all insta placables or using simplified version (true or true within time frame).
cancelled = true;
}
// Scaffold Check
// Null check because I guess it can return null sometimes?
if (Scaffold.isEnabled(player, pData) && placedFace != null) {
MovingData mData = pData.getGenericInstance(MovingData.class);
if (faces.contains(placedFace) && player.getLocation().getY() - blockPlaced.getY() < 2D
&& player.getLocation().getY() - blockPlaced.getY() >= 1D
&& blockPlaced.getType().isSolid() && distance < 2D) {
cancelled = data.cancelNextPlace && (Math.abs(data.currentTick - TickTask.getTick()) < 10)
|| Scaffold.check(player, placedFace, pData, data, cc, event.isCancelled(),
mData.playerMoves.getCurrentMove().yDistance, mData.sfJumpPhase);
if (!cancelled) data.scaffoldVL *= 0.98;
}
data.cancelNextPlace = false;
}
final FlyingQueueHandle flyingHandle;
final boolean reachCheck = pData.isCheckActive(CheckType.BLOCKPLACE_REACH, player);
final boolean directionCheck = pData.isCheckActive(CheckType.BLOCKPLACE_DIRECTION, player);
if (reachCheck || directionCheck) {
flyingHandle = new FlyingQueueHandle(pData);
final Location loc = player.getLocation(useLoc);
@@ -260,35 +286,34 @@ public class BlockPlaceListener extends CheckListener {
// Reach check (distance).
if (!cancelled && !shouldSkipSome) {
if (isInteractBlock && bdata.isPassedCheck(CheckType.BLOCKINTERACT_REACH)) {
skippedRedundantChecks ++;
skippedRedundantChecks++;
}
else if (reachCheck && reach.check(player, eyeHeight, block, data, cc)) {
cancelled = true;
}
}
// Direction check.
if (!cancelled && !shouldSkipSome) {
if (isInteractBlock && bdata.isPassedCheck(CheckType.BLOCKINTERACT_DIRECTION)) {
skippedRedundantChecks ++;
skippedRedundantChecks++;
}
else if (directionCheck) {
if (blockAgainst.getType() == Material.LADDER || BlockProperties.isCarpet(blockAgainst.getType())) {
}
else if (direction.check(player, loc, eyeHeight, block, flyingHandle, data, cc, pData)) {
cancelled = true;
}
if (blockAgainst.getType() == Material.LADDER || BlockProperties.isCarpet(blockAgainst.getType())) {
// Ignore
}
else if (direction.check(player, loc, eyeHeight, block, null, flyingHandle, data, cc, pData)) {
cancelled = true;
}
}
}
useLoc.setWorld(null);
}
else {
flyingHandle = null;
}
// Surrounding material.
if (!cancelled && against.isEnabled(player, pData) && against.check(player, block, placedMat, blockAgainst,
isInteractBlock, data, cc, pData)) {
if (!cancelled && against.isEnabled(player, pData) && !BlockProperties.isScaffolding(placedMat)
&& against.check(player, block, placedMat, blockAgainst, isInteractBlock, data, cc, pData)) {
cancelled = true;
}
@@ -296,7 +321,7 @@ public class BlockPlaceListener extends CheckListener {
if (cancelled) {
event.setCancelled(cancelled);
}
// Debug check breaks when checking blockAgainst is equal to something, disabled for now
// Debug check breaks when checking blockAgainst is equal to something, disabled for now
/* else {
// Debug log (only if not cancelled, to avoid spam).
if (debug) {
@@ -331,6 +356,9 @@ public class BlockPlaceListener extends CheckListener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onSignChange(final SignChangeEvent event) {
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKPLACE, event.getPlayer())) return;
if (event.getClass() != SignChangeEvent.class) {
// Built in plugin compatibility.
// TODO: Don't understand why two consecutive events editing the same block are a problem.
@@ -360,7 +388,8 @@ public class BlockPlaceListener extends CheckListener {
priority = EventPriority.MONITOR)
public void onPlayerAnimation(final PlayerAnimationEvent event) {
// Just set a flag to true when the arm was swung.
DataManager.getPlayerData(event.getPlayer()).getGenericInstance(BlockPlaceData.class).noSwingArmSwung = true;
final BlockPlaceData data = DataManager.getGenericInstance(event.getPlayer(), BlockPlaceData.class);
data.noSwingCount = Math.max(data.noSwingCount - 1, 0);
}
/**
@@ -371,6 +400,9 @@ public class BlockPlaceListener extends CheckListener {
*/
@EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)
public void onPlayerInteract(final PlayerInteractEvent event) {
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKPLACE, event.getPlayer())) return;
if (event.isCancelled()) {
// TODO: Might run checks if (event.useInteractedBlock()) ...
return;
@@ -392,7 +424,7 @@ public class BlockPlaceListener extends CheckListener {
if (cc.preventBoatsAnywhere) {
// TODO: Alter config (activation, allow on top of ground).
// TODO: Version/plugin specific alteration for 'default'.
checkBoatsAnywhere(player, event, cc, pData);
checkBoatsAnywhere(player, event, pData);
}
}
else if (MaterialUtil.isSpawnEgg(type)) {
@@ -403,34 +435,8 @@ public class BlockPlaceListener extends CheckListener {
}
}
}
/**
* Listens for PlayerInteract events to check for their target block face vs their
* attempted block face. This is used for the scaffold check.
*/
@EventHandler(priority = EventPriority.MONITOR)
public void placeBlock(PlayerInteractEvent event) {
if (!Scaffold.isEnabled(event.getPlayer())) return;
Player player = event.getPlayer();
Block targetBlock = player.getTargetBlock((Set<Material>) null, 7);
if (event.getAction() != Action.RIGHT_CLICK_BLOCK || !event.isBlockInHand() || player.isFlying() && player.getAllowFlight() || targetBlock.isLiquid() || player.isSneaking()) return;
List<Block> lastTarget = player.getLastTwoTargetBlocks((Set<Material>) null, 7);
BlockFace blockFace = event.getBlockFace();
if (targetBlock.getY() != player.getLocation().subtract(0, 1, 0).getY()) return;
final IPlayerData pData = DataManager.getPlayerData(player);
final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);
if (Scaffold.check(player, targetBlock, lastTarget, blockFace, pData, data)) {
event.setCancelled(true);
}
}
private void checkBoatsAnywhere(final Player player, final PlayerInteractEvent event,
final BlockPlaceConfig cc, final IPlayerData pData) {
private void checkBoatsAnywhere(final Player player, final PlayerInteractEvent event, final IPlayerData pData) {
// Check boats-anywhere.
final Block block = event.getClickedBlock();
final Material mat = block.getType();
@@ -476,6 +482,8 @@ public class BlockPlaceListener extends CheckListener {
return;
}
if (!DataManager.getPlayerData(player).isCheckActive(CheckType.BLOCKPLACE, player)) return;
if (MovingUtil.hasScheduledPlayerSetBack(player)) {
// TODO: Should log.
event.setCancelled(true);
@@ -486,15 +494,10 @@ public class BlockPlaceListener extends CheckListener {
EntityType type = event.getEntityType();
switch (type) {
case ENDER_PEARL:
break;
case ENDER_SIGNAL:
break;
case EGG:
break;
case SNOWBALL:
break;
case THROWN_EXP_BOTTLE:
break;
case SPLASH_POTION:
break;
default:
@@ -517,11 +520,12 @@ public class BlockPlaceListener extends CheckListener {
cancel = true;
}
else if (cc.speedImprobableWeight > 0.0f) {
if (cc.speedImprobableFeedOnly) {
Improbable.feed(player, cc.speedImprobableWeight, now);
} else if (Improbable.check(player, cc.speedImprobableWeight, now, "blockplace.speed", pData)) {
cancel = true;
}
if (cc.speedImprobableFeedOnly) {
Improbable.feed(player, cc.speedImprobableWeight, now);
}
else if (Improbable.check(player, cc.speedImprobableWeight, now, "blockplace.speed", pData)) {
cancel = true;
}
}
}
@@ -533,7 +537,7 @@ public class BlockPlaceListener extends CheckListener {
}
else if (!BlockProperties.isPassable(projectile.getLocation(useLoc))) {
// Launch into a block.
// TODO: This might be a general check later.
// TODO: This might be a general check later.
cancel = true;
}
else {
@@ -568,4 +572,22 @@ public class BlockPlaceListener extends CheckListener {
// Cleanup.
useLoc.setWorld(null);
}
}
// TODO: remove this
@EventHandler(priority = EventPriority.MONITOR)
public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(player);
final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);
if (!pData.isCheckActive(CheckType.BLOCKPLACE, player)) return;
if (player.isSprinting()) {
data.sprintTime = TickTask.getTick();
} else if (player.isSneaking()) {
data.sneakTime = TickTask.getTick();
}
}
}
@@ -45,13 +45,12 @@ public class NoSwing extends Check {
boolean cancel = false;
// Did they swing their arm before?
if (data.noSwingArmSwung) {
// "Consume" the flag.
data.noSwingArmSwung = false;
if (++data.noSwingCount <= 1) {
// Reward with lowering of the violation level.
data.noSwingVL *= 0.9D;
} else {
// They failed, increase violation level.
data.noSwingCount = 0;
data.noSwingVL += 1D;
// Execute whatever actions are associated with this check and the violation level and find out if we should
@@ -1,34 +1,194 @@
/*
* 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.blockplace;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.block.Block;
import fr.neatmonster.nocheatplus.components.registry.feature.TickListener;
import fr.neatmonster.nocheatplus.utilities.TickTask;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
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.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.StringUtil;
/**
* Check for common behavior from a client using the "Scaffold" cheat.
* Each sub-check should cover areas that one sub-check may not cover.
* If the cheat does not flag any other sub-checks, the time sub-check
* Should enforce realistic time between block placements.
*/
public class Scaffold extends Check {
public Scaffold() {
final static double MAX_ANGLE = Math.toRadians(90);
public List<String> tags = new LinkedList<>();
/*
* Instanties a new Scaffold check
*
*/
public Scaffold() {
super(CheckType.BLOCKPLACE_SCAFFOLD);
}
public boolean check(Player player, Block targetBlock, List<Block> lastTarget, BlockFace blockFace, final IPlayerData pData, final BlockPlaceData data) {
BlockFace face = null;
boolean cancel = false;
if (lastTarget.size() > 1) {
face = lastTarget.get(1).getFace(lastTarget.get(0));
}
/**
* Check the player for Scaffold cheats
*
* @param player the player
* @param placedFace blockface player placed against
* @param pData player data
* @param data block place data
* @param cc block place config
* @param isCancelled is the event cancelled
* @param yDistance players current yDistance for this move
* @param jumpPhase players jump phase
* @return
*/
public boolean check(final Player player, final BlockFace placedFace, final IPlayerData pData,
final BlockPlaceData data, final BlockPlaceConfig cc, final boolean isCancelled,
final double yDistance, final int jumpPhase) {
boolean cancel = false;
if (blockFace != face) {
cancel = executeActions(player, data.scaffoldVL, 1D, pData.getGenericInstance(BlockPlaceConfig.class).scaffoldActions).willCancel();
data.scaffoldVL += 1D;
}
return cancel;
}
// Update sneakTime since the player may have unsneaked after the last move.
if (player.isSneaking()) {
data.sneakTime = data.currentTick;
}
data.currentTick = TickTask.getTick();
// Angle Check - Check if the player is looking at the block (Should already be covered by BlockInteract.Direction)
if (cc.scaffoldAngle) {
final Vector placedVector = new Vector(placedFace.getModX(), placedFace.getModY(), placedFace.getModZ());
float placedAngle = player.getLocation().getDirection().angle(placedVector);
if (placedAngle > MAX_ANGLE) cancel = violation("Angle", Math.min(Math.max(1, (int) (placedAngle - MAX_ANGLE) * 10), 10), player, data, pData);
}
// Time Check - A FastPlace check but for Scaffold type block placements. If all other sub-checks fail to detect the cheat this
// Should ensure the player cannot quickly place blocks below themselves.
if (cc.scaffoldTime && !isCancelled && Math.abs(player.getLocation().getPitch()) > 70
&& (data.currentTick - data.sneakTime) > 3
&& !player.hasPotionEffect(PotionEffectType.SPEED)
) {
data.placeTick.add(data.currentTick);
if (data.placeTick.size() > 2) {
long sum = 0;
long lastTick = 0;
for (int i = 0; i < data.placeTick.size(); i++) {
long tick = data.placeTick.get(i);
if (lastTick != 0) {
sum += (tick - lastTick);
}
lastTick = tick;
}
double avg = sum / data.placeTick.size();
if (avg < cc.scaffoldTimeAvg) {
cancel = violation("Time", Math.min((cc.scaffoldTimeAvg - (int) avg), 5), player, data, pData);
if (data.placeTick.size() > 20) data.placeTick.clear(); // Clear if it gets too big to prevent players being unable to place blocks
}
else {
data.placeTick.clear();
}
}
}
// Sprint check - Prevent players from sprinting while placing blocks below them
long diff = data.currentTick - data.sprintTime;
if (cc.scaffoldSprint && Math.abs(player.getLocation().getPitch()) > 70
&& diff < 8 && yDistance < 0.1 && jumpPhase < 4) {
cancel = violation("Sprint", 1, player, data, pData);
}
// Rotate Check - Check for large changes in rotation between block placements
if (cc.scaffoldRotate) {
data.lastYaw = player.getLocation().getYaw();
TickListener pitchTick = new TickListener() {
@Override
public void onTick(int tick, long timeLast) {
// Needs to be run on the next tick
// Most likely better way to to this with TickTask but this works as well
if (TickTask.getTick() != data.currentTick) {
float diff = Math.abs(data.lastYaw - player.getLocation().getYaw());
if (diff > cc.scaffoldRotateDiff) {
data.cancelNextPlace = violation("Rotate", Math.min((int) (diff - cc.scaffoldRotateDiff) / 10, 5), player, data, pData);
tags.clear();
}
TickTask.removeTickListener(this);
}
}
};
TickTask.addTickListener(pitchTick);
}
// Tool Switch - Check if the player is quickly switching inventory slots between block placements
if (cc.scaffoldToolSwitch) {
data.lastSlot = player.getInventory().getHeldItemSlot();
TickListener toolSwitchTick = new TickListener() {
@Override
public void onTick(int tick, long timeLast) {
// Needs to be run on the next tick
// Most likely better way to to this with TickTask but this works as well
if (data.currentTick != TickTask.getTick()) {
if (data.lastSlot != player.getInventory().getHeldItemSlot()) {
data.cancelNextPlace = violation("ToolSwitch", 1, player, data, pData);
tags.clear();
}
TickTask.removeTickListener(this);
}
}
};
TickTask.addTickListener(toolSwitchTick);
}
tags.clear();
return cancel;
}
/**
* Create a violation for Scaffold
*
* @param addTags
* @param weight
* @param player
* @param data
* @param pData
* @return
*/
public boolean violation(final String addTags, final int weight, final Player player,
final BlockPlaceData data, final IPlayerData pData) {
ViolationData vd = new ViolationData(this, player, data.scaffoldVL, weight, pData.getGenericInstance(BlockPlaceConfig.class).scaffoldActions);
tags.add(addTags);
if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
data.scaffoldVL += weight;
return executeActions(vd).willCancel();
}
}
@@ -139,6 +139,8 @@ public class ChatListener extends CheckListener implements INotifyReload, JoinLe
final Player player = event.getPlayer();
final boolean alreadyCancelled = event.isCancelled();
if (!DataManager.getPlayerData(player).isCheckActive(CheckType.CHAT, player)) return;
// Tell TickTask to update cached permissions.
// (Might omit this if already cancelled.)
final IPlayerData pData = DataManager.getPlayerData(player);
@@ -276,6 +278,9 @@ public class ChatListener extends CheckListener implements INotifyReload, JoinLe
if (event.getResult() != Result.ALLOWED) return;
final Player player = event.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(player);
if (!pData.isCheckActive(CheckType.CHAT, player)) return;
final ChatConfig cc = pData.getGenericInstance(ChatConfig.class);
final ChatData data = pData.getGenericInstance(ChatData.class);
@@ -100,6 +100,9 @@ public class CombinedListener extends CheckListener {
final Player player = event.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(player);
if (!pData.isCheckActive(CheckType.COMBINED, player)) return;
final CombinedData data = pData.getGenericInstance(CombinedData.class);
final CombinedConfig cc = pData.getGenericInstance(CombinedConfig.class);
@@ -124,6 +127,9 @@ public class CombinedListener extends CheckListener {
if (!(entity instanceof Player)) return;
final Player player = (Player) entity;
final IPlayerData pData = DataManager.getPlayerData(player);
if (!pData.isCheckActive(CheckType.COMBINED, player)) return;
final CombinedConfig cc = pData.getGenericInstance(CombinedConfig.class);
if (!cc.invulnerableCheck) return;
final DamageCause cause = event.getCause();
@@ -41,8 +41,10 @@ import org.bukkit.ChatColor;
* Thanks @asofold for the original idea!
*/
public class Angle extends Check {
private final List<String> tags = new LinkedList<String>();
private final List<String> tags = new LinkedList<String>();
public static class AttackLocation {
public final double x, y, z;
@@ -80,8 +82,10 @@ public class Angle extends Check {
}
}
public static long maxTimeDiff = 1000L;
/**
* Instantiates a new angle check.
*/
@@ -89,6 +93,7 @@ public class Angle extends Check {
super(CheckType.FIGHT_ANGLE);
}
/**
* The Angle check.
* @param player
@@ -99,12 +104,10 @@ public class Angle extends Check {
* @return
*/
public boolean check(final Player player, final Location loc,
final Entity damagedEntity, final boolean worldChanged,
final FightData data, final FightConfig cc, final IPlayerData pData) {
final Entity damagedEntity, final boolean worldChanged,
final FightData data, final FightConfig cc, final IPlayerData pData) {
if (worldChanged){
data.angleHits.clear();
}
if (worldChanged) data.angleHits.clear();
boolean cancel = false;
tags.clear();
@@ -163,101 +166,86 @@ public class Angle extends Check {
// Declare the variables.
double violation = 0.0;
double violationone = 0.0;
double violationtwo = 0.0;
double violationthree = 0.0;
double violationfour = 0.0;
double violationMove = 0.0;
double violationTime = 0.0;
double violationYaw = 0.0;
double violationSwitchSpeed = 0.0;
// If the average move is between 0 and 0.2 block(s), add it to the violation.
if (averageMove >= 0.0 && averageMove < 0.2D) {
violationone += 20.0 * (0.2 - averageMove) / 0.2;
tags.add("Average_move");
violationMove += 20.0 * (0.2 - averageMove) / 0.2;
tags.add("avgmove");
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgMove: " + averageMove + " avgMove VL: " + violationone + "/" + cc.angleMove);
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgMove: " + averageMove + " avgMove VL: " + violationMove + "/" + cc.angleMove);
}
}
// If the average time elapsed is between 0 and 150 millisecond(s), add it to the violation.
if (averageTime >= 0.0 && averageTime < 150.0) {
violationtwo += 30.0 * (150.0 - averageTime) / 150.0;
tags.add("Average_time");
violationTime += 30.0 * (150.0 - averageTime) / 150.0;
tags.add("avgtime");
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgTime: " + averageTime + " avgTime VL: " + violationtwo + "/" + cc.angleTime);
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgTime: " + averageTime + " avgTime VL: " + violationTime + "/" + cc.angleTime);
}
}
// If the average difference of yaw is superior to 50 degrees, add it to the violation.
if (averageYaw > 50.0) {
violationthree += 30.0 * averageYaw / 180.0;
tags.add("Average_yaw");
violationYaw += 30.0 * averageYaw / 180.0;
tags.add("avgyaw");
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgYaw: " + averageYaw + " avgYaw VL: " + violationthree + "/" + cc.angleYaw);
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgYaw: " + averageYaw + " avgYaw VL: " + violationYaw + "/" + cc.angleYaw);
}
}
// Check for too quick target switch speed
if (averageSwitching > 0.0) {
violationfour += 20.0 * averageSwitching;
tags.add("SwitchSpeed");
violationSwitchSpeed += 20.0 * averageSwitching;
tags.add("switchspeed");
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgSwitch: " + averageSwitching + " avgSwitch VL: " + violationfour + "/" + cc.angleSwitch);
player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgSwitch: " + averageSwitching + " avgSwitch VL: " + violationSwitchSpeed + "/" + cc.angleSwitch);
}
}
// Is the violation is superior to the threshold defined in the configuration?
if (violationone > cc.angleMove) {
// Has the server lagged?
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
// If it hasn't, increment the violation level
violation = violationone;
data.angleVL += violation;
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
if (vd.needsParameters()){
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
}
return executeActions(vd).willCancel();
}
if (violationMove > cc.angleMove) {
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
violation = violationMove;
data.angleVL += violation;
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
cancel = executeActions(vd).willCancel();
}
}
else if (violationtwo > cc.angleTime) {
// Has the server lagged?
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
// If it hasn't, increment the violation level
violation = violationtwo;
data.angleVL += violation;
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
if (vd.needsParameters()){
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
}
return executeActions(vd).willCancel();
}
else if (violationTime > cc.angleTime) {
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
violation = violationTime;
data.angleVL += violation;
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
cancel = executeActions(vd).willCancel();
}
}
else if (violationthree > cc.angleYaw) {
// Has the server lagged?
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
// If it hasn't, increment the violation level
violation = violationthree;
data.angleVL += violation;
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
if (vd.needsParameters()){
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
}
return executeActions(vd).willCancel();
}
else if (violationYaw > cc.angleYaw) {
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
violation = violationYaw;
data.angleVL += violation;
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
cancel = executeActions(vd).willCancel();
}
}
else if (violationfour > cc.angleSwitch) {
// Has the server lagged?
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
// If it hasn't, increment the violation level
violation = violationfour;
data.angleVL += violation;
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
if (vd.needsParameters()){
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
}
return executeActions(vd).willCancel();
}
else if (violationSwitchSpeed > cc.angleSwitch) {
if (TickTask.getLag(maxTimeDiff, true) < 1.5f){
violation = violationSwitchSpeed;
data.angleVL += violation;
final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
cancel = executeActions(vd).willCancel();
}
}
else {
// Reward the player by lowering their violation level.
// Reward the player by lowering their violation level.
data.angleVL *= 0.98D;
}
return cancel;
@@ -1,128 +0,0 @@
package fr.neatmonster.nocheatplus.checks.fight;
import java.util.HashMap;
import org.bukkit.ChatColor;
// import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.checks.Check;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.TickTask;
// import net.minecraft.server.v1_13_R2.EntityPlayer;
public class ClickPattern extends Check {
/**
* Instantiates a new click pattern check.
*/
public ClickPattern() {
super(CheckType.FIGHT_CLICKPATTERN);
}
/*public int getPing(Player p) {
CraftPlayer cp = (CraftPlayer) p; EntityPlayer ep = cp.getHandle(); return ep.ping;
} */
HashMap<String, Long> clickData = new HashMap<String, Long>();
// Resets the click times to check for another click difference
private void resetClickTime(HashMap<String, Long> clickData) {
clickData.put("thisAttackTime", 0L);
clickData.put("lastAttackTime", 0L);
}
// Resets all the attack times once the check has been finished
private void resetAllTimes(HashMap<String, Long> clickData) {
clickData.put("thisAttackTime", 0L);
clickData.put("lastAttackTime", 0L);
clickData.put("thisClickDifference", 0L);
clickData.put("lastClickDifference", 0L);
}
/*
* This check compares the players time between each click, and attempts to find a pattern,
* Right now, this is bare-bone version, and more testing/fixing needs to be done to improve it.
* This can detect AutoClickers or KillAuras that do not allow aps ranges.
*
*/
public boolean check(final Player player, final FightData data, final IPlayerData pData, final FightConfig cc) {
boolean cancel = false;
final long now = System.currentTimeMillis();
// Adds the HashMap if it has not already been added
if (clickData.isEmpty()) {
clickData.putIfAbsent("lastAttackTime", 0L);
clickData.putIfAbsent("thisAttackTime", 0L);
clickData.putIfAbsent("lastClickDifference", 0L);
clickData.putIfAbsent("thisClickDifference", 0L);
}
// Skip the player if they are lagging
if (TickTask.getLag(1000, true) > 1.3f) return false;
// Setting the attack times
else if (clickData.get("lastAttackTime").equals(0L)) {
clickData.put("lastAttackTime", now);
}
else if (clickData.get("thisAttackTime").equals(0L)) {
clickData.put("thisAttackTime", now);
}
// Calculating the difference
if (!clickData.get("lastAttackTime").equals(0L) && !clickData.get("thisAttackTime").equals(0L)) {
if (clickData.get("lastClickDifference").equals(0L)) {
clickData.put("lastClickDifference", Math.abs(clickData.get("thisAttackTime") - clickData.get("lastAttackTime")));
resetClickTime(clickData);
} else if (clickData.get("thisClickDifference").equals(0L)) {
clickData.put("thisClickDifference", Math.abs(clickData.get("thisAttackTime") - clickData.get("lastAttackTime")));
if (clickData.get("thisClickDifference") == clickData.get("lastClickDifference") || cc.clickRange > Math.max(clickData.get("thisClickDifference") - clickData.get("lastClickDifference"), clickData.get("lastClickDifference") - clickData.get("thisClickDifference"))) {
cancel = executeActions(player, data.clickPatternVL, 1D, pData.getGenericInstance(FightConfig.class).clickActions).willCancel();
data.clickPatternVL += 1D;
} else {
data.clickPatternVL *= 0.86D;
}
if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
player.sendMessage(ChatColor.RED + "NCP Debug: " + ChatColor.RESET + "ThisClick Difference: " + clickData.get("thisClickDifference") + " Last Click Differnce: " + clickData.get("lastClickDifference") + ChatColor.RED + " false");
}
resetAllTimes(clickData);
}
}
if (cancel) {
data.clicPatPenalty.applyPenalty(cc.clickPen);
}
return cancel;
}
}
/**
* Code to be touched up/fixed later, and the effectiveness of this check needs to be tested.
* This part would get the average of their click difference and attempt to find a pattern there.
* Could be useful to attempt to eliminate false positives with the click difference check.
* Requires Java 8 to calculate the average, but a for method could be used to keep cross compatibility
*
* if (avgData.size() >= 8) {
* player.sendMessage("Calculating avg:");
* if (calcAvg(avgData) <= 25) {
* player.sendMessage("Avg is " + ChatColor.GREEN + "true " + avgData);
* } else {
* player.sendMessage("Avg is " + ChatColor.RED + "false " + avgData);
* }
* }
*
* avgData.add(Math.max(clickData.get("thisClickDifference") - clickData.get("lastClickDifference"), clickData.get("lastClickDifference") - clickData.get("thisClickDifference")));
*
* private double calcAvg(ArrayList <Long> avgData) {
* double avg = avgData.stream().mapToInt(Long::intValue).average().getAsDouble();
* int size = avgData.size();
* Bukkit.getLogger().info("[NoCheatPlus] avg: " + avg + " size " + size);
*
* return avg / size;
* }
*
* ArrayList<Long> avgData = new ArrayList<Long>();
*/
@@ -28,7 +28,7 @@ import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.ViolationData;
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.checks.moving.model.LiftOffEnvelope;
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveInfo;
import fr.neatmonster.nocheatplus.checks.moving.util.AuxMoving;
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
@@ -42,8 +42,10 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
*/
public class Critical extends Check {
private final AuxMoving auxMoving = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstance(AuxMoving.class);
/**
* Instantiates a new critical check.
*/
@@ -51,6 +53,7 @@ public class Critical extends Check {
super(CheckType.FIGHT_CRITICAL);
}
/**
* Checks a player.
*
@@ -58,58 +61,108 @@ public class Critical extends Check {
* the player
* @return true, if successful
*/
public boolean check(final Player player, final Location loc,
final FightData data, final FightConfig cc,
final IPlayerData pData, final IPenaltyList penaltyList) {
boolean cancel = false;
public boolean check(final Player player, final Location loc, final FightData data, final FightConfig cc,
final IPlayerData pData, final IPenaltyList penaltyList) {
boolean cancel = false;
boolean violation = false;
final List<String> tags = new ArrayList<String>();
final double mcFallDistance = (double) player.getFallDistance();
final MovingData mData = pData.getGenericInstance(MovingData.class);
final MovingConfig mcc = pData.getGenericInstance(MovingConfig.class);
final PlayerMoveData thisMove = mData.playerMoves.getCurrentMove();
final double fallDistDiff = Math.abs(mData.noFallFallDistance - mcFallDistance);
// Check if the hit was a critical hit (very small fall-distance, not on ladder,
// not in liquid, not in vehicle, and without blindness effect).
if (mcFallDistance > 0.0 && !player.isInsideVehicle()
&& !player.hasPotionEffect(PotionEffectType.BLINDNESS)) {
if (mcFallDistance > 0.0 && !player.isInsideVehicle() && !player.hasPotionEffect(PotionEffectType.BLINDNESS)) {
if (pData.isDebugActive(type)) {
debug(player, "y=" + loc.getY() + " mcfalldist=" + mcFallDistance);
debug(player, "y=" + loc.getY() + " mcfalldist=" + mcFallDistance
+ " jumpphase: " + mData.sfJumpPhase
+ " noFallDist: " + mData.noFallFallDistance + " lowjump: " + mData.sfLowJump
+ " toGround: " + thisMove.to.onGround + " fromGround: " + thisMove.from.onGround);
}
// Might be a violation.
final MovingConfig mcc = pData.getGenericInstance(MovingConfig.class);
final MovingData dataM = pData.getGenericInstance(MovingData.class);
/*
* TODO: NoFall data max y. (past moves too perhaps - low jump,
* number split moves without reason)
*/
// Detect silent jumping (might be redundant with the mismatch check below)
if (fallDistDiff > cc.criticalFallDistLeniency
&& mcFallDistance <= cc.criticalFallDistance
&& mData.sfJumpPhase <= 1
&& !BlockProperties.isResetCond(player, loc, mcc.yOnGround)
) {
tags.add("silent_jump");
violation = true;
}
// Detect lowjumping
else if (mData.sfLowJump) {
tags.add("low_jump");
// False positives with lowJump when the player jumps on/off a block while attacking an entity
if (fallDistDiff < cc.criticalFallDistLeniency) {
if (mcFallDistance > cc.criticalFallDistance) {
if (!thisMove.to.onGround || !thisMove.from.onGround) {
violation = false;
}
}
}
else if (!thisMove.to.onGround || !thisMove.from.onGround) {
if (fallDistDiff > cc.criticalFallDistLeniency) {
violation = false;
}
}
else violation = true;
}
// As a last resort, ensure that Minecraft's fall distance is on par with our fall distance if the move is fully grounded.
else if (mData.noFallFallDistance != mcFallDistance && thisMove.from.onGround && thisMove.to.onGround) {
tags.add("falldist_mismatch");
violation = true;
}
// Handle violations
if (violation) {
// TODO: Skip near the highest jump height (needs check if head collided with something solid, which also detects low jump).
if (!dataM.isVelocityJumpPhase() &&
(dataM.sfLowJump && !dataM.sfNoLowJump && dataM.liftOffEnvelope == LiftOffEnvelope.NORMAL
|| mcFallDistance < cc.criticalFallDistance && !BlockProperties.isResetCond(player, loc, mcc.yOnGround))) {
// TODO: Use past move tracking to check for SurvivalFly and the like?
final PlayerMoveInfo moveInfo = auxMoving.usePlayerMoveInfo();
moveInfo.set(player, loc, null, mcc.yOnGround);
if (MovingUtil.shouldCheckSurvivalFly(player, moveInfo.from, dataM, mcc, pData)) {
data.criticalVL += 1.0;
// Execute whatever actions are associated with this check and
// the violation level and find out if we should cancel the event.
final ViolationData vd = new ViolationData(this, player, data.criticalVL, 1.0, cc.criticalActions);
if (vd.needsParameters()) {
final List<String> tags = new ArrayList<String>();
if (dataM.sfLowJump) {
tags.add("lowjump");
}
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
}
cancel = executeActions(vd).willCancel();
// TODO: Introduce penalty instead of cancel.
// False positives with medium counts reset all nofall data when nearby boat
// TODO: Fix isOnGroundDueToStandingOnAnEntity() to work on entity not nearby
if (MovingUtil.shouldCheckSurvivalFly(player, moveInfo.from, moveInfo.to, mData, mcc, pData) && !moveInfo.from.isOnGroundDueToStandingOnAnEntity()) {
moveInfo.from.collectBlockFlags(0.4);
// TODO: maybe these require a fix/modification with NoFall? For now, exempt the player.
// Don't think its possible to fake a crit in these situations either (except for being onGround in a web/water, which is checked for before being exempt) ... or at least from my testing?
if (thisMove.from.onClimbable || thisMove.to.onClimbable) {
// Ignore climbables
}
else if ((thisMove.from.inLiquid | thisMove.to.inLiquid) && thisMove.from.onGround && thisMove.to.onGround) {
// Ignore liquids
}
else if ((thisMove.from.inWeb | thisMove.to.inWeb) & !thisMove.to.onGround) {
// Ignore webs
}
else if ((moveInfo.from.getBlockFlags() & BlockProperties.F_BOUNCE25) != 0 && !thisMove.from.onGround && !thisMove.to.onGround) {
// Slime blocks
}
else {
data.criticalVL += 1.0;
// Execute whatever actions are associated with this check and
// the violation level and find out if we should cancel the event.
final ViolationData vd = new ViolationData(this, player, data.criticalVL, 1.0, cc.criticalActions);
if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
cancel = executeActions(vd).willCancel();
// TODO: Introduce penalty instead of cancel.
}
auxMoving.returnPlayerMoveInfo(moveInfo);
}
auxMoving.returnPlayerMoveInfo(moveInfo);
}
if (!cancel) {
data.criticalVL *= 0.96D;
}
}
return cancel;
}
}
@@ -66,6 +66,8 @@ public class Direction extends Check {
// entity.height is broken and will always be 0, therefore. Calculate height instead based on boundingBox.
final double height = damagedIsFake ? (damaged instanceof LivingEntity ? ((LivingEntity) damaged).getEyeHeight() : 1.75) : mcAccess.getHeight(damaged);
final boolean isPlayer = damaged instanceof Player ? true : false;
// TODO: allow any hit on the y axis (might just adapt interface to use foot position + height)!
@@ -74,13 +76,14 @@ public class Direction extends Check {
final Vector direction = loc.getDirection();
final double off;
if (cc.directionStrict){
off = CollisionUtil.combinedDirectionCheck(loc, player.getEyeHeight(), direction, dLoc.getX(), dLoc.getY() + height / 2D, dLoc.getZ(), width, height, TrigUtil.DIRECTION_PRECISION, 80.0);
off = CollisionUtil.directionCheck(loc, player.getEyeHeight(), direction, dLoc.getX(), dLoc.getY() + height / 2D, dLoc.getZ(), width, height, TrigUtil.DIRECTION_PRECISION);
/*if (cc.directionStrict){
off = CollisionUtil.combinedDirectionCheck(loc, player.getEyeHeight(), direction, dLoc.getX(), dLoc.getY() + height / 2D, dLoc.getZ(), width, height, TrigUtil.DIRECTION_PRECISION, 80.0, isPlayer);
}
else{
// Also take into account the angle.
off = CollisionUtil.directionCheck(loc, player.getEyeHeight(), direction, dLoc.getX(), dLoc.getY() + height / 2D, dLoc.getZ(), width, height, TrigUtil.DIRECTION_PRECISION);
}
} */
if (off > 0.1) {
// Player failed the check. Let's try to guess how far they were from looking directly to the entity...
@@ -156,6 +159,7 @@ public class Direction extends Check {
return false;
}
boolean cancel = false;
boolean isPlayer = damaged instanceof Player ? true : false;
// TODO: allow any hit on the y axis (might just adapt interface to use foot position + height)!
@@ -165,7 +169,7 @@ public class Direction extends Check {
final double damagedBoxMarginVertical = dLoc.getBoxMarginVertical();
final double off;
if (cc.directionStrict){
off = CollisionUtil.combinedDirectionCheck(loc, player.getEyeHeight(), context.direction, dLoc.getX(), dLoc.getY() + damagedBoxMarginVertical / 2D, dLoc.getZ(), damagedBoxMarginHorizontal * 2.0, damagedBoxMarginVertical, TrigUtil.DIRECTION_LOOP_PRECISION, 80.0);
off = CollisionUtil.combinedDirectionCheck(loc, player.getEyeHeight(), context.direction, dLoc.getX(), dLoc.getY() + damagedBoxMarginVertical / 2D, dLoc.getZ(), damagedBoxMarginHorizontal * 2.0, damagedBoxMarginVertical, cc.directionloopprecision, cc.directionangleprecision, isPlayer);
}
else{
// Also take into account the angle.
@@ -173,7 +177,7 @@ public class Direction extends Check {
context.direction, dLoc.getX(),
dLoc.getY() + damagedBoxMarginVertical / 2D, dLoc.getZ(),
damagedBoxMarginHorizontal * 2.0, damagedBoxMarginVertical,
TrigUtil.DIRECTION_LOOP_PRECISION);
cc.directionloopprecision);
}
if (off > 0.0) {
@@ -191,7 +195,7 @@ public class Direction extends Check {
}
context.minResult = Math.min(context.minResult, off);
}
}
} else if (cc.directionFailAll) context.minResult = 0.0;
return cancel;
}
@@ -234,4 +238,4 @@ public class Direction extends Check {
return cancel;
}
}
}
@@ -14,6 +14,7 @@
*/
package fr.neatmonster.nocheatplus.checks.fight;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.actions.ActionList;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.access.ACheckConfig;
@@ -37,17 +38,17 @@ public class FightConfig extends ACheckConfig {
public final double angleSwitch;
public final double angleTime;
public final ActionList angleActions;
public final int clickRange;
public long clickPen;
public final ActionList clickActions;
public final long toolChangeAttackPenalty;
public final double criticalFallDistance;
public final double criticalFallDistLeniency;
public final ActionList criticalActions;
public final boolean directionStrict;
public final boolean directionStrict;
public final boolean directionFailAll;
public final double directionloopprecision;
public final double directionangleprecision;
public final long directionPenalty;
public final ActionList directionActions;
@@ -85,14 +86,17 @@ public class FightConfig extends ACheckConfig {
public final float speedImprobableWeight;
public final ActionList speedActions;
public final ActionList wrongTurnActions;
public final ActionList visibleActions;
public final double hitBoxHorizontalExpansion;
public final double hitBoxVerticalExpansion;
// Special flags:
public final boolean cancelDead;
public final boolean knockBackVelocityPvP;
/** Maximum latency counted in ticks for the loop checks (reach, direction). */
public final long loopMaxLatencyTicks = 15; // TODO: Configurable, sections for players and entities.
/** Maximum latency counted in ms for the loop checks (reach, direction). */
public final int loopMaxLatencyMs; // TODO: Configurable, sections for players and entities.
/**
* Instantiates a new fight configuration.
@@ -108,24 +112,35 @@ public class FightConfig extends ACheckConfig {
angleYaw = config.getDouble(ConfPaths.FIGHT_ANGLE_THRESHOLD_YAW);
angleTime = config.getDouble(ConfPaths.FIGHT_ANGLE_THRESHOLD_TIME);
angleActions = config.getOptimizedActionList(ConfPaths.FIGHT_ANGLE_ACTIONS, Permissions.FIGHT_ANGLE);
clickRange = config.getInt(ConfPaths.FIGHT_CLICKPATTERN_RANGE);
clickPen = config.getLong(ConfPaths.FIGHT_CLICKPATTERN_PENALTY);
clickActions = config.getOptimizedActionList(ConfPaths.FIGHT_CLICKPATTERN_ACTIONS, Permissions.FIGHT_SPEED);
toolChangeAttackPenalty = config.getLong(ConfPaths.FIGHT_TOOLCHANGEPENALTY);
criticalFallDistance = config.getDouble(ConfPaths.FIGHT_CRITICAL_FALLDISTANCE);
criticalFallDistLeniency = config.getDouble(ConfPaths.FIGHT_CRITICAL_FALLDISTLENIENCY);
criticalActions = config.getOptimizedActionList(ConfPaths.FIGHT_CRITICAL_ACTIONS, Permissions.FIGHT_CRITICAL);
directionStrict = config.getBoolean(ConfPaths.FIGHT_DIRECTION_STRICT);
directionFailAll = config.getBoolean(ConfPaths.FIGHT_DIRECTION_FAILALL);
directionangleprecision = config.getDouble(ConfPaths.FIGHT_DIRECTION_STRICTANGLEPRECISION, 50.0, 100.0, 80.0);
directionloopprecision = config.getDouble(ConfPaths.FIGHT_DIRECTION_LOOPPRECISION, 0.0, 2.0, 0.5);
directionPenalty = config.getLong(ConfPaths.FIGHT_DIRECTION_PENALTY);
directionActions = config.getOptimizedActionList(ConfPaths.FIGHT_DIRECTION_ACTIONS, Permissions.FIGHT_DIRECTION);
if (ServerVersion.compareMinecraftVersion("1.9") >= 0) {
worldData.overrideCheckActivation(CheckType.FIGHT_FASTHEAL,
AlmostBoolean.NO, OverrideType.PERMANENT,
true);
/** Note: Disable check should use
* NCPAPIProvider#getNoCheatPlusAPI()#getWorldDataManager()#overrideCheckActivation()
* to actually disable from all worlds.
* Using worldData from config will only affect
* on world they are staying on join; And on other worlds still remain unchanged.
*/
NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().overrideCheckActivation(
CheckType.FIGHT_FASTHEAL, AlmostBoolean.NO,
OverrideType.PERMANENT, true);
}
if (ServerVersion.compareMinecraftVersion("1.8") >= 0) {
NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().overrideCheckActivation(
CheckType.FIGHT_SELFHIT, AlmostBoolean.NO,
OverrideType.PERMANENT, true);
}
fastHealInterval = config.getLong(ConfPaths.FIGHT_FASTHEAL_INTERVAL);
fastHealBuffer = config.getLong(ConfPaths.FIGHT_FASTHEAL_BUFFER);
@@ -137,7 +152,10 @@ public class FightConfig extends ACheckConfig {
noSwingActions = config.getOptimizedActionList(ConfPaths.FIGHT_NOSWING_ACTIONS, Permissions.FIGHT_NOSWING);
reachSurvivalDistance = config.getDouble(ConfPaths.FIGHT_REACH_SURVIVALDISTANCE, 3.5, 6.0, 4.4);
hitBoxHorizontalExpansion = config.getDouble(ConfPaths.FIGHT_HITBOX_HORIZONTAL_EXPAND, 0.125);
hitBoxVerticalExpansion = config.getDouble(ConfPaths.FIGHT_HITBOX_VERTICAL_EXPAND, 0.125);
reachSurvivalDistance = config.getDouble(ConfPaths.FIGHT_REACH_SURVIVALDISTANCE, 3.0, 6.0, 4.4);
reachPenalty = config.getLong(ConfPaths.FIGHT_REACH_PENALTY);
reachPrecision = config.getBoolean(ConfPaths.FIGHT_REACH_PRECISION);
reachReduce = config.getBoolean(ConfPaths.FIGHT_REACH_REDUCE);
@@ -159,11 +177,10 @@ public class FightConfig extends ACheckConfig {
speedImprobableWeight = (float) config.getDouble(ConfPaths.FIGHT_SPEED_IMPROBABLE_WEIGHT);
speedActions = config.getOptimizedActionList(ConfPaths.FIGHT_SPEED_ACTIONS, Permissions.FIGHT_SPEED);
wrongTurnActions = config.getOptimizedActionList(ConfPaths.FIGHT_WRONGTURN_ACTIONS,
CheckType.FIGHT_WRONGTURN.getPermission());
visibleActions = config.getOptimizedActionList(ConfPaths.FIGHT_VISIBLE_ACTIONS, Permissions.FIGHT_VISIBLE);
cancelDead = config.getBoolean(ConfPaths.FIGHT_CANCELDEAD);
loopMaxLatencyMs = config.getInt(ConfPaths.FIGHT_MAXLOOPLETENCYMS, 500);
AlmostBoolean ref = config.getAlmostBoolean(ConfPaths.FIGHT_PVP_KNOCKBACKVELOCITY, AlmostBoolean.MAYBE);
knockBackVelocityPvP = ref == AlmostBoolean.MAYBE ? Bugs.shouldPvpKnockBackVelocity() : ref.decide();
}
@@ -35,7 +35,6 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
// Violation levels.
public double angleVL;
public double clickPatternVL;
public double criticalVL;
public double directionVL;
public double fastHealVL;
@@ -43,7 +42,7 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
public double noSwingVL;
public double reachVL;
public double speedVL;
public double wrongTurnVL;
public double visibleVL;
// Shared
public String lastWorld = "";
@@ -95,8 +94,8 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
public int godModeAcc = 0;
// Data of the no swing check.
public boolean noSwingArmSwung = true; // TODO: First is free for now, 1.12.2, other?
public boolean exemptArmSwing = true;
public int noSwingCount = 0;
public boolean exemptArmSwing = false;
// Data of the reach check.
public double reachMod = 1.0;
@@ -129,6 +128,14 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
for (final CheckType checkType : checkTypes) {
switch(checkType) {
// TODO: case FIGHT: ...
case FIGHT_HITBOX:
directionVL = 0;
visibleVL = 0;
reachVL = 0;
break;
case FIGHT_VISIBLE:
visibleVL = 0;
break;
case FIGHT_DIRECTION:
directionVL = 0;
break;
@@ -140,8 +147,6 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
angleVL = 0;
angleHits.clear();
break;
case FIGHT_CLICKPATTERN:
clickPatternVL = 0;
case FIGHT_SPEED:
speedVL = 0;
speedBuckets.clear(System.currentTimeMillis());
@@ -19,7 +19,6 @@ import java.util.Iterator;
import org.bukkit.Location;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Parrot;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
@@ -52,8 +51,6 @@ import fr.neatmonster.nocheatplus.checks.moving.player.UnusedVelocity;
import fr.neatmonster.nocheatplus.checks.moving.util.AuxMoving;
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
import fr.neatmonster.nocheatplus.checks.moving.velocity.VelocityFlags;
import fr.neatmonster.nocheatplus.checks.net.NetConfig;
import fr.neatmonster.nocheatplus.checks.net.NetData;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.compat.BridgeEnchant;
import fr.neatmonster.nocheatplus.compat.BridgeHealth;
@@ -91,8 +88,6 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
/** The critical check. */
private final Critical critical = addCheck(new Critical());
private final ClickPattern clickpat = addCheck(new ClickPattern());
/** The direction check. */
private final Direction direction = addCheck(new Direction());
@@ -103,10 +98,11 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
/** The god mode check. */
private final GodMode godMode = addCheck(new GodMode());
/** THe hit box check. */
private final HitBox hitBox = addCheck(new HitBox());
/** The no swing check. */
private final NoSwing noSwing = addCheck(new NoSwing());
private final FightSync FightSync = addCheck(new FightSync());
/** The reach check. */
private final Reach reach = addCheck(new Reach());
@@ -117,8 +113,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
/** The speed check. */
private final Speed speed = addCheck(new Speed());
/** WrongTurn: clearly invalid data on Bukkit side. */
private final WrongTurn wrongTurn = addCheck(new WrongTurn());
/** The visible check. */
private final Visible visible = addCheck(new Visible());
/** For temporary use: LocUtil.clone before passing deeply, call setWorld(null) after use. */
private final Location useLoc1 = new Location(null, 0, 0, 0);
@@ -184,6 +180,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
final IPenaltyList penaltyList) {
final FightConfig cc = pData.getGenericInstance(FightConfig.class);
final MovingConfig mCc = pData.getGenericInstance(MovingConfig.class);
final MovingData mData = pData.getGenericInstance(MovingData.class);
// Hotfix attempt for enchanted books.
// TODO: maybe a generalized version for the future...
@@ -254,12 +252,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
// Get+update the damaged players.
// TODO: Problem with NPCs: data stays (not a big problem).
// (This is done even if the event has already been cancelled, to keep track, if the player is on a horse.)
damagedTrace = DataManager.getPlayerData(damagedPlayer).getGenericInstance(
MovingData.class
).updateTrace(
damagedPlayer, damagedLoc, tick,
damagedIsFake ? null : mcAccess.getHandle()
);
damagedTrace = DataManager.getPlayerData(damagedPlayer).getGenericInstance(MovingData.class)
.updateTrace(damagedPlayer, damagedLoc, now, damagedIsFake ? null : mcAccess.getHandle()); //.getTrace(damagedPlayer);
}
else {
damagedPlayer = null; // TODO: This is a temporary workaround.
@@ -320,18 +314,6 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
data.thornsId = Integer.MIN_VALUE;
}
// TODO: Add as real check.
// TODO: Add something on packet level already.
if (pData.isCheckActive(CheckType.FIGHT_WRONGTURN, player)
&& wrongTurn.check(player, loc, data, cc)) {
cancelled = true;
}
// ClickPatern check
if (clickpat.check(player, data, pData, cc) && clickpat.isEnabled(player, pData)) {
cancelled = true;
}
// Run through the main checks.
if (!cancelled && speed.isEnabled(player, pData)) {
if (speed.check(player, now, data, cc, pData)) {
@@ -348,20 +330,20 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
else {
if (cc.speedImprobableWeight > 0.0f) {
Improbable.feed(player, cc.speedImprobableWeight, now);
}
}
// Improbable.feed(player, 2f, now);
}
// Improbable.feed(player, 2f, now);
}
}
else if (normalizedMove > 2.0) { // && Improbable.check(player, 1f, now, "fight.speed", pData)) {
if (cc.speedImprobableWeight > 0.0f) {
if (!cc.speedImprobableFeedOnly && Improbable.check(player, cc.speedImprobableWeight, now, "fight.speed", pData)) {
cancelled = true;
}
}
else if (normalizedMove > 2.0) { // && Improbable.check(player, 1f, now, "fight.speed", pData)) {
if (cc.speedImprobableWeight > 0.0f) {
if (!cc.speedImprobableFeedOnly && Improbable.check(player, cc.speedImprobableWeight, now, "fight.speed", pData)) {
cancelled = true;
}
}
// Feed improbable in case of ok-moves too.
// TODO: consider only feeding if attacking with higher average speed (!)
}
}
// TODO: Consider to always check improbable (first?). At least if config.always or speed or net.attackfrequency are enabled.
if (!cancelled && critical.isEnabled(player, pData)
@@ -370,35 +352,47 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
cancelled = true;
}
if (!cancelled && noSwing.isEnabled(player, pData) && noSwing.check(player, data, cc)) {
if (!cancelled && mData.timeRiptiding + 3000 < now && noSwing.isEnabled(player, pData) && noSwing.check(player, data, cc)) {
cancelled = true;
}
if (!cancelled && player.isBlocking()
&& !pData.hasPermission(Permissions.MOVING_SURVIVALFLY_BLOCKING, player)) {
// TODO: Permission ?
cancelled = true;
if (mCc.survivalFlyResetItem && mcAccess.getHandle().resetActiveItem(player)) {
}
else cancelled = true;
}
if (!cancelled) {
final boolean reachEnabled = reach.isEnabled(player, pData);
final boolean directionEnabled = direction.isEnabled(player, pData);
if (reachEnabled || directionEnabled) {
final boolean directionEnabled = direction.isEnabled(player, pData) && mData.timeRiptiding + 3000 < now;
final boolean visibleEnabled = visible.isEnabled(player, pData);
final boolean hitboxEnabled = hitBox.isEnabled(player, pData);
if (reachEnabled || directionEnabled || visibleEnabled) {
if (damagedTrace != null) {
// Checks that use the LocationTrace instance of the attacked entity/player.
cancelled = locationTraceChecks(player, loc, data, cc, pData,
damaged, damagedIsFake, damagedLoc, damagedTrace, tick, now, debug,
reachEnabled, directionEnabled);
reachEnabled, directionEnabled, visibleEnabled, hitboxEnabled);
}
else {
// Still use the classic methods for non-players. maybe[]
if (reachEnabled && reach.check(player, loc, damaged, damagedIsFake, damagedLoc,
data, cc, pData)) {
cancelled = true;
}
if (directionEnabled && hitboxEnabled) {
if (hitBox.check(player, loc, damaged, damagedIsFake, damagedLoc, data, cc, pData,
reachEnabled, visibleEnabled)) {
cancelled = true;
}
} else {
if (reachEnabled && reach.check(player, loc, damaged, damagedIsFake, damagedLoc,
data, cc, pData)) {
cancelled = true;
}
if (directionEnabled && direction.check(player, loc, damaged, damagedIsFake, damagedLoc, data, cc)) {
cancelled = true;
if (directionEnabled && direction.check(player, loc, damaged, damagedIsFake, damagedLoc, data, cc)) {
cancelled = true;
}
}
}
}
@@ -440,18 +434,16 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
// TODO: Confine further with simple pre-conditions.
// TODO: Evaluate if moving traces can help here.
if (!cancelled && TrigUtil.distance(loc.getX(), loc.getZ(), damagedLoc.getX(), damagedLoc.getZ()) < 4.5) {
final MovingData mData = pData.getGenericInstance(MovingData.class);
// Check if fly checks is an issue at all, re-check "real sprinting".
final PlayerMoveData lastMove = mData.playerMoves.getFirstPastMove();
if (lastMove.valid && mData.liftOffEnvelope == LiftOffEnvelope.NORMAL) {
final double hDist = TrigUtil.xzDistance(loc, lastMove.from);
if (hDist >= 0.23) {
// TODO: Might need to check hDist relative to speed / modifiers.
final MovingConfig mCc = pData.getGenericInstance(MovingConfig.class);
final PlayerMoveInfo moveInfo = auxMoving.usePlayerMoveInfo();
moveInfo.set(player, loc, null, mCc.yOnGround);
if (now <= mData.timeSprinting + mCc.sprintingGrace
&& MovingUtil.shouldCheckSurvivalFly(player, moveInfo.from, mData, mCc, pData)) {
&& MovingUtil.shouldCheckSurvivalFly(player, moveInfo.from, moveInfo.to, mData, mCc, pData)) {
// Judge as "lost sprint" problem.
// TODO: What would mData.lostSprintCount > 0 mean here?
mData.lostSprintCount = 7;
@@ -494,6 +486,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
* @param tick
* @param reachEnabled
* @param directionEnabled
* @param hitboxEnabled
* @param visibleEnabled
* @return If to cancel (true) or not (false).
*/
private boolean locationTraceChecks(final Player player, final Location loc,
@@ -501,7 +495,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
final Entity damaged, final boolean damagedIsFake,
final Location damagedLoc, LocationTrace damagedTrace,
final long tick, final long now, final boolean debug,
final boolean reachEnabled, final boolean directionEnabled) {
final boolean reachEnabled, final boolean directionEnabled,
final boolean visibleEnabled, final boolean hitboxEnabled) {
// TODO: Order / splitting off generic stuff.
/*
* TODO: Abstract: interface with common setup/loop/post routine, only
@@ -514,8 +509,9 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
// (Might pass generic context to factories, for shared + heavy properties.)
final ReachContext reachContext = reachEnabled ? reach.getContext(player, loc, damaged, damagedLoc, data, cc) : null;
final DirectionContext directionContext = directionEnabled ? direction.getContext(player, loc, damaged, damagedIsFake, damagedLoc, data, cc) : null;
final VisibleContext visibleContext = visibleEnabled ? visible.getContext(player, loc, damaged, damagedLoc, data, cc) : null;
final long traceOldest = tick - cc.loopMaxLatencyTicks; // TODO: Set by latency-window.
final long traceOldest = now - cc.loopMaxLatencyMs; // TODO: Set by latency-window.
// TODO: Iterating direction, which, static/dynamic choice.
final Iterator<ITraceEntry> traceIt = damagedTrace.maxAgeIterator(traceOldest);
@@ -531,23 +527,32 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
// Simplistic just check both until end or hit.
// TODO: Other default distances/tolerances.
boolean thisPassed = true;
if (reachEnabled) {
if (reach.loopCheck(player, loc, damaged, entry, reachContext, data, cc)) {
if (directionEnabled && hitboxEnabled) {
if (hitBox.loopCheck(player, loc, entry,
directionContext, reachContext, visibleContext, data, cc,
directionEnabled, reachEnabled, visibleEnabled)) {
thisPassed = false;
}
else {
reachPassed = true;
}
}
// TODO: Efficiency: don't check at all, if strict and !thisPassed.
if (directionEnabled && (reachPassed || !directionPassed)) {
if (direction.loopCheck(player, loc, damaged, entry, directionContext, data, cc)) {
thisPassed = false;
}
else {
directionPassed = true;
} else {
if (reachEnabled) {
if (reach.loopCheck(player, loc, damaged, entry, reachContext, data, cc)) {
thisPassed = false;
}
else {
reachPassed = true;
}
}
// TODO: Efficiency: don't check at all, if strict and !thisPassed.
if (directionEnabled && (reachPassed || !directionPassed)) {
if (direction.loopCheck(player, loc, damaged, entry, directionContext, data, cc)) {
thisPassed = false;
}
else {
directionPassed = true;
}
}
}
if (thisPassed) {
// TODO: Log/set estimated latency.
violation = false;
@@ -556,20 +561,29 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
break;
}
}
// TODO: How to treat mixed state: violation && reachPassed && directionPassed [current: use min violation // thinkable: silent cancel, if actions have cancel (!)]
// TODO: Adapt according to strictness settings?
// TODO: violation vs. reachPassed + directionPassed (current: fail one = fail all).
if (reachEnabled) {
// TODO: Might ignore if already cancelled by mixed/silent cancel.
if (reach.loopFinish(player, loc, damaged, reachContext, successEntry, violation,
data, cc, pData)) {
if (directionEnabled && hitboxEnabled) {
if (hitBox.loopFinish(player, loc, damaged,
reachContext, directionContext, visibleContext,
successEntry, violation, data, cc,
reachEnabled, visibleEnabled, pData)) {
cancelled = true;
}
}
if (directionEnabled) {
// TODO: Might ignore if already cancelled.
if (direction.loopFinish(player, loc, damaged, directionContext, violation, data, cc)) {
cancelled = true;
} else {
// TODO: How to treat mixed state: violation && reachPassed && directionPassed [current: use min violation // thinkable: silent cancel, if actions have cancel (!)]
// TODO: Adapt according to strictness settings?
// TODO: violation vs. reachPassed + directionPassed (current: fail one = fail all).
if (reachEnabled) {
// TODO: Might ignore if already cancelled by mixed/silent cancel.
if (reach.loopFinish(player, loc, damaged, reachContext, successEntry, violation,
data, cc, pData)) {
cancelled = true;
}
}
if (directionEnabled) {
// TODO: Might ignore if already cancelled.
if (direction.loopFinish(player, loc, damaged, directionContext, violation, data, cc)) {
cancelled = true;
}
}
}
// TODO: Log exact state, probably record min/max latency (individually).
@@ -594,6 +608,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
final boolean damagedIsDead = damaged.isDead();
final boolean damagedIsFake = !crossPlugin.getHandle().isNativeEntity(damaged);
IPenaltyList penaltyList = null;
if (damagedPlayer != null) {
final IPlayerData damagedPData = DataManager.getPlayerData(damagedPlayer);
damagedData = damagedPData.getGenericInstance(FightData.class);
@@ -638,7 +653,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
if (penaltyList == null) {
penaltyList = new DefaultPenaltyList();
}
onEntityDamageByEntity(damaged, damagedPlayer, damagedIsDead, damagedIsFake,
onEntityDamageByEntity(damaged, damagedPlayer, damagedIsDead, damagedIsFake,
damagedData, (EntityDamageByEntityEvent) event,
penaltyList);
}
@@ -662,6 +677,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
final boolean damagedIsDead, final boolean damagedIsFake,
final FightData damagedData, final EntityDamageByEntityEvent event,
final IPenaltyList penaltyList) {
final Entity damager = event.getDamager();
final int tick = TickTask.getTick();
if (damagedPlayer != null && !damagedIsDead) {
@@ -688,6 +704,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
attacker = (Player) source;
}
}
final FightData attackerData;
final IPlayerData attackerPData = attacker == null ? null : DataManager.getPlayerData(attacker);
if (attacker != null) {
@@ -741,12 +758,14 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onEntityDamageMonitor(final EntityDamageEvent event) {
final Entity damaged = event.getEntity();
if (damaged instanceof Player) {
final Player damagedPlayer = (Player) damaged;
final IPlayerData damagedPData = DataManager.getPlayerData(damagedPlayer);
final FightData damagedData = damagedPData.getGenericInstance(FightData.class);
final int ndt = damagedPlayer.getNoDamageTicks();
if (damagedData.lastDamageTick == TickTask.getTick() && damagedData.lastNoDamageTicks != ndt) {
// Plugin compatibility thing.
damagedData.lastNoDamageTicks = ndt;
@@ -777,14 +796,16 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
*/
private void applyKnockBack(final Player attacker, final Player damagedPlayer,
final FightData damagedData, final IPlayerData pData) {
final double level = getKnockBackLevel(attacker);
final MovingData mdata = pData.getGenericInstance(MovingData.class);
final MovingConfig mcc = pData.getGenericInstance(MovingConfig.class);
// TODO: How is the direction really calculated?
// Aim at sqrt(vx * vx + vz * vz, 2), not the exact direction.
final double vx = level / Math.sqrt(8.0);
final double vz = vx;
final double vy = 0.462; // TODO: (0.365) Needs other workarounds, to allow more when moving off ground (vel + GRAVITY_MAX or max jump gain + little?).
final double[] vel2Dvec = calculateVelocity(attacker, damagedPlayer);
final double vx = vel2Dvec[0];
final double vz = vel2Dvec[2];
final double vy = vel2Dvec[1];
useLoc1.setWorld(null); // Cleanup.
if (pData.isDebugActive(checkType) || pData.isDebugActive(CheckType.MOVING)) {
debug(damagedPlayer, "Received knockback level: " + level);
@@ -802,6 +823,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
* @return
*/
private double getKnockBackLevel(final Player player) {
double level = 1.0; // 1.0 is the minimum knock-back value.
// TODO: Get the RELEVANT item (...).
final ItemStack stack = Bridge1_9.getItemInMainHand(player);
@@ -816,6 +838,57 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
return Math.min(20.0, level);
}
/**
* Better method to calculate velocity including direction!
*
* @param attacker
* @param damagedPlayer
* @return velocityX, velocityY, velocityZ
*/
private double[] calculateVelocity(final Player attacker, final Player damagedPlayer) {
final Location aloc = attacker.getLocation();
final Location dloc = damagedPlayer.getLocation();
final double Xdiff = dloc.getX() - aloc.getX();
final double Zdiff = dloc.getZ() - aloc.getZ();
final double diffdist = Math.sqrt(Xdiff * Xdiff + Zdiff * Zdiff);
double vx = 0.0;
double vz = 0.0;
int incknockbacklevel = 0;
// TODO: Get the RELEVANT item (...).
final ItemStack stack = Bridge1_9.getItemInMainHand(attacker);
if (!BlockProperties.isAir(stack)) {
incknockbacklevel = stack.getEnchantmentLevel(Enchantment.KNOCKBACK);
}
if (attacker.isSprinting()) {
// TODO: Lost sprint?
incknockbacklevel++;
}
// Cap the level to something reasonable. TODO: Config / cap the velocity anyway.
incknockbacklevel = Math.min(20, incknockbacklevel);
if (Math.sqrt(Xdiff * Xdiff + Zdiff * Zdiff) < 1.0E-4D) {
if (incknockbacklevel <= 0) incknockbacklevel = -~0;
vx = vz = incknockbacklevel / Math.sqrt(8.0);
final double vy = incknockbacklevel > 0 ? 0.465 : 0.365;
return new double[] {vx, vy, vz};
} else {
vx = Xdiff / diffdist * 0.4;
vz = Zdiff / diffdist * 0.4;
}
if (incknockbacklevel > 0) {
vx *= 1.0 + 1.25 * incknockbacklevel;
vz *= 1.0 + 1.25 * incknockbacklevel;
// Still not exact direction since yaw difference between packet and Location#getYaw();
// with incknockbacklevel = 0, it still the precise direction
//vx -= Math.sin(aloc.getYaw() * Math.PI / 180.0F) * incknockbacklevel * 0.5F;
//vz += Math.cos(aloc.getYaw() * Math.PI / 180.0F) * incknockbacklevel * 0.5F;
}
final double vy = incknockbacklevel > 0 ? 0.465 : 0.365;
return new double[] {vx, vy, vz};
}
/**
* We listen to death events to prevent a very specific method of doing godmode.
*
@@ -843,17 +916,14 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerAnimation(final PlayerAnimationEvent event) {
// Set a flag telling us that the arm has been swung.
/*
* TODO: First one always fails: Packet inversion on 1.12.2? This could
* be moved to packet level (register either).
*/
DataManager.getGenericInstance(event.getPlayer(),
FightData.class).noSwingArmSwung = true;
final FightData data = DataManager.getGenericInstance(event.getPlayer(), FightData.class);
data.noSwingCount = Math.max(data.noSwingCount - 1, 0);
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onEntityRegainHealthLow(final EntityRegainHealthEvent event) {
final Entity entity = event.getEntity();
if (!(entity instanceof Player)) {
return;
@@ -880,6 +950,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityRegainHealth(final EntityRegainHealthEvent event) {
final Entity entity = event.getEntity();
if (!(entity instanceof Player)) {
return;
@@ -900,12 +971,8 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
Entity entity = e.getRightClicked();
final Player player = e.getPlayer();
final FightData data = DataManager.getGenericInstance(player, FightData.class);
if (entity instanceof Parrot) {
data.exemptArmSwing = true;
} else {
data.exemptArmSwing = false;
}
data.exemptArmSwing = entity != null && entity.getType().name().equals("PARROT") ? true : false;
}
@Override
@@ -920,6 +987,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
@EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)
public void onItemHeld(final PlayerItemHeldEvent event) {
final Player player = event.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(player);
final long penalty = pData.getGenericInstance(FightConfig.class).toolChangeAttackPenalty;
@@ -927,29 +995,5 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
pData.getGenericInstance(FightData.class).attackPenalty.applyPenalty(penalty);
}
}
@EventHandler
public void entityDamage(EntityDamageByEntityEvent event) {
if (!(event.getDamager() instanceof Player)) return;
Player player = (Player) event.getDamager();
final IPlayerData pData = DataManager.getPlayerData(player);
final NetData data = pData.getGenericInstance(NetData.class);
final NetConfig cc = pData.getGenericInstance(NetConfig.class);
if (!pData.isCheckActive(CheckType.NET_FIGHTSYNC, player)) return;
if (data.fightSyncCount >= cc.fightSyncResetCount) {
data.fightSyncCount = 0;
data.fightSyncReset = 0;
data.fightSyncVL *= 0.99D;
}
data.fightSyncReset += 1;
Location packet = data.lastHitLocation, eventLoc = player.getLocation();
if (FightSync.check(player, pData, data, packet, eventLoc, cc)) {
event.setCancelled(true);
}
}
}
Loaded 100 of 230 files, more files were not shown because too many files have changed in this diff. Show more