159 Commits
Author SHA1 Message Date
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 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
102 changed files with 7824 additions and 5673 deletions

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.3-R0.1-SNAPSHOT</version>
<version>1.15-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -70,7 +70,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 +97,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.6.1-1.14.4|?"; // uh oh
}
@Override
@@ -60,8 +60,7 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
private static final BukkitShapeModel MODEL_THICK_FENCE2 = new BukkitWall(
0.25, 1.5);
// .75 .25 0 max: .25 .75 .5
private static final BukkitShapeModel MODEL_WALL_HEAD = new BukkitStatic(
0.75, 0.25, 0.0, 0.25, 0.75, 0.5);
private static final BukkitShapeModel MODEL_WALL_HEAD = new BukkitWallHead();
// Static blocks (various height and inset values).
@@ -79,7 +78,9 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
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(
@@ -123,7 +124,7 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
@Override
public String getMCVersion() {
return "1.13.2-1.14|?";
return "1.13.2-1.15|?";
}
@Override
@@ -142,21 +143,20 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
// TODO: Also consider removing flags (passable_x4 etc).
// Variables for repeated flags (Temporary flags, these should be fixed later so that they are not added here)
final long headFlags = BlockFlags.SOLID_GROUND | BlockProperties.F_XZ100 | BlockProperties.F_IGN_PASSABLE;
final long blockFix = BlockFlags.SOLID_GROUND | BlockProperties.F_XZ100 | BlockProperties.F_IGN_PASSABLE;
final long blockFix = BlockFlags.SOLID_GROUND;
// Adjust flags for individual blocks.
BlockProperties.setBlockFlags(Material.CAULDRON,
BlockFlags.SOLID_GROUND | BlockProperties.F_GROUND_HEIGHT
| BlockProperties.F_MIN_HEIGHT4_1);
BlockProperties.setBlockFlags(Material.COCOA, blockFix);
BlockProperties.setBlockFlags(Material.TURTLE_EGG, BlockProperties.F_IGN_PASSABLE | BlockFlags.SOLID_GROUND | BlockProperties.F_GROUND | BlockProperties.F_XZ100);
BlockProperties.setBlockFlags(Material.TURTLE_EGG, blockFix);
BlockProperties.setBlockFlags(Material.CHORUS_PLANT, blockFix);
BlockProperties.setBlockFlags(Material.CREEPER_WALL_HEAD, headFlags);
BlockProperties.setBlockFlags(Material.ZOMBIE_WALL_HEAD, headFlags);
BlockProperties.setBlockFlags(Material.PLAYER_WALL_HEAD, headFlags);
BlockProperties.setBlockFlags(Material.DRAGON_WALL_HEAD, headFlags);
BlockProperties.setBlockFlags(Material.WITHER_SKELETON_WALL_SKULL, headFlags);
BlockProperties.setBlockFlags(Material.SKELETON_WALL_SKULL, headFlags);
BlockProperties.setBlockFlags(Material.CREEPER_WALL_HEAD, blockFix);
BlockProperties.setBlockFlags(Material.ZOMBIE_WALL_HEAD, blockFix);
BlockProperties.setBlockFlags(Material.PLAYER_WALL_HEAD, blockFix);
BlockProperties.setBlockFlags(Material.DRAGON_WALL_HEAD, blockFix);
BlockProperties.setBlockFlags(Material.WITHER_SKELETON_WALL_SKULL, blockFix);
BlockProperties.setBlockFlags(Material.SKELETON_WALL_SKULL, blockFix);
// Directly keep blocks as is.
for (final Material mat : new Material[] {
@@ -345,6 +345,9 @@ public class MCAccessBukkitModern extends MCAccessBukkit {
mt = BridgeMaterial.getBlock("bell");
if (mt != null) addModel(mt, MODEL_BELL);
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);
@@ -21,22 +21,26 @@ 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;
//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);
//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());
//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[] {minX+0.09, 0.0, 1.0-minZ+0.09, minX+xz-0.09, 1.0, 1.0-minZ+xz-0.09};
//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
@@ -14,12 +14,9 @@
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import java.util.Set;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.MultipleFacing;
@@ -32,16 +29,37 @@ public class BukkitChorusPlant implements BukkitShapeModel {
final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockData blockData = block.getBlockData();
double[] res = new double[] {0.187, 0.188, 0.187, 1.0 - 0.187, 0.8125, 1.0 - 0.187};
if (blockData instanceof MultipleFacing) {
final MultipleFacing chorusplant = (MultipleFacing) blockData;
for (final BlockFace face : chorusplant.getFaces()) {
switch (face) {
//case DOWN:
// res[1]=0.0;
// break;
case UP:
res[4]=1.0;
break;
case SOUTH:
res[5]=1.0;
break;
case NORTH:
res[2]=0.0;
break;
case WEST:
res[0]=0.0;
break;
case EAST:
res[3]=1.0;
break;
default:
break;
}
}
}
double minX = Math.abs(block.getBoundingBox().getMinX()) - Math.abs((int) block.getBoundingBox().getMinX());
double minY = Math.abs(block.getBoundingBox().getMinY()) - Math.abs((int) block.getBoundingBox().getMinY());
double minZ = Math.abs(block.getBoundingBox().getMinZ()) - Math.abs((int) block.getBoundingBox().getMinZ());
double maxX = Math.abs(block.getBoundingBox().getMaxX()) - Math.abs((int) block.getBoundingBox().getMaxX());
double maxY = Math.abs(block.getBoundingBox().getMaxY()) - Math.abs((int) block.getBoundingBox().getMaxY());
double maxZ = Math.abs(block.getBoundingBox().getMaxZ()) - Math.abs((int) block.getBoundingBox().getMaxZ());
return new double[] {minX, minY, minZ, maxX, maxY, maxZ};
return res;
}
@Override
@@ -16,8 +16,10 @@ package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import org.bukkit.block.data.type.Cocoa;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
@@ -31,17 +33,51 @@ public class BukkitCocoa implements BukkitShapeModel {
final BlockState state = block.getState();
final BlockData blockData = state.getBlockData();
if (blockData instanceof Cocoa) {
if (blockData instanceof Cocoa && blockData instanceof Directional) {
BlockFace face = ((Directional) blockData).getFacing();
final Cocoa cocoa = (Cocoa) blockData;
switch (cocoa.getAge()) {
case 0: // .625 .4375 .0625 max: .375 .75 .3125
return new double[] {0.625, 0.4375, 0.0625, 0.375, 0.75, 0.3125};
case 1: // .6875 .3125 .0625 max: .3125 .75 .4375
return new double[] {0.6875, 0.3125, 0.0625, 0.3125, 0.75, 0.4375};
case 2: // .75 .1875 .0625 max: .25 .75 .5625
return new double[] {0.75, 0.1875, 0.0625, 0.25, 0.75, 0.5625};
default:
switch (face) {
case NORTH:
return new double[] {0.375, 0.4375, 0.0, 0.625, 0.75, 0.315};
case SOUTH:
return new double[] {0.375, 0.4375, 0.685, 0.625, 0.75, 1.0};
case WEST:
return new double[] {0.0, 0.4375, 0.375, 0.315, 0.75, 0.625};
case EAST:
return new double[] {0.685, 0.4375, 0.375, 1.0, 0.75, 0.625};
default:
break;
}
break;
case 1: // .6875 .3125 .0625 max: .3125 .75 .4375
switch (face) {
case NORTH:
return new double[] {0.3125, 0.3125, 0.0, 0.6875, 0.75, 0.4375};
case SOUTH:
return new double[] {0.3125, 0.3125, 0.5625, 0.6875, 0.75, 1.0};
case WEST:
return new double[] {0.0, 0.3125, 0.3125, 0.4375, 0.75, 0.6875};
case EAST:
return new double[] {0.5625, 0.3125, 0.3125, 1.0, 0.75, 0.6875};
default:
break;
}
break;
case 2: // .75 .1875 .0625 max: .25 .75 .5625
switch (face) {
case NORTH:
return new double[] {0.25, 0.1875, 0.0, 0.75, 0.75, 0.5625};
case SOUTH:
return new double[] {0.25, 0.1875, 0.4375, 0.75, 0.75, 1.0};
case WEST:
return new double[] {0.0, 0.1875, 0.25, 0.5625, 0.75, 0.75};
case EAST:
return new double[] {0.4375, 0.1875, 0.25, 1.0, 0.75, 0.75};
default:
break;
}
}
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
@@ -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;
}
}
@@ -35,11 +35,11 @@ public class BukkitTurtleEgg implements BukkitShapeModel {
final TurtleEgg egg = (TurtleEgg) blockData;
switch (egg.getEggs()) {
case 1: // .8125 0.0 .1875 max: .25 .4375 .75
return new double[] {0.8125, 0.0, 0.1875, 0.25, 0.4375, 0.75};
return new double[] {0.23, 0.0, 0.23, 0.75, 0.4375, 0.75};
case 2: // .9375 .0 .0625 max: 0.0625 .4375 .9375
case 3:
case 4:
return new double[] {0.9375, 0.0, 0.0625, 0.0625, 0.4375, 0.9375};
return new double[] {0.0625, 0.0, 0.0625, 0.9375, 0.4375, 0.9375};
default:
break;
}
@@ -0,0 +1,57 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.compat.bukkit.model;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Directional;
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
public class BukkitWallHead implements BukkitShapeModel {
@Override
public double[] getShape(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
final Block block = world.getBlockAt(x, y, z);
final BlockData blockData = block.getBlockData();
if (blockData instanceof Directional) {
BlockFace face = ((Directional) blockData).getFacing();
switch (face) {
case NORTH:
return new double[] {0.25, 0.25, 0.5, 0.75, 0.75, 1.0};
case SOUTH:
return new double[] {0.25, 0.25, 0.0, 0.75, 0.75, 0.5};
case WEST:
return new double[] {0.5, 0.25, 0.25, 1.0, 0.75, 0.75};
case EAST:
return new double[] {0.0, 0.25, 0.25, 0.5, 0.75, 0.75};
default:
break;
}
}
return new double[] {0.0, 0.0, 0.0, 1.0, 1.0, 1.0};
}
@Override
public int getFakeData(final BlockCache blockCache,
final World world, final int x, final int y, final int z) {
return 0;
}
}
@@ -53,7 +53,7 @@ public class MCAccessCBReflect extends MCAccessBukkitModern {
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.INIT, "The Minecraft version seems to be older than what Compat-CB-Reflect can support.");
this.knownSupportedVersion = false;
}
else if (GenericVersion.compareVersions(mcVersion, "1.12.2") > 0) {
else if (GenericVersion.compareVersions(mcVersion, "1.14.4") > 0) {
this.knownSupportedVersion = false;
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().warning(Streams.INIT, "The Minecraft version seems to be more recent than the one Compat-CB-Reflect has been built with - this might work, but there could be incompatibilities.");
} else {
@@ -71,7 +71,7 @@ public class MCAccessCBReflect extends MCAccessBukkitModern {
@Override
public String getMCVersion() {
// Potentially all :p.
return "1.4.5-1.13|?";
return "1.7-1.14.4|?";
}
@Override
@@ -23,7 +23,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.10-R0.1-SNAPSHOT</version>
<version>1.10.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -32,9 +32,9 @@
To add a new compat module the pom.xml file within NCPCompatNonFree has to be modified:
- Add as module within the profile with id 'all'.
- Add as dependency within the profile with id 'all'.
- (Add a new profile with both the module and dependency set.)
- Add as dependency within the profile with id 'all'.
- (Add a new profile with both the module and dependency set.)
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
<build>
@@ -49,4 +49,4 @@ The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, Enti
</plugins>
</build>
</project>
</project>
@@ -23,7 +23,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.11.2-R0.1-SNAPSHOT</version>
<version>1.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -32,9 +32,9 @@
To add a new compat module the pom.xml file within NCPCompatNonFree has to be modified:
- Add as module within the profile with id 'all'.
- Add as dependency within the profile with id 'all'.
- (Add a new profile with both the module and dependency set.)
- Add as dependency within the profile with id 'all'.
- (Add a new profile with both the module and dependency set.)
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
<build>
@@ -49,4 +49,4 @@ The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, Enti
</plugins>
</build>
</project>
</project>
@@ -23,7 +23,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.8.4-R0.1-SNAPSHOT</version>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -39,4 +39,4 @@
</plugins>
</build>
<description>Compatibility for Minecraft 1.8.4-1.8.6 with CraftBukkit/Spigot (1_8_R3).</description>
</project>
</project>
+379 -379
View File
@@ -1,381 +1,381 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<name>NCPCompatNonFree</name>
<description>Combine compatibility modules with dependencies that can't be obtained from a public maven repository, such as CraftBukkit or Spigot builds, hence &quot;NonFree&quot;.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatnonfree</artifactId>
<version>1.1-SNAPSHOT</version>
<name>NCPCompatNonFree</name>
<description>Combine compatibility modules with dependencies that can't be obtained from a public maven repository, such as CraftBukkit or Spigot builds, hence &quot;NonFree&quot;.
To add a new compat module:
- Add as module within the profile with id 'all'.
- Add as dependency within the profile with id 'all'.
- (Add a new profile with both the module and dependency set.)
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
<!-- Profile based activation of modules and dependencies. -->
<profiles>
<profile>
<id>all</id>
<modules>
<module>NCPCompatCB2512</module>
<module>NCPCompatCB2545</module>
<module>NCPCompatCB2602</module>
<module>NCPCompatCB2645</module>
<module>NCPCompatCB2691</module>
<module>NCPCompatCB2763</module>
<module>NCPCompatCB2794</module>
<module>NCPCompatCB2808</module>
<module>NCPCompatCB2882</module>
<module>NCPCompatCB2922</module>
<module>NCPCompatCB3026</module>
<module>NCPCompatCB3043</module>
<module>NCPCompatCB3100</module>
<module>NCPCompatSpigotCB1_8_R1</module>
<module>NCPCompatSpigotCB1_8_R2</module>
<module>NCPCompatSpigotCB1_8_R3</module>
<module>NCPCompatSpigotCB1_9_R1</module>
<module>NCPCompatSpigotCB1_9_R2</module>
<module>NCPCompatSpigotCB1_10_R1</module>
<module>NCPCompatSpigotCB1_11_R1</module>
<!-- ... -->
<module>NCPCompatCBDev</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<!-- ... -->
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3043</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3026</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2922</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2882</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2808</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2794</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2763</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2691</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2645</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2602</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2545</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2512</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>cbdev</id>
<modules>
<module>NCPCompatCBDev</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<!-- ... -->
<profile>
<id>spigot1_12_r1</id>
<modules>
<module>NCPCompatCBDev</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_11_r1</id>
<modules>
<module>NCPCompatSpigotCB1_11_R1</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_10_r1</id>
<modules>
<module>NCPCompatSpigotCB1_10_R1</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_9_r2</id>
<modules>
<module>NCPCompatSpigotCB1_9_R2</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_9_r1</id>
<modules>
<module>NCPCompatSpigotCB1_9_R1</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_8_r3</id>
<modules>
<module>NCPCompatSpigotCB1_8_R3</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_7_r4</id>
<modules>
<module>NCPCompatCB3100</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>cblegacy</id>
<modules>
<module>NCPCompatCB2512</module>
<module>NCPCompatCB2545</module>
<module>NCPCompatCB2602</module>
<module>NCPCompatCB2645</module>
<module>NCPCompatCB2691</module>
<module>NCPCompatCB2763</module>
<module>NCPCompatCB2794</module>
<module>NCPCompatCB2808</module>
<module>NCPCompatCB2882</module>
<module>NCPCompatCB2922</module>
<module>NCPCompatCB3026</module>
<module>NCPCompatCB3043</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3043</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3026</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2922</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2882</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2808</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2794</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2763</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2691</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2645</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2602</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2545</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2512</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
- Add as dependency within the profile with id 'all'.
- (Add a new profile with both the module and dependency set.)
The NCPPlugin sub-project contains the relevant factories (MCAccessFactory, EntityAccessFactory, AttributeAccessFactory).</description>
<parent>
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
<!-- Profile based activation of modules and dependencies. -->
<profiles>
<profile>
<id>all</id>
<modules>
<!-- <module>NCPCompatCB2512</module>
<module>NCPCompatCB2545</module>
<module>NCPCompatCB2602</module>
<module>NCPCompatCB2645</module>
<module>NCPCompatCB2691</module>
<module>NCPCompatCB2763</module>
<module>NCPCompatCB2794</module>
<module>NCPCompatCB2808</module>
<module>NCPCompatCB2882</module> -->
<module>NCPCompatCB2922</module>
<module>NCPCompatCB3026</module>
<module>NCPCompatCB3043</module>
<module>NCPCompatCB3100</module>
<module>NCPCompatSpigotCB1_8_R1</module>
<module>NCPCompatSpigotCB1_8_R2</module>
<module>NCPCompatSpigotCB1_8_R3</module>
<module>NCPCompatSpigotCB1_9_R1</module>
<module>NCPCompatSpigotCB1_9_R2</module>
<module>NCPCompatSpigotCB1_10_R1</module>
<module>NCPCompatSpigotCB1_11_R1</module>
<!-- ... -->
<module>NCPCompatCBDev</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<!-- ... -->
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3043</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3026</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2922</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<!-- <dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2882</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2808</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2794</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2763</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2691</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2645</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2602</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2545</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2512</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency> -->
</dependencies>
</profile>
<profile>
<id>cbdev</id>
<modules>
<module>NCPCompatCBDev</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<!-- ... -->
<profile>
<id>spigot1_12_r1</id>
<modules>
<module>NCPCompatCBDev</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcbdev</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_11_r1</id>
<modules>
<module>NCPCompatSpigotCB1_11_R1</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_11_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_10_r1</id>
<modules>
<module>NCPCompatSpigotCB1_10_R1</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_10_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_9_r2</id>
<modules>
<module>NCPCompatSpigotCB1_9_R2</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r2</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_9_r1</id>
<modules>
<module>NCPCompatSpigotCB1_9_R1</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_9_r1</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_8_r3</id>
<modules>
<module>NCPCompatSpigotCB1_8_R3</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatspigotcb1_8_r3</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>spigot1_7_r4</id>
<modules>
<module>NCPCompatCB3100</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>cblegacy</id>
<modules>
<module>NCPCompatCB2512</module>
<module>NCPCompatCB2545</module>
<module>NCPCompatCB2602</module>
<module>NCPCompatCB2645</module>
<module>NCPCompatCB2691</module>
<module>NCPCompatCB2763</module>
<module>NCPCompatCB2794</module>
<module>NCPCompatCB2808</module>
<module>NCPCompatCB2882</module>
<module>NCPCompatCB2922</module>
<module>NCPCompatCB3026</module>
<module>NCPCompatCB3043</module>
</modules>
<dependencies>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3043</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3026</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2922</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2882</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2808</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2794</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2763</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2691</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2645</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2602</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb3100</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2545</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.neatmonster</groupId>
<artifactId>ncpcompatcb2512</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
+7 -7
View File
@@ -22,9 +22,9 @@
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.12-pre2-SNAPSHOT</version>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -35,13 +35,13 @@
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib-API</artifactId>
<version>4.3.0-SNAPSHOT</version>
<artifactId>ProtocolLib</artifactId>
<version>4.5.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<description>Features using the plugin ProtocolLib:
<description>Features using the plugin ProtocolLib:
https://dev.bukkit.org/bukkit-plugins/protocollib/</description>
<build>
@@ -56,4 +56,4 @@ https://dev.bukkit.org/bukkit-plugins/protocollib/</description>
</plugins>
</build>
</project>
</project>
@@ -68,6 +68,7 @@ public class CatchAllAdapter extends BaseAdapter {
@Override
public void onPacketReceiving(PacketEvent event) {
if (event.isPlayerTemporary()) return;
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,53 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.checks.net.protocollib;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.plugin.Plugin;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketEvent;
import fr.neatmonster.nocheatplus.checks.fight.FightData;
import fr.neatmonster.nocheatplus.players.DataManager;
public class Fight extends BaseAdapter{
private static PacketType[] initPacketTypes() {
final List<PacketType> types = new LinkedList<PacketType>(Arrays.asList(
PacketType.Play.Client.ARM_ANIMATION
));
return types.toArray(new PacketType[types.size()]);
}
public Fight(Plugin plugin) {
super(plugin, ListenerPriority.LOW, initPacketTypes());
}
@Override
public void onPacketReceiving(final PacketEvent event) {
handleAnmationPacket(event);
}
public void handleAnmationPacket(final PacketEvent event) {
if (event.isPlayerTemporary()) return;
final FightData data = DataManager.getGenericInstance(event.getPlayer(), FightData.class);
data.noSwingPacket = true;
data.noSwingArmSwung = true;
}
}
@@ -57,7 +57,8 @@ public class KeepAliveAdapter extends BaseAdapter {
@Override
public void onPacketReceiving(final PacketEvent event) {
final long time = System.currentTimeMillis();
if (event.isPlayerTemporary()) return;
final long time = System.currentTimeMillis();
final Player player = event.getPlayer();
if (player == null) {
counters.add(ProtocolLibComponent.idNullPlayer, 1);
@@ -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,7 @@ public class MovingFlying extends BaseAdapter {
@Override
public void onPacketReceiving(final PacketEvent event) {
if (event.isPlayerTemporary()) return;
if (event.getPacketType().equals(confirmTeleportType)) {
if (acceptConfirmTeleportPackets) {
onConfirmTeleportPacket(event);
@@ -223,6 +229,52 @@ 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 amount = xzdist - Mdata.getHorizontalFreedom();
final double ydist = Math.abs(loc1.getY() - loc2.getY());
final boolean allowVerticalVelocity = true; // TODO: Configurable
final boolean allowHorizontalVelocity = true; // TODO: Configurable
// Vertical move.
if (ydist > 100.0 && !(allowVerticalVelocity && Mdata.getOrUseVerticalVelocity(ydist) != null)) {
++data.diffpacketVLs;
}
// Horizontal move.
else if (amount > 100.0 && !(allowHorizontalVelocity && Mdata.useHorizontalVelocity(amount) >= amount)) {
++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,253 @@
/*
* 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.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.plugin.Plugin;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerDigType;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
import fr.neatmonster.nocheatplus.components.registry.order.RegistrationOrder.RegisterMethodWithOrder;
import fr.neatmonster.nocheatplus.event.mini.MiniListener;
import fr.neatmonster.nocheatplus.logging.StaticLog;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.InventoryUtil;
public class NoSlow extends BaseAdapter {
private final static String dftag = "system.nocheatplus.noslow";
private final static MiniListener<?>[] miniListeners = new MiniListener<?>[] {
new MiniListener<PlayerItemConsumeEvent>() {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
@RegisterMethodWithOrder(tag = dftag)
@Override
public void onEvent(final PlayerItemConsumeEvent event) {
onItemConsume(event);
}
},
new MiniListener<PlayerInteractEvent>() {
@EventHandler(priority = EventPriority.LOWEST)
@RegisterMethodWithOrder(tag = dftag)
@Override
public void onEvent(final PlayerInteractEvent event) {
onItemInteract(event);
}
},
new MiniListener<InventoryOpenEvent>() {
@EventHandler(priority = EventPriority.LOWEST)
@RegisterMethodWithOrder(tag = dftag)
@Override
public void onEvent(final InventoryOpenEvent event) {
onInventoryOpen(event);
}
},
new MiniListener<PlayerItemHeldEvent>() {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@RegisterMethodWithOrder(tag = dftag)
@Override
public void onEvent(final PlayerItemHeldEvent event) {
onChangeSlot(event);
}
},
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){
if (e.getAction() != Action.RIGHT_CLICK_AIR && e.getAction() != Action.RIGHT_CLICK_BLOCK) return;
final Player p = e.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(p);
final MovingData data = pData.getGenericInstance(MovingData.class);
Block b = e.getClickedBlock();
if (p.getGameMode() == GameMode.CREATIVE) {
data.isusingitem = false;
return;
}
if (b != null && (
b.getType().toString().endsWith("DOOR")
|| b.getType().toString().endsWith("GATE")
|| b.getType().toString().endsWith("BUTTON")
|| b.getType().toString().endsWith("LEVER")
|| (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 (InventoryUtil.isConsumable(item)) {
// pre1.9 splash potion
if (item.getDurability() > 16384) return;
if (m == Material.POTION || m == Material.MILK_BUCKET || m.toString().endsWith("_APPLE") || m.name().startsWith("HONEY_BOTTLE")) {
data.isusingitem = true;
return;
}
if (item.getType().isEdible() && p.getFoodLevel() < 20) {
data.isusingitem = true;
return;
}
}
if (m.toString().equals("BOW") && hasArrow(p.getInventory())) {
data.isusingitem = true;
return;
}
if (m.toString().equals("CROSSBOW")) {
if (item.getItemMeta().serialize().get("charged").equals(false) && hasArrow(p.getInventory())) {
data.isusingitem = true;
}
}
} else data.isusingitem = false;
}
private static void onChangeSlot(final PlayerItemHeldEvent e) {
final Player p = e.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(p);
final MovingData data = pData.getGenericInstance(MovingData.class);
data.isusingitem = false;
}
private static 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);
data.isusingitem = false;
//Advanced check
if(digtype == PlayerDigType.RELEASE_USE_ITEM) {
long now = System.currentTimeMillis();
if (data.time_rl_item != 0) {
if (now < data.time_rl_item) {
data.time_rl_item = now;
data.isusingitem = false;
return;
}
if (data.time_rl_item + timeBetweenRL > now) {
data.isHackingRI = true;
}
}
data.time_rl_item = now;
}
}
/**
* Set Minimum time between RELEASE_USE_ITEM packet is sent.
* If time lower this value, A check will flag
* Should be set from 51-100. Larger number, more protection more false-positive
*
* @param milliseconds
*/
public static void setuseRLThreshold(int time) {
timeBetweenRL = time;
}
}
@@ -27,6 +27,7 @@ import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.net.NetData;
import fr.neatmonster.nocheatplus.checks.net.model.CountableLocation;
import fr.neatmonster.nocheatplus.logging.StaticLog;
import fr.neatmonster.nocheatplus.logging.Streams;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
@@ -53,12 +54,21 @@ public class OutgoingPosition extends BaseAdapter {
@Override
public void onPacketSending(PacketEvent event) {
if (event.isCancelled()) {
if (event.isPlayerTemporary()) return;
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,
@@ -126,13 +126,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) {
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) {
@@ -142,6 +142,7 @@ public class SoundDistance extends BaseAdapter {
@Override
public void onPacketSending(final PacketEvent event) {
if (event.isPlayerTemporary()) return;
final PacketContainer packetContainer = event.getPacket();
// Compare sound effect name.
@@ -123,6 +123,7 @@ public class UseEntityAdapter extends BaseAdapter {
@Override
public void onPacketReceiving(final PacketEvent event) {
if (event.isPlayerTemporary()) return;
final long time = System.currentTimeMillis();
final Player player = event.getPlayer();
if (player == null) {
@@ -134,7 +135,6 @@ public class UseEntityAdapter extends BaseAdapter {
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)) {
@@ -0,0 +1,49 @@
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 StructureModifier<Float> floats = event.getPacket().getFloat();
final float pitch = floats.read(1);
final Player player = event.getPlayer();
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?
}
}
}
+1 -1
View File
@@ -17,7 +17,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.3-R0.1-SNAPSHOT</version>
<version>1.15-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -72,7 +72,6 @@ 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),
@@ -90,7 +89,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 +106,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),
;
@@ -153,7 +153,7 @@ public class BlockBreakListener extends CheckListener {
final Block block = event.getBlock();
boolean cancelled = false;
if (block.getType().toString().equals("SCAFFOLDING")) return;
// Do the actual checks, if still needed. It's a good idea to make computationally cheap checks first, because
// it may save us from doing the computationally expensive checks.
@@ -232,7 +232,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;
@@ -409,4 +409,4 @@ public class BlockBreakListener extends CheckListener {
}
}
}
}
@@ -186,6 +186,8 @@ public class BlockInteractListener extends CheckListener {
if (block == null) {
data.resetLastBlock();
blockChecks = false;
} else if (block.getType().toString().equals("SCAFFOLDING")) {
blockChecks = false;
}
else {
data.setLastBlock(block, action);
@@ -205,6 +207,9 @@ public class BlockInteractListener extends CheckListener {
if (stack != null && stack.getType() == Material.ENDER_PEARL) {
checkEnderPearlRightClickBlock(player, block, face, event, previousLastTick, data, pData);
}
if (stack != null && stack.getType().toString().equals("SCAFFOLDING")) {
blockChecks = false;
}
break;
default:
data.setPlayerInteractEventResolution(event);
@@ -373,8 +378,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) * 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 ?
@@ -433,4 +439,4 @@ public class BlockInteractListener extends CheckListener {
debug(player, builder.toString());
}
}
}
@@ -70,11 +70,17 @@ public class Against extends Check {
else if (BlockProperties.isLiquid(againstType)) {
// TODO: F_PLACE_AGAINST_WATER|LIQUID...
if ((placedMat != BridgeMaterial.LILY_PAD
|| !BlockProperties.isLiquid(block.getRelative(BlockFace.DOWN).getType()))
|| !BlockProperties.isLiquid(block.getRelative(BlockFace.DOWN).getType()))
&& !BlockProperties.isNewLiq(bdata.getLastType())
&& !pData.hasPermission(Permissions.BLOCKPLACE_AGAINST_LIQUIDS, player)) {
violation = true;
}
}
} else
// Replace block placed by block placed and interact with air or water
if (block.equals(blockAgainst) && (bdata.getLastType() == null || (BlockProperties.isLiquid(bdata.getLastType()) && !BlockProperties.isNewLiq(bdata.getLastType())))
&& !pData.hasPermission(Permissions.BLOCKPLACE_AGAINST_SELF, player)) {
violation = true;
}
// Handle violation and return.
bdata.addConsumedCheck(this.type);
if (violation) {
@@ -90,4 +96,4 @@ public class Against extends Check {
}
}
}
}
@@ -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,11 @@ 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 boolean scaffoldSprint;
public final long speedInterval;
public final boolean speedImprobableFeedOnly;
@@ -90,8 +93,11 @@ 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);
scaffoldSprint = config.getBoolean(ConfPaths.BLOCKPLACE_SCAFFOLD_SPRINT);
speedInterval = config.getLong(ConfPaths.BLOCKPLACE_SPEED_INTERVAL);
speedImprobableFeedOnly = config.getBoolean(ConfPaths.BLOCKPLACE_SPEED_IMPROBABLE_FEEDONLY);
@@ -108,4 +114,4 @@ public class BlockPlaceConfig extends ACheckConfig {
*/
}
}
}
@@ -14,6 +14,8 @@
*/
package fr.neatmonster.nocheatplus.checks.blockplace;
import java.util.ArrayList;
import fr.neatmonster.nocheatplus.checks.access.ACheckData;
import fr.neatmonster.nocheatplus.utilities.ds.count.ActionFrequency;
@@ -37,6 +39,14 @@ public class BlockPlaceData extends ACheckData {
/** Using Material.SIGN . */
public long autoSignPlacedHash = 0;
// Scaffold data
public long lastPlaceTime = 0;
public long lastPlaceAvg = 0;
public ArrayList<Long> placeTime = new ArrayList<Long>();
public long sneakTime = 0;
public long sprintTime = 0;
public boolean cancelNextPlace = false;
// Data of the fast place check.
public final ActionFrequency fastPlaceBuckets = new ActionFrequency(2, 1000);
public int fastPlaceShortTermTick = 0;
@@ -52,4 +62,4 @@ public class BlockPlaceData extends ACheckData {
public boolean speedLastRefused;
public long speedLastTime;
}
}
@@ -34,6 +34,7 @@ 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;
@@ -50,6 +51,7 @@ import fr.neatmonster.nocheatplus.checks.net.FlyingQueueHandle;
import fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
import fr.neatmonster.nocheatplus.components.data.ICheckData;
import fr.neatmonster.nocheatplus.components.data.IData;
@@ -113,7 +115,7 @@ public class BlockPlaceListener extends CheckListener {
/** The scaffold check. */
private final Scaffold Scaffold = addCheck(new Scaffold());
/** The speed check. */
private final Speed speed = addCheck(new Speed());
@@ -200,6 +202,12 @@ public class BlockPlaceListener extends CheckListener {
int skippedRedundantChecks = 0;
final boolean debug = pData.isDebugActive(CheckType.BLOCKPLACE);
final BlockFace placedFace = event.getBlock().getFace(event.getBlockAgainst());
final Block blockPlaced = event.getBlockPlaced();
// TODO: change to distsquared for possible performance boost
final double distance = player.getLocation().distance(blockPlaced.getLocation());
boolean shouldCheck = false;
final boolean shouldSkipSome;
if (blockMultiPlaceEvent != null && event.getClass() == blockMultiPlaceEvent) {
if (placedMat == Material.BEDROCK
@@ -212,6 +220,8 @@ public class BlockPlaceListener extends CheckListener {
}
shouldSkipSome = false;
}
} else if (placedMat.toString().equals("SCAFFOLDING")) {
shouldSkipSome = true;
}
else {
shouldSkipSome = false;
@@ -250,6 +260,24 @@ public class BlockPlaceListener extends CheckListener {
cancelled = true;
}
switch (placedFace) {
case NORTH:
case SOUTH:
case EAST:
case WEST:
shouldCheck = true;
break;
default:
shouldCheck = false;
break;
}
if (Scaffold.isEnabled(player, pData) && player.getLocation().getY() - blockPlaced.getY() < 2D && blockPlaced.getType().isSolid() && shouldCheck && distance < 2D) {
cancelled = Scaffold.check(player, placedFace, pData, data, cc);
}
final FlyingQueueHandle flyingHandle;
final boolean reachCheck = pData.isCheckActive(CheckType.BLOCKPLACE_REACH, player);
final boolean directionCheck = pData.isCheckActive(CheckType.BLOCKPLACE_DIRECTION, player);
@@ -267,6 +295,7 @@ public class BlockPlaceListener extends CheckListener {
}
}
// Direction check.
if (!cancelled && !shouldSkipSome) {
if (isInteractBlock && bdata.isPassedCheck(CheckType.BLOCKINTERACT_DIRECTION)) {
@@ -403,31 +432,6 @@ 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) {
@@ -568,4 +572,19 @@ public class BlockPlaceListener extends CheckListener {
// Cleanup.
useLoc.setWorld(null);
}
}
@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 (player.isSprinting()) {
data.sprintTime = System.currentTimeMillis();
} else if (player.isSneaking()) {
data.sneakTime = System.currentTimeMillis();
}
}
}
@@ -1,34 +1,133 @@
package fr.neatmonster.nocheatplus.checks.blockplace;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.block.Block;
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.checks.inventory.InventoryConfig;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.StringUtil;
public class Scaffold extends Check {
private final List<String> tags = new LinkedList<String>();
public Scaffold() {
super(CheckType.BLOCKPLACE_SCAFFOLD);
}
final static double MAX_ANGLE = Math.toRadians(90);
public boolean check(Player player, Block targetBlock, List<Block> lastTarget, BlockFace blockFace, final IPlayerData pData, final BlockPlaceData data) {
BlockFace face = null;
public boolean check(Player player, BlockFace placedFace, final IPlayerData pData, final BlockPlaceData data, final BlockPlaceConfig cc) {
boolean cancel = false;
if (lastTarget.size() > 1) {
face = lastTarget.get(1).getFace(lastTarget.get(0));
final Vector placedVector = new Vector(placedFace.getModX(), placedFace.getModY(), placedFace.getModZ());
float placedAngle = player.getLocation().getDirection().angle(placedVector);
long now = System.currentTimeMillis();
float pitchNow = player.getLocation().getPitch();
int current = player.getInventory().getHeldItemSlot();
// Angle Check
if (cc.scaffoldAngle && placedAngle > MAX_ANGLE) {
ViolationData vd = new ViolationData(this, player, data.scaffoldVL, 1, pData.getGenericInstance(BlockPlaceConfig.class).scaffoldActions);
tags.add("Angle");
if (vd.needsParameters()) {
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
}
cancel = executeActions(vd).willCancel();
data.scaffoldVL += 1D;
}
// Average time check
if (cc.scaffoldTime && data.sneakTime + 150 < now && !player.hasPotionEffect(PotionEffectType.SPEED)) {
// TODO: need to make this more efficient
if (data.placeTime.size() > 2) {
long avg = 0;
for (int i = 0; i < data.placeTime.size(); i++) {
avg += data.placeTime.get(i);
}
avg = avg / data.placeTime.size();
if (avg < 238L) {
ViolationData vd = new ViolationData(this, player, data.scaffoldVL, 1, pData.getGenericInstance(BlockPlaceConfig.class).scaffoldActions);
tags.add("Time");
if (vd.needsParameters()) {
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
}
cancel = executeActions(vd).willCancel();
data.scaffoldVL += 1D;
}
data.lastPlaceAvg = avg;
data.placeTime.clear();
data.lastPlaceTime = 0L;
} else {
if (data.lastPlaceTime == 0) {
data.lastPlaceTime = now;
} else {
long diff = now - data.lastPlaceTime;
data.placeTime.add(diff);
data.lastPlaceTime = now;
if (diff <= data.lastPlaceAvg && data.lastPlaceAvg < 238L) {
ViolationData vd = new ViolationData(this, player, data.scaffoldVL, 1, pData.getGenericInstance(BlockPlaceConfig.class).scaffoldActions);
tags.add("TimeAvg");
if (vd.needsParameters()) {
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
}
cancel = executeActions(vd).willCancel();
data.scaffoldVL += 1D;
}
}
}
}
if (blockFace != face) {
cancel = executeActions(player, data.scaffoldVL, 1D, pData.getGenericInstance(BlockPlaceConfig.class).scaffoldActions).willCancel();
// Pitch Check
//Bukkit.getScheduler().runTaskLater(data.plugin, checkDiff(player, now, pData, data), 2L);
// Tool switch check
// Bukkit.getScheduler().runTaskLater(data.plugin, checkTool(player, current, pData, data), 1L);
// Sprint check
long diff = System.currentTimeMillis() - data.sprintTime;
if (cc.scaffoldSprint && diff < 400) {
ViolationData vd = new ViolationData(this, player, data.scaffoldVL, 1, pData.getGenericInstance(BlockPlaceConfig.class).scaffoldActions);
tags.add("Sprint");
if (vd.needsParameters()) {
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
}
cancel = executeActions(vd).willCancel();
data.scaffoldVL += 1D;
}
tags.clear();
return cancel;
}
// Check diff
private void checkDiff(Player player, float now, final IPlayerData pData, final BlockPlaceData data) {
float pitchNow = player.getLocation().getPitch();
float diff = Math.abs(now - pitchNow);
if (diff > 20F) {
executeActions(player, data.scaffoldVL, 1D, pData.getGenericInstance(BlockPlaceConfig.class).scaffoldActions).willCancel();
data.scaffoldVL += 1D;
}
}
}
private void checkTool(Player player, int item, final IPlayerData pData, final BlockPlaceData data) {
int newItem = player.getInventory().getHeldItemSlot();
if (newItem != item) {
executeActions(player, data.scaffoldVL, 1D, pData.getGenericInstance(BlockPlaceConfig.class).scaffoldActions).willCancel();
data.scaffoldVL += 1D;
}
}
}
@@ -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;
@@ -64,52 +64,110 @@ public class Critical extends Check {
boolean cancel = false;
final double mcFallDistance = (double) player.getFallDistance();
final MovingData mData = pData.getGenericInstance(MovingData.class);
// 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)) {
// Might be a violation.
final MovingConfig mcc = pData.getGenericInstance(MovingConfig.class);
final PlayerMoveData thisMove = mData.playerMoves.getCurrentMove();
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)
*/
// 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?
/*
* 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.
*
*/
// 0.0009 is just a random number for leniency that works fine, maybe add a config option?
if (Math.abs(mData.noFallFallDistance - mcFallDistance) > 0.0009 && mcFallDistance <= cc.criticalFallDistance && mData.sfJumpPhase <= 1 && !BlockProperties.isResetCond(player, loc, mcc.yOnGround) || mData.sfLowJump || mData.noFallFallDistance != mcFallDistance && thisMove.from.onGround && thisMove.to.onGround) {
// 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, "+"));
if (MovingUtil.shouldCheckSurvivalFly(player, moveInfo.from, mData, mcc, pData)) {
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) {
} else if ((thisMove.from.inLiquid | thisMove.to.inLiquid) && thisMove.from.onGround && thisMove.to.onGround) {
} else if ((thisMove.from.inWeb | thisMove.to.inWeb) & !thisMove.to.onGround) {
} else if ((moveInfo.from.getBlockFlags() & BlockProperties.F_BOUNCE25) != 0 && !thisMove.from.onGround && !thisMove.to.onGround) {
}
else {
boolean exemptLowJump = false;
// False positives with lowJump when the player jumps on/off a block while attacking an entity
if (mData.sfLowJump) {
if (Math.abs(mData.noFallFallDistance - mcFallDistance) < 0.0009) {
if (mcFallDistance > cc.criticalFallDistance) {
if (!thisMove.to.onGround || !thisMove.from.onGround) {
exemptLowJump = true;
}
}
} else if (!thisMove.to.onGround || !thisMove.from.onGround) {
if (Math.abs(mData.noFallFallDistance - mcFallDistance) > 0.0009) {
exemptLowJump = true;
}
}
}
if (!exemptLowJump) {
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 (mData.sfLowJump) {
tags.add("lowjump");
}
vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
}
cancel = executeActions(vd).willCancel();
// TODO: Introduce penalty instead of cancel.
}
}
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;
}
}
}
@@ -21,6 +21,7 @@ import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.TickTask;
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
/**
* Legacy check (client side health regeneration).
@@ -35,6 +36,9 @@ public class FastHeal extends Check {
}
public boolean check(final Player player, final IPlayerData pData){
if (ServerVersion.compareMinecraftVersion("1.9") >= 0) {
return false;
}
final long time = System.currentTimeMillis();
final FightConfig cc = pData.getGenericInstance(FightConfig.class);
@@ -37,17 +37,16 @@ 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 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;
@@ -73,6 +72,7 @@ public class FightConfig extends ACheckConfig {
public final ActionList reachActions;
public final ActionList selfHitActions;
public final boolean selfHitExcludeprojectile;
public final int speedLimit;
public final int speedBuckets;
@@ -85,14 +85,12 @@ public class FightConfig extends ACheckConfig {
public final float speedImprobableWeight;
public final ActionList speedActions;
public final ActionList wrongTurnActions;
// 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.
public final long loopMaxLatencyTicks; // TODO: Configurable, sections for players and entities.
/**
* Instantiates a new fight configuration.
@@ -108,10 +106,6 @@ 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);
@@ -119,6 +113,9 @@ public class FightConfig extends ACheckConfig {
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);
@@ -148,6 +145,7 @@ public class FightConfig extends ACheckConfig {
reachActions = config.getOptimizedActionList(ConfPaths.FIGHT_REACH_ACTIONS, Permissions.FIGHT_REACH);
selfHitActions = config.getOptimizedActionList(ConfPaths.FIGHT_SELFHIT_ACTIONS, Permissions.FIGHT_SELFHIT);
selfHitExcludeprojectile = config.getBoolean(ConfPaths.FIGHT_SELFHIT_EXCLUDEPROJECTILE);
speedLimit = config.getInt(ConfPaths.FIGHT_SPEED_LIMIT);
speedBuckets = config.getInt(ConfPaths.FIGHT_SPEED_BUCKETS_N, 6);
@@ -159,11 +157,8 @@ 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());
cancelDead = config.getBoolean(ConfPaths.FIGHT_CANCELDEAD);
loopMaxLatencyTicks = config.getInt(ConfPaths.FIGHT_MAXLOOPLETENCYTICKS, 1, 15, 8);
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,6 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
public double noSwingVL;
public double reachVL;
public double speedVL;
public double wrongTurnVL;
// Shared
public String lastWorld = "";
@@ -96,7 +94,8 @@ public class FightData extends ACheckData implements IDataOnRemoveSubCheckData,
// Data of the no swing check.
public boolean noSwingArmSwung = true; // TODO: First is free for now, 1.12.2, other?
public boolean exemptArmSwing = true;
public boolean exemptArmSwing = false;
public boolean noSwingPacket = false;
// Data of the reach check.
public double reachMod = 1.0;
@@ -140,8 +139,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;
@@ -91,8 +90,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());
@@ -105,8 +102,6 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
/** 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,9 +112,6 @@ 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());
/** For temporary use: LocUtil.clone before passing deeply, call setWorld(null) after use. */
private final Location useLoc1 = new Location(null, 0, 0, 0);
@@ -320,18 +312,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)) {
@@ -687,6 +667,14 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
if (source instanceof Player) {
attacker = (Player) source;
}
}
if (damagedPlayer != null && !damagedIsDead && (damageCause == DamageCause.BLOCK_EXPLOSION
|| damageCause == DamageCause.ENTITY_EXPLOSION)) {
final IPlayerData dpdata = DataManager.getPlayerData(damagedPlayer);
if (dpdata != null) {
MovingData data = dpdata.getGenericInstance(MovingData.class);
data.applyexplosionvel = true;
}
}
final FightData attackerData;
final IPlayerData attackerPData = attacker == null ? null : DataManager.getPlayerData(attacker);
@@ -782,8 +770,9 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
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[] vel2Dvec = calculateHorizontalVelocity(attacker, damagedPlayer);
final double vx = vel2Dvec[0];
final double vz = vel2Dvec[1];
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?).
useLoc1.setWorld(null); // Cleanup.
if (pData.isDebugActive(checkType) || pData.isDebugActive(CheckType.MOVING)) {
@@ -815,6 +804,54 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
// Cap the level to something reasonable. TODO: Config / cap the velocity anyway.
return Math.min(20.0, level);
}
/**
* Better method to calculate horizontal velocity including direction!
*
* @param attacker
* @param damagedPlayer
* @return velocityX, velocityZ
*/
private double[] calculateHorizontalVelocity(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);
return new double[] {vx, 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;
}
return new double[] {vx, vz};
}
/**
* We listen to death events to prevent a very specific method of doing godmode.
@@ -847,8 +884,9 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
* 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);
if (data.noSwingPacket) return;
data.noSwingArmSwung = true;
}
@@ -901,11 +939,7 @@ public class FightListener extends CheckListener implements JoinLeaveListener{
final Player player = e.getPlayer();
final FightData data = DataManager.getGenericInstance(player, FightData.class);
if (entity instanceof Parrot) {
data.exemptArmSwing = true;
} else {
data.exemptArmSwing = false;
}
data.exemptArmSwing = entity != null && entity.getType().name().equals("PARROT") ? true : false;
}
@Override
@@ -927,29 +961,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);
}
}
}
@@ -1,36 +0,0 @@
package fr.neatmonster.nocheatplus.checks.fight;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.checks.Check;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.net.NetConfig;
import fr.neatmonster.nocheatplus.checks.net.NetData;
import fr.neatmonster.nocheatplus.players.IPlayerData;
public class FightSync extends Check {
public FightSync() {
super(CheckType.NET_FIGHTSYNC);
}
public boolean check(Player player, IPlayerData pData, NetData data, Location packet, Location eventLoc, final NetConfig cc) {
boolean cancel = false;
if (eventLoc != null && packet != null) {
double diff = Math.abs(eventLoc.getYaw() - packet.getYaw()) + Math.abs(eventLoc.getPitch() - packet.getPitch());
if (diff != 0) {
if (data.fightSyncCount >= cc.fightSyncThreshold) {
data.fightSyncVL += diff * 5;
cancel = executeActions(player, data.fightSyncVL, Math.abs(diff * 5), pData.getGenericInstance(NetConfig.class).fightSyncActions).willCancel();
data.fightSyncCount = 0;
} else {
data.fightSyncCount += 1;
}
}
}
return cancel;
}
}
@@ -1,62 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.checks.fight;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.checks.Check;
import fr.neatmonster.nocheatplus.checks.CheckType;
/**
* First WrongTurn variant (pitch, possibly other).
*
* @author asofold
*
*/
public class WrongTurn extends Check {
public WrongTurn() {
super(CheckType.FIGHT_WRONGTURN);
}
public boolean check (final Player player, final Location loc,
final FightData data, final FightConfig cc) {
final float pitch = loc.getPitch();
// Invalid Pitch
// TODO: Does invalid pitch arrive here at all?
// TODO: Prefer to detect on packet level already.
if (Math.abs(pitch) > 90.0f || pitch < -90.0f) {
data.wrongTurnVL += 1; // (Never cooldown.)
if (executeActions(player, data.wrongTurnVL, 1.0, cc.wrongTurnActions).willCancel()) {
return true;
}
}
// TODO: Better have the following in a check not resulting in banning 100% of the time.
// TODO: Suspicious yaw + pitch combination (static).
/*
* TODO: Past moves: detect fast turning towards opponent for an easier
* thing (re-use for difficulty). Better have an extra spot for relating
* moves of the attacker vs. moves of the attacked.
*/
// TODO: Past moves: detect optimizing look/position in general.
return false;
}
}
@@ -24,6 +24,7 @@ import fr.neatmonster.nocheatplus.checks.Check;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.net.FlyingQueueHandle;
import fr.neatmonster.nocheatplus.checks.net.FlyingQueueLookBlockChecker;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.components.config.ICheckConfig;
import fr.neatmonster.nocheatplus.components.data.ICheckData;
import fr.neatmonster.nocheatplus.players.IPlayerData;
@@ -198,7 +199,7 @@ public abstract class AbstractBlockDirectionCheck<D extends ICheckData, C extend
// Initialize fully each time.
boulder.setFindNearestPointIfNotCollide(true)
.setRay(x, y, z, dirX, dirY, dirZ)
.setAABB(blockX, blockY, blockZ, 0.1)
.setAABB(blockX, blockY, blockZ, Bridge1_13.hasIsSwimming() ? 0.9 : 0.1)
.loop();
// Interpret result.
if (boulder.collides()) {
@@ -113,7 +113,7 @@ public class InventoryConfig extends ACheckConfig {
openCancelOther = data.getBoolean(ConfPaths.INVENTORY_OPEN_CANCELOTHER);
invMoveDisableCreative = data.getBoolean(ConfPaths.INVENTORY_INVENTORYMOVE_DISABLECREATIVE);
invMoveActionList = data.getOptimizedActionList(ConfPaths.INVENTORY_INVENTORYMOVE_ACTIONS, Permissions.INVENTORY_MOVE);
invMoveActionList = data.getOptimizedActionList(ConfPaths.INVENTORY_INVENTORYMOVE_ACTIONS, Permissions.INVENTORY_INVENTORYMOVE);
hotFixFallingBlockEndPortalActive = data.getBoolean(ConfPaths.INVENTORY_HOTFIX_DUPE_FALLINGBLOCKENDPORTAL);
}
@@ -41,6 +41,7 @@ import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.Inventory;
@@ -53,6 +54,7 @@ import fr.neatmonster.nocheatplus.checks.CheckListener;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.combined.Combined;
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.compat.BridgeHealth;
@@ -84,6 +86,9 @@ public class InventoryListener extends CheckListener implements JoinLeaveListen
/** Inventory Move check */
private final InventoryMove invMove = addCheck(new InventoryMove());
/** More Inventory check */
private final MoreInventory moreInv = addCheck(new MoreInventory());
/** The fast click check. */
private final FastClick fastClick = addCheck(new FastClick());
@@ -265,7 +270,7 @@ public class InventoryListener extends CheckListener implements JoinLeaveListen
// Fast inventory manipulation check.
if (fastClick.isEnabled(player, pData)) {
final InventoryConfig cc = pData.getGenericInstance(InventoryConfig.class);
if (!(event.getView().getType().equals(InventoryType.CREATIVE) && cc.fastClickSpareCreative) && !cc.inventoryExemptions.contains(ChatColor.stripColor(event.getView().getTitle()))) {
if (!((event.getView().getType().equals(InventoryType.CREATIVE) || player.getGameMode() == GameMode.CREATIVE) && cc.fastClickSpareCreative) && !cc.inventoryExemptions.contains(ChatColor.stripColor(event.getView().getTitle()))) {
if (fastClick.check(player, now,
event.getView(), slot, cursor, clicked, event.isShiftClick(),
inventoryAction, data, cc, pData)) {
@@ -576,6 +581,30 @@ public class InventoryListener extends CheckListener implements JoinLeaveListen
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onMove(final PlayerMoveEvent event) {
final Player player = event.getPlayer();
final Location from = event.getFrom();
final Location to = event.getTo();
final boolean PoYdiff = from.getPitch() != to.getPitch() || from.getYaw() != to.getYaw();
final IPlayerData pData = DataManager.getPlayerData(player);
if (pData == null) return;
final MovingData data = pData.getGenericInstance(MovingData.class);
final Inventory inv = player.getOpenInventory().getTopInventory();
if (moreInv.isEnabled(player, pData)
&& moreInv.check(player, data, pData, inv.getType(), inv, PoYdiff)) {
for (int i =1; i<=4 ;i++) {
final ItemStack item = inv.getItem(i);
if (item != null && item.getType() != Material.AIR) {
player.getWorld().dropItemNaturally(player.getLocation(), item);
inv.setItem(i, null);
if (pData.isDebugActive(CheckType.INVENTORY_MOREINVENTORY))
debug(player , "Drop items from crafting slot:" + i);
}
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerTeleport(final PlayerTeleportEvent event) {
@@ -4,6 +4,7 @@ import java.util.LinkedList;
import java.util.List;
import org.bukkit.GameMode;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.inventory.InventoryType.SlotType;
import org.bukkit.entity.Player;
@@ -12,6 +13,9 @@ 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.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.StringUtil;
@@ -24,13 +28,20 @@ public class InventoryMove extends Check {
private final List<String> tags = new LinkedList<String>();
public InventoryMove() {
super(CheckType.INVENTORY_MOVE);
super(CheckType.INVENTORY_INVENTORYMOVE);
}
public boolean check(final Player player, final InventoryData data, final IPlayerData pData, final InventoryConfig cc, final SlotType type) {
boolean cancel = false;
final MovingData Mdata = pData.getGenericInstance(MovingData.class);
final PlayerMoveData lastMove = Mdata.playerMoves.getCurrentMove();
final boolean isOnGround = lastMove.touchedGround || lastMove.from.onGround || lastMove.to.onGround;
// Dummy way to fix bug when interacting shopkeeper trader
final boolean a = player.getOpenInventory().getTopInventory().getType() == InventoryType.MERCHANT;
// Tags
if (player.isBlocking()) {
tags.add("isBlocking");
@@ -38,8 +49,8 @@ public class InventoryMove extends Check {
else if (player.isSneaking()) {
tags.add("isSneaking");
}
else if (player.isSwimming()) {
tags.add("isSwimming");
else if (Bridge1_13.isSwimming(player)) {
if (!isOnGround) tags.add("isSwimming");
}
else if (player.isSprinting()) {
tags.add("isSprinting");
@@ -49,7 +60,8 @@ public class InventoryMove extends Check {
}
// Do the actual check
if (player.isSneaking() || player.isSprinting() || player.isSwimming() || player.isBlocking() || player.isDead()) {
if (player.isSneaking() || (player.isSprinting() && !Bridge1_13.isSwimming(player))
|| (player.isBlocking() && !a) || player.isDead() || (Bridge1_13.isSwimming(player) && !isOnGround)) {
// Check if the player is in creative
if (player.getGameMode() == GameMode.CREATIVE) {
// (Skip hotbar interactions)
@@ -0,0 +1,24 @@
package fr.neatmonster.nocheatplus.checks.inventory;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import fr.neatmonster.nocheatplus.checks.Check;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.players.IPlayerData;
public class MoreInventory extends Check{
public MoreInventory() {
super(CheckType.INVENTORY_MOREINVENTORY);
}
public boolean check(final Player player, final MovingData movingdata, final IPlayerData pData, final InventoryType type, final Inventory inv, final boolean PoYdiff) {
if (type == InventoryType.CRAFTING
&& (player.isSprinting() || PoYdiff || player.isBlocking() || player.isSneaking() || movingdata.isusingitem)) {
return true;
}
return false;
}
}
@@ -169,6 +169,8 @@ public class MovingConfig extends ACheckConfig {
public final boolean enforceLocation;
public final boolean trackBlockMove;
public final PlayerSetBackMethod playerSetBackMethod;
public final boolean resetFwOnground;
public final boolean elytraStrict;
// Vehicles
public final boolean vehicleEnforceLocation;
@@ -218,6 +220,8 @@ public class MovingConfig extends ACheckConfig {
flyingModelElytra = new ModelFlying(ID_JETPACK_ELYTRA, config,
ConfPaths.MOVING_CREATIVEFLY_MODEL + "elytra.",
new ModelFlying(null, defaultModel).verticalAscendGliding(true).lock());
resetFwOnground = config.getBoolean(ConfPaths.MOVING_CREATIVEFLY_EYTRA_FWRESET);
elytraStrict = config.getBoolean(ConfPaths.MOVING_CREATIVEFLY_EYTRA_STRICT);
creativeFlyActions = config.getOptimizedActionList(ConfPaths.MOVING_CREATIVEFLY_ACTIONS,
Permissions.MOVING_CREATIVEFLY);
@@ -404,4 +408,4 @@ public class MovingConfig extends ACheckConfig {
return modelGameMode;
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -130,8 +130,8 @@ public class LocationTrace {
@Override
public boolean isInside(final double x, final double y, final double z) {
return y >= this.y && y <= this.y + this.boxMarginVertical
&& Math.abs(x - this.x) <= this.boxMarginHorizontal
&& Math.abs(z - this.z) <= this.boxMarginHorizontal;
&& Math.abs(x - this.x) <= this.boxMarginHorizontal * 2.5
&& Math.abs(z - this.z) <= this.boxMarginHorizontal * 2.5;
}
}
@@ -47,22 +47,28 @@ public class Magic {
// Horizontal speeds/modifiers.
public static final double WALK_SPEED = 0.221D;
public static final double modSneak = 0.13D / WALK_SPEED;
// public static final double modSprint = 0.29 / walkSpeed; // TODO: without bunny 0.29 / practical is 0.35
public static final double modBlock = 0.16D / WALK_SPEED;
public static final double modSwim = 0.3D / WALK_SPEED; // 0.152D / WALK_SPEED
public static final double modRiptide = 10.0D;
public static final double modDolphinsGrace = 5.0D; // TODO: Adjust value to be more stricter and closer to actual movement speed, and use different value from in water vs above water
public static final double modSprint = 0.27 / WALK_SPEED; // TODO: without bunny 0.29 / practical is 0.35
public static final double modBlock = 0.1277D / WALK_SPEED;
public static final double[] modSwim = new double[] {0.115D / WALK_SPEED, 0.044D / WALK_SPEED, 0.3D / WALK_SPEED}; // 0.044D for horizontal, 0.3 for vertical swimming
public static final double[] modRiptide = new double[] {
1.0,
4.8, //4.6 ?
7.2, //7.0 ?
10.0
};
public static final double modDolphinsGrace = 4.3D; // TODO: Adjust value to be more stricter and closer to actual movement speed, and use different value from in water vs above water
public static final double[] modDepthStrider = new double[] {
1.0,
0.1645 / modSwim / WALK_SPEED,
0.1995 / modSwim / WALK_SPEED,
1.0 / modSwim, // Results in walkspeed.
0.1645 / modSwim[0] / WALK_SPEED,
0.1995 / modSwim[0] / WALK_SPEED,
1.0 / modSwim[0], // Results in walkspeed.
};
public static final double modWeb = 0.105D / WALK_SPEED; // TODO: walkingSpeed * 0.15D; <- does not work
public static final double modWeb = 0.09D / WALK_SPEED; // TODO: walkingSpeed * 0.15D; <- does not work
public static final double modSoulSand = 0.16D / WALK_SPEED;
public static final double modStairs = 0.27D / WALK_SPEED;
public static final double modIce = 2.5D; //
/** Faster moving down stream (water mainly). */
public static final double modDownStream = 0.19 / (WALK_SPEED * modSwim);
public static final double modDownStream = 0.19 / (WALK_SPEED * modSwim[0]);
/**
* Somewhat arbitrary horizontal speed gain maximum for advance glide phase.
@@ -125,9 +131,9 @@ public class Magic {
*
* @return
*/
public static double swimBaseSpeedV() {
public static double swimBaseSpeedV(boolean isSwimming) {
// TODO: Does this have to be the dynamic walk speed (refactoring)?
return WALK_SPEED * modSwim + 0.1; // 0.244
return isSwimming ? WALK_SPEED * modSwim[2] + 0.1 : WALK_SPEED * modSwim[0] + 0.07; // 0.244
}
/**
@@ -379,4 +385,4 @@ public class Magic {
&& lastMove.yDistance < maxJumpGain && lastMove.yDistance > maxJumpGain * 0.67
&& Magic.fallingEnvelope(yDistance, maxJumpGain, data.lastFrictionVertical, Magic.GRAVITY_SPAN);
}
}
}
@@ -18,7 +18,10 @@ 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.velocity.SimpleEntry;
import fr.neatmonster.nocheatplus.checks.moving.velocity.VelocityFlags;
import fr.neatmonster.nocheatplus.checks.workaround.WRPT;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.utilities.location.PlayerLocation;
public class MagicAir {
@@ -68,6 +71,22 @@ public class MagicAir {
&& data.ws.use(WRPT.W_M_SF_SLIME_JP_2X0)
;
}
public static boolean oddBounce(final PlayerLocation to, final double yDistance, final PlayerMoveData lastMove, final MovingData data) {
final SimpleEntry entry = data.peekVerticalVelocity(yDistance, 0, 4);
if (entry != null && entry.hasFlag(VelocityFlags.ORIGIN_BLOCK_BOUNCE)) {
data.setFrictionJumpPhase();
return true;
} else {
// Try to use past yDis
final SimpleEntry entry2 = data.peekVerticalVelocity(lastMove.yDistance, 0, 4);
if (entry2 != null && entry2.hasFlag(VelocityFlags.ORIGIN_BLOCK_BOUNCE)) {
data.setFrictionJumpPhase();
return true;
}
}
return false;
}
/**
* Odd decrease after lift-off.
@@ -183,6 +202,7 @@ public class MagicAir {
// yDistance >= -GRAVITY_MAX - GRAVITY_SPAN
// && (yDistChange < -GRAVITY_MIN && Math.abs(yDistChange) <= 2.0 * GRAVITY_MAX + GRAVITY_SPAN
// || from.isHeadObstructed(from.getyOnGround()) || data.fromWasReset && from.isHeadObstructed())
final int blockdata = from.getData(from.getBlockX(), from.getBlockY(), from.getBlockZ());
return
// 0: Any envelope (supposedly normal) near 0 yDistance.
yDistance > -2.0 * Magic.GRAVITY_MAX - Magic.GRAVITY_MIN && yDistance < 2.0 * Magic.GRAVITY_MAX + Magic.GRAVITY_MIN
@@ -243,7 +263,7 @@ public class MagicAir {
// 1: Bounce without velocity set. TODO: wat?
//|| lastMove.yDistance == 0.0 && yDistance > -GRAVITY_MIN && yDistance < GRAVITY_SPAN
// 1: Bounce with carpet.
|| yDistance < 0.006
//|| yDistance < 0.006
)
// 0: Jump-effect-specific
// TODO: Jump effect at reduced lift off envelope -> skip this?
@@ -259,21 +279,21 @@ public class MagicAir {
|| data.liftOffEnvelope != LiftOffEnvelope.NORMAL
&& (
// 1: Wild-card allow half gravity near 0 yDistance. TODO: Check for removal of included cases elsewhere.
lastMove.yDistance > -10.0 * Magic.GRAVITY_ODD / 2.0 && lastMove.yDistance < 10.0 * Magic.GRAVITY_ODD
!(data.liftOffEnvelope.name().startsWith("LIMIT") && (Math.abs(yDistance) > 0.1 || blockdata > 3)) && lastMove.yDistance > -10.0 * Magic.GRAVITY_ODD / 2.0 && lastMove.yDistance < 10.0 * Magic.GRAVITY_ODD
&& yDistance < lastMove.yDistance - Magic.GRAVITY_MIN / 2.0 && yDistance > lastMove.yDistance - Magic.GRAVITY_MAX
// 1:
|| lastMove.yDistance < Magic.GRAVITY_MAX + Magic.GRAVITY_SPAN && lastMove.yDistance > Magic.GRAVITY_ODD
|| !data.liftOffEnvelope.name().startsWith("LIMIT") && lastMove.yDistance < Magic.GRAVITY_MAX + Magic.GRAVITY_SPAN && lastMove.yDistance > Magic.GRAVITY_ODD
&& yDistance > 0.4 * Magic.GRAVITY_ODD && yDistance - lastMove.yDistance < -Magic.GRAVITY_ODD / 2.0
// 1:
|| lastMove.yDistance < 0.2 && lastMove.yDistance >= 0.0 && yDistance > -0.2 && yDistance < 2.0 * Magic.GRAVITY_MAX
// 1:
// 1: (damaged in liquid) ?
|| lastMove.yDistance < 0.2 && lastMove.yDistance >= 0.0 && yDistance > -0.2 && yDistance < 2.0 * Magic.GRAVITY_MIN
// 1: Reset condition?
|| lastMove.yDistance > 0.4 * Magic.GRAVITY_ODD && lastMove.yDistance < Magic.GRAVITY_MIN && yDistance == 0.0
// 1: Too small decrease, right after lift off.
|| data.sfJumpPhase == 1 && lastMove.yDistance > -Magic.GRAVITY_ODD && lastMove.yDistance <= Magic.GRAVITY_MAX + Magic.GRAVITY_SPAN
&& yDistance - lastMove.yDistance < 0.0114
&& Math.abs(yDistance - lastMove.yDistance) < 0.0114
// 1: Any leaving liquid and keeping distance once.
|| data.sfJumpPhase == 1
&& Math.abs(yDistance) <= Magic.swimBaseSpeedV() && yDistance == lastMove.yDistance
&& Math.abs(yDistance) <= Magic.swimBaseSpeedV(Bridge1_13.isSwimming(from.getPlayer())) && yDistance == lastMove.yDistance
)
;
}
@@ -446,4 +466,4 @@ public class MagicAir {
return false;
}
}
}
@@ -15,7 +15,9 @@
package fr.neatmonster.nocheatplus.checks.moving.magic;
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.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.utilities.location.PlayerLocation;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
@@ -49,17 +51,18 @@ public class MagicLiquid {
// TODO: liftOffEnvelope: refine conditions (general) , should be near water level.
// TODO: 1.5 high blocks ?
// TODO: Conditions seem warped.
final int blockdata = from.getData(from.getBlockX(), from.getBlockY(), from.getBlockZ());
if (yDistance <= 0.5) {
if (lastMove.toIsValid && yDistance < lastMove.yDistance
&& lastMove.yDistance - yDistance > Math.max(0.001, yDistance - baseSpeed)) {
// Decrease more than difference to baseSpeed.
return yDistance;
}
if (yDistance <= data.liftOffEnvelope.getMaxJumpGain(data.jumpAmplifier) && !BlockProperties.isLiquid(from.getTypeIdAbove())
if (!(data.liftOffEnvelope == LiftOffEnvelope.LIMIT_LIQUID && Double.isInfinite(Bridge1_13.getDolphinGraceAmplifier(from.getPlayer())) && blockdata < 4) && (yDistance <= data.liftOffEnvelope.getMaxJumpGain(data.jumpAmplifier) && !BlockProperties.isLiquid(from.getTypeIdAbove())
// TODO: What now !?
|| !to.isInLiquid() // TODO: impossible !?
|| (thisMove.to.onGround || lastMove.toIsValid && lastMove.yDistance - yDistance >= 0.010 || to.isAboveStairs())) {
double vAllowedDistance = baseSpeed + 0.5;
|| (thisMove.to.onGround || lastMove.toIsValid && lastMove.yDistance - yDistance >= 0.010 || to.isAboveStairs()))) {
double vAllowedDistance = baseSpeed + (blockdata > 3 || data.liftOffEnvelope == LiftOffEnvelope.NORMAL ? 0.397 : 0.197); // asc by water level
double vDistanceAboveLimit = yDistance - vAllowedDistance;
if (vDistanceAboveLimit <= 0.0) {
return vAllowedDistance;
@@ -161,4 +164,4 @@ public class MagicLiquid {
return null;
}
}
}
@@ -23,6 +23,7 @@ import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.actions.ParameterName;
@@ -37,15 +38,21 @@ import fr.neatmonster.nocheatplus.checks.moving.model.LiftOffEnvelope;
import fr.neatmonster.nocheatplus.checks.moving.model.ModelFlying;
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
import fr.neatmonster.nocheatplus.checks.moving.util.MovingUtil;
import fr.neatmonster.nocheatplus.checks.moving.velocity.AccountEntry;
import fr.neatmonster.nocheatplus.checks.moving.velocity.SimpleEntry;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.compat.BridgeEnchant;
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
import fr.neatmonster.nocheatplus.compat.blocks.changetracker.BlockChangeTracker;
import fr.neatmonster.nocheatplus.components.modifier.IAttributeAccess;
import fr.neatmonster.nocheatplus.components.registry.event.IGenericInstanceHandle;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.PotionUtil;
import fr.neatmonster.nocheatplus.utilities.StringUtil;
import fr.neatmonster.nocheatplus.utilities.location.PlayerLocation;
import fr.neatmonster.nocheatplus.utilities.location.TrigUtil;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
/**
* A check designed for people that are allowed to fly. The complement to the "SurvivalFly", which is for people that
@@ -55,6 +62,7 @@ public class CreativeFly extends Check {
private final List<String> tags = new LinkedList<String>();
private final BlockChangeTracker blockChangeTracker;
private IGenericInstanceHandle<IAttributeAccess> attributeAccess = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstanceHandle(IAttributeAccess.class);
/**
* Instantiates a new creative fly check.
@@ -95,24 +103,13 @@ public class CreativeFly extends Check {
final ModelFlying model = thisMove.modelFlying;
// TODO: Other set back policy for elytra, e.g. not set in narrow spaces?
// Proactive reset of elytraBoost (MC 1.11.2).
if (data.fireworksBoostDuration > 0) {
if (!lastMove.valid || lastMove.flyCheck != CheckType.MOVING_CREATIVEFLY
|| lastMove.modelFlying != model
|| data.fireworksBoostTickExpire < tick ) {
data.fireworksBoostDuration = 0;
}
else {
data.fireworksBoostDuration --;
}
}
// Calculate some distances.
final double yDistance = thisMove.yDistance;
final double hDistance = thisMove.hDistance;
final boolean flying = gameMode == BridgeMisc.GAME_MODE_SPECTATOR || player.isFlying();
final boolean sprinting = time <= data.timeSprinting + cc.sprintingGrace;
boolean lostground = false;
// Lost ground, if set so.
if (model.getGround()) {
@@ -121,21 +118,34 @@ public class CreativeFly extends Check {
if (from.isSamePos(to)) {
if (lastMove.toIsValid && lastMove.hDistance > 0.0 && lastMove.yDistance < -0.3 // Copy and paste from sf.
&& LostGround.lostGroundStill(player, from, to, hDistance, yDistance, sprinting, lastMove, data, cc, tags)) {
// Nothing to do.
lostground = true;
}
}
else if (LostGround.lostGround(player, from, to, hDistance, yDistance, sprinting, lastMove,
data, cc, useBlockChangeTracker ? blockChangeTracker : null, tags)) {
// Nothing to do.
lostground = true;
}
}
}
// Since still check NoFall on CreativeFly, need to exempt who has slow falling effect
if (Bridge1_13.hasSlowfalling() && model.getScaleSlowfallingEffect()) {
data.clearNoFallData();
} else
// Accounting for elytra fall damage
if (Bridge1_9.isGlidingWithElytra(player) && thisMove.yDistance > -0.5) {
data.clearNoFallData();
}
workaroundSwitchingModel(player, thisMove, lastMove, model, data, cc);
// Horizontal distance check.
double[] resH = hDist(player, from, to, hDistance, yDistance, sprinting, flying, lastMove, time, model, data, cc);
double limitH = resH[0];
double resultH = resH[1];
double[] rese = hackElytraH(player, from, to, hDistance, yDistance, thisMove, lastMove, lostground, data, cc);
resultH = Math.max(resultH, rese[1]);
// Check velocity.
if (resultH > 0) {
double hFreedom = data.getHorizontalFreedom();
@@ -156,21 +166,21 @@ public class CreativeFly extends Check {
}
resultH *= 100.0; // Normalize to % of a block.
long now = System.currentTimeMillis();
// Sometimes resultH can be up to 18
if (player.isGliding() && (player.isRiptiding() || data.timeRiptiding + 4000 > now) && resultH<14.0) {
resultH = 0.0;
if (Bridge1_9.isGliding(player) && (Bridge1_13.isRiptiding(player) || data.timeRiptiding + 4000 > now) && resultH<14.0) {
resultH = 0.0;
}
if (resultH > 0.0) {
tags.add("hdist");
}
// Vertical move.
double limitV = 0.0; // Limit.
double resultV = 0.0; // Violation (normalized to 100 * 1 block, applies if > 0.0).
double resultV = rese[0]; // Violation (normalized to 100 * 1 block, applies if > 0.0).
// Distinguish checking method by y-direction of the move.
if (yDistance > 0.0) {
@@ -206,13 +216,28 @@ public class CreativeFly extends Check {
}
resultV *= 100.0; // Normalize to % of a block.
// Sometimes resultV can be up to 78
if (player.isGliding() && (player.isRiptiding() || data.timeRiptiding + 4000 > now) && resultV<50.0) {
resultV = 0.0;
// Sometimes resultV can be up to 78
if (Bridge1_9.isGliding(player) && (Bridge1_13.isRiptiding(player) || data.timeRiptiding + 4000 > now) && resultV<60.0) {
resultV = 0.0;
}
if (resultV > 0.0) {
tags.add("vdist");
}
if (lastMove.toIsValid && !player.isFlying() && !Double.isInfinite(Bridge1_9.getLevitationAmplifier(player)) && !Bridge1_9.isGlidingWithElytra(player)
&& thisMove.modelFlying == lastMove.modelFlying
&& !from.isHeadObstructed() && !to.isHeadObstructed()
//Exempt check for 20 seconds after joined
&& !(now > pData.getLastJoinTime() && pData.getLastJoinTime() + 20000 > now)
&& !from.isInLiquid() && !(thisMove.yDistance < 0.0 && lastMove.yDistance - thisMove.yDistance < 0.0001)) {
double allowY = (lastMove.yDistance + (0.05D * (Bridge1_9.getLevitationAmplifier(player) + 1) - lastMove.yDistance) * 0.2D) * 0.98;
if (lastMove.yDistance < 0.0 && thisMove.yDistance < allowY) {
resultV = Math.max(resultV,1.0);
tags.add("antilevitate");
} else if (from.getY() >= to.getY() && !(thisMove.yDistance == 0.0 && allowY < 0.0)) {
resultV = Math.max(resultV,1.0);
tags.add("antilevitate");
}
}
final double result = Math.max(0.0, resultH) + Math.max(0.0, resultV);
@@ -327,6 +352,8 @@ public class CreativeFly extends Check {
}
else {
// (Ignore sprinting here).
final double attrMod = attributeAccess.getHandle().getSpeedAttributeMultiplier(player);
if (attrMod != Double.MAX_VALUE) fSpeed *= attrMod;
fSpeed *= data.walkSpeed / Magic.DEFAULT_WALKSPEED;
}
}
@@ -335,9 +362,16 @@ public class CreativeFly extends Check {
}
double limitH = model.getHorizontalModSpeed() / 100.0 * ModelFlying.HORIZONTAL_SPEED * fSpeed;
if (from.isInWater() || to.isInWater()) {
if (!Double.isInfinite(Bridge1_13.getDolphinGraceAmplifier(player))) {
limitH *= Magic.modDolphinsGrace;
}
}
if (model.getScaleSlowfallingEffect() && Bridge1_13.hasSlowfalling()) {
Double Amplifier = PotionUtil.getPotionEffectAmplifier(from.getPlayer(), PotionEffectType.SPEED);
limitH = Double.isInfinite(Amplifier) ? limitH : limitH + 0.1*(Amplifier +1);
Double Amplifier = PotionUtil.getPotionEffectAmplifier(from.getPlayer(), PotionEffectType.SPEED);
limitH = Double.isInfinite(Amplifier) ? limitH : limitH + 0.1*(Amplifier +1);
}
if (lastMove.toIsValid) {
@@ -399,8 +433,8 @@ public class CreativeFly extends Check {
tags.add("levitation:" + levitation);
}
} else if (model.getScaleSlowfallingEffect() && Bridge1_13.hasSlowfalling()) {
Double Amplifier = PotionUtil.getPotionEffectAmplifier(from.getPlayer(), PotionEffectType.JUMP);
limitV += Double.isInfinite(Amplifier) ? 0.5 : 0.5 + 0.1*(Amplifier +1);
Double Amplifier = PotionUtil.getPotionEffectAmplifier(from.getPlayer(), PotionEffectType.JUMP);
limitV += Double.isInfinite(Amplifier) ? 0.5 : 0.5 + 0.1*(Amplifier +1);
}
// Related to elytra.
@@ -408,6 +442,9 @@ public class CreativeFly extends Check {
// TODO: Better detection of an elytra model (extra flags?).
limitV = Math.max(limitV, limitV = hackLytra(yDistance, limitV, thisMove, lastMove, data));
}
if (Bridge1_9.isGlidingWithElytra(from.getPlayer()) &&
(from.isInLiquid() || to.isInLiquid() || data.liqtick > 10)) // recently left water
limitV = Math.max(limitV, 0.35);
if (model.getGravity()) {
// Friction with gravity.
@@ -416,7 +453,7 @@ public class CreativeFly extends Check {
// TODO: Use last friction (as well)?
double frictionDist = lastMove.yDistance * Magic.FRICTION_MEDIUM_AIR;
if (!flying) {
frictionDist -= Magic.GRAVITY_MIN;
frictionDist -= 0.019;
}
if (frictionDist > limitV) {
limitV = frictionDist;
@@ -464,6 +501,129 @@ public class CreativeFly extends Check {
return new double[] {limitV, resultV};
}
/**
*
* @param from
* @param to
* @param hDistance
* @param yDistance
* @param thisMove
* @param lastMove
* @param lostground
* @param data
* @param player
* @return resultH, resultV.
*/
private double[] hackElytraH(final Player player, final PlayerLocation from, final PlayerLocation to, final double hDistance, final double yDistance, final PlayerMoveData thisMove,
final PlayerMoveData lastMove, final boolean lostground, final MovingData data, final MovingConfig cc) {
/* Known false positives:
* Still have setback with taking off ?
* Fall into water
* Some random falses with quick rotation ?
*/
if (!cc.elytraStrict || !Bridge1_9.isGlidingWithElytra(player)) return new double[] {0.0, 0.0};
// Gliding in air
if (lastMove.toIsValid && lastMove.modelFlying == thisMove.modelFlying && !from.isInLiquid()) {
final Vector lookvec = to.getLocation().getDirection();
final float f = to.getPitch() * 0.017453292F;
final float lastf = lastMove.to.getPitch() * 0.017453292F;
final float diff = Math.abs(f - lastf);
double allwyDistance = lastMove.yDistance;
double allwHDistance = 0.0;
final double xzlength = Math.sqrt(lookvec.getX() * lookvec.getX() + lookvec.getZ() * lookvec.getZ());
double f4 = Math.cos(f);
f4 = f4 * f4;
allwyDistance += -0.08D + f4 * 0.06D;
double x = 0.0;
double z = 0.0;
if (allwyDistance < 0.0D) {
final double d = allwyDistance * -0.1 * f4;
x += lookvec.getX() * d / xzlength;
z += lookvec.getZ() * d / xzlength;
allwyDistance += d;
}
// Look up
if (f < 0.0F) {
final double d = lastMove.hDistance * -Math.sin(f) * 0.04;
x -= lookvec.getX() * d / xzlength;
z -= lookvec.getZ() * d / xzlength;
allwyDistance += d * 3.2;
}
x += lookvec.getX() / (xzlength*0.995) * lastMove.hDistance;
z += lookvec.getZ() / (xzlength*0.995) * lastMove.hDistance;
// Fireworks
// Can't be more precise due to some problems, still have ~15% faster bypasses :(
if (data.fireworksBoostDuration > 0) {
x += lookvec.getX() * 0.1D + (lookvec.getX() * 1.5D - x) * 0.5D;
z += lookvec.getZ() * 0.1D + (lookvec.getZ() * 1.5D - z) * 0.5D;
// Quick rotation problems
if (Math.abs(f) > Math.abs(lastf)) if (diff > 1.9) allwHDistance += (diff - 0.6)/1.4; else allwHDistance += diff/1.4;
// Problem with calculating fireworks duration and it end sooner. Speed after boost might be faster a little bit!
if (f > 0.0 && f < 1.4 && Math.round(data.fireworksBoostTickNeedCheck / 4) > data.fireworksBoostDuration) allwHDistance += 0.24;
allwHDistance += 0.12;
// Speed isn't affected by fireworks in first tick
if (data.fireworksBoostDuration >= data.fireworksBoostTickNeedCheck) allwHDistance += 0.65;
tags.add("fw_speed");
}
//System.out.println(allwyDistance + " " + yDistance + " diff:" + Math.abs(yDistance - allwyDistance * Magic.FRICTION_MEDIUM_AIR) + " diffl:" + diff);
if (f > -0.11 && Math.abs(yDistance - allwyDistance * Magic.FRICTION_MEDIUM_AIR) > 0.005
// Ignore fireworks, in water, lostground, slow_falling effect, velocity, honey block
&& data.fireworksBoostDuration <= 0 && data.liqtick == 0 && !lostground && !data.isVelocityJumpPhase()
&& Double.isInfinite(Bridge1_13.getSlowfallingAmplifier(player)) && !isCollideWithHB(from, to)
) {
tags.add("elytra_v_keep");
return new double[] {yDistance == 0.0 ? 0.1 : Math.abs(yDistance), 0.0};
}
// Adjust false
allwHDistance += Math.sqrt(x*x +z*z) + (f < -1.37 ? 0.15 : 0.0);
allwyDistance += allwyDistance > 0.0 ? 0.002 : (f < -1.37 ? (f < -1.5 ? -0.394 : -0.18) : -0.04);
allwyDistance *= Magic.FRICTION_MEDIUM_AIR;
//System.out.println("f:" + f + " Hdist:" + hDistance + " allow:" + allwHDistance + " yDist:" + yDistance + " allowy:" + allwyDistance + " fwb:" + data.fireworksBoostDuration);
if (data.fireworksBoostDuration <= 0) {
if (yDistance > 0.0) {
if (allwyDistance < yDistance
// Inversion (neg -> pos).
&& !(yDistance < Magic.GRAVITY_MIN && lastMove.yDistance > -Magic.GRAVITY_MAX - Magic.GRAVITY_MIN && lastMove.yDistance < 0.5 * Magic.GRAVITY_SPAN)) {
tags.add("elytra_v_asc");
return new double[] {yDistance, 0.0};
}
} else if (allwyDistance > yDistance
// Inversion (neg -> pos , pos -> neg).
&& !(allwyDistance > 0.0 && yDistance > -0.25)) {
tags.add("elytra_v_desc");
return new double[] {Math.abs(yDistance), 0.0};
}
}
if (allwHDistance < hDistance) {
tags.add("elytra_h_asc");
return new double[] {0.0, hDistance - allwHDistance};
}
// Gliding in water
// TODO: Will add later, look unstable
} //else if(from.isInLiquid() && data.liqtick > 35) {
// if (data.timeRiptiding + 4000 > System.currentTimeMillis()) return new double[] {0.0, 0.0};
// double allwHDistance = Magic.DEFAULT_WALKSPEED * cc.survivalFlyWalkingSpeed / 100D;
// if (data.fireworksBoostDuration > 0) allwHDistance = 1.6;
// final int level = BridgeEnchant.getDepthStriderLevel(player);
// if (level > 0) {
// allwHDistance *= Magic.modDepthStrider[level];
// }
// if (!Double.isInfinite(Bridge1_13.getDolphinGraceAmplifier(player))) allwHDistance *= 4.9;
// if (data.fireworksBoostDuration > 0) allwHDistance = Math.max(allwHDistance, 1.8);
// System.out.println(thisMove.hDistance + " " + allwHDistance);
// if (thisMove.hDistance > allwHDistance) {
// tags.add("elytra_hspeed(water)");
// return new double[] {0.0, hDistance - allwHDistance};
// }
// }
return new double[] {0.0, 0.0};
}
private double hackLytra(final double yDistance, final double limitV, final PlayerMoveData thisMove, final PlayerMoveData lastMove, final MovingData data) {
// TODO: Hack, move / config / something.
// TODO: Confine more. hdist change relates to ydist change
@@ -581,6 +741,67 @@ public class CreativeFly extends Check {
return Math.max(maximumHeight - 10.0, world.getMaxHeight());
}
private void workaroundSwitchingModel(final Player player, final PlayerMoveData thisMove, final PlayerMoveData lastMove, final ModelFlying model, final MovingData data, final MovingConfig cc) {
if (lastMove.toIsValid) {
// Other modelflying -> levitation
// TODO: Better horizontal workaround
if (data.bunnyhopTick > 0) data.bunnyhopTick--;
if (lastMove.modelFlying != thisMove.modelFlying && thisMove.modelFlying.getScaleLevitationEffect()) {
data.addVerticalVelocity(new SimpleEntry(0.0, 2));
final double amount = guessFlyNoFlyVelocity(player, data.playerMoves.getCurrentMove(), lastMove, data);
data.addHorizontalVelocity(new AccountEntry(amount, 2, MovingData.getHorVelValCount(amount)));
data.bunnyhopTick = 20;
if (thisMove.yDistance > 0.0) {
data.yDis = thisMove.yDistance;
data.addVerticalVelocity(new SimpleEntry(data.yDis, 1));
} else {
data.bunnyhopTick = 21;
final double jumpamplifier = PotionUtil.getPotionEffectAmplifier(player, PotionEffectType.JUMP);
data.yDis = 0.42 * (1 + 0.24*(Double.isInfinite(jumpamplifier) ? 0.0 : jumpamplifier + 1));
data.addVerticalVelocity(new SimpleEntry(data.yDis, 2));
}
return;
} else if (thisMove.modelFlying.getScaleLevitationEffect() && data.bunnyhopTick > 0 && thisMove.yDistance > 0.0 && thisMove.yDistance < data.yDis * 0.95) {
if (data.bunnyhopTick == 20) return;
data.yDis = (data.yDis + (0.05D * (Bridge1_9.getLevitationAmplifier(player) + 1) - data.yDis) * 0.2D) * Magic.FRICTION_MEDIUM_AIR;
data.addVerticalVelocity(new SimpleEntry(thisMove.yDistance, 1));
final double levitation = Bridge1_9.getLevitationAmplifier(player);
if (thisMove.yDistance < 0.1 + 0.046 * (levitation > 0.0 ? levitation : 0.0)) data.bunnyhopTick = 0;
return;
} else if (thisMove.yDistance < 0.0) data.bunnyhopTick = 0;
//Gliding -> Creative
if (lastMove.modelFlying != null && lastMove.modelFlying.getVerticalAscendGliding() && thisMove.modelFlying.getId().equals("gamemode.creative")) {
final double amount = guessFlyNoFlyVelocity(player, data.playerMoves.getCurrentMove(), lastMove, data);
data.addHorizontalVelocity(new AccountEntry(amount, 2, MovingData.getHorVelValCount(amount)));
data.addVerticalVelocity(new SimpleEntry(0.0, 2));
return;
}
// TODO: Levitation -> Slow_falling
}
}
private static double guessFlyNoFlyVelocity(final Player player,
final PlayerMoveData thisMove, final PlayerMoveData lastMove, final MovingData data) {
// Default margin: Allow slightly less than the previous speed.
final double defaultAmount = lastMove.hDistance * (1.0 + Magic.FRICTION_MEDIUM_AIR) / 2.0;
// Test for exceptions.
if (thisMove.hDistance > defaultAmount && Bridge1_9.isWearingElytra(player) && lastMove.modelFlying != null && lastMove.modelFlying.getId().equals(MovingConfig.ID_JETPACK_ELYTRA)) {
// Allowing the same speed won't always work on elytra (still increasing, differing modeling on client side with motXYZ).
// (Doesn't seem to be overly effective.)
final PlayerMoveData secondPastMove = data.playerMoves.getSecondPastMove();
if (secondPastMove.modelFlying != null && Magic.glideEnvelopeWithHorizontalGain(thisMove, lastMove, secondPastMove)) {
return thisMove.hDistance + Magic.GLIDE_HORIZONTAL_GAIN_MAX;
}
}
return defaultAmount;
}
private boolean isCollideWithHB(PlayerLocation from ,PlayerLocation to) {
final boolean a = BlockProperties.collides(to.getBlockCache(), to.getMinX() - 0.1, to.getMinY(), to.getMinZ() - 0.1, to.getMaxX() + 0.1, to.getMaxY(), to.getMaxZ() + 0.1, BlockProperties.F_STICKY) ||
BlockProperties.collides(from.getBlockCache(), from.getMinX() - 0.1, from.getMinY(), from.getMinZ() - 0.1, from.getMaxX() + 0.1, from.getMaxY(), from.getMaxZ() + 0.1, BlockProperties.F_STICKY);
return a;
}
private void outpuDebugMove(final Player player, final double hDistance, final double limitH,
final double yDistance, final double limitV, final ModelFlying model, final List<String> tags,
final MovingData data) {
@@ -609,4 +830,4 @@ public class CreativeFly extends Check {
debug(player, builder.toString());
}
}
}
@@ -14,12 +14,19 @@
*/
package fr.neatmonster.nocheatplus.checks.moving.player;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import fr.neatmonster.nocheatplus.checks.Check;
import fr.neatmonster.nocheatplus.checks.CheckType;
@@ -28,9 +35,13 @@ import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.checks.moving.magic.Magic;
import fr.neatmonster.nocheatplus.checks.moving.model.LocationData;
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.compat.BridgeEnchant;
import fr.neatmonster.nocheatplus.compat.BridgeHealth;
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.location.PlayerLocation;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
/**
* A check to see if people cheat by tricking the server to not deal them fall damage.
@@ -50,6 +61,7 @@ public class NoFall extends Check {
/** For temporary use: LocUtil.clone before passing deeply, call setWorld(null) after use. */
private final Location useLoc = new Location(null, 0, 0, 0);
private final Random random = new Random();
/**
* Instantiates a new no fall check.
@@ -84,8 +96,9 @@ public class NoFall extends Check {
final IPlayerData pData) {
// Damage to be dealt.
final float fallDist = (float) getApplicableFallHeight(player, y, previousSetBackY, data);
final double maxD = getDamage(fallDist);
double maxD = getDamage(fallDist);
maxD = calcDamagewithfeatherfalling(player, calcReducedDamageByHB(player, maxD));
fallOn(player, fallDist);
if (maxD >= Magic.FALL_DAMAGE_MINIMUM) {
// Check skipping conditions.
if (cc.noFallSkipAllowFlight && player.getAllowFlight()) {
@@ -109,6 +122,39 @@ public class NoFall extends Check {
player.setFallDistance(0);
}
}
private void fallOn(final Player player, final double fallDist) {
Block block = player.getLocation().subtract(0, 1, 0).getBlock();
if (block.getType() == BridgeMaterial.FARMLAND && fallDist > 0.5 && random.nextFloat() < fallDist - 0.5) {
final PlayerInteractEvent event = new PlayerInteractEvent(player, Action.PHYSICAL, null, block, BlockFace.SELF);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
//Move up a little bit in order not to stuck in a block
player.setVelocity(player.getLocation().getDirection().clone().setY(0.0626).setX(-0.004).setZ(-0.004));
block.setType(Material.DIRT);
}
}
}
public static double calcDamagewithfeatherfalling(Player player, double damage) {
if (!Bridge1_13.hasIsSwimming()) return damage;
if (BridgeEnchant.hasFeatherFalling() && damage > 0.0) {
int levelench = BridgeEnchant.getFeatherFallingLevel(player);
if (levelench > 0) {
int tmp = levelench * 3;
if (tmp > 20) tmp = 20;
return damage * (1.0 - tmp / 25.0);
}
}
return damage;
}
/** Calculate the damage was reduced by HoneyBlock */
public static double calcReducedDamageByHB(final Player player ,final double damage) {
final Material blockmat = player.getLocation().subtract(0, 0.5, 0).getBlock().getType();
if ((BlockProperties.getBlockFlags(blockmat) & BlockProperties.F_STICKY) != 0) return Math.round(damage / 5);
return damage;
}
/**
* Estimate the applicable fall height for the given data.
@@ -27,6 +27,8 @@ import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.ViolationData;
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.compat.blocks.changetracker.BlockChangeTracker;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.collision.Axis;
@@ -165,7 +167,7 @@ public class Passable extends Check {
rayTracing.setIgnoreInitiallyColliding(false);
//rayTracing.setCutOppositeDirectionMargin(false);
//getEyeHeight() is a way to check isSwimming but not in water
if (rayTracing.collides() && !player.isSwimming() && !player.isGliding() && !(player.getEyeHeight()<0.45)) {
if (rayTracing.collides() && !Bridge1_13.isSwimming(player) && !Bridge1_9.isGliding(player) && !(player.getEyeHeight()<0.45)) {
tags = "raytracing_collide_";
}
else if (rayTracing.getStepsDone() >= rayTracing.getMaxSteps()) {
File diff suppressed because it is too large. Load diff
@@ -219,6 +219,7 @@ public class VehicleChecks extends CheckListener {
debug(player, "onPlayerMoveVehicle: vehicle: " + vehicle);
}
data.wasInVehicle = true;
data.waspreInVehicle = true;
data.sfHoverTicks = -1;
data.removeAllVelocity();
data.sfLowJump = false;
@@ -552,7 +553,7 @@ public class VehicleChecks extends CheckListener {
vehicleEnvelope.prepareCheckDetails(vehicle, moveInfo, thisMove);
// Check.
final SetBackEntry tempNewTo = vehicleEnvelope.check(player, vehicle,
thisMove, fake, data, cc, pData);
thisMove, fake, data, cc, pData, moveInfo);
if (tempNewTo != null) {
newTo = tempNewTo;
}
@@ -727,6 +728,9 @@ public class VehicleChecks extends CheckListener {
if (debug) {
debug(player, "Vehicle enter: first vehicle: " + vehicle.getClass().getName());
}
data.waspreInVehicle = true;
// Check for nested vehicles.
final Entity lastVehicle = passengerUtil.getLastNonPlayerVehicle(vehicle, true);
if (lastVehicle == null) {
@@ -982,4 +986,4 @@ public class VehicleChecks extends CheckListener {
NCPAPIProvider.getNoCheatPlusAPI().getLogManager().debug(Streams.TRACE_FILE, builder.toString());
}
}
}
@@ -17,12 +17,18 @@ package fr.neatmonster.nocheatplus.checks.moving.vehicle;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import fr.neatmonster.nocheatplus.actions.ParameterName;
import fr.neatmonster.nocheatplus.checks.Check;
@@ -36,9 +42,14 @@ import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
import fr.neatmonster.nocheatplus.checks.moving.model.VehicleMoveData;
import fr.neatmonster.nocheatplus.checks.moving.model.VehicleMoveInfo;
import fr.neatmonster.nocheatplus.checks.workaround.WRPT;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.PotionUtil;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
import fr.neatmonster.nocheatplus.utilities.StringUtil;
import fr.neatmonster.nocheatplus.utilities.location.RichEntityLocation;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
/**
* Vehicle moving envelope check, for Minecraft 1.9 and higher.
@@ -107,7 +118,7 @@ public class VehicleEnvelope extends Check {
public SetBackEntry check(final Player player, final Entity vehicle,
final VehicleMoveData thisMove, final boolean isFake,
final MovingData data, final MovingConfig cc,
final IPlayerData pData) {
final IPlayerData pData, final VehicleMoveInfo moveInfo) {
final boolean debug = pData.isDebugActive(type);
// Delegate to a sub-check.
tags.clear();
@@ -117,7 +128,7 @@ public class VehicleEnvelope extends Check {
data.ws.setJustUsedIds(debugDetails); // Add just used workaround ids to this list directly, for now.
}
final boolean violation = checkEntity(player, vehicle, thisMove, isFake,
data, cc, debug);
data, cc, debug, moveInfo);
if (debug && !debugDetails.isEmpty()) {
debugDetails(player);
debugDetails.clear();
@@ -153,12 +164,14 @@ public class VehicleEnvelope extends Check {
debugDetails.clear();
}
private double getHDistCap(final EntityType type, final MovingConfig cc) {
private double getHDistCap(final EntityType type, final MovingConfig cc, final VehicleMoveData thisMove) {
final Double v = cc.vehicleEnvelopeHorizontalSpeedCap.get(type);
if (v == null) {
if (type == EntityType.BOAT && (thisMove.from.onIce || thisMove.to.onIce)) return 4.1;
return cc.vehicleEnvelopeHorizontalSpeedCap.get(null);
}
else {
if (type == EntityType.BOAT && (thisMove.from.onIce || thisMove.to.onIce)) return v * 2.5;
return v;
}
}
@@ -166,11 +179,16 @@ public class VehicleEnvelope extends Check {
private boolean checkEntity(final Player player, final Entity vehicle,
final VehicleMoveData thisMove, final boolean isFake,
final MovingData data, final MovingConfig cc,
final boolean debug) {
final boolean debug, final VehicleMoveInfo moveInfo) {
boolean violation = false;
long now = System.currentTimeMillis();
if (debug) {
debugDetails.add("inair: " + data.sfJumpPhase);
}
if (isBubbleColumn(moveInfo.from)
|| (isBouncingBlock(moveInfo.from) && thisMove.yDistance >= 0.0 && thisMove.yDistance <= 1.0)) {
data.timeVehicletoss = System.currentTimeMillis();
}
// Medium dependent checking.
@@ -178,7 +196,13 @@ public class VehicleEnvelope extends Check {
// Maximum thinkable horizontal speed.
// TODO: Further distinguish, best set in CheckDetails.
if (maxDistHorizontal(thisMove, getHDistCap(checkDetails.simplifiedType, cc))) { // Override type for now.
if (vehicle instanceof LivingEntity) {
Double speed = PotionUtil.getPotionEffectAmplifier((LivingEntity)vehicle, PotionEffectType.SPEED);
if (!Double.isInfinite(speed)) {
if (maxDistHorizontal(thisMove, getHDistCap(checkDetails.simplifiedType, cc, thisMove) * (1 + 0.2 * (speed+1)))) return true;
} else if (maxDistHorizontal(thisMove, getHDistCap(checkDetails.simplifiedType, cc, thisMove) + (checkDetails.canJump ? 0.18 : 0.0))) return true;
} else
if (maxDistHorizontal(thisMove, getHDistCap(checkDetails.simplifiedType, cc, thisMove))) { // Override type for now.
return true;
}
@@ -252,7 +276,7 @@ public class VehicleEnvelope extends Check {
}
else if (checkDetails.inAir) {
// In-air move.
if (checkInAir(thisMove, data, debug)) {
if (checkInAir(thisMove, data, debug, vehicle, moveInfo)) {
violation = true;
}
}
@@ -268,11 +292,23 @@ public class VehicleEnvelope extends Check {
// TODO: At least do something here?
}
}
if (vehicle instanceof LivingEntity) {
Double levitation = Bridge1_9.getLevitationAmplifier((LivingEntity)vehicle);
if (!Double.isInfinite(levitation)) {
checkDetails.maxAscend += 0.046 * (levitation + 1);
violation = false;
}
}
// Maximum ascend speed.
if (checkDetails.checkAscendMuch && thisMove.yDistance > checkDetails.maxAscend) {
tags.add("ascend_much");
violation = true;
}
if (data.timeVehicletoss + 2000 > now && thisMove.yDistance < 4.0) {
violation = false;
}
// Maximum descend speed.
if (checkDetails.checkDescendMuch && thisMove.yDistance < -MagicVehicle.maxDescend) {
// TODO: At times it looks like one move is skipped, resulting in double distance ~ -5 and at the same time 'vehicle moved too quickly'.
@@ -280,6 +316,61 @@ public class VehicleEnvelope extends Check {
tags.add("descend_much");
violation = true;
}
if (vehicle instanceof LivingEntity) {
final VehicleMoveData firstPastMove = data.vehicleMoves.getFirstPastMove();
if (thisMove.hDistance > 0.1D && thisMove.yDistance == 0D && !thisMove.to.onGround && !thisMove.from.onGround
&& firstPastMove.valid && firstPastMove.yDistance == 0D
&& thisMove.to.inWater && thisMove.from.inWater
&& !thisMove.headObstructed // TODO: Might decrease margin here.
) {
// TODO: Relative hdistance.
// TODO: Might check actual bounds (collidesBlock). Might implement + use BlockProperties.getCorrectedBounds or getSomeHeight.
violation = true;
tags.add("waterwalk");
}
Block blockUnder = vehicle.getLocation().subtract(0, 0.3, 0).getBlock();
Material blockAbove = vehicle.getLocation().add(0, 0.10, 0).getBlock().getType();
if (blockUnder != null && blockAbove != null && blockUnder.getType().toString().endsWith("WATER")) {
if (blockAbove == Material.AIR) {
// hDist and vDist checks, simply checks for horizontal movement with little y distance
if (thisMove.hDistance > 0.11D && thisMove.yDistance <= 0.1D && !thisMove.to.onGround && !thisMove.from.onGround
&& firstPastMove.valid && firstPastMove.yDistance == thisMove.yDistance || firstPastMove.yDistance == thisMove.yDistance * -1 && firstPastMove.yDistance != 0D
&& !thisMove.headObstructed) {
// Prevent being flagged if a vehicle transitions from a block to water and the player falls into the water.
if (!(thisMove.yDistance < 0 && thisMove.yDistance != 0 && firstPastMove.yDistance < 0 && firstPastMove.yDistance != 0)) {
violation = true;
tags.add("watermove");
}
}
//Bouncing on water
//if (!violation && firstPastMove.valid && !thisMove.to.onGround && !thisMove.from.onGround
//&& (thisMove.from.getY() < thisMove.to.getY()) && !(firstPastMove.from.inLiquid && !thisMove.to.inLiquid)
//&& !firstPastMove.from.onGround && !thisMove.headObstructed) {
// boolean tag = false;
// if (Bridge1_13.hasIsSwimming()) {
// if (((Levelled)blockUnder.getBlockData()).getLevel() == 0) tag = true;
// } else if (blockUnder.getData() == 0) tag = true;
// Block blockUnder2 = blockUnder.getRelative(BlockFace.DOWN);
// if (checkDetails.canJump) {
// if (BlockProperties.isGround(blockUnder2.getType()))
// tag = false;
// else {
// if (BlockProperties.isGround(blockUnder2.getRelative(BlockFace.EAST).getType())
// || BlockProperties.isGround(blockUnder2.getRelative(BlockFace.WEST).getType())
// || BlockProperties.isGround(blockUnder2.getRelative(BlockFace.NORTH).getType())
// || BlockProperties.isGround(blockUnder2.getRelative(BlockFace.SOUTH).getType())
// ) tag = false;
// }
// }
// if (tag) {
// violation = true;
// tags.add("waterjump");
// }
//}
}
}
}
if (!violation) {
// No violation.
@@ -305,6 +396,15 @@ public class VehicleEnvelope extends Check {
return violation;
}
private boolean isBouncingBlock(RichEntityLocation from) {
return BlockProperties.collides(from.getBlockCache(), from.getMinX(), from.getMinY() - 1.0, from.getMinZ(), from.getMaxX(), from.getMaxY(), from.getMaxZ(), BlockProperties.F_BOUNCE25);
}
private boolean isBubbleColumn(RichEntityLocation from) {
if (!Bridge1_13.hasIsSwimming()) return false;
return BlockProperties.collidesId(from.getBlockCache(), from.getMinX(), from.getMinY(), from.getMinZ(), from.getMaxX(), from.getMaxY(), from.getMaxZ(), Material.BUBBLE_COLUMN);
}
/**
* Prepare checkDetails according to vehicle-specific interpretation of side
@@ -359,7 +459,7 @@ public class VehicleEnvelope extends Check {
// Generic settings.
// (maxAscend is not checked for stepping up blocks)
if (checkDetails.canJump) {
checkDetails.maxAscend = 1.0; // Coarse envelope. Actual lift off gain should be checked on demand.
checkDetails.maxAscend = 1.2; // Coarse envelope. Actual lift off gain should be checked on demand.
}
// Climbable
if (checkDetails.canClimb) {
@@ -381,7 +481,9 @@ public class VehicleEnvelope extends Check {
* @return
*/
private boolean checkInAir(final VehicleMoveData thisMove, final MovingData data,
final boolean debug) {
final boolean debug, final Entity vehicle, final VehicleMoveInfo moveInfo) {
final RichEntityLocation from = moveInfo.from;
final RichEntityLocation to = moveInfo.to;
// TODO: Distinguish sfJumpPhase and inAirDescendCount (after reaching the highest point).
@@ -417,8 +519,11 @@ public class VehicleEnvelope extends Check {
final double maxDescend = getInAirMaxDescend(thisMove, data);
if (data.sfJumpPhase > (checkDetails.canJump ? MagicVehicle.maxJumpPhaseAscend : 1)
&& thisMove.yDistance > Math.max(minDescend, -checkDetails.gravityTargetSpeed)) {
tags.add("slow_fall_vdist");
violation = true;
if (ColliesHoneyBlock(from)) data.sfJumpPhase = 5; else
if (!(vehicle instanceof LivingEntity && !Double.isInfinite(Bridge1_13.getSlowfallingAmplifier((LivingEntity)vehicle)))) {
tags.add("slow_fall_vdist");
violation = true;
}
}
// Fast falling (vdist).
else if (data.sfJumpPhase > 1 && thisMove.yDistance < maxDescend) {
@@ -466,5 +571,9 @@ public class VehicleEnvelope extends Check {
return false;
}
}
private boolean ColliesHoneyBlock(RichEntityLocation from) {
return BlockProperties.collides(from.getBlockCache(), from.getMinX() - 0.1, from.getMinY(), from.getMinZ() - 0.1, from.getMaxX() + 0.1, from.getMaxY() + 0.3, from.getMaxZ() + 0.1, BlockProperties.F_STICKY);
}
}
}
@@ -39,6 +39,7 @@ public class NetConfig extends ACheckConfig {
Permissions.NET_FLYINGFREQUENCY,
Permissions.NET_KEEPALIVEFREQUENCY,
Permissions.NET_PACKETFREQUENCY,
Permissions.NET_WRONGTURN,
};
public static RegisteredPermission[] getPreferKeepUpdatedPermissions() {
@@ -57,10 +58,6 @@ public class NetConfig extends ACheckConfig {
public final float attackFrequencyLimitSecondsEight;
public final float attackFrequencyImprobableWeight;
public final ActionList attackFrequencyActions;
public final int fightSyncResetCount;
public final int fightSyncThreshold;
public final ActionList fightSyncActions;
public final int flyingFrequencySeconds;
public final double flyingFrequencyPPS;
@@ -75,6 +72,8 @@ public class NetConfig extends ACheckConfig {
public final float packetFrequencyPacketsPerSecond;
public final int packetFrequencySeconds;
public final ActionList packetFrequencyActions;
public final ActionList wrongTurnActions;
/** Maximum distance for lightning effects (squared). */
public final double soundDistanceSq;
@@ -96,10 +95,6 @@ public class NetConfig extends ACheckConfig {
attackFrequencyImprobableWeight = (float) config.getDouble(ConfPaths.NET_ATTACKFREQUENCY_IMPROBABLE_WEIGHT);
attackFrequencyActions = config.getOptimizedActionList(ConfPaths.NET_ATTACKFREQUENCY_ACTIONS, Permissions.NET_ATTACKFREQUENCY);
fightSyncResetCount = config.getInt(ConfPaths.NET_FIGHTSYNC_RESETCOUNT);
fightSyncThreshold = config.getInt(ConfPaths.NET_FIGHTSYNC_THRESHOLD);
fightSyncActions = config.getOptimizedActionList(ConfPaths.NET_FIGHTSYNC_ACTIONS, Permissions.NET_ATTACKFREQUENCY);
flyingFrequencySeconds = Math.max(1, globalConfig.getInt(ConfPaths.NET_FLYINGFREQUENCY_SECONDS));
flyingFrequencyPPS = Math.max(1.0, globalConfig.getDouble(ConfPaths.NET_FLYINGFREQUENCY_PACKETSPERSECOND));
flyingFrequencyActions = config.getOptimizedActionList(ConfPaths.NET_FLYINGFREQUENCY_ACTIONS, Permissions.NET_FLYINGFREQUENCY);
@@ -119,6 +114,8 @@ public class NetConfig extends ACheckConfig {
packetFrequencyPacketsPerSecond = config.getInt(ConfPaths.NET_PACKETFREQUENCY_PPS);
packetFrequencySeconds = config.getInt(ConfPaths.NET_PACKETFREQUENCY_SECONDS);
packetFrequencyActions = config.getOptimizedActionList(ConfPaths.NET_PACKETFREQUENCY_ACTIONS, Permissions.NET_PACKETFREQUENCY);
wrongTurnActions = config.getOptimizedActionList(ConfPaths.NET_WRONGTURN_ACTIONS, Permissions.NET_WRONGTURN);
double dist = config.getDouble(ConfPaths.NET_SOUNDDISTANCE_MAXDISTANCE);
soundDistanceSq = dist * dist;
@@ -18,7 +18,6 @@ import java.util.LinkedList;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.checks.access.ACheckData;
@@ -35,18 +34,12 @@ import fr.neatmonster.nocheatplus.utilities.ds.count.ActionFrequency;
*
*/
public class NetData extends ACheckData {
public double fightSyncVL;
// Reentrant lock.
private final Lock lock = new ReentrantLock();
// AttackFrequency
public ActionFrequency attackFrequencySeconds = new ActionFrequency(16, 500);
public Location lastHitLocation;
public int fightSyncReset;
public int fightSyncCount;
// FlyingFrequency
/** All flying packets, use System.currentTimeMillis() for time. */
@@ -54,6 +47,7 @@ public class NetData extends ACheckData {
public boolean flyingFrequencyOnGround = false;
public long flyingFrequencyTimeOnGround = 0L;
public long flyingFrequencyTimeNotOnGround = 0L;
public double diffpacketVLs = 0;
/**
* Monitors redundant packets, when more than 20 packets per second are
* sent. Use System.currentTimeMillis() for time.
@@ -66,6 +60,9 @@ public class NetData extends ACheckData {
* time of the last event. System.currentTimeMillis() is used.
*/
public ActionFrequency keepAliveFreq = new ActionFrequency(20, 1000);
// Wrong Turn
public double wrongTurnVL = 0;
// Shared.
/**
@@ -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.checks.net;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.checks.Check;
import fr.neatmonster.nocheatplus.checks.CheckType;
public class WrongTurn extends Check {
public WrongTurn() {
super(CheckType.NET_WRONGTURN);
}
public boolean check(final Player player, final float pitch, final NetData data, final NetConfig cc) {
boolean cancel = false;
if (Math.abs(pitch) > 90.0 || pitch < -90.0) {
data.wrongTurnVL++;
if (executeActions(player, data.wrongTurnVL, 1, cc.wrongTurnActions).willCancel()) {
cancel = true;
}
}
return cancel;
}
}
@@ -14,18 +14,35 @@
*/
package fr.neatmonster.nocheatplus.compat;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import fr.neatmonster.nocheatplus.utilities.PotionUtil;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
public class Bridge1_13 {
private static final PotionEffectType SLOWFALLING = PotionEffectType.getByName("SLOW_FALLING");
private static final PotionEffectType DOLPHINSGRACE = PotionEffectType.getByName("DOLPHINS_GRACE");
private static final boolean hasIsRiptiding = ReflectionUtil.getMethodNoArgs(Player.class, "isRiptiding", boolean.class) != null;
private static final boolean hasIsSwimming = ReflectionUtil.getMethodNoArgs(Player.class, "isSwimming", boolean.class) != null;
public static boolean hasSlowfalling() {
return SLOWFALLING != null;
}
public static boolean hasDolphinGrace() {
return DOLPHINSGRACE != null;
}
public static boolean hasIsRiptiding() {
return hasIsRiptiding;
}
public static boolean hasIsSwimming() {
return hasIsSwimming;
}
/**
* Test for the 'slowfalling' potion effect.
*
@@ -38,4 +55,32 @@ public class Bridge1_13 {
}
return PotionUtil.getPotionEffectAmplifier(player, SLOWFALLING);
}
/**
* Test for the 'slowfalling' potion effect.
*
* @param LivingEntity
* @return Double.NEGATIVE_INFINITY if not present.
*/
public static double getSlowfallingAmplifier(final LivingEntity entity) {
if (SLOWFALLING == null) {
return Double.NEGATIVE_INFINITY;
}
return PotionUtil.getPotionEffectAmplifier(entity, SLOWFALLING);
}
public static double getDolphinGraceAmplifier(final Player player) {
if (DOLPHINSGRACE == null) {
return Double.NEGATIVE_INFINITY;
}
return PotionUtil.getPotionEffectAmplifier(player, DOLPHINSGRACE);
}
public static boolean isRiptiding(final Player player) {
return hasIsRiptiding ? player.isRiptiding() : false;
}
public static boolean isSwimming(final Player player) {
return hasIsSwimming ? player.isSwimming() : false;
}
}
@@ -15,6 +15,7 @@
package fr.neatmonster.nocheatplus.compat;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
@@ -83,6 +84,19 @@ public class Bridge1_9 {
}
return PotionUtil.getPotionEffectAmplifier(player, LEVITATION);
}
/**
* Test for the 'levitation' potion effect.
*
* @param player
* @return Double.NEGATIVE_INFINITY if not present.
*/
public static double getLevitationAmplifier(final LivingEntity entity) {
if (LEVITATION == null) {
return Double.NEGATIVE_INFINITY;
}
return PotionUtil.getPotionEffectAmplifier(entity, LEVITATION);
}
/**
* Gliding + wearing elytra.
@@ -35,6 +35,10 @@ public final class BridgeEnchant {
private final static Enchantment DEPTH_STRIDER = parseEnchantment("DEPTH_STRIDER");
private final static Enchantment THORNS = parseEnchantment("THORNS");
private final static Enchantment RIPTIDE = parseEnchantment("RIPTIDE");
private final static Enchantment FEATHER_FALLING = parseEnchantment("PROTECTION_FALL");
/**
* Retrieve the maximum level for an enchantment, present in armor slots.
@@ -90,6 +94,10 @@ public final class BridgeEnchant {
public static boolean hasDepthStrider() {
return DEPTH_STRIDER != null;
}
public static boolean hasFeatherFalling() {
return FEATHER_FALLING != null;
}
/**
* Check if the player might return some damage due to the "thorns"
@@ -102,6 +110,17 @@ public final class BridgeEnchant {
return hasArmor(player, THORNS);
}
/**
*
* @param player
* @return Maximum level of FEATHER_FALLING found on armor items, capped at 4.
* Will return 0 if not available.
*/
public static int getFeatherFallingLevel(final Player player) {
// Cap at three.
return Math.min(4, getMaxLevelArmor(player, FEATHER_FALLING));
}
/**
*
* @param player
@@ -112,5 +131,34 @@ public final class BridgeEnchant {
// Cap at three.
return Math.min(3, getMaxLevelArmor(player, DEPTH_STRIDER));
}
/**
* Retrieve the maximum level for an enchantment, present in main and off hand slot.
*
* @param player
* @param enchantment
* If null, 0 will be returned.
* @return 0 if none found, or the maximum found.
*/
private static int getTrident(final Player player, final Enchantment enchantment) {
if (enchantment == null) {
return 0;
}
int level = 0;
// Find the maximum level for the given enchantment.
final ItemStack mainhand = player.getInventory().getItemInMainHand();
final ItemStack offhand = player.getInventory().getItemInOffHand();
if (mainhand.getType().toString().equals("TRIDENT")) {
return Math.max(mainhand.getEnchantmentLevel(enchantment), level);
}
if (offhand.getType().toString().equals("TRIDENT")) {
level = Math.max(offhand.getEnchantmentLevel(enchantment), level);
}
return level;
}
public static int getRiptideLevel(final Player player) {
return Math.min(3, getTrident(player, RIPTIDE));
}
}
@@ -276,7 +276,7 @@ public class BridgeMaterial {
"repeating_command_block", "command_repeating");
/** Sign block. */
public static final Material SIGN = getFirstNotNull("acacia_sign", "birch_sign", "dark_oak_sign", "jungle_sign", "oak_sign", "spruce_sign", "acacia_wall_sign", "birch_wall_sign", "dark_oak_wall_sign", "jungle_wall_sign", "oak_wall_sign", "spruce_wall_sign", "sign", "sign_post", "wall_sign");
public static final Material SIGN = getFirstNotNull("acacia_sign", "birch_sign", "dark_oak_sign", "jungle_sign", "oak_sign", "spruce_sign", "acacia_wall_sign", "birch_wall_sign", "dark_oak_wall_sign", "jungle_wall_sign", "oak_wall_sign", "spruce_wall_sign", "sign_post", "sign", "wall_sign");
/** Some skull for reference. */
public static final Material SKELETON_SKULL = getFirst("skeleton_skull", "skull");
@@ -291,6 +291,8 @@ public class BridgeMaterial {
"stone_brick_stairs", "smooth_stairs");
public static final Material STONE_PRESSURE_PLATE = getFirstNotNull(
"stone_pressure_plate", "stone_plate");
public static final Material WOODEN_PRESSURE_PLATE = getFirstNotNull(
"wooden_pressure_plate", "wood_plate", "acacia_pressure_plate", "birch_pressure_plate", "dark_oak_pressure_plate", "jungle_pressure_plate", "oak_pressure_plate", "spruce_pressure_plate");
public static final Material STONE_SLAB = getFirstNotNull("stone_slab", "step");
public static final Material SUGAR_CANE = getFirstNotNull("sugar_cane_block", "sugar_cane"); // Reversed
@@ -36,10 +36,6 @@ public class BlocksMC1_13 implements BlockPropertiesSetup {
@Override
public void setupBlockProperties(WorldConfigProvider<?> worldConfigProvider) {
// Remove flag for these blocks
BlockFlags.removeFlags("TALL_SEAGRASS", BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
BlockFlags.removeFlags("SEAGRASS", BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
BlockFlags.removeFlags("KELP_PLANT", BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
// Add flag for anvil
BlockFlags.addFlags("ANVIL", BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
// Change flag for walls
@@ -83,6 +79,12 @@ public class BlocksMC1_13 implements BlockPropertiesSetup {
// Shulker boxes.
for (Material mat : MaterialUtil.SHULKER_BOXES) {
BlockFlags.addFlags(mat, BlockProperties.F_XZ100 | BlockFlags.SOLID_GROUND);
BlockProperties.setBlockProps(mat, new BlockProps(BlockProperties.woodPickaxe, 2,
BlockProperties.secToMs(3.0, 1.45, 0.7, 0.45, 0.35, 0.2)));
}
for (Material mat : MaterialUtil.INFESTED_BLOCKS) {
BlockProperties.setBlockProps(mat, BlockProperties.instantType);
}
// Stone types.
@@ -144,7 +144,7 @@ public class BlocksMC1_14 implements BlockPropertiesSetup{
BlockProperties.setBlockProps("BELL", new BlockProperties.BlockProps(BlockProperties.woodPickaxe, 7f, BlockProperties.secToMs(23.0, 3.8, 2.2, 1, 1.5, 0.8)));
BlockProperties.setBlockProps("LANTERN", new BlockProperties.BlockProps(BlockProperties.woodPickaxe, 6.0f, BlockProperties.secToMs(17.0, 2.8, 1.8, 0.7, 0.8, 0.5)));
BlockFlags.addFlags("LANTERN", BlockProperties.F_GROUND | BlockProperties.F_GROUND_HEIGHT);
BlockFlags.addFlags("SWEET_BERRY_BUSH", BlockProperties.F_COBWEB);
BlockFlags.addFlags("SWEET_BERRY_BUSH", BlockProperties.F_COBWEB | BlockProperties.F_COBWEB2);
StaticLog.logInfo("Added block-info for Minecraft 1.14 blocks.");
}
@@ -0,0 +1,31 @@
package fr.neatmonster.nocheatplus.compat.blocks.init.vanilla;
import fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup;
import fr.neatmonster.nocheatplus.compat.blocks.init.BlockInit;
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
import fr.neatmonster.nocheatplus.logging.StaticLog;
import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
public class BlocksMC1_15 implements BlockPropertiesSetup{
public BlocksMC1_15() {
BlockInit.assertMaterialExists("BEEHIVE");
BlockInit.assertMaterialExists("BEE_NEST");
BlockInit.assertMaterialExists("HONEY_BLOCK");
BlockInit.assertMaterialExists("HONEYCOMB_BLOCK");
}
@SuppressWarnings("deprecation")
@Override
public void setupBlockProperties(WorldConfigProvider<?> worldConfigProvider) {
BlockFlags.addFlags("BEEHIVE", BlockFlags.FULLY_SOLID_BOUNDS);
BlockFlags.addFlags("BEE_NEST", BlockFlags.FULLY_SOLID_BOUNDS);
BlockFlags.addFlags("HONEYCOMB_BLOCK", BlockFlags.FULLY_SOLID_BOUNDS);
BlockFlags.addFlags("HONEY_BLOCK", BlockFlags.SOLID_GROUND | BlockProperties.F_STICKY);
BlockProperties.setBlockProps("BEEHIVE", new BlockProperties.BlockProps(BlockProperties.woodAxe, 0.6f, BlockProperties.secToMs(0.85, 0.425, 0.225, 0.13, 0.11, 0.7)));
BlockProperties.setBlockProps("BEE_NEST", new BlockProperties.BlockProps(BlockProperties.woodAxe, 0.3f, BlockProperties.secToMs(0.4, 0.225, 0.11, 0.05, 0.042, 0.0)));
BlockProperties.setBlockProps("HONEYCOMB_BLOCK", new BlockProperties.BlockProps(BlockProperties.noTool, 0.6f));
BlockProperties.setBlockProps("HONEY_BLOCK", BlockProperties.instantType);
StaticLog.logInfo("Added block-info for Minecraft 1.15 blocks.");
}
}
@@ -113,7 +113,7 @@ public class BlocksMC1_5 implements BlockPropertiesSetup {
////////////////////
// 78 Snow
BlockFlags.addFlags("SNOW", BlockProperties.F_HEIGHT_8_INC);
BlockFlags.addFlags("SNOW", BlockProperties.F_HEIGHT_8_INC | BlockProperties.F_XZ100 | BlockProperties.F_GROUND_HEIGHT | BlockProperties.F_GROUND);
BlockFlags.removeFlags("SNOW", BlockProperties.F_HEIGHT_8SIM_INC);
StaticLog.logInfo("Added block-info for Minecraft 1.5 blocks.");
@@ -16,6 +16,7 @@ package fr.neatmonster.nocheatplus.compat.blocks.init.vanilla;
import org.bukkit.Material;
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
import fr.neatmonster.nocheatplus.compat.blocks.BlockPropertiesSetup;
import fr.neatmonster.nocheatplus.compat.blocks.init.BlockInit;
import fr.neatmonster.nocheatplus.config.WorldConfigProvider;
@@ -40,6 +41,8 @@ public class BlocksMC1_6_1 implements BlockPropertiesSetup{
// Hay Bale
BlockInit.setPropsAs("HAY_BLOCK", Material.STONE_BUTTON);
BlockFlags.setFlagsAs("HAY_BLOCK", Material.STONE); // TODO: Assumption (!).
if (BridgeMaterial.getBlock("wall_sign") != null) BlockInit.setAs("WALL_SIGN", BridgeMaterial.SIGN);
// (Carpet via generic setup.)
@@ -52,9 +52,6 @@ public class BlocksMC1_8 implements BlockPropertiesSetup {
}) {
BlockProperties.setBlockProps(mat, props);
}
// Wall Sign
if (BridgeMaterial.getBlock("wall_sign") != null) BlockInit.setAs("WALL_SIGN", BridgeMaterial.SIGN);
// Ladder.
props = new BlockProps(BlockProperties.woodAxe, 0.4f, BlockProperties.secToMs(0.6, 0.3, 0.15, 0.1, 0.075, 0.05));
@@ -41,6 +41,7 @@ public class VanillaBlocksFactory {
setups.add(new BlocksMC1_12());
setups.add(new BlocksMC1_13());
setups.add(new BlocksMC1_14());
setups.add(new BlocksMC1_15());
}
catch(Throwable t){}
for (final BlockPropertiesSetup setup : setups){
@@ -29,7 +29,7 @@ import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
/**
* Multi client protocol support between 1.7.x - 1.13.x.
* Multi client protocol support between 1.7.x - 1.14.x.
*
* @author asofold
*
@@ -39,7 +39,7 @@ public class MultiClientProtocolBlockShapePatch extends AbstractBlockPropertiesP
public MultiClientProtocolBlockShapePatch() {
activation
.neutralDescription("Block shape patch for multi client protocol support around 1.7.x - 1.13.x.")
.neutralDescription("Block shape patch for multi client protocol support around 1.7.x - 1.14.x.")
.advertise(true)
.setConditionsAND()
.notUnitTest()
@@ -53,6 +53,7 @@ public class MultiClientProtocolBlockShapePatch extends AbstractBlockPropertiesP
final List<String> done = new LinkedList<String>();
//This freaks out with 1.8 using viaversion
BlockFlags.addFlags(BridgeMaterial.LILY_PAD,
BlockProperties.F_GROUND
| BlockProperties.F_HEIGHT8_1
@@ -288,6 +288,9 @@ public abstract class ConfPaths {
private static final String BLOCKPLACE_SCAFFOLD = BLOCKPLACE + "scaffold.";
public static final String BLOCKPLACE_SCAFFOLD_CHECK = BLOCKPLACE_SCAFFOLD + SUB_ACTIVE;
public static final String BLOCKPLACE_SCAFFOLD_ANGLE = BLOCKPLACE_SCAFFOLD + "angle";
public static final String BLOCKPLACE_SCAFFOLD_TIME = BLOCKPLACE_SCAFFOLD + "time";
public static final String BLOCKPLACE_SCAFFOLD_SPRINT = BLOCKPLACE_SCAFFOLD + "sprint";
public static final String BLOCKPLACE_SCAFFOLD_ACTIONS = BLOCKPLACE_SCAFFOLD + "actions";
private static final String BLOCKPLACE_SPEED = BLOCKPLACE + "speed.";
@@ -473,6 +476,7 @@ public abstract class ConfPaths {
public static final String FIGHT_CANCELDEAD = FIGHT + "canceldead";
public static final String FIGHT_TOOLCHANGEPENALTY = FIGHT + "toolchangepenalty";
private static final String FIGHT_PVP = FIGHT + "pvp.";
public static final String FIGHT_MAXLOOPLETENCYTICKS = FIGHT + "maxloopletencyticks";
public static final String FIGHT_PVP_KNOCKBACKVELOCITY = FIGHT_PVP + "knockbackvelocity";
private static final String FIGHT_ANGLE = FIGHT + "angle.";
@@ -484,12 +488,6 @@ public abstract class ConfPaths {
public static final String FIGHT_ANGLE_THRESHOLD_SWITCH = FIGHT_ANGLE_THRESHOLD + "average_switch";
public static final String FIGHT_ANGLE_ACTIONS = FIGHT_ANGLE + "actions";
private static final String FIGHT_CLICKPATTERN = FIGHT + "clickpattern.";
public static final String FIGHT_CLICKPATTERN_CHECK = FIGHT_CLICKPATTERN + SUB_ACTIVE;
public static final String FIGHT_CLICKPATTERN_RANGE = FIGHT_CLICKPATTERN + "range";
public static final String FIGHT_CLICKPATTERN_PENALTY = FIGHT_CLICKPATTERN + "penalty";
public static final String FIGHT_CLICKPATTERN_ACTIONS = FIGHT_CLICKPATTERN + "actions";
private static final String FIGHT_CRITICAL = FIGHT + "critical.";
public static final String FIGHT_CRITICAL_CHECK = FIGHT_CRITICAL + SUB_ACTIVE;
// TODO: Deprecate or rename (->falldistancemin)?
@@ -499,6 +497,9 @@ public abstract class ConfPaths {
private static final String FIGHT_DIRECTION = FIGHT + "direction.";
public static final String FIGHT_DIRECTION_CHECK = FIGHT_DIRECTION + SUB_ACTIVE;
public static final String FIGHT_DIRECTION_STRICT = FIGHT_DIRECTION + "strict";
public static final String FIGHT_DIRECTION_FAILALL = FIGHT_DIRECTION + "failall";
public static final String FIGHT_DIRECTION_LOOPPRECISION = FIGHT_DIRECTION + "loopprecision";
public static final String FIGHT_DIRECTION_STRICTANGLEPRECISION = FIGHT_DIRECTION + "strictangleprecision";
public static final String FIGHT_DIRECTION_PENALTY = FIGHT_DIRECTION + "penalty";
public static final String FIGHT_DIRECTION_ACTIONS = FIGHT_DIRECTION + "actions";
@@ -533,6 +534,7 @@ public abstract class ConfPaths {
public static final String FIGHT_SELFHIT = FIGHT + "selfhit.";
public static final String FIGHT_SELFHIT_CHECK = FIGHT_SELFHIT + SUB_ACTIVE;
public static final String FIGHT_SELFHIT_EXCLUDEPROJECTILE = FIGHT_SELFHIT + "excludeprojectile";
public static final String FIGHT_SELFHIT_ACTIONS = FIGHT_SELFHIT + "actions";
@@ -552,11 +554,7 @@ public abstract class ConfPaths {
public static final String FIGHT_SPEED_IMPROBABLE_FEEDONLY = FIGHT_SPEED_IMPROBABLE + "feedonly";
public static final String FIGHT_SPEED_IMPROBABLE_WEIGHT = FIGHT_SPEED_IMPROBABLE + "weight";
public static final String FIGHT_SPEED_ACTIONS = FIGHT_SPEED + "actions";
private static final String FIGHT_WRONGTURN = FIGHT + "wrongturn.";
public static final String FIGHT_WRONGTURN_CHECK = FIGHT_WRONGTURN + SUB_ACTIVE;
public static final String FIGHT_WRONGTURN_ACTIONS = FIGHT_WRONGTURN + "actions";
private static final String FIGHT_YAWRATE = FIGHT + "yawrate.";
public static final String FIGHT_YAWRATE_CHECK = FIGHT_YAWRATE + SUB_ACTIVE;
@@ -636,6 +634,8 @@ public abstract class ConfPaths {
public static final String MOVING_CREATIVEFLY_IGNOREALLOWFLIGHT = MOVING_CREATIVEFLY + "ignoreallowflight";
public static final String MOVING_CREATIVEFLY_MODEL = MOVING_CREATIVEFLY + SUB_MODEL + ".";
public static final String MOVING_CREATIVEFLY_ACTIONS = MOVING_CREATIVEFLY + "actions";
public static final String MOVING_CREATIVEFLY_EYTRA_FWRESET = MOVING_CREATIVEFLY_MODEL + "elytra.resetFwOnground";
public static final String MOVING_CREATIVEFLY_EYTRA_STRICT = MOVING_CREATIVEFLY_MODEL + "elytra.strict";
private static final String MOVING_MOREPACKETS = MOVING + "morepackets.";
public static final String MOVING_MOREPACKETS_CHECK = MOVING_MOREPACKETS + SUB_ACTIVE;
@@ -695,6 +695,13 @@ public abstract class ConfPaths {
public static final String MOVING_SURVIVALFLY_SETBACKPOLICY_FALLDAMAGE = MOVING_SURVIVALFLY_SETBACKPOLICY + "falldamage";
public static final String MOVING_SURVIVALFLY_SETBACKPOLICY_VOIDTOVOID = MOVING_SURVIVALFLY_SETBACKPOLICY + "voidtovoid";
public static final String MOVING_SURVIVALFLY_ACTIONS = MOVING_SURVIVALFLY + "actions";
private static final String MOVING_SURVIVALFLY_VLFREQUENCY = MOVING_SURVIVALFLY_LENIENCY + "violationfrequency.";
public static final String MOVING_SURVIVALFLY_VLFREQUENCY_ACTIVE = MOVING_SURVIVALFLY_VLFREQUENCY + "active";
public static final String MOVING_SURVIVALFLY_VLFREQUENCY_DEBUG = MOVING_SURVIVALFLY_VLFREQUENCY + "debug";
public static final String MOVING_SURVIVALFLY_VLFREQUENCY_MAXTOTALVLS = MOVING_SURVIVALFLY_VLFREQUENCY + "maxleniencyvl";
public static final String MOVING_SURVIVALFLY_VLFREQUENCY_MINADDEDVLS = MOVING_SURVIVALFLY_VLFREQUENCY + "mintoadd";
public static final String MOVING_SURVIVALFLY_VLFREQUENCY_MOVECOUNT = MOVING_SURVIVALFLY_VLFREQUENCY + "movecount";
public static final String MOVING_SURVIVALFLY_VLFREQUENCY_MOREVLS = MOVING_SURVIVALFLY_VLFREQUENCY + "morevls";
@GlobalConfig
public static final String MOVING_SURVIVALFLY_HOVER = MOVING_SURVIVALFLY + "hover.";
@@ -770,12 +777,6 @@ public abstract class ConfPaths {
private static final String NET_ATTACKFREQUENCY_IMPROBABLE = NET_ATTACKFREQUENCY + "improbable.";
public static final String NET_ATTACKFREQUENCY_IMPROBABLE_WEIGHT = NET_ATTACKFREQUENCY_IMPROBABLE + "weight";
public static final String NET_ATTACKFREQUENCY_ACTIONS = NET_ATTACKFREQUENCY + "actions";
private static final String NET_FIGHTSYNC = NET + "fightsync.";
public static final String NET_FIGHTSYNC_ACTIVE = NET_FIGHTSYNC + SUB_ACTIVE;
public static final String NET_FIGHTSYNC_THRESHOLD = NET_FIGHTSYNC + "threshold";
public static final String NET_FIGHTSYNC_RESETCOUNT = NET_FIGHTSYNC + "reset_count";
public static final String NET_FIGHTSYNC_ACTIONS = NET_FIGHTSYNC + "actions";
private static final String NET_FLYINGFREQUENCY = NET + "flyingfrequency.";
public static final String NET_FLYINGFREQUENCY_ACTIVE = NET_FLYINGFREQUENCY + SUB_ACTIVE;
@@ -810,6 +811,10 @@ public abstract class ConfPaths {
private static final String NET_SUPERSEDED = NET + "superseded.";
private static final String NET_SUPERSEDED_FLYING = NET_SUPERSEDED + "flying.";
public static final String NET_SUPERSEDED_FLYING_CANCELWAITING = NET_SUPERSEDED_FLYING + "cancelwaiting";
private static final String NET_WRONGTURN = NET + "wrongturn.";
public static final String NET_WRONGTURN_ACTIVE = NET_WRONGTURN + SUB_ACTIVE;
public static final String NET_WRONGTURN_ACTIONS = NET_WRONGTURN + "actions";
public static final String STRINGS = "strings";
@@ -948,6 +953,10 @@ public abstract class ConfPaths {
public static final String FIGHT_CRITICAL_CANCEL_CANCEL = "checks.fight.critical.cancel.cancel";
@Deprecated
public static final String FIGHT_CRITICAL_CANCEL_DIVIDEDAMAGE = "checks.fight.critical.cancel.dividedamage";
@Deprecated // Does this need to be done?
private static final String FIGHT_CLICKPATTERN = "checks.fight.clickpattern";
@Deprecated
private static final String NET_FIGHTSYNC = "checks.net.fightsync";
/**
* Get moved paths for which an annotation doesn't work.
@@ -972,4 +981,4 @@ public abstract class ConfPaths {
return entries;
}
}
}
@@ -23,6 +23,7 @@ import org.bukkit.Material;
import fr.neatmonster.nocheatplus.compat.Bridge1_13;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
import fr.neatmonster.nocheatplus.compat.BridgeMaterial;
/**
* These are the default settings for NoCheatPlus. They will be used in addition to/in replacement of configurations
@@ -32,8 +33,8 @@ public class DefaultConfig extends ConfigFile {
// TODO: Other version details ?
private static final String unifiedBlockDirectionActions = "cancel vl>10 log:bdirection:0:3:if cancel";
private static final String unifiedBlockReachActions = "cancel vl>5 log:breach:0:2:if cancel";
private static final String unifiedBlockDirectionActions = "vl>1 cancel vl>15 cancel log:bdirection:4:8:i vl>200 cancel log:bdirection:1:5:if cmdc:kickillegalblockinteract:1:5";
private static final String unifiedBlockReachActions = "cancel log:breach:5:6:i";
/**
* Instantiates a new default configuration.
@@ -64,7 +65,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.LOGGING_BACKEND_FILE_PREFIX, "", 785);
set(ConfPaths.LOGGING_BACKEND_FILE_FILENAME, "nocheatplus.log", 785);
set(ConfPaths.LOGGING_BACKEND_INGAMECHAT_ACTIVE, true, 785);
set(ConfPaths.LOGGING_BACKEND_INGAMECHAT_PREFIX, "&cNCP: &f", 785);
set(ConfPaths.LOGGING_BACKEND_INGAMECHAT_PREFIX, "&7&l[&cNC+&7&l]&7 ", 1154);
// Data settings.
// Expired offline players data.
@@ -81,7 +82,7 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.PERMISSIONS_POLICY_DEFAULT, "ALWAYS", 1140);
set(ConfPaths.PERMISSIONS_POLICY_RULES, Arrays.asList(
"nocheatplus.notify :: INTERVAL:60, -world, -offline", // Not sure about this one.
"nocheatplus.admin.debug :: INTERVAL:5",
"nocheatplus.admin.debug :: INTERVAL:10",
"nocheatplus.admin* :: ALWAYS",
// TODO: Command permissions are always checked anyway :p. Will be changed...
"nocheatplus.command* :: ALWAYS",
@@ -93,10 +94,10 @@ public class DefaultConfig extends ConfigFile {
*/
"nocheatplus.checks.chat.relog :: INTERVAL:10",
"nocheatplus.checks.chat.logins :: INTERVAL:10",
"nocheatplus.checks.chat.* :: INTERVAL:2",
"nocheatplus.checks.net.* :: INTERVAL:2",
"nocheatplus.checks.moving.survivalfly.* :: INTERVAL:5" // (Excludes the sf base permission.)
), 1142);
"nocheatplus.checks.chat.* :: INTERVAL:4",
"nocheatplus.checks.net.* :: INTERVAL:4",
"nocheatplus.checks.moving.survivalfly.* :: INTERVAL:10" // (Excludes the sf base permission.)
), 1154);
// Protection features.
// Hide plugins.
@@ -113,44 +114,44 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.PROTECT_CLIENTS_MOTD_ACTIVE, true, 785);
set(ConfPaths.PROTECT_CLIENTS_MOTD_ALLOWALL, false, 785);
/* Checks! */
set(ConfPaths.CHECKS_ACTIVE, true, 1144);
set(ConfPaths.CHECKS_LAG, true, 1144);
set(ConfPaths.CHECKS_DEBUG, false, 1144);
/* BlockBreak */
set(ConfPaths.BLOCKBREAK_ACTIVE, "default", 1144);
set(ConfPaths.BLOCKBREAK_DIRECTION_CHECK, "default", 785);
set(ConfPaths.BLOCKBREAK_DIRECTION_ACTIONS, unifiedBlockDirectionActions, 1097);
set(ConfPaths.BLOCKBREAK_DIRECTION_ACTIONS, "cancel", 1154);
set(ConfPaths.BLOCKBREAK_FASTBREAK_CHECK, "default", 785);
set(ConfPaths.BLOCKBREAK_FASTBREAK_STRICT, true, 785);
set(ConfPaths.BLOCKBREAK_FASTBREAK_DELAY, 100, 785);
set(ConfPaths.BLOCKBREAK_FASTBREAK_DELAY, 95, 785); //100
set(ConfPaths.BLOCKBREAK_FASTBREAK_MOD_SURVIVAL, 100, 785);
set(ConfPaths.BLOCKBREAK_FASTBREAK_GRACE, 2000, 785);
set(ConfPaths.BLOCKBREAK_FASTBREAK_ACTIONS, "cancel vl>0 log:fastbreak:3:5:cif cancel", 785);
set(ConfPaths.BLOCKBREAK_FASTBREAK_ACTIONS, "cancel vl>5 cancel log:fastbreak:4:2:i vl>50 cancel log:fastbreak:0:2:if cmdc:kickfastbreak:2:5", 1154);
set(ConfPaths.BLOCKBREAK_FREQUENCY_CHECK, "default", 785);
set(ConfPaths.BLOCKBREAK_FREQUENCY_MOD_CREATIVE, 95, 785);
set(ConfPaths.BLOCKBREAK_FREQUENCY_MOD_SURVIVAL, 45, 785);
set(ConfPaths.BLOCKBREAK_FREQUENCY_SHORTTERM_TICKS, 5, 785);
set(ConfPaths.BLOCKBREAK_FREQUENCY_SHORTTERM_LIMIT, 7, 785);
set(ConfPaths.BLOCKBREAK_FREQUENCY_ACTIONS, "cancel vl>5 log:bbfrequency:3:5:if cancel vl>60 log:bbfrequency:0:5:cif cancel cmd:kickfrequency", 785);
set(ConfPaths.BLOCKBREAK_FREQUENCY_ACTIONS, "cancel vl>5 log:bbfrequency:3:5:i cancel vl>40 log:bbfrequency:0:5:if cancel cmdc:kickfrequency:0:5", 1154);
set(ConfPaths.BLOCKBREAK_NOSWING_CHECK, "default", 785);
set(ConfPaths.BLOCKBREAK_NOSWING_ACTIONS, "cancel vl>10 log:noswing:0:5:if cancel", 785);
set(ConfPaths.BLOCKBREAK_NOSWING_ACTIONS, "cancel vl>10 log:noswing:0:5:i cancel", 785);
set(ConfPaths.BLOCKBREAK_REACH_CHECK, "default", 785);
set(ConfPaths.BLOCKBREAK_REACH_ACTIONS, unifiedBlockReachActions, 785);
set(ConfPaths.BLOCKBREAK_REACH_ACTIONS, "cancel", 1154);
set(ConfPaths.BLOCKBREAK_WRONGBLOCK_CHECK, "default", 785);
set(ConfPaths.BLOCKBREAK_WRONGBLOCK_LEVEL, 10, 785);
set(ConfPaths.BLOCKBREAK_WRONGBLOCK_LEVEL, 20, 1154);
set(ConfPaths.BLOCKBREAK_WRONGBLOCK_IMPROBABLE_FEEDONLY, false, 1154);
set(ConfPaths.BLOCKBREAK_WRONGBLOCK_IMPROBABLE_WEIGHT, 2.0, 1154);
set(ConfPaths.BLOCKBREAK_WRONGBLOCK_ACTIONS, "cancel vl>10 log:bwrong:0:5:if cancel vl>30 log:bwrong:0:5:cif cancel cmd:kickwb", 785);
set(ConfPaths.BLOCKBREAK_WRONGBLOCK_ACTIONS, "cancel vl>10 log:bwrong:2:5:i cancel vl>30 log:bwrong:0:5:if cancel cmdc:kickwb:0:5", 1154);
/* BlockInteract */
set(ConfPaths.BLOCKINTERACT_ACTIVE, "default", 1144);
set(ConfPaths.BLOCKINTERACT_DIRECTION_CHECK, "default", 785);
@@ -161,77 +162,79 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.BLOCKINTERACT_SPEED_CHECK, "default", 785);
set(ConfPaths.BLOCKINTERACT_SPEED_INTERVAL, 2000, 785);
set(ConfPaths.BLOCKINTERACT_SPEED_LIMIT, 60, 785);
set(ConfPaths.BLOCKINTERACT_SPEED_ACTIONS, "cancel vl>200 log:bspeed:0:2:if cancel vl>1000 cancel log:bspeed:0:2:icf cmd:kickbspeed", 785);
set(ConfPaths.BLOCKINTERACT_SPEED_LIMIT, 55, 1154); // Old limit: 60
set(ConfPaths.BLOCKINTERACT_SPEED_ACTIONS, "cancel vl>10 cancel log:bspeed:5:4:i cancel vl>500 cancel log:bspeed:0:5:icf cmdc:kickbspeed:2:5", 1154);
set(ConfPaths.BLOCKINTERACT_VISIBLE_CHECK, "default", 785);
set(ConfPaths.BLOCKINTERACT_VISIBLE_ACTIONS, "cancel vl>100 log:bvisible:0:10:if cancel", 785);
set(ConfPaths.BLOCKINTERACT_VISIBLE_ACTIONS, "cancel vl>30 log:bvisible:8:5:if cancel", 1154); // Visible + stone generators = fps NCP issue #575
// BLOCKPLACE
/* BlockPlace */
set(ConfPaths.BLOCKPLACE_ACTIVE, "default", 1144);
set(ConfPaths.BLOCKPLACE_AGAINST_CHECK, "default", 785);
set(ConfPaths.BLOCKPLACE_AGAINST_ACTIONS, "cancel", 785);
set(ConfPaths.BLOCKPLACE_AGAINST_ACTIONS, "cancel log:against:1:5:i vl>10 cancel log:against:0:2:if cmdc:kickagainst:0:10", 1154);
set(ConfPaths.BLOCKPLACE_AUTOSIGN_CHECK, "default", 785);
set(ConfPaths.BLOCKPLACE_AUTOSIGN_SKIPEMPTY, false, 785);
set(ConfPaths.BLOCKPLACE_AUTOSIGN_ACTIONS, "cancel vl>10 log:bautosign:0:3:if cancel", 785);
set(ConfPaths.BLOCKPLACE_DIRECTION_CHECK, "default", 785);
set(ConfPaths.BLOCKPLACE_DIRECTION_ACTIONS, unifiedBlockDirectionActions, 785);
set(ConfPaths.BLOCKPLACE_DIRECTION_ACTIONS, "cancel", 1154);
set(ConfPaths.BLOCKPLACE_FASTPLACE_CHECK, "default", 785);
set(ConfPaths.BLOCKPLACE_FASTPLACE_LIMIT, 22, 785);
set(ConfPaths.BLOCKPLACE_FASTPLACE_LIMIT, 15, 1154); // Old limit: 22
set(ConfPaths.BLOCKPLACE_FASTPLACE_SHORTTERM_TICKS, 10, 785);
set(ConfPaths.BLOCKPLACE_FASTPLACE_SHORTTERM_LIMIT, 6, 785);
set(ConfPaths.BLOCKPLACE_FASTPLACE_IMPROBABLE_FEEDONLY, false, 1154);
set(ConfPaths.BLOCKPLACE_FASTPLACE_IMPROBABLE_WEIGHT, 0.5, 1154);
set(ConfPaths.BLOCKPLACE_FASTPLACE_ACTIONS, "cancel vl>100 log:fastplace:3:5:cif cancel", 785);
set(ConfPaths.BLOCKPLACE_FASTPLACE_ACTIONS, "cancel vl>5 cancel log:fastplace:8:3:i vl>20 cancel log:fastplace:2:4:i vl>80 cancel log:fastplace:0:10:if cmdc:kickfastplace:1:10", 1154);
set(ConfPaths.BLOCKPLACE_REACH_CHECK, "default", 785);
set(ConfPaths.BLOCKPLACE_REACH_ACTIONS, unifiedBlockReachActions, 785);
set(ConfPaths.BLOCKPLACE_REACH_ACTIONS, "cancel", 1154);
set(ConfPaths.BLOCKPLACE_NOSWING_CHECK, "default", 785);
set(ConfPaths.BLOCKPLACE_NOSWING_EXCEPTIONS, Arrays.asList("LILY_PAD", Material.FLINT_AND_STEEL.toString()), 785);
set(ConfPaths.BLOCKPLACE_NOSWING_ACTIONS, "cancel vl>10 log:noswing:0:5:if cancel", 785);
set(ConfPaths.BLOCKPLACE_NOSWING_EXCEPTIONS, Arrays.asList(BridgeMaterial.LILY_PAD.toString(), Material.FLINT_AND_STEEL.toString()), 1154);
set(ConfPaths.BLOCKPLACE_NOSWING_ACTIONS, "cancel vl>10 log:noswing:2:5:i cancel", 1154);
set(ConfPaths.BLOCKPLACE_SCAFFOLD_CHECK, "default", 1154);
set(ConfPaths.BLOCKPLACE_SCAFFOLD_ACTIONS, "vl>15 log:scaffold:0:6:if", 1154);
set(ConfPaths.BLOCKPLACE_SCAFFOLD_ANGLE, true, 1154);
set(ConfPaths.BLOCKPLACE_SCAFFOLD_SPRINT, true, 1154);
set(ConfPaths.BLOCKPLACE_SCAFFOLD_TIME, true, 1154);
set(ConfPaths.BLOCKPLACE_SCAFFOLD_ACTIONS, "vl>1 cancel vl>10 cancel log:scaffold:3:7:if vl>60 cancel log:scaffold:1:2:if cmdc:kickscaffold:2:10 cmd:clearscaffold:0:5", 1154);
set(ConfPaths.BLOCKPLACE_SPEED_CHECK, "default", 785);
set(ConfPaths.BLOCKPLACE_SPEED_INTERVAL, 45L, 785);
set(ConfPaths.BLOCKPLACE_SPEED_IMPROBABLE_FEEDONLY, false, 1154);
set(ConfPaths.BLOCKPLACE_SPEED_IMPROBABLE_WEIGHT, 0.6, 1154);
set(ConfPaths.BLOCKPLACE_SPEED_ACTIONS,
"cancel vl>150 log:bpspeed:3:5:if cancel vl>1000 log:bpspeed:3:5:cif cancel", 785);
set(ConfPaths.BLOCKPLACE_SPEED_INTERVAL, 30L, 1154); // Old limit: 45L < FPs with throwable potions.
set(ConfPaths.BLOCKPLACE_SPEED_IMPROBABLE_FEEDONLY, true, 1154);
set(ConfPaths.BLOCKPLACE_SPEED_IMPROBABLE_WEIGHT, 0.3, 1154);
set(ConfPaths.BLOCKPLACE_SPEED_ACTIONS, "cancel vl>100 log:bpspeed:6:7:i cancel vl>1000 log:bpspeed:3:5:if cancel", 1154);
set(ConfPaths.BLOCKPLACE_PREVENTMISC_BOATSANYWHERE, true);
/* Chat */
set(ConfPaths.CHAT_ACTIVE, "default", 1144);
// Captcha.
set(ConfPaths.CHAT_CAPTCHA_CHECK, "default", 785);
set(ConfPaths.CHAT_CAPTCHA_CHECK, "false", 1154);
set(ConfPaths.CHAT_CAPTCHA_SKIP_COMMANDS, false, 785);
set(ConfPaths.CHAT_CAPTCHA_CHARACTERS, "abcdefghjkmnpqrtuvwxyzABCDEFGHJKMNPQRTUVWXYZ2346789", 785);
set(ConfPaths.CHAT_CAPTCHA_CHARACTERS, "abcdefghjkmnpqrtuvwxyzABCDEFGHJKMNPQRTUVWXYZ2346789!?><", 1154);
set(ConfPaths.CHAT_CAPTCHA_LENGTH, 6, 785);
set(ConfPaths.CHAT_CAPTCHA_QUESTION, "&cPlease type '&6[captcha]&c' to continue sending messages/commands.", 785);
set(ConfPaths.CHAT_CAPTCHA_SUCCESS, "&aOK, it sounds like you're not a spambot.", 785);
set(ConfPaths.CHAT_CAPTCHA_QUESTION, "&c&l(!)&7 Please type '&6[captcha]&7' to continue using chat.", 1154);
set(ConfPaths.CHAT_CAPTCHA_SUCCESS, "&c&l(!)&7 Antispam check passed.", 1154);
set(ConfPaths.CHAT_CAPTCHA_TRIES, 3, 785);
set(ConfPaths.CHAT_CAPTCHA_ACTIONS, "cancel cmd:kickcaptcha vl>4 log:captcha:2:5:cf cancel cmd:kickcaptcha", 785);
set(ConfPaths.CHAT_COLOR_CHECK, "default", 785);
set(ConfPaths.CHAT_COLOR_ACTIONS, "log:color:0:1:if cancel", 785);
set(ConfPaths.CHAT_CAPTCHA_ACTIONS, "cancel cmdc:kickcaptcha vl>4 log:captcha:2:5:cf cancel cmdc:kickcaptcha", 785);
// This check should be subject to removal
set(ConfPaths.CHAT_COLOR_CHECK, "false", 1154);
set(ConfPaths.CHAT_COLOR_ACTIONS, "cancel", 1154);
set(ConfPaths.CHAT_COMMANDS_CHECK, "default", 785);
set(ConfPaths.CHAT_COMMANDS_EXCLUSIONS, new ArrayList<String>(), 785);
set(ConfPaths.CHAT_COMMANDS_HANDLEASCHAT, Arrays.asList("me"), 785);
set(ConfPaths.CHAT_COMMANDS_EXCLUSIONS, Arrays.asList("undo", "redo"), 1154);
set(ConfPaths.CHAT_COMMANDS_HANDLEASCHAT, Arrays.asList("me", "msg", "emsg", "essentials:msg", "tell", "etell", "essentials:tell", "say", "esay", "essentials:say", "whisper", "ewhisper", "essentials:whisper", "w", "essentials:w", "ew", "r", "er", "essentials:r", "reply", "essentials:reply", "ereply"), 1154);
set(ConfPaths.CHAT_COMMANDS_LEVEL, 10, 785);
set(ConfPaths.CHAT_COMMANDS_SHORTTERM_TICKS, 18, 785);
set(ConfPaths.CHAT_COMMANDS_SHORTTERM_LEVEL, 3, 785);
set(ConfPaths.CHAT_COMMANDS_ACTIONS, "log:commands:0:5:cf cancel cmd:kickcommands vl>20 log:commands:0:5:cf cancel cmd:tempkick1", 785);
set(ConfPaths.CHAT_COMMANDS_ACTIONS, "log:commands:0:5:cf cancel cmdc:kickcommands vl>20 log:commands:0:5:cf cancel cmdc:tempkick1", 1154);
// Text (ordering on purpose).
set(ConfPaths.CHAT_TEXT_CHECK, "default", 785);
@@ -240,57 +243,57 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.CHAT_TEXT_FREQ_NORM_FACTOR, 0.9D, 785);
set(ConfPaths.CHAT_TEXT_FREQ_NORM_WEIGHT, 6, 785);
set(ConfPaths.CHAT_TEXT_FREQ_NORM_LEVEL, 160, 785);
set(ConfPaths.CHAT_TEXT_FREQ_NORM_ACTIONS, "cancel cmd:tellchatnormal vl>7 log:chatnormal:0:5:f cancel cmd:tellchatnormal vl>20 log:chatnormal:0:5:cf cancel cmd:kickchatnormal vl>40 log:chatnormal:0:5:cf cancel cmd:kickchat5", 785);
set(ConfPaths.CHAT_TEXT_FREQ_NORM_ACTIONS, "cancel cmdc:tellchatnormal vl>7 log:chatnormal:0:5:cif cancel cmdc:tellchatnormal vl>20 log:chatnormal:0:5:cif cancel cmdc:kickchatnormal vl>40 log:chatnormal:0:5:cif cancel cmdc:kickchat5", 1154);
set(ConfPaths.CHAT_TEXT_FREQ_SHORTTERM_MIN, 2.0, 785);
set(ConfPaths.CHAT_TEXT_FREQ_SHORTTERM_FACTOR, 0.7, 785);
set(ConfPaths.CHAT_TEXT_FREQ_SHORTTERM_WEIGHT, 3.0, 785);
set(ConfPaths.CHAT_TEXT_FREQ_SHORTTERM_LEVEL, 20.0, 785);
set(ConfPaths.CHAT_TEXT_FREQ_SHORTTERM_ACTIONS, "log:chatfast:0:5:cf cancel cmd:kickchatfast vl>20 log:chatfast:0:5:cf cancel cmd:kickchat1 vl>40 log:chatfast:0:5:cf cancel cmd:kickchat5", 785);
set(ConfPaths.CHAT_TEXT_FREQ_SHORTTERM_ACTIONS, "log:chatfast:2:3:icf cancel cmdc:kickchatfast:0:5 vl>20 cancel log:chatfast:0:5:cif cmdc:kickchatfast vl>40 cancel log:chatfast:0:5:cif cmdc:kickchat1", 1154);
// Message
set(ConfPaths.CHAT_TEXT_MSG_LETTERCOUNT, 1.0, 785);
set(ConfPaths.CHAT_TEXT_MSG_PARTITION, 1.0, 785);
set(ConfPaths.CHAT_TEXT_MSG_UPPERCASE, 1.0, 785);
set(ConfPaths.CHAT_TEXT_MSG_UPPERCASE, 1.2, 1154);
set(ConfPaths.CHAT_TEXT_MSG_AFTERJOIN, 1.5, 785);
set(ConfPaths.CHAT_TEXT_MSG_NOMOVING, 1.5, 785);
set(ConfPaths.CHAT_TEXT_MSG_REPEATCANCEL, 1.0, 785);
set(ConfPaths.CHAT_TEXT_MSG_NOMOVING, 1.1, 1154);
set(ConfPaths.CHAT_TEXT_MSG_REPEATCANCEL, 2.0, 1154);
set(ConfPaths.CHAT_TEXT_MSG_REPEATGLOBAL, 1.0, 785);
set(ConfPaths.CHAT_TEXT_MSG_REPEATSELF, 1.5, 785);
set(ConfPaths.CHAT_TEXT_MSG_WORDS_LENGTHAV, 1.0, 785);
set(ConfPaths.CHAT_TEXT_MSG_WORDS_LENGTHMSG, 1.0, 785);
set(ConfPaths.CHAT_TEXT_MSG_WORDS_NOLETTER, 0.0, 785);
set(ConfPaths.CHAT_TEXT_MSG_WORDS_NOLETTER, 0.2, 1154);
// Global
set(ConfPaths.CHAT_TEXT_GL_CHECK, true, 785);
set(ConfPaths.CHAT_TEXT_GL_WEIGHT, 0.5, 785);
set(ConfPaths.CHAT_TEXT_GL_WORDS_CHECK, false, 785);
set(ConfPaths.CHAT_TEXT_GL_WORDS_CHECK, true, 1154);
set(ConfPaths.CHAT_TEXT_GL_WEIGHT, 1.0, 785);
set(ConfPaths.CHAT_TEXT_GL_PREFIXES_CHECK , false, 785);
set(ConfPaths.CHAT_TEXT_GL_SIMILARITY_CHECK , false, 785);
set(ConfPaths.CHAT_TEXT_GL_SIMILARITY_CHECK , true, 1154);
// Player
set(ConfPaths.CHAT_TEXT_PP_CHECK, true, 785);
set(ConfPaths.CHAT_TEXT_PP_WORDS_CHECK, false, 785);
set(ConfPaths.CHAT_TEXT_PP_PREFIXES_CHECK, false, 785);
set(ConfPaths.CHAT_TEXT_PP_SIMILARITY_CHECK , false, 785);
set(ConfPaths.CHAT_TEXT_PP_WORDS_CHECK, true, 1154);
set(ConfPaths.CHAT_TEXT_PP_PREFIXES_CHECK, true, 1154);
set(ConfPaths.CHAT_TEXT_PP_SIMILARITY_CHECK , true, 1154);
// Warning (commands + chat).
set(ConfPaths.CHAT_WARNING_CHECK, true, 785);
set(ConfPaths.CHAT_WARNING_LEVEL, 67, 785);
set(ConfPaths.CHAT_WARNING_MESSAGE, "&e>>>\n&e>>> &cPlease &eslow down &cchat, &eyou might get kicked &cfor spam.\n&e>>>", 785);
set(ConfPaths.CHAT_WARNING_MESSAGE, "\n &c&l(!)&7 Please slow down chat, you might get kicked by the antispam.\n \n", 1154);
set(ConfPaths.CHAT_WARNING_TIMEOUT, 10, 785);
// Relog
set(ConfPaths.CHAT_RELOG_CHECK, "default", 785);
set(ConfPaths.CHAT_RELOG_TIMEOUT, 5000L, 785);
set(ConfPaths.CHAT_RELOG_WARNING_MESSAGE, "&cYou relogged really fast! If you keep doing that, you're going to be banned.", 785);
set(ConfPaths.CHAT_RELOG_WARNING_MESSAGE, "&c&l(!)&7 You relogged really fast! If you keep doing that, you're going to be banned.", 1154);
set(ConfPaths.CHAT_RELOG_WARNING_NUMBER, 1, 785);
set(ConfPaths.CHAT_RELOG_KICKMESSAGE, "Too fast re-login, try with a little delay.", 785);
set(ConfPaths.CHAT_RELOG_WARNING_TIMEOUT, 60000L, 785);
set(ConfPaths.CHAT_RELOG_ACTIONS, "log:relog:0:10:cf cancel vl>20 log:relog:0:10:cf cancel cmd:tempkick5", 785);
set(ConfPaths.CHAT_RELOG_ACTIONS, "log:relog:0:10:cf cancel vl>20 log:relog:0:10:cf cancel cmdc:tempkick5", 1154);
// Logins
set(ConfPaths.CHAT_LOGINS_CHECK, "default", 785);
set(ConfPaths.CHAT_LOGINS_STARTUPDELAY, 600, 785);
set(ConfPaths.CHAT_LOGINS_PERWORLDCOUNT, false, 785);
set(ConfPaths.CHAT_LOGINS_SECONDS, 10, 785);
set(ConfPaths.CHAT_LOGINS_LIMIT, 10, 785);
set(ConfPaths.CHAT_LOGINS_KICKMESSAGE, "Too many people logging in, retry soon.", 785);
set(ConfPaths.CHAT_LOGINS_KICKMESSAGE, "Too many players are logging in at the same time, please try again later.", 1154);
/*
* Combined !
@@ -299,15 +302,15 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.COMBINED_ACTIVE, "default", 1144);
set(ConfPaths.COMBINED_BEDLEAVE_CHECK, "default", 785);
set(ConfPaths.COMBINED_BEDLEAVE_ACTIONS, "cancel log:bedleave:0:5:if cmd:kickbedleave", 785);
set(ConfPaths.COMBINED_BEDLEAVE_ACTIONS, "cancel log:bedleave:0:5:if cmdc:kickbedleave", 1154);
set(ConfPaths.COMBINED_ENDERPEARL_CHECK, "default", 785);
set(ConfPaths.COMBINED_ENDERPEARL_CHECK, true, 1154); // 'default' activation flag issue
set(ConfPaths.COMBINED_ENDERPEARL_PREVENTCLICKBLOCK, true, 785);
set(ConfPaths.COMBINED_IMPROBABLE_CHECK , "default", 785);
set(ConfPaths.COMBINED_IMPROBABLE_LEVEL, 300, 785);
// set(ConfPaths.COMBINED_IMPROBABLE_FASTBREAK_CHECK, false, 785);
set(ConfPaths.COMBINED_IMPROBABLE_ACTIONS, "cancel log:improbable:2:8:if", 785);
set(ConfPaths.COMBINED_IMPROBABLE_ACTIONS, "cancel vl>10 log:improbable:8:9:if cancel vl>1500 cancel log:improbable:0:10:if cmdc:kickimprobable:0:10 cmdc:clearimprobable:0:10", 1154);
set(ConfPaths.COMBINED_INVULNERABLE_CHECK, true, 785); // Not a check type yet.
set(ConfPaths.COMBINED_INVULNERABLE_TRIGGERS_ALWAYS, false, 785);
@@ -320,89 +323,92 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.COMBINED_MUNCHHAUSEN_ACTIONS, "cancel vl>100 cancel log:munchhausen:0:60:if", 785);
// (No active flag set !?)
set(ConfPaths.COMBINED_YAWRATE_RATE , 380, 785);
set(ConfPaths.COMBINED_YAWRATE_PENALTY_FACTOR, 1.0, 785);
set(ConfPaths.COMBINED_YAWRATE_PENALTY_MIN, 250, 785);
set(ConfPaths.COMBINED_YAWRATE_PENALTY_MAX, 2000, 785);
set(ConfPaths.COMBINED_YAWRATE_RATE , 290, 1154); // Old limit: 360
set(ConfPaths.COMBINED_YAWRATE_PENALTY_FACTOR, 2.0, 1154); // 1.0
set(ConfPaths.COMBINED_YAWRATE_PENALTY_MIN, 450, 1154); // 250
set(ConfPaths.COMBINED_YAWRATE_PENALTY_MAX, 2500, 1154); // 1500
set(ConfPaths.COMBINED_YAWRATE_IMPROBABLE_FEEDONLY, false, 1154);
set(ConfPaths.COMBINED_YAWRATE_IMPROBABLE_WEIGHT, 100.0, 1154);
set(ConfPaths.COMBINED_YAWRATE_IMPROBABLE_WEIGHT, 90.0, 1154); // 100.0
// set(ConfPaths.COMBINED_YAWRATE_IMPROBABLE, true, 785);
// FIGHT
set(ConfPaths.FIGHT_ACTIVE, "default", 1144);
set(ConfPaths.FIGHT_CANCELDEAD, true, 785);
set(ConfPaths.FIGHT_TOOLCHANGEPENALTY, 500L, 785);
set(ConfPaths.FIGHT_MAXLOOPLETENCYTICKS, 8, 1154);
set(ConfPaths.FIGHT_TOOLCHANGEPENALTY, 0L, 1154); // Disabled for now, it interferes too much with pvp. 500L
set(ConfPaths.FIGHT_PVP_KNOCKBACKVELOCITY, "default", 785);
set(ConfPaths.FIGHT_YAWRATE_CHECK, true, 785); // Not a check type.
set(ConfPaths.FIGHT_ANGLE_CHECK, "default", 785);
set(ConfPaths.FIGHT_ANGLE_THRESHOLD_MOVE, 50, 1153);
set(ConfPaths.FIGHT_ANGLE_THRESHOLD_TIME, 50, 1153);
set(ConfPaths.FIGHT_ANGLE_THRESHOLD_YAW, 50, 1153);
set(ConfPaths.FIGHT_ANGLE_THRESHOLD_MOVE, 100, 1154); // Move is problematic with mob grinders and in a 2 VS 1 scenario.
set(ConfPaths.FIGHT_ANGLE_THRESHOLD_TIME, 200, 1154); // Time is problematic with mob grinders and in a 2 VS 1 scenario.
set(ConfPaths.FIGHT_ANGLE_THRESHOLD_YAW, 60, 1154);
set(ConfPaths.FIGHT_ANGLE_THRESHOLD_SWITCH, 50, 1153);
set(ConfPaths.FIGHT_ANGLE_ACTIONS, "cancel vl>100 log:angle:3:5:f cancel vl>250 log:angle:0:5:cif cancel", 785);
set(ConfPaths.FIGHT_CLICKPATTERN_CHECK, "default", 1154);
set(ConfPaths.FIGHT_CLICKPATTERN_RANGE, 8, 1154);
set(ConfPaths.FIGHT_CLICKPATTERN_PENALTY, 150L, 1154);
set(ConfPaths.FIGHT_CLICKPATTERN_ACTIONS, "vl>2 cancel vl>6 log:clickpat:0:7:cif cancel", 1154);
set(ConfPaths.FIGHT_ANGLE_ACTIONS, "cancel vl>100 log:angle:4:5:i cancel vl>500 log:angle:0:20:if cancel", 1154);
set(ConfPaths.FIGHT_CRITICAL_CHECK, "default", 785);
set(ConfPaths.FIGHT_CRITICAL_FALLDISTANCE, 0.06251, 785);
set(ConfPaths.FIGHT_CRITICAL_ACTIONS, "cancel vl>50 log:critical:0:5:cif cancel", 785);
// Old value: 0.06251. NCP seems to be unable to catch packet-critical cheats with this value, although it has nearly no false positives.
set(ConfPaths.FIGHT_CRITICAL_FALLDISTANCE, 0.075, 785);
set(ConfPaths.FIGHT_CRITICAL_ACTIONS, "vl>2 cancel vl>50 cancel log:critical:10:9:i vl>100 cancel cmd:clearcritical:0:10", 1154);
set(ConfPaths.FIGHT_DIRECTION_CHECK, "default", 785);
set(ConfPaths.FIGHT_DIRECTION_STRICT, false, 785);
set(ConfPaths.FIGHT_DIRECTION_PENALTY, 500L, 785);
set(ConfPaths.FIGHT_DIRECTION_ACTIONS,
"cancel vl>5 log:fdirection:3:5:f cancel vl>20 log:fdirection:0:5:if cancel vl>50 log:fdirection:0:5:cif cancel", 785);
set(ConfPaths.FIGHT_DIRECTION_STRICT, true, 1154);
set(ConfPaths.FIGHT_DIRECTION_FAILALL, true, 1154);
set(ConfPaths.FIGHT_DIRECTION_PENALTY, 75L, 1154);
set(ConfPaths.FIGHT_DIRECTION_ACTIONS, "vl>2 log:fdirectionlowvl:9:10:i vl>5 log:fdirectionlowvl:5:4:i vl>10 cancel log:fdirection:2:4:if vl>50 cancel log:fdirection:0:7:icf cmdc:kicksuspiciouscombat:1:5", 1154);
set(ConfPaths.FIGHT_FASTHEAL_CHECK, "default", 785);
set(ConfPaths.FIGHT_FASTHEAL_INTERVAL, 4000L, 785);
set(ConfPaths.FIGHT_FASTHEAL_BUFFER, 1000L, 785);
set(ConfPaths.FIGHT_FASTHEAL_ACTIONS, "cancel vl>10 cancel log:fastheal:0:10:i vl>30 cancel log:fastheal:0:10:if", 785);
set(ConfPaths.FIGHT_FASTHEAL_ACTIONS, "cancel vl>10 cancel log:fastheal:2:6:i vl>30 cancel log:fastheal:1:1:i vl>90 cancel log:fastheal:0:10:if cmdc:kickfastheal:0:10", 1154);
set(ConfPaths.FIGHT_GODMODE_CHECK, "default", 785);
set(ConfPaths.FIGHT_GODMODE_LAGMINAGE, 1100, 785); // TODO: ndt/2 => 500-600.
set(ConfPaths.FIGHT_GODMODE_LAGMAXAGE, 5000, 785);
set(ConfPaths.FIGHT_GODMODE_ACTIONS, "log:godmode:2:5:if cancel vl>60 log:godmode:2:5:icf cancel", 785); // cmd:kickgod", 785);
set(ConfPaths.FIGHT_GODMODE_ACTIONS, "cancel log:godmode:0:5:icf cmdc:kickgod:0:5", 1154);
set(ConfPaths.FIGHT_NOSWING_CHECK, "default", 785);
set(ConfPaths.FIGHT_NOSWING_ACTIONS, "cancel vl>10 log:noswing:0:5:if cancel", 785);
set(ConfPaths.FIGHT_NOSWING_ACTIONS, "vl>2 cancel vl>10 log:noswing:1:5:i cancel", 1154);
// TODO: Merge @CaptainObvious' pitchpattern check in this fork.
//set(ConfPaths.FIGHT_PITCHPATTERN_CHECK, "default", 1153);
//set(ConfPaths.FIGHT_PITCHPATTERN_ALWAYSACTIVE, false, 1154); // <- Cinematic/Zoom-like mods issue.
//set(ConfPaths.FIGHT_PITCHPATTERN_LIMIT, 10F, 1153);
//set(ConfPaths.FIGHT_PITCHPATTERN_SAMPLE, 35, 1154);
//set(ConfPaths.FIGHT_PITCHPATTERN_DIFF, 0.001D, 1153);
//set(ConfPaths.FIGHT_PITCHPATTERN_DELTAGCD, 0.00001F, 1153);
//set(ConfPaths.FIGHT_PITCHPATTERN_ACTIONS, "vl>2 cancel vl>10 cancel log:pitchpattern:5:6:i vl>100 cancel log:pitchpattern:0:10:icf cmdc:kickillegalrotations:3:10", 1154);
set(ConfPaths.FIGHT_REACH_CHECK, "default", 785);
set(ConfPaths.FIGHT_REACH_SURVIVALDISTANCE, 4.4, 785);
set(ConfPaths.FIGHT_REACH_PENALTY, 500, 785);
set(ConfPaths.FIGHT_REACH_SURVIVALDISTANCE, 4.22, 1154); // 4.4
set(ConfPaths.FIGHT_REACH_PENALTY, 250, 1154);
set(ConfPaths.FIGHT_REACH_REDUCE, true, 785);
set(ConfPaths.FIGHT_REACH_REDUCEDISTANCE, 0.9, 785);
set(ConfPaths.FIGHT_REACH_REDUCESTEP, 0.15, 785);
set(ConfPaths.FIGHT_REACH_IMPROBABLE_FEEDONLY, false, 1154);
set(ConfPaths.FIGHT_REACH_IMPROBABLE_WEIGHT, 2.0, 1154);
set(ConfPaths.FIGHT_REACH_ACTIONS, "cancel vl>10 log:freach:2:5:if cancel", 785);
set(ConfPaths.FIGHT_REACH_ACTIONS, "vl>1 log:freach:8:9:i vl>5 cancel log:freach:2:6:if vl>12 cancel log:kreach:1:5:i vl>35 cancel log:kreach:0:5:if cmdc:kicksuspiciouscombat:2:1", 1154);
set(ConfPaths.FIGHT_SELFHIT_CHECK, "default", 785);
set(ConfPaths.FIGHT_SELFHIT_ACTIONS, "log:fselfhit:0:5:if cancel vl>10 log:fselfhit:0:5:icf cancel cmd:kickselfhit", 785);
set(ConfPaths.FIGHT_SELFHIT_EXCLUDEPROJECTILE, false, 1154);
set(ConfPaths.FIGHT_SELFHIT_ACTIONS, "cancel log:fselfhit:0:5:icf cmdc:kickselfhit:0:5", 1154);
set(ConfPaths.FIGHT_SPEED_CHECK, "default", 785);
set(ConfPaths.FIGHT_SPEED_LIMIT, 15, 785);
set(ConfPaths.FIGHT_SPEED_ACTIONS, "cancel vl>50 log:fspeed:0:5:if cancel", 785);
set(ConfPaths.FIGHT_SPEED_LIMIT, 15, 1154);
set(ConfPaths.FIGHT_SPEED_ACTIONS, "cancel vl>20 cancel log:fspeed:2:5:i vl>80 cancel log:fspeed:1:1:if cmd:kickattackfrequency:0:10", 1154);
set(ConfPaths.FIGHT_SPEED_SHORTTERM_TICKS, 7, 785);
set(ConfPaths.FIGHT_SPEED_SHORTTERM_LIMIT, 6, 785);
set(ConfPaths.FIGHT_SPEED_SHORTTERM_LIMIT, 5, 1154);
set(ConfPaths.FIGHT_SPEED_IMPROBABLE_FEEDONLY, false, 1154);
set(ConfPaths.FIGHT_SPEED_IMPROBABLE_WEIGHT, 2.0, 1154);
set(ConfPaths.FIGHT_WRONGTURN_CHECK, "default", 1143);
set(ConfPaths.FIGHT_WRONGTURN_ACTIONS, "cancel cmd:kick_wrongturn log:log_wrongturn:0:15:fci", 1143);
set(ConfPaths.INVENTORY_ACTIVE, "default", 1144);
set(ConfPaths.INVENTORY_DROP_CHECK, "default", 785);
set(ConfPaths.INVENTORY_DROP_LIMIT, 100, 785);
set(ConfPaths.INVENTORY_DROP_LIMIT, 10, 1154);
set(ConfPaths.INVENTORY_DROP_TIMEFRAME, 20L, 785);
set(ConfPaths.INVENTORY_DROP_ACTIONS, "log:drop:0:1:cif cancel cmd:dropkick:0:1", 785);
set(ConfPaths.INVENTORY_DROP_ACTIONS, "log:drop:0:5:if cancel cmdc:dropkick:0:5", 1154);
set(ConfPaths.INVENTORY_FASTCLICK_CHECK, "default", 785);
set(ConfPaths.INVENTORY_FASTCLICK_EXCLUDE, Arrays.asList("Inventory Name Here"), 1154);
@@ -410,33 +416,34 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.INVENTORY_FASTCLICK_TWEAKS1_5, true, 785);
set(ConfPaths.INVENTORY_FASTCLICK_LIMIT_SHORTTERM, 4, 785);
set(ConfPaths.INVENTORY_FASTCLICK_LIMIT_NORMAL, 15, 785);
set(ConfPaths.INVENTORY_FASTCLICK_LIMIT_CHEST, 152, 1154);
set(ConfPaths.INVENTORY_FASTCLICK_LIMIT_CHEST, 155, 1154);
set(ConfPaths.INVENTORY_FASTCLICK_IMPROBABLE_WEIGHT, 0.7, 1154);
set(ConfPaths.INVENTORY_FASTCLICK_ACTIONS, "cancel vl>50 log:fastclick:3:5:cif cancel", 785);
set(ConfPaths.INVENTORY_FASTCLICK_ACTIONS, "cancel vl>200 cancel log:fastclick:7:5:i vl>600 cancel log:fastclick:1:5:if vl>5000 cancel log:fastclick:1:2:if cmdc:kickfastclick:2:15", 1154);
set(ConfPaths.INVENTORY_INSTANTBOW_CHECK, "default", 785);
set(ConfPaths.INVENTORY_INSTANTBOW_STRICT, true, 785);
set(ConfPaths.INVENTORY_INSTANTBOW_DELAY, 130, 785);
set(ConfPaths.INVENTORY_INSTANTBOW_DELAY, 75, 1154);
set(ConfPaths.INVENTORY_INSTANTBOW_IMPROBABLE_FEEDONLY, false, 1085);
set(ConfPaths.INVENTORY_INSTANTBOW_IMPROBABLE_WEIGHT, 0.6, 1085);
set(ConfPaths.INVENTORY_INSTANTBOW_ACTIONS, "cancel vl>15 log:instantbow:2:5:if cancel", 785);
set(ConfPaths.INVENTORY_INSTANTBOW_ACTIONS, "cancel vl>15 cancel log:instantbow:4:5:i vl>200 cancel log:instantbow:0:10:if cmdc:kickbow:2:10", 1154);
// TODO: Set this to false as default?
set(ConfPaths.INVENTORY_INSTANTEAT_CHECK, "default", 785);
set(ConfPaths.INVENTORY_INSTANTEAT_ACTIONS, "log:instanteat:2:5:if cancel", 785);
set(ConfPaths.INVENTORY_INSTANTEAT_ACTIONS, "log:instanteat:2:5:i cancel", 1154);
set(ConfPaths.INVENTORY_FASTCONSUME_CHECK, "default", 785);
set(ConfPaths.INVENTORY_FASTCONSUME_DURATION, 0.7, 785);
set(ConfPaths.INVENTORY_FASTCONSUME_DURATION, 1.4, 1154); // The actual consumption time needed would be 1.5s. Set to 1.4 for leniency
set(ConfPaths.INVENTORY_FASTCONSUME_WHITELIST, false, 785);
set(ConfPaths.INVENTORY_FASTCONSUME_ITEMS, new LinkedList<String>(), 785);
set(ConfPaths.INVENTORY_FASTCONSUME_ACTIONS, "log:fastconsume:2:5:if cancel", 785);
set(ConfPaths.INVENTORY_FASTCONSUME_ITEMS, Arrays.asList("DRIED_KELP"), 1154);
set(ConfPaths.INVENTORY_FASTCONSUME_ACTIONS, "cancel vl>2 log:fastconsume:2:5:if cancel vl>35 cancel log:fastconsume:0:5:if cmdc:kickfastconsume:0:5", 1154);
set(ConfPaths.INVENTORY_INVENTORYMOVE_CHECK, "default", 1153);
set(ConfPaths.INVENTORY_INVENTORYMOVE_DISABLECREATIVE, true, 1153);
set(ConfPaths.INVENTORY_INVENTORYMOVE_ACTIONS, "log:inventorymove:2:5:if cancel", 785);
set(ConfPaths.INVENTORY_INVENTORYMOVE_ACTIONS, "log:inventorymove:2:5:i cancel", 1154);
set(ConfPaths.INVENTORY_GUTENBERG_CHECK, "default", 785);
set(ConfPaths.INVENTORY_GUTENBERG_PAGELIMIT, 50, 1154);
set(ConfPaths.INVENTORY_GUTENBERG_ACTIONS, "cancel log:gutenberg:0:10:icf cmd:kickinvaliddata", 785);
set(ConfPaths.INVENTORY_GUTENBERG_ACTIONS, "cancel log:gutenberg:0:10:if cmdc:kickinvaliddata:0:5", 1154);
set(ConfPaths.INVENTORY_ITEMS_CHECK, "default", 785);
@@ -446,12 +453,12 @@ public class DefaultConfig extends ConfigFile {
set (ConfPaths.INVENTORY_HOTFIX_DUPE_FALLINGBLOCKENDPORTAL, true, 785);
// MOVING
/* Moving ! */
set(ConfPaths.MOVING_ACTIVE, "default", 1144);
// CreativeFly
set(ConfPaths.MOVING_CREATIVEFLY_CHECK, "default", 785);
set(ConfPaths.MOVING_CREATIVEFLY_IGNOREALLOWFLIGHT, true, 785);
set(ConfPaths.MOVING_CREATIVEFLY_IGNORECREATIVE, false, 785); // TODO: -> true ?
set(ConfPaths.MOVING_CREATIVEFLY_IGNORECREATIVE, false, 785);
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "creative." + ConfPaths.SUB_HORIZONTAL_SPEED, 100, 785);
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "creative." + ConfPaths.SUB_VERTICAL_ASCEND_SPEED, 100, 785);
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "creative." + ConfPaths.SUB_VERTICAL_MAXHEIGHT, 128, 785);
@@ -486,23 +493,26 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "elytra." + ConfPaths.SUB_VERTICAL_ASCEND_SPEED, 0, 785);
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "elytra." + ConfPaths.SUB_VERTICAL_MAXHEIGHT, 128, 1104);
set(ConfPaths.MOVING_CREATIVEFLY_MODEL + "elytra." + ConfPaths.SUB_MODIFIERS, false, 785);
set(ConfPaths.MOVING_CREATIVEFLY_EYTRA_FWRESET, false, 1154);
set(ConfPaths.MOVING_CREATIVEFLY_EYTRA_STRICT, false, 1154);
}
set(ConfPaths.MOVING_CREATIVEFLY_ACTIONS,
"log:flyfile:3:5:f cancel"
+ " vl>100 log:flyshort:0:5:i log:flyfile:0:5:f cancel"
+ " vl>400 log:flylong:0:5:i log:flyfile:0:5:cf cancel"
, 1080);
"cancel log:flyfile:3:5:f"
+ " vl>100 cancel log:creativefly:8:9:i log:flyfile:0:10:f"
+ " vl>900 cancel log:creativefly:2:4:i log:flyfile:0:5:cf"
+ " vl>2000 cancel log:creativefly:0:5:icf cmdc:kickfly:0:15 cmd:clearcf:0:15"
, 1154);
// MorePackets
set(ConfPaths.MOVING_MOREPACKETS_CHECK, "default", 785);
set(ConfPaths.MOVING_MOREPACKETS_SECONDS, 6, 785);
set(ConfPaths.MOVING_MOREPACKETS_EPSIDEAL, 20, 785);
set(ConfPaths.MOVING_MOREPACKETS_EPSMAX, 22, 785);
set(ConfPaths.MOVING_MOREPACKETS_BURST_PACKETS, 40, 785);
set(ConfPaths.MOVING_MOREPACKETS_BURST_DIRECT, 60, 785);
set(ConfPaths.MOVING_MOREPACKETS_BURST_EPM, 180, 785);
set(ConfPaths.MOVING_MOREPACKETS_SETBACKAGE, 40, 1091);
set(ConfPaths.MOVING_MOREPACKETS_ACTIONS, "cancel vl>10 log:morepackets:0:2:if cancel vl>100 log:morepackets:0:2:if cancel cmd:kickpackets", 785);
set(ConfPaths.MOVING_MOREPACKETS_BURST_EPM, 120, 1154);
set(ConfPaths.MOVING_MOREPACKETS_SETBACKAGE, 70, 1154); // 40
set(ConfPaths.MOVING_MOREPACKETS_ACTIONS, "cancel vl>2 cancel log:morepackets:10:9:i vl>100 cancel log:morepackets:0:2:ifc cmdc:kickpackets:2:10", 1154);
// NoFall
set(ConfPaths.MOVING_NOFALL_CHECK, "default", 785);
set(ConfPaths.MOVING_NOFALL_DEALDAMAGE, true, 785);
set(ConfPaths.MOVING_NOFALL_SKIPALLOWFLIGHT, true, 785);
@@ -510,37 +520,44 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.MOVING_NOFALL_RESETONTP, false, 785);
set(ConfPaths.MOVING_NOFALL_RESETONVEHICLE, true, 785);
set(ConfPaths.MOVING_NOFALL_ANTICRITICALS, true, 785);
set(ConfPaths.MOVING_NOFALL_ACTIONS, "log:nofall:0:5:if cancel vl>30 log:nofall:0:5:icf cancel", 785);
set(ConfPaths.MOVING_NOFALL_ACTIONS, "cancel vl>2 cancel log:nofall:0:5:if", 1154); //vl>6 cancel log:nofall:0:1:if cmdc:kickfly:0:5", 1154);
// Passable
set(ConfPaths.MOVING_PASSABLE_CHECK, "default", 785);
set(ConfPaths.MOVING_PASSABLE_ACTIONS, "cancel vl>10 log:passable:0:5:if cancel vl>50 log:passable:0:5:icf cancel", 785);
set(ConfPaths.MOVING_PASSABLE_ACTIONS, "cancel vl>15 cancel log:passable:7:9:i vl>100 cancel log:passable:1:4:if cmd:clearpassable:3:15", 1154);
set(ConfPaths.MOVING_PASSABLE_UNTRACKED_TELEPORT_ACTIVE, true, 785);
set(ConfPaths.MOVING_PASSABLE_UNTRACKED_CMD_ACTIVE, true, 785);
set(ConfPaths.MOVING_PASSABLE_UNTRACKED_CMD_TRYTELEPORT, true, 785);
set(ConfPaths.MOVING_PASSABLE_UNTRACKED_CMD_PREFIXES, Arrays.asList("sethome", "home set", "setwarp", "warp set", "setback", "set back", "back set"), 785);
set(ConfPaths.MOVING_PASSABLE_UNTRACKED_CMD_PREFIXES, Arrays.asList("sethome", "home set", "setwarp", "warp set", "setback", "set back", "back set", "warp", "home", "tp" ), 1154);
// SurvivalFly
set(ConfPaths.MOVING_SURVIVALFLY_CHECK, "default", 785);
set(ConfPaths.MOVING_SURVIVALFLY_STEPHEIGHT, "default", 785);
set(ConfPaths.MOVING_SURVIVALFLY_EXTENDED_VACC, true, 785);
set(ConfPaths.MOVING_SURVIVALFLY_LENIENCY_HBUFMAX, 1.0, 1143);
set(ConfPaths.MOVING_SURVIVALFLY_LENIENCY_HBUFMAX, 0.5, 1154);
// SurvivalFly ViolationFrequencyHook
set(ConfPaths.MOVING_SURVIVALFLY_VLFREQUENCY_ACTIVE, true, 1154);
set(ConfPaths.MOVING_SURVIVALFLY_VLFREQUENCY_DEBUG, false, 1154);
set(ConfPaths.MOVING_SURVIVALFLY_VLFREQUENCY_MAXTOTALVLS, 35, 1154);
set(ConfPaths.MOVING_SURVIVALFLY_VLFREQUENCY_MINADDEDVLS, 5, 1154);
set(ConfPaths.MOVING_SURVIVALFLY_VLFREQUENCY_MOREVLS, 5, 1154);
set(ConfPaths.MOVING_SURVIVALFLY_VLFREQUENCY_MOVECOUNT, 10, 1154);
set(ConfPaths.MOVING_SURVIVALFLY_LENIENCY_FREEZECOUNT, 40, 1144);
set(ConfPaths.MOVING_SURVIVALFLY_LENIENCY_FREEZEINAIR, true, 1143);
set(ConfPaths.MOVING_SURVIVALFLY_SETBACKPOLICY_FALLDAMAGE, true, 785);
set(ConfPaths.MOVING_SURVIVALFLY_SETBACKPOLICY_VOIDTOVOID, true, 785);
set(ConfPaths.MOVING_SURVIVALFLY_ACTIONS,
"log:flyfile:3:10:f cancel"
+ " vl>100 log:flyshort:0:10:i log:flyfile:0:10:f cancel"
+ " vl>400 log:flylong:0:5:i log:flyfile:0:5:cf cancel"
+ " vl>1500 log:flylong:0:5:i log:flyfile:0:5:cf cancel cmd:kickfly"
, 1080);
// sf / hover check.
set(ConfPaths.MOVING_SURVIVALFLY_SETBACKPOLICY_VOIDTOVOID, false, 1154);
set(ConfPaths.MOVING_SURVIVALFLY_ACTIONS, "cancel log:flyfile:6:15:f"
+ " vl>50 cancel log:survivalfly:13:9:i log:flyfile:6:15:f"
+ " vl>300 cancel log:survivalfly:7:8:i log:flyfile:1:3:f"
+ " vl>830 cancel log:survivalflyhighvl:4:9:i log:flyfile:2:3:f"
+ " vl>1500 cancel log:survivalflyhighvl:3:4:i log:flyfile:1:2:f"
+ " vl>2100 cancel log:survivalflyhighvl:0:4:icf cmdc:kickfly:0:15 cmd:clearsf:0:15", 1154);
// SurvivalFly - Hover Subcheck
set(ConfPaths.MOVING_SURVIVALFLY_HOVER_CHECK, true, 785); // Not a check type yet.
set(ConfPaths.MOVING_SURVIVALFLY_HOVER_STEP, 5, 785);
set(ConfPaths.MOVING_SURVIVALFLY_HOVER_TICKS, 85, 785);
set(ConfPaths.MOVING_SURVIVALFLY_HOVER_LOGINTICKS, 60, 785);
set(ConfPaths.MOVING_SURVIVALFLY_HOVER_FALLDAMAGE, true, 785);
set(ConfPaths.MOVING_SURVIVALFLY_HOVER_SFVIOLATION, 500, 785);
set(ConfPaths.MOVING_SURVIVALFLY_HOVER_SFVIOLATION, 200, 1154); // Old VL: 500
// Moving Trace
//set(ConfPaths.MOVING_TRACE_MAXAGE, 200, 785); // Your grandma reads code.
@@ -571,55 +588,56 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.MOVING_VEHICLE_SCHEDULESETBACKS, "default", 785);
set(ConfPaths.MOVING_VEHICLE_MOREPACKETS_CHECK, "default", 785);
set(ConfPaths.MOVING_VEHICLE_MOREPACKETS_ACTIONS, "cancel vl>10 log:morepackets:0:2:if cancel", 785);
set(ConfPaths.MOVING_VEHICLE_MOREPACKETS_ACTIONS, "cancel vl>2 log:morepackets:2:5:if cancel vl>100 cancel log:morepackets:1:2:if cmdc:kickpackets:2:10", 1154);
set(ConfPaths.MOVING_VEHICLE_ENVELOPE_ACTIVE, "default", 785);
set(ConfPaths.MOVING_VEHICLE_ENVELOPE_ACTIONS, "cancel vl>100 cancel log:vehicleenvelope:0:15:icf", 785);
set(ConfPaths.MOVING_VEHICLE_ENVELOPE_HSPEEDCAP + ".default", 0.9, 1154);
set(ConfPaths.MOVING_VEHICLE_ENVELOPE_HSPEEDCAP + ".pig", 0.3, 1154);
set(ConfPaths.MOVING_VEHICLE_ENVELOPE_ACTIONS, "cancel vl>50 cancel log:vehicleenvelope:10:6:if vl>300 cancel log:vehicleenvelope:0:10:icf cmdc:kickvehiclefly:0:10 cmd:clearvehicle:0:15", 1154);
// Messages
set(ConfPaths.MOVING_MESSAGE_ILLEGALPLAYERMOVE, "Illegal move.", 785);
set(ConfPaths.MOVING_MESSAGE_ILLEGALVEHICLEMOVE, "Illegal vehicle move.", 785);
// NET
/* Net */
set(ConfPaths.NET_ACTIVE, "default", 1144);
// AttackFrequency
set(ConfPaths.NET_ATTACKFREQUENCY_ACTIVE, "default", 785);
set(ConfPaths.NET_ATTACKFREQUENCY_SECONDS_HALF, 10, 785);
set(ConfPaths.NET_ATTACKFREQUENCY_SECONDS_ONE, 15, 785);
set(ConfPaths.NET_ATTACKFREQUENCY_SECONDS_HALF, 8, 1154); // 10
set(ConfPaths.NET_ATTACKFREQUENCY_SECONDS_ONE, 15, 785);
set(ConfPaths.NET_ATTACKFREQUENCY_SECONDS_TWO, 30, 785);
set(ConfPaths.NET_ATTACKFREQUENCY_SECONDS_FOUR, 60, 785);
set(ConfPaths.NET_ATTACKFREQUENCY_SECONDS_EIGHT, 100, 785);
set(ConfPaths.NET_ATTACKFREQUENCY_IMPROBABLE_WEIGHT, 2.0, 1154);
set(ConfPaths.NET_ATTACKFREQUENCY_ACTIONS, "cancel vl>30 cancel log:attackfrequency:0:5:if vl>160 cancel log:attackfrequency:0:0:cif cmd:kickattackfrequency", 785);
// FightSync
set(ConfPaths.NET_FIGHTSYNC_ACTIVE, "default", 1154);
set(ConfPaths.NET_FIGHTSYNC_THRESHOLD, 5, 1154);
set(ConfPaths.NET_FIGHTSYNC_RESETCOUNT, 11, 1154);
set(ConfPaths.NET_FIGHTSYNC_ACTIONS, "vl>10 log:fightsync:0:5:if", 1154);
set(ConfPaths.NET_ATTACKFREQUENCY_SECONDS_EIGHT, 95, 1154); //100
set(ConfPaths.NET_ATTACKFREQUENCY_IMPROBABLE_WEIGHT, 3.0, 1154);
set(ConfPaths.NET_ATTACKFREQUENCY_ACTIONS, "cancel vl>10 cancel log:attackfrequency:4:5:i vl>200 cancel log:attackfrequency:0:4:if cmdc:kickattackfrequency", 1154);
// FlyingFrequency
set(ConfPaths.NET_FLYINGFREQUENCY_ACTIVE, "default", 785);
set(ConfPaths.NET_FLYINGFREQUENCY_SECONDS, 5, 785);
set(ConfPaths.NET_FLYINGFREQUENCY_PACKETSPERSECOND, 60, 785);
set(ConfPaths.NET_FLYINGFREQUENCY_ACTIONS, "cancel", 785); // TODO: Log actions.
// Observed: when a flying packet gets canceled, the position of the player won't get updated to the server
// but they will still be able to move client-side; this will result in a server-sided freeze.
// When the player thaws out of this state, (presumably) their position will update in a rather fast sequence, which SurvivalFly
// really seems to dislike. (Players can sometimes reach 1000+ VLs(!))
// Thus, lower Flyingfrequency violation should not be immediately canceled, 20 seems a reasonable threshold through testing.
set(ConfPaths.NET_FLYINGFREQUENCY_ACTIONS, "vl>20 cancel log:flyingfrequency:3:2:i vl>500 cancel log:flyingfrequency:0:5:if vl>1000 cancel log:flyingfrequency:0:2:icf cmdc:kickflyingfrequency:0:10", 1154);
set(ConfPaths.NET_FLYINGFREQUENCY_REDUNDANT_ACTIVE, true, 785);
set(ConfPaths.NET_FLYINGFREQUENCY_REDUNDANT_SECONDS, 3, 785);
set(ConfPaths.NET_FLYINGFREQUENCY_REDUNDANT_ACTIONS, "cancel", 785); // TODO: Log actions.
set(ConfPaths.NET_FLYINGFREQUENCY_REDUNDANT_ACTIONS, "cancel", 785);
// KeepAliveFrequency
set(ConfPaths.NET_KEEPALIVEFREQUENCY_ACTIVE, "default", 785);
set(ConfPaths.NET_KEEPALIVEFREQUENCY_SECONDS, 20, 1153);
set(ConfPaths.NET_KEEPALIVEFREQUENCY_ACTIONS, "cancel vl>10 cancel log:keepalive:0:10:if vl>40 cancel log:keepalive:0:10:icf vl>100 cancel log:keepalive:0:10:icf cmd:kickalive", 785);
set(ConfPaths.NET_KEEPALIVEFREQUENCY_ACTIONS, "cancel vl>10 cancel log:keepalive:2:6:i vl>60 cancel log:keepalive:0:10:icf cmdc:kickalive", 1154);
// PacketFrequency (pre 1.9).
set(ConfPaths.NET_PACKETFREQUENCY_ACTIVE, "default", 785);
set(ConfPaths.NET_PACKETFREQUENCY_PPS, 200, 785);
set(ConfPaths.NET_PACKETFREQUENCY_PPS, 300, 1154); // Old limit: 200, legit 1.8 clients seem to be able to reach such value more often than not...
set(ConfPaths.NET_PACKETFREQUENCY_SECONDS, 4, 785);
set(ConfPaths.NET_PACKETFREQUENCY_ACTIONS, "cancel cmd:kickpacketfrequency", 785);
set(ConfPaths.NET_PACKETFREQUENCY_ACTIONS, "cancel vl>2 cancel cmdc:kickpacketfrequency", 1154);
// SoundDistance
set(ConfPaths.NET_SOUNDDISTANCE_ACTIVE, "default", 785);
@@ -627,89 +645,113 @@ public class DefaultConfig extends ConfigFile {
// Superseded
set(ConfPaths.NET_SUPERSEDED_FLYING_CANCELWAITING, true, 1090);
set(ConfPaths.NET_WRONGTURN_ACTIVE, "default", 1154);
set(ConfPaths.NET_WRONGTURN_ACTIONS, "cancel cmdc:kickillegalrotations:0:10 log:wrongturn:0:15:i", 1154);
// TODO: An extra file might suit these.
final String start = "[player] failed [check]: ";
final String end = ". VL [violations].";
final String tell = "ncp tell [player] ";
set(ConfPaths.STRINGS + ".angle", start + "tried to hit multiple entities at the same time (Tags [tags])" + end, 785);
set(ConfPaths.STRINGS + ".attackfrequency", start + "attacks with too high a frequency ([packets]/[limit], [tags])" + end, 785);
set(ConfPaths.STRINGS + ".ban", "ban [player]", 785);
set(ConfPaths.STRINGS + ".ban-ip", "ban-ip [ip]", 785);
set(ConfPaths.STRINGS + ".bautosign", start + "failed autosign with [tags]" + end, 785);
set(ConfPaths.STRINGS + ".bbfrequency", start + "tried to break too many blocks within time frame" + end, 785);
set(ConfPaths.STRINGS + ".bdirection", start + "tried to interact with a block out of their line of sight" + end, 785);
set(ConfPaths.STRINGS + ".bedleave", start + "sends bed leave packets (was not in bed)" + end, 785);
set(ConfPaths.STRINGS + ".bpspeed", start + "tried to throw projectiles too quickly" + end, 785);
set(ConfPaths.STRINGS + ".breach", start + "exceeds block-interact distance ([reachdistance])" + end, 785);
set(ConfPaths.STRINGS + ".bspeed", start + "interacts too fast" + end, 785);
set(ConfPaths.STRINGS + ".bvisible", start + "interacts with a block out of sight" + end, 785);
set(ConfPaths.STRINGS + ".bwrong", start + "broke another block than clicked" + end, 785);
final String start = "&c[player]&7 failed &c[check]&7: ";
final String end = " &7(&cVL[violations]&7)";
final String tell = "ncp tell [player] &c&l(!)&7 ";
final String clear = "ncp delay delay=2 ncp removeplayer [player] ";
final String kick = "ncp kick [player] &c&l(!)&7 ";
set(ConfPaths.STRINGS + ".against", start + "tried to place a block against liquid blocks or air as if they were solid" + end, 1154);
set(ConfPaths.STRINGS + ".angle", start + "potentially tried to hit multiple entities at the same time (Tags: &6[tags]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".attackfrequency", start + "seems to be using an autoclicker (Clicks: &6[packets]&7/LimitPerTime-frame:&7[limit]&7, &6[tags]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".bautosign", start + "tried to use the autosign hack (Subcheck: &6[tags]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".bbfrequency", start + "tried to break too many blocks at once" + end, 1154);
set(ConfPaths.STRINGS + ".bdirection", start + "tried to interact with a block out of their line of sight" + end, 1154);
set(ConfPaths.STRINGS + ".bedleave", start + "tried to send fake bed leave packets (was not in/near a bed)" + end, 1154);
set(ConfPaths.STRINGS + ".bpspeed", start + "tried to throw projectiles too quickly" + end, 1154);
set(ConfPaths.STRINGS + ".breach", start + "tried to interact with a block too far away" + end, 1154);
set(ConfPaths.STRINGS + ".bspeed", start + "is interacting with blocks beyond legit speeds" + end, 1154);
set(ConfPaths.STRINGS + ".bvisible", start + "tried to interact with a block through a solid obstacle" + end, 1154);
set(ConfPaths.STRINGS + ".bwrong", start + "tried to break another block than interacted with last" + end, 1154);
set(ConfPaths.STRINGS + ".captcha", "[player] failed captcha repeatedly" + end, 785);
set(ConfPaths.STRINGS + ".chatnormal", start + "potentially annoying chat" + end, 785);
set(ConfPaths.STRINGS + ".clickpat", start + " seems to be clicking with bot-like frequencies" + end, 785);
set(ConfPaths.STRINGS + ".color", start + "sent colored chat message" + end, 785);
set(ConfPaths.STRINGS + ".commands", start + "issued too many commands" + end, 785);
set(ConfPaths.STRINGS + ".critical", start + "tried to do a critical hit but wasn't technically jumping [tags]" + end, 785);
set(ConfPaths.STRINGS + ".chatfast", start + "acted like spamming (message deleted) (IP: &6[ip]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".chatnormal", start + "seems to be spamming the server chat" + end, 1154);
set(ConfPaths.STRINGS + ".commands", start + "issued too many commands too quickly" + end, 785);
set(ConfPaths.STRINGS + ".creativefly", start + "tried to move unexpectedly while in air (Tags: &6[tags]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".critical", start + "tried to perform an illegal critical hit (Tags: &6[tags]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".drop", start + "tried to drop more items than allowed" + end, 785);
set(ConfPaths.STRINGS + ".dropkick", "ncp delay ncp kick [player] Dropping items too fast.", 785);
set(ConfPaths.STRINGS + ".fastbreak", start + "tried to break blocks ([blocktype]) faster than possible" + end, 785);
set(ConfPaths.STRINGS + ".dropkick", kick + "Dropping items too fast.", 1154);
set(ConfPaths.STRINGS + ".fastbreak", start + "tried to break a block faster than possible (Block: &6[blocktype]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".fastclick", start + "tried to move items in their inventory too quickly" + end, 785);
set(ConfPaths.STRINGS + ".fastconsume", start + "consumes [food] [tags] too fast" + end, 785);
set(ConfPaths.STRINGS + ".fastheal", start + "regenerates health faster than usual (health [health])" + end, 785);
set(ConfPaths.STRINGS + ".fastplace", start + "tried to place too many blocks" + end, 785);
set(ConfPaths.STRINGS + ".fdirection", start + "tried to hit an entity out of line of sight" + end, 785);
set(ConfPaths.STRINGS + ".fightsync", start + "client and server fight data out of sync" + end, 1154);
set(ConfPaths.STRINGS + ".flyshort", start + "tried to move unexpectedly" + end, 785);
set(ConfPaths.STRINGS + ".flylong", start
+ "tried to move: [locationfrom] -> [locationto], d=[distance] ([tags])" + end, 1067);
set(ConfPaths.STRINGS + ".flyfile", start
+ "tried to move: [locationfrom] -> [locationto], d=[distance] ([tags])" + end, 785);
set(ConfPaths.STRINGS + ".freach", start + "tried to attack entity out of reach" + end, 785);
set(ConfPaths.STRINGS + ".fselfhit", start + "tried to self-hit" + end, 785);
set(ConfPaths.STRINGS + ".fspeed", start + "tried to attack with too high a frequency" + end, 785);
set(ConfPaths.STRINGS + ".fastconsume", start + "tried to consume an item too quickly (Food: &6[food][tags]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".fastheal", start + "tried to regenerate their health bar faster than possible (Health: &6health]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".fastplace", start + "tried to place blocks too quickly" + end, 1154);
set(ConfPaths.STRINGS + ".fdirection", start + "tried to hit an entity outside their line of sight" + end, 1154);
set(ConfPaths.STRINGS + ".fdirectionlowvl", start + "could be using an aimbot (hit not canceled)" + end, 1154);
set(ConfPaths.STRINGS + ".flyfile", start + "tried to perform an illegal move from ([locationfrom]) to ([locationto]) over a distance of ([distance]) blocks, subchecks triggered> ([tags])" + end, 1154);
set(ConfPaths.STRINGS + ".flyingfrequency", start + "is manipulating packets sent to the server to gain an unfair advantage" + end, 1154);
set(ConfPaths.STRINGS + ".freach", start + "tried to hit an entity from a suspicious distance" + end, 1154);
set(ConfPaths.STRINGS + ".fselfhit", start + "tried to hit themselves" + end, 1154);
set(ConfPaths.STRINGS + ".fspeed", start + "clicked [violations] times over the established CPS limit" + end, 1154);
set(ConfPaths.STRINGS + ".godmode", start + "tried to ignore inflicted damage (Health: &7[health]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".gutenberg", start + "created a book with too many pages" + end, 785);
set(ConfPaths.STRINGS + ".godmode", start + "avoided taking damage or lagging (health [health])" + end, 785);
set(ConfPaths.STRINGS + ".improbable", start + "meets the improbable more than expected" + end, 785);
set(ConfPaths.STRINGS + ".instantbow", start + "fires bow too fast" + end, 785);
set(ConfPaths.STRINGS + ".instanteat", start + "eats food [food] too fast" + end, 785);
set(ConfPaths.STRINGS + ".inventorymove", start + "interacted with inventory while it was not possible (tags [tags])" + end, 1153);
set(ConfPaths.STRINGS + ".keepalive", start + "spams keep-alive packets (god/freecam?)" + end, 785);
set(ConfPaths.STRINGS + ".kick", "kick [player]", 785);
set(ConfPaths.STRINGS + ".kickalive", "ncp kick [player] Too many keep-alive packets.", 785);
set(ConfPaths.STRINGS + ".kickattackfrequency", "ncp kick [player] Unlikely fast clicking.", 785);
set(ConfPaths.STRINGS + ".kickbedleave", "ncp delay ncp kick [player] Go find a bed!", 785);
set(ConfPaths.STRINGS + ".kickbspeed", "ncp kick [player] You interacted too fast!", 785);
set(ConfPaths.STRINGS + ".kickcaptcha", "ncp kick [player] Enter the captcha!", 785);
set(ConfPaths.STRINGS + ".kickchat1", "ncp tempkick [player] 1 You're still not allowed to spam!", 785);
set(ConfPaths.STRINGS + ".kickchat5", "ncp tempkick [player] 5 You're not intended to spam!", 785);
set(ConfPaths.STRINGS + ".kickchatfast", "ncp kick [player] You're not allowed to spam in chat!", 785);
set(ConfPaths.STRINGS + ".kickchatnormal", "ncp kick [player] Too many chat messages, take a break.", 785);
set(ConfPaths.STRINGS + ".kickcommands", "ncp tempkick [player] 1 You're not allowed to spam commands!", 785);
set(ConfPaths.STRINGS + ".kickfly", "ncp delay ncp kick [player] Kicked for flying (or related)", 785);
set(ConfPaths.STRINGS + ".kickfrequency", "ncp kick [player] You did something too fast!", 785);
set(ConfPaths.STRINGS + ".kickgod", "ncp kick [player] God mode?", 785);
set(ConfPaths.STRINGS + ".kickinvaliddata", "ncp kick [player] Invalid data.", 785);
set(ConfPaths.STRINGS + ".kickpacketfrequency", "ncp kick [player] Too many packets.", 785); // TODO
set(ConfPaths.STRINGS + ".kickpackets", "ncp delay ncp kick [player] Too many packets (extreme lag?)", 785);
set(ConfPaths.STRINGS + ".kickselfhit", "ncp kick [player] You tried to hit yourself!", 785);
set(ConfPaths.STRINGS + ".kickwb", "ncp kick [player] Block breaking out of sync!", 785);
set(ConfPaths.STRINGS + ".kick_wrongturn", "ncp kick [player] Wrong turn!", 1143);
set(ConfPaths.STRINGS + ".log_wrongturn", start + "looked wrongly" + end, 1143);
set(ConfPaths.STRINGS + ".morepackets", start + "sent too many moves ([packets] [tags])" + end, 785);
set(ConfPaths.STRINGS + ".improbable", start + "is exhibiting an erratic behaviour (Check: &6[tags]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".instantbow", start + "tried to shoot an arrow too fast" + end, 1154);
set(ConfPaths.STRINGS + ".instanteat", start + "tried to consume an item too quickly (Food: &6[food]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".inventorymove", start + "tried to click in their inventory while simultaneously performing another action (Tags: &6[tags]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".keepalive", start + "is spamming keep-alive packets to the server" + end, 1154);
set(ConfPaths.STRINGS + ".kickagainst", kick + "Invalid block placements.", 1154);
set(ConfPaths.STRINGS + ".kickalive", kick + "Too many keep-alive packets.", 1154);
set(ConfPaths.STRINGS + ".kickattackfrequency", kick + "Unlikely fast clicking.", 1154);
set(ConfPaths.STRINGS + ".kickbedleave", kick + "Invalid bed-leave packets.", 1154);
set(ConfPaths.STRINGS + ".kickbow", kick + "Shooting arrows too quickly.", 1154);
set(ConfPaths.STRINGS + ".kickbspeed", kick + "Too fast block interactions.", 1154);
set(ConfPaths.STRINGS + ".kickcaptcha", kick + "Enter the captcha!", 1154);
set(ConfPaths.STRINGS + ".kickchat1", "ncp tempkick [player] 1 &c&l(!)&7 Do not spam the server chat (1 minute tempkick)", 1154);
set(ConfPaths.STRINGS + ".kickchat5", "ncp tempkick [player] 5 &c&l(!)&7 You are not allowed to spam the server chat (5 minutes tempkick)", 1154);
set(ConfPaths.STRINGS + ".kickchatfast", kick + "Stop spamming.", 1154);
set(ConfPaths.STRINGS + ".kickchatnormal", kick + "Too many chat messages, take a break.", 1154);
set(ConfPaths.STRINGS + ".kickcommands", "ncp tempkick [player] 1 &c&l(!)&7 Do not spam commands (1 minute tempkick)", 1154);
set(ConfPaths.STRINGS + ".kickfastbreak", kick + "Breaking blocks too fast.", 1154);
set(ConfPaths.STRINGS + ".kickfastclick", kick + "Unlikely inventory interactions.", 1154);
set(ConfPaths.STRINGS + ".kickfastconsume", kick + "Using items too quickly.", 1154);
set(ConfPaths.STRINGS + ".kickfastheal", kick + "Too fast health regeneration.", 1154);
set(ConfPaths.STRINGS + ".kickfastplace", kick + "Placing blocks too quickly.", 1154);
set(ConfPaths.STRINGS + ".kickfly", kick + "Moved unexpectedly.", 1154);
set(ConfPaths.STRINGS + ".kickflyingfrequency", kick + "Kicked for packet spam.", 1154);
set(ConfPaths.STRINGS + ".kickfrequency", kick + "Illegal block-breaking frequency.", 1154);
set(ConfPaths.STRINGS + ".kickgod", kick + "GodMode?", 1154);
set(ConfPaths.STRINGS + ".kickillegalblockinteract", kick + "Illegal block interactions.", 1154);
set(ConfPaths.STRINGS + ".kickillegalrotations", kick + "Invalid rotations.", 1154);
set(ConfPaths.STRINGS + ".kickimprobable", kick + "Illegal client modifications.", 1154);
set(ConfPaths.STRINGS + ".kickinvaliddata", kick + "Invalid book data.", 1154);
set(ConfPaths.STRINGS + ".kickpacketfrequency", kick + "Too many packets.", 1154);
set(ConfPaths.STRINGS + ".kickpackets", kick + "You sent too many moves (extreme lag?)", 1154);
set(ConfPaths.STRINGS + ".kickscaffold", kick + "Incorrect block placements.", 1154);
set(ConfPaths.STRINGS + ".kickselfhit", kick + "You tried to hit yourself!", 1154);
set(ConfPaths.STRINGS + ".kicksuspiciouscombat", kick + "Illegal combat modifications.", 1154);
set(ConfPaths.STRINGS + ".kickvehiclefly", kick + "Unexpected vehicle movement.", 1154);
set(ConfPaths.STRINGS + ".kickwb", kick + "Block breaking out of sync.", 1154);
set(ConfPaths.STRINGS + ".kreach", start + "is most likely using a killaura cheat" + end, 1154);
set(ConfPaths.STRINGS + ".morepackets", start + "sent too many moves (&cPackets&7/&cVL [packets]&7)", 1154);
set(ConfPaths.STRINGS + ".msgtempdenylogin", "You are temporarily denied to join this server.", 785);
set(ConfPaths.STRINGS + ".munchhausen", start + "almost made it off the pit" + end, 785);
set(ConfPaths.STRINGS + ".nofall", start + "tried to alter fall damage ([tags])" + end, 1057);
set(ConfPaths.STRINGS + ".chatfast", start + "acted like spamming (IP: [ip])" + end, 785);
set(ConfPaths.STRINGS + ".noswing", start + "didn't swing arm" + end, 785);
set(ConfPaths.STRINGS + ".passable", start + "moved into a block ([blocktype]) from [locationfrom] to [locationto] distance [distance] " + end, 785);
set(ConfPaths.STRINGS + ".relog", start + "relogs too fast" + end, 785);
set(ConfPaths.STRINGS + ".scaffold", start + "placed against a block face they did not interact with" + end, 1154);
set(ConfPaths.STRINGS + ".tellchatnormal", tell + "&cNCP: &eToo many messages, slow down...", 785);
set(ConfPaths.STRINGS + ".tempkick1", "ncp tempkick [player] 1 Wait a minute!", 785);
set(ConfPaths.STRINGS + ".tempkick5", "ncp tempkick [player] 5 You have five minutes to think about it!", 785);
set(ConfPaths.STRINGS + ".vehicleenvelope", start + "moved a vehicle too fast ([tags])" + end, 785);
set(ConfPaths.STRINGS + ".munchhausen", start + "tried to hit themeselves with a fishing rod too many times (the knockback can be potentially abused for bypasses)" + end, 1154);
set(ConfPaths.STRINGS + ".nofall", start + "tried to alter fall damage or fall distance (Tags: &6[tags]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".noswing", start + "didn't swing arm before performing their action" + end, 1154);
set(ConfPaths.STRINGS + ".passable", start + "tried to move into a block (bugged player of phase cheat)" + end, 1154);
set(ConfPaths.STRINGS + ".pitchpattern", start + "has pitch rotation patterns that are often associated with cheats" + end, 1154);
set(ConfPaths.STRINGS + ".relog", start + "tried to relog too fast" + end, 1154);
set(ConfPaths.STRINGS + ".scaffold", start + "tried to place a block in an unnatural way (Tags: &6[tags]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".survivalfly", start + "tried to move unexpectedly" + end, 1154);
set(ConfPaths.STRINGS + ".survivalflyhighvl", start + "tried to perform an illegal move (Subchecks: &6[tags]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".tellchatnormal", tell + "Too many messages, slow down...", 1154);
set(ConfPaths.STRINGS + ".tempkick1", "ncp tempkick [player] 1 &c&l(!)&7 You have to wait 1 minute before joining this server again.", 1154);
set(ConfPaths.STRINGS + ".tempkick5", "ncp tempkick [player] 5 &c&l(!)&7 You have to wait 5 minutes before joining this server again.", 1154);
set(ConfPaths.STRINGS + ".vehicleenvelope", start + "tried to move a vehicle unexpectedly (Tags/Vehicle: &6[tags]&7)" + end, 1154);
set(ConfPaths.STRINGS + ".wrongturn", start + "sent an impossible pitch rotation (&6>90 &7or&6 <-90&7)" + end, 1154);
// Clear a check data
set(ConfPaths.STRINGS + ".clearimprobable", clear + "COMBINED_IMPROBABLE", 1154);
set(ConfPaths.STRINGS + ".clearsf", clear + "MOVING_SURVIVALFLY", 1154);
set(ConfPaths.STRINGS + ".clearcf", clear + "MOVING_CREATIVEFLY", 1154);
set(ConfPaths.STRINGS + ".clearpassable", clear + "MOVING_PASSABLE", 1154);
set(ConfPaths.STRINGS + ".clearvehicle", clear + "MOVING_VEHICLE_ENVELOPE", 1154);
set(ConfPaths.STRINGS + ".clearcritical", clear + "FIGHT_CRITICAL", 1154);
set(ConfPaths.STRINGS + ".clearscaffold", clear + "BLOCKPLACE_SCAFFOLD", 1154);
// Compatibility settings.
set(ConfPaths.COMPATIBILITY_EXEMPTIONS_WILDCARD_DEFAULT_METADATA_ACTIVE, true, 785);
@@ -732,6 +774,7 @@ public class DefaultConfig extends ConfigFile {
)) {
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + name, "default+ign_passable+ground_height", 785);
}
// TODO: proper model for these blocks
for (final String DeadCoralType : Arrays.asList(
"DEAD_TUBE",
"DEAD_BRAIN",
@@ -739,8 +782,8 @@ public class DefaultConfig extends ConfigFile {
"DEAD_FIRE",
"DEAD_HORN"
)) {
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + DeadCoralType + "_CORAL", "default+ign_passable+ground_height", 1154);
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + DeadCoralType + "_CORAL_WALL_FAN", "default+ign_passable+ground_height", 1154);
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + DeadCoralType + "_CORAL", "default+ign_passable+ground_height", 1154);
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + DeadCoralType + "_CORAL_WALL_FAN", "default+ign_passable+ground_height", 1154);
}
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "DEAD_TUBE_CORAL_FAN", "default+ign_passable+ground_height", 1154);
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_OVERRIDEFLAGS + "." + "DEAD_BRAIN_CORAL_FAN", "default+ign_passable+ground_height", 1154);
@@ -753,4 +796,4 @@ public class DefaultConfig extends ConfigFile {
// // Update internal factory based on all the new entries to the "actions" section.
// setActionFactory();
}
}
}
@@ -113,6 +113,7 @@ public class Permissions {
public static final RegisteredPermission BLOCKPLACE_AGAINST = add(BLOCKPLACE + ".against");
public static final RegisteredPermission BLOCKPLACE_AGAINST_AIR = add(BLOCKPLACE_AGAINST + ".air");
public static final RegisteredPermission BLOCKPLACE_AGAINST_LIQUIDS = add(BLOCKPLACE_AGAINST + ".liquids");
public static final RegisteredPermission BLOCKPLACE_AGAINST_SELF = add(BLOCKPLACE_AGAINST + ".self");
public static final RegisteredPermission BLOCKPLACE_AUTOSIGN = add(BLOCKPLACE + ".autosign");
public static final RegisteredPermission BLOCKPLACE_BOATSANYWHERE = add(BLOCKPLACE + ".boatsanywhere");
public static final RegisteredPermission BLOCKPLACE_DIRECTION = add(BLOCKPLACE + ".direction");
@@ -152,7 +153,8 @@ public class Permissions {
public static final RegisteredPermission INVENTORY_GUTENBERG = add(INVENTORY + ".gutenberg");
public static final RegisteredPermission INVENTORY_INSTANTBOW = add(INVENTORY + ".instantbow");
public static final RegisteredPermission INVENTORY_INSTANTEAT = add(INVENTORY + ".instanteat");
public static final RegisteredPermission INVENTORY_MOVE = add(INVENTORY + ".inventorymove");
public static final RegisteredPermission INVENTORY_INVENTORYMOVE = add(INVENTORY + ".inventorymove");
public static final RegisteredPermission INVENTORY_MOREINVENTORY = add(INVENTORY + ".moreinventory");
public static final RegisteredPermission INVENTORY_ITEMS = add(INVENTORY + ".items");
public static final RegisteredPermission INVENTORY_OPEN = add(INVENTORY + ".open");
@@ -161,6 +163,7 @@ public class Permissions {
public static final RegisteredPermission NET_FLYINGFREQUENCY = add(NET + ".flyingfrequency");
public static final RegisteredPermission NET_KEEPALIVEFREQUENCY = add(NET + ".keepalivefrequency");
public static final RegisteredPermission NET_PACKETFREQUENCY = add(NET + ".packetfrequency");
public static final RegisteredPermission NET_WRONGTURN = add(NET + ".wrongturn");
public static final RegisteredPermission MOVING = add(CHECKS + ".moving");
public static final RegisteredPermission MOVING_CREATIVEFLY = add(MOVING + ".creativefly");
@@ -172,6 +175,7 @@ public class Permissions {
public static final RegisteredPermission MOVING_SURVIVALFLY_SNEAKING = add(MOVING_SURVIVALFLY + ".sneaking");
public static final RegisteredPermission MOVING_SURVIVALFLY_SPEEDING = add(MOVING_SURVIVALFLY + ".speeding");
public static final RegisteredPermission MOVING_SURVIVALFLY_SPRINTING = add(MOVING_SURVIVALFLY + ".sprinting");
public static final RegisteredPermission MOVING_SURVIVALFLY_WATERWALK = add(MOVING_SURVIVALFLY + ".waterwalk");
public static final RegisteredPermission MOVING_SURVIVALFLY_STEP = add(MOVING_SURVIVALFLY + ".step");
public static final RegisteredPermission MOVING_VEHICLE = add(MOVING + ".vehicle");
public static final RegisteredPermission MOVING_VEHICLE_MOREPACKETS = add(MOVING_VEHICLE + ".morepackets");
@@ -229,4 +233,4 @@ public class Permissions {
return new ArrayList<RegisteredPermission>(permissions.values());
}
}
}
@@ -907,8 +907,13 @@ public class PlayerDataManager implements IPlayerDataManager, ComponentWithName
@Override
public PlayerData getPlayerData(final Player player, boolean create) {
try {
return getPlayerData(player.getUniqueId(), player.getName(),
create, create ? worldDataManager.getWorldDataSafe(player) : null);
} catch (Exception e) {
// Fake player
return null;
}
}
@Override
@@ -16,6 +16,7 @@ package fr.neatmonster.nocheatplus.utilities;
import java.util.Collection;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@@ -51,5 +52,29 @@ public class PotionUtil {
}
return max;
}
/**
* Get amplifier for a potion effect.
*
* @param entity
* the LivingEntity
* @param type
* the type
* @return Double.NEGATIVE_INFINITY if not present, otherwise the maximal
* amplifier.
*/
public static final double getPotionEffectAmplifier(final LivingEntity entity, final PotionEffectType type) {
if (!entity.hasPotionEffect(type)) {
return Double.NEGATIVE_INFINITY; // TODO: Might not win anything.
}
final Collection<PotionEffect> effects = entity.getActivePotionEffects();
double max = Double.NEGATIVE_INFINITY;
for (final PotionEffect effect : effects){
if (effect.getType().equals(type)){
max = Math.max(max, effect.getAmplifier());
}
}
return max;
}
}
@@ -438,4 +438,4 @@ public abstract class AxisTracing implements ICollideBlocks, ISetMargins {
double minX, double minY, double minZ, double maxX, double maxY, double maxZ,
Axis axis, int increment);
}
}
@@ -14,8 +14,12 @@
*/
package fr.neatmonster.nocheatplus.utilities.collision;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@@ -196,9 +200,9 @@ public class CollisionUtil {
* the angle precision
* @return the double
*/
public static double combinedDirectionCheck(final Location sourceFoot, final double eyeHeight, final Vector dir, final double targetX, final double targetY, final double targetZ, final double targetWidth, final double targetHeight, final double precision, final double anglePrecision)
public static double combinedDirectionCheck(final Location sourceFoot, final double eyeHeight, final Vector dir, final double targetX, final double targetY, final double targetZ, final double targetWidth, final double targetHeight, final double precision, final double anglePrecision, boolean isPlayer)
{
return combinedDirectionCheck(sourceFoot.getX(), sourceFoot.getY() + eyeHeight, sourceFoot.getZ(), dir.getX(), dir.getY(), dir.getZ(), targetX, targetY, targetZ, targetWidth, targetHeight, precision, anglePrecision);
return combinedDirectionCheck(sourceFoot.getX(), sourceFoot.getY() + eyeHeight, sourceFoot.getZ(), dir.getX(), dir.getY(), dir.getZ(), targetX, targetY, targetZ, targetWidth, targetHeight, precision, anglePrecision, isPlayer);
}
/**
@@ -220,7 +224,7 @@ public class CollisionUtil {
*/
public static double combinedDirectionCheck(final Location sourceFoot, final double eyeHeight, final Vector dir, final Block target, final double precision, final double anglePrecision)
{
return combinedDirectionCheck(sourceFoot.getX(), sourceFoot.getY() + eyeHeight, sourceFoot.getZ(), dir.getX(), dir.getY(), dir.getZ(), target.getX(), target.getY(), target.getZ(), 1, 1, precision, anglePrecision);
return combinedDirectionCheck(sourceFoot.getX(), sourceFoot.getY() + eyeHeight, sourceFoot.getZ(), dir.getX(), dir.getY(), dir.getZ(), target.getX(), target.getY(), target.getZ(), 1, 1, precision, anglePrecision, true);
}
/**
@@ -255,7 +259,7 @@ public class CollisionUtil {
* Precision in grad.
* @return the double
*/
public static double combinedDirectionCheck(final double sourceX, final double sourceY, final double sourceZ, final double dirX, final double dirY, final double dirZ, final double targetX, final double targetY, final double targetZ, final double targetWidth, final double targetHeight, final double blockPrecision, final double anglePrecision)
public static double combinedDirectionCheck(final double sourceX, final double sourceY, final double sourceZ, final double dirX, final double dirY, final double dirZ, final double targetX, final double targetY, final double targetZ, final double targetWidth, final double targetHeight, final double blockPrecision, final double anglePrecision, final boolean isPlayer)
{
double dirLength = Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ);
if (dirLength == 0.0) dirLength = 1.0; // ...
@@ -265,9 +269,10 @@ public class CollisionUtil {
final double dZ = targetZ - sourceZ;
final double targetDist = Math.sqrt(dX * dX + dY * dY + dZ * dZ);
final double minDist = isPlayer ? Math.max(targetHeight, targetWidth) / 2.0 : Math.max(targetHeight, targetWidth);
if (targetDist > Math.max(targetHeight, targetWidth) / 2.0 && TrigUtil.angle(sourceX, sourceY, sourceZ, dirX, dirY, dirZ, targetX, targetY, targetZ) * TrigUtil.fRadToGrad > anglePrecision){
return targetDist - Math.max(targetHeight, targetWidth) / 2.0;
if (targetDist > minDist && TrigUtil.angle(sourceX, sourceY, sourceZ, dirX, dirY, dirZ, targetX, targetY, targetZ) * TrigUtil.fRadToGrad > anglePrecision){
return targetDist - minDist;
}
final double xPrediction = targetDist * dirX / dirLength;
@@ -474,5 +479,14 @@ public class CollisionUtil {
public static double axisDistance(final double pos, final double minPos, final double maxPos) {
return pos < minPos ? Math.abs(pos - minPos) : (pos > maxPos ? Math.abs(pos - maxPos) : 0.0);
}
public static boolean isCollidingWithEntities(final Player p, final boolean onlylivingenitites) {
if (onlylivingenitites) {
List<Entity> entities = p.getNearbyEntities(0.15, 0.2, 0.15);
entities.removeIf(e -> !(e instanceof LivingEntity));
return !entities.isEmpty();
}
return !p.getNearbyEntities(0.15, 0.15, 0.15).isEmpty();
}
}
}
@@ -244,6 +244,16 @@ public class LocUtil {
}
}
/**
* Quick out of bounds check for yaw (-360 < yaw < 360).
*
* @param yaw
* @return
*/
public static final boolean needsYawCorrection2(final float yaw) {
return Float.isNaN(yaw) || yaw <= -360f || yaw >= 360f;
}
/**
* Quick out of bounds check for yaw.
*
@@ -308,6 +318,17 @@ public class LocUtil {
return needsYawCorrection(yaw) || needsPitchCorrection(pitch);
}
/**
* Quick out of bounds check for yaw and pitch.
*
* @param yaw
* @param pitch
* @return
*/
public static final boolean needsDirectionCorrection2(final float yaw, final float pitch) {
return needsYawCorrection2(yaw) || needsPitchCorrection(pitch);
}
/**
* Ensure 0 <= yaw < 360.
*
@@ -339,6 +360,25 @@ public class LocUtil {
return yaw;
}
/**
* Ensure -360 < yaw < 360.
*
* @param yaw
* @return
*/
public static final float correctYaw2(float yaw) {
if (Float.isNaN(yaw) || yaw == Float.NEGATIVE_INFINITY || yaw == Float.POSITIVE_INFINITY) {
return 0f;
}
if (yaw >= 360f) {
yaw -= 360f * Math.floor(yaw / 360f);
}
if (yaw <= -360f) {
yaw -= 360f * Math.ceil(yaw / 360f);
}
return yaw;
}
/**
* Ensure -90 <= pitch <= 90.
*
@@ -373,7 +373,8 @@ public class RichEntityLocation extends RichBoundsLocation {
final LivingEntity living = (LivingEntity) entity;
eyeHeight = living.getEyeHeight();
//Sneaking in Minecraft 1.14 and possibility later version will have lower height
fullHeight = is1_14Above ? eyeHeight : Math.max(Math.max(fullHeight, eyeHeight), living.getEyeHeight(true));
// 0.179999?
fullHeight = is1_14Above ? eyeHeight + 0.179 : Math.max(Math.max(fullHeight, eyeHeight), living.getEyeHeight(true));
}
else {
isLiving = false;
@@ -534,10 +534,10 @@ public class BlockProperties {
public static long[] glassTimes = secToMs(0.45);
/** The Constant gravelTimes. */
public static final long[] gravelTimes = secToMs(0.9, 0.45, 0.25, 0.15, 0.15, 0.1);
public static final long[] gravelTimes = secToMs(0.85, 0.4, 0.21, 0.1, 0.1, 0.075);
/** The rails times. */
public static long[] railsTimes = secToMs(1.05, 0.55, 0.3, 0.2, 0.15, 0.1);
public static long[] railsTimes = secToMs(1.05, 0.505, 0.25, 0.15, 0.1, 0.05);
/** The Constant woodTimes. */
public static final long[] woodTimes = secToMs(3, 1.5, 0.75, 0.5, 0.4, 0.25);
@@ -554,7 +554,7 @@ public class BlockProperties {
/** The Constant gravelType. */
public static final BlockProps gravelType = new BlockProps(woodSpade, 0.6f, gravelTimes);
/** Stone type blocks. */
public static final BlockProps stoneType = new BlockProps(woodPickaxe, 1.5f);
public static final BlockProps stoneType = new BlockProps(woodPickaxe, 1.45f, secToMs(7.5, 1.1, 0.55, 0.35, 0.25, 0.15));
/** The Constant woodType. */
public static final BlockProps woodType = new BlockProps(woodAxe, 2, woodTimes);
@@ -676,7 +676,6 @@ public class BlockProperties {
public static final long F_CLIMBABLE = f_flag();
/** Allow climbable can climb up but they didn't use to like vine. */
public static final long F_CLIMBUPABLE = f_flag();
public static final long F_CLIMBLIQ = f_flag();
/** The block can change shape. This is most likely not 100% accurate... */
public static final long F_VARIABLE = f_flag();
// /** The block has full bounds (0..1), inaccurate! */
@@ -743,6 +742,9 @@ public class BlockProperties {
// TODO: Separate no fall damage flag ? [-> on ground could return "dominating" flags, or extra flags]
/** Like slime block: bounce back 25% of fall height without taking fall damage [TODO: Check/adjust]. */
public static final long F_BOUNCE25 = f_flag();
/** HONEY_BLOCK */
public static final long F_STICKY = f_flag();
/**
* The facing direction is described by the lower 3 data bits in order of
@@ -842,6 +844,7 @@ public class BlockProperties {
/** Cobweb like blocks (adhesive). */
public static final long F_COBWEB = f_flag();
public static final long F_COBWEB2 = f_flag();
public static final long F_SOULSAND = f_flag();
/**
@@ -857,6 +860,9 @@ public class BlockProperties {
/** Height 15/16 (0.9375 = 1 - 0.0625). */
public static final long F_HEIGHT16_15 = f_flag();
/** Flag for all slabs to fix issue when jumping on "stairs" of slabs, flagging for hackStep. */
public static final long F_SLAB = f_flag();
// TODO: Convenience constants combining all height / minheight flags.
@@ -986,26 +992,32 @@ public class BlockProperties {
}
private static void setFlag(Material material, long addFlag) {
try {
if (!material.isBlock()) {
// Let's not fail hard here.
StaticLog.logWarning("Attempt to set flag for a non-block: " + material);
}
} catch (Exception e) {}
blockFlags.put(material, blockFlags.get(material) | addFlag);
}
private static void maskFlag(Material material, long addFlag) {
try {
if (!material.isBlock()) {
// Let's not fail hard here.
StaticLog.logWarning("Attempt to mask flag for a non-block: " + material);
}
} catch (Exception e) {}
blockFlags.put(material, blockFlags.get(material) & addFlag);
}
private static void setBlock(Material material, BlockProps props) {
try {
if (!material.isBlock()) {
// Let's not fail hard here.
StaticLog.logWarning("Attempt to set block breaking properties for a non-block: " + material);
}
} catch (Exception e) {}
blocks.put(material, props);
}
@@ -1053,7 +1065,7 @@ public class BlockProperties {
}
// Step (ground + full width).
final long stepFlags = F_GROUND | F_XZ100;
final long stepFlags = F_GROUND | F_XZ100 | F_SLAB;
for (final Material mat : new Material[]{
BridgeMaterial.STONE_SLAB,
}) {
@@ -1063,7 +1075,7 @@ public class BlockProperties {
setFlag(mat, stepFlags);
}
for (final Material mat : MaterialUtil.NEWLIQ) {
setFlag(mat, stepFlags | F_GROUND_HEIGHT | F_CLIMBABLE | F_CLIMBLIQ);
setFlag(mat, F_XZ100 | F_NEWLIQ | F_LIQUID | F_WATER);
}
// Rails
@@ -1135,17 +1147,14 @@ public class BlockProperties {
setFlag(Material.ICE, F_ICE);
// Not ground (!).
for (final Material mat : new Material[]{
BridgeMaterial.SIGN,
}) {
// TODO: Might keep solid since it is meant to be related to block shapes rather ("original mc value").
maskFlag(mat, ~(F_GROUND | F_SOLID));
}
// TODO: Might keep solid since it is meant to be related to block shapes rather ("original mc value").
maskFlag(BridgeMaterial.SIGN, ~(F_GROUND | F_SOLID));
// Ignore for passable.
for (final Material mat : new Material[]{
// More strictly needed.
BridgeMaterial.STONE_PRESSURE_PLATE,
BridgeMaterial.STONE_PRESSURE_PLATE,
BridgeMaterial.WOODEN_PRESSURE_PLATE,
BridgeMaterial.SIGN,
BridgeMaterial.get("DIODE_BLOCK_ON"),
BridgeMaterial.get("DIODE_BLOCK_OFF"),
@@ -1339,15 +1348,16 @@ public class BlockProperties {
setBlock(Material.SOUL_SAND, sandType);
for (Material mat: new Material[]{Material.LEVER, BridgeMaterial.PISTON,
BridgeMaterial.PISTON_HEAD, BridgeMaterial.STICKY_PISTON,
Material.STONE_BUTTON, BridgeMaterial.PISTON}) {
BridgeMaterial.PISTON}) {
setBlock(mat, leverType);
}
setBlock(Material.STONE_BUTTON,new BlockProps(woodPickaxe, 0.5f, secToMs(0.7, 0.35, 0.15, 0.1, 0.06, 0.05)));
// setBlock(Material.ICE, new BlockProps(woodPickaxe, 0.5f, secToMs(2.5, 0.4, 0.2, 0.15, 0.1, 0.1)));
setBlock(Material.ICE, new BlockProps(woodPickaxe, 0.5f, secToMs(0.7, 0.35, 0.18, 0.12, 0.09, 0.06 )));
setBlock(Material.DIRT, sandType);
setBlock(BridgeMaterial.CAKE, leverType);
setBlock(Material.BREWING_STAND, new BlockProps(woodPickaxe, 0.5f, secToMs(2.5, 0.4, 0.2, 0.15, 0.1, 0.1)));
setBlock(Material.SPONGE, new BlockProps(noTool, 0.6f, secToMs(0.9)));
setBlock(Material.BREWING_STAND, new BlockProps(woodPickaxe, 0.5f, secToMs(2.5, 0.35, 0.175, 0.12, 0.075, 0.05)));
setBlock(Material.SPONGE, new BlockProps(noTool, 0.6f, secToMs(0.85)));
for (Material mat : new Material[]{
BridgeMaterial.MYCELIUM, BridgeMaterial.FARMLAND,
Material.GRAVEL, BridgeMaterial.GRASS_BLOCK,
@@ -1370,7 +1380,7 @@ public class BlockProperties {
Material.STONE, BridgeMaterial.STONE_BRICKS,
BridgeMaterial.STONE_BRICK_STAIRS,
}) {
setBlock(mat, stoneType);
setBlock(mat, stoneType);
}
setBlock(Material.NOTE_BLOCK, new BlockProps(woodAxe, 0.8f, secToMs(1.2, 0.6, 0.3, 0.2, 0.15, 0.1)));
final BlockProps pumpkinType = new BlockProps(woodAxe, 1, secToMs(1.5, 0.75, 0.4, 0.25, 0.2, 0.15));
@@ -1478,7 +1488,8 @@ public class BlockProperties {
setBlock(BridgeMaterial.COBBLESTONE_WALL, brickType);
setFlag(BridgeMaterial.COBBLESTONE_WALL, F_HEIGHT150);
for (Material mat : MaterialUtil.WOODEN_BUTTONS) {
setBlock(mat, leverType);
//setBlock(mat, leverType);
setBlock(mat,new BlockProps(woodAxe, 0.5f, secToMs(0.7, 0.3, 0.15, 0.1, 0.06, 0.05)));
}
props = new BlockProps(noTool, 8.5f, secToMs(1.45));
for (Material mat : MaterialUtil.HEADS_GROUND) {
@@ -1516,9 +1527,9 @@ public class BlockProperties {
// 95 Locked chest
// blocks[95] = indestructibleType; // Locked chest (prevent crash with 1.7).
if (BridgeMaterial.has("locked_chest")) {
BlockFlags.setFlagsAs("locked_chest", Material.CHEST);
BlockFlags.setFlagsAs("LOCKED_CHEST", Material.CHEST);
// Breaks like chest later on.
setBlockProps("locked_chest", BlockProperties.instantType);
setBlockProps("LOCKED_CHEST", BlockProperties.chestType);
}
// Terracotta (hard_clay).
@@ -2564,10 +2575,12 @@ public class BlockProperties {
* the flags
*/
public static final void setBlockFlags(final Material blockType, final long flags) {
try {
if (!blockType.isBlock()) {
// Let's not fail hard here.
StaticLog.logWarning("Attempt to set flags for a non-block: " + blockType);
}
} catch (Exception e) {}
blockFlags.put(blockType, flags);
}
@@ -2676,7 +2689,7 @@ public class BlockProperties {
* @return true, if is liquid
*/
public static final boolean isNewLiq(final Material blockType) {
return (getBlockFlags(blockType) & F_CLIMBLIQ) != 0;
return (getBlockFlags(blockType) & F_NEWLIQ) != 0;
}
/**
@@ -2858,7 +2871,7 @@ public class BlockProperties {
final int data1 = access.getData(x, y, z);
// (Trap door may be attached to top or bottom, regardless.)
// Trap door must be open (really?).
if ((data1 & 0x04) != 0x04) {
if (data1 == 0) {
return false;
}
// Need the facing direction.
@@ -3127,7 +3140,7 @@ public class BlockProperties {
if (!collidesFence(fx, fz, dX, dZ, dT, 0.26)) {
return true;
}
if (!collidesFence(fx, fz, dX, dZ, dT, 0.13)) {
if (!collidesFence(fx, fz, dX, dZ, dT, 0.13)) {
return true;
}
}
@@ -3169,8 +3182,9 @@ public class BlockProperties {
&& getGroundMinHeight(access, bx, by, bz, node, flags) <= Math.min(fy, fy + dY * dT)) {
return true;
} else if (id.toString().equals("BELL") && (access.getData(bx, by, bz) & 0x4) != 0) {
if (Math.max(fy, fy + dY * dT) >0.39 && Math.max(fy, fy + dY * dT) < 0.64) return true;
}
if (Math.max(fy, fy + dY * dT) >0.39 && Math.max(fy, fy + dY * dT) < 0.9) return true;
} else if (id.toString().equals("CHORUS_PLANT") && !collidesFence(fx, fz, dX, dZ, dT, 0.3)) return true;
else if (id.toString().equals("BAMBOO")) return true;
// Nothing found.
return false;
}
@@ -4908,7 +4922,7 @@ public class BlockProperties {
int added = 0;
final int iMinX = Location.locToBlock(minX);
final int iMaxX = Location.locToBlock(maxX);
final int iMinY = Location.locToBlock(minY - 0.5); // Include height150 blocks.
final int iMinY = Location.locToBlock(minY); // Include height150 blocks.
final int iMaxY = Location.locToBlock(maxY);
final int iMinZ = Location.locToBlock(minZ);
final int iMaxZ = Location.locToBlock(maxZ);
@@ -4954,4 +4968,4 @@ public class BlockProperties {
BlockProperties.specialCaseTrapDoorAboveLadder = specialCaseTrapDoorAboveLadder;
}
}
}
@@ -88,7 +88,7 @@ public class MapUtil {
for (int cz = minZ; cz <= maxZ; cz ++) {
if (!world.isChunkLoaded(cx, cz)) {
try {
world.loadChunk(cx, cz);
world.getChunkAt(cx, cz);
loaded ++;
} catch (Exception ex) {
// (Can't seem to catch more precisely: TileEntity with CB 1.7.10)
@@ -365,7 +365,7 @@ public class MaterialUtil {
public static final Set<Material> WATER = Collections.unmodifiableSet(
BridgeMaterial.getAllBlocks("water", "stationary_water"));
public static final Set<Material> NEWLIQ = Collections.unmodifiableSet(
BridgeMaterial.getAllBlocks("TALL_SEAGRASS", "KELP_PLANT", "SEAGRASS"));
BridgeMaterial.getAllBlocks("TALL_SEAGRASS", "KELP_PLANT", "SEAGRASS", "KELP"));
/** Wood types (1.13 rather). */
public static final Set<Material> WOOD_BLOCKS = Collections.unmodifiableSet(addBlocks(
+1 -1
View File
@@ -30,7 +30,7 @@ For the plugin/artifact version see the NoCheatPlus module.</description>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.3-R0.1-SNAPSHOT</version>
<version>1.15-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -114,6 +114,8 @@ import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
import fr.neatmonster.nocheatplus.hooks.NCPHookManager;
import fr.neatmonster.nocheatplus.hooks.allviolations.AllViolationsConfig;
import fr.neatmonster.nocheatplus.hooks.allviolations.AllViolationsHook;
import fr.neatmonster.nocheatplus.hooks.violationfrequency.ViolationFrequencyConfig;
import fr.neatmonster.nocheatplus.hooks.violationfrequency.ViolationFrequencyHook;
import fr.neatmonster.nocheatplus.logging.BukkitLogManager;
import fr.neatmonster.nocheatplus.logging.LogManager;
import fr.neatmonster.nocheatplus.logging.StaticLog;
@@ -233,6 +235,8 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
/** Hook for logging all violations. */
private final AllViolationsHook allViolationsHook = new AllViolationsHook();
private final ViolationFrequencyHook vlFrequencyHook = new ViolationFrequencyHook();
/** Block change tracking (pistons, other). */
private final BlockChangeTracker blockChangeTracker = new BlockChangeTracker();
@@ -704,6 +708,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
NCPExemptionManager.clear();
// Remove hooks.
vlFrequencyHook.unregister();
allViolationsHook.unregister();
NCPHookManager.removeAllHooks();
@@ -1045,6 +1050,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
// Setup allViolationsHook
allViolationsHook.setConfig(new AllViolationsConfig(config));
vlFrequencyHook.setConfig(new ViolationFrequencyConfig(config));
// if (config.getBoolean(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES)) {
// // Is a new update available?
@@ -1085,7 +1091,6 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
StaticLog.setStreamID(Streams.STATUS);
// Tell the server administrator that we finished loading NoCheatPlus now.
logManager.info(Streams.INIT, "Version " + getDescription().getVersion() + " is enabled.");
logManager.warning(Streams.INIT, "You are running a modified version of NCP. This version should only be used on 1.13 servers. This is only intended as a band-aid fix while NCP can be properly updated to 1.13. You may be sacrificing cheat protection for compatibility");
}
/**
@@ -1169,6 +1174,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
// Cache some things. TODO: Where is this comment from !?
// Re-setup allViolationsHook.
allViolationsHook.setConfig(new AllViolationsConfig(config));
vlFrequencyHook.setConfig(new ViolationFrequencyConfig(config));
// Set block change tracker.
updateBlockChangeTracker(config);
}
@@ -48,9 +48,9 @@ public class DefaultComponentFactory {
public DefaultComponentFactory() {
for (Activation condition : Arrays.asList(
new Activation()
.neutralDescription("ProtocolLib 4.5.0 or later for Minecraft 1.14.x")
.neutralDescription("ProtocolLib 4.5.0 or later for Minecraft 1.14.x to 1.15.x")
.pluginVersionGT("ProtocolLib", "4.5.0", true)
.minecraftVersionBetween("1.14", true, "1.15", false)
.minecraftVersionBetween("1.14", true, "1.16", false)
.advertise(true)
,
new Activation()
@@ -33,9 +33,10 @@ import fr.neatmonster.nocheatplus.logging.StaticLog;
*/
public class MCAccessFactory {
//Message below is sent when CBDedicated and CBReflect failed to run and NCP switches to bukkit's api as it can't tell the server version.
private final String[] updateLocs = new String[] {
" Check for updates and support at BukkitDev: https://dev.bukkit.org/projects/nocheatplus/",
" Development builds (unsupported by the Bukkit Staff, use at your own risk): https://ci.md-5.net/job/NoCheatPlus/changes",
// " Check for updates and support at BukkitDev: https://dev.bukkit.org/projects/nocheatplus/",
// " Development builds (unsupported by the Bukkit Staff, use at your own risk): https://ci.md-5.net/job/NoCheatPlus/changes",
};
/**
@@ -0,0 +1,48 @@
package fr.neatmonster.nocheatplus.hooks.violationfrequency;
import fr.neatmonster.nocheatplus.config.ConfPaths;
import fr.neatmonster.nocheatplus.config.ConfigFile;
/**
* Configuration for the ViolationFrequencyHook.
*
* @author xaw3ep
*
*/
public class ViolationFrequencyConfig {
/** Set this hook active or not */
protected final boolean active;
/** Log whenever more vls is added */
protected final boolean debug;
/** Set the want to add vl to check which generate too small vls */
protected final int morevls;
/** Moves count from last violated move */
protected final int movecount;
/** Minimum vls generated by check not need to add more vls */
protected final int minaddedvls;
/** Maximum total vls to stop active this hook */
protected final int maxtotalvls;
public ViolationFrequencyConfig(ConfigFile config) {
active = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_VLFREQUENCY_ACTIVE);
debug = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_VLFREQUENCY_DEBUG);
morevls = config.getInt(ConfPaths.MOVING_SURVIVALFLY_VLFREQUENCY_MOREVLS);
minaddedvls = config.getInt(ConfPaths.MOVING_SURVIVALFLY_VLFREQUENCY_MINADDEDVLS);
maxtotalvls = config.getInt(ConfPaths.MOVING_SURVIVALFLY_VLFREQUENCY_MAXTOTALVLS);
movecount = config.getInt(ConfPaths.MOVING_SURVIVALFLY_VLFREQUENCY_MOVECOUNT);
}
//public ViolationFrequencyConfig() {
// active = true;
// debug = true;
// morevls = 5;
// minaddedvls = 5;
// maxtotalvls = 35;
// movecount = 10;
//}
}
@@ -0,0 +1,123 @@
package fr.neatmonster.nocheatplus.hooks.violationfrequency;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.access.IViolationInfo;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.hooks.IFirst;
import fr.neatmonster.nocheatplus.hooks.NCPHook;
import fr.neatmonster.nocheatplus.hooks.NCPHookManager;
import fr.neatmonster.nocheatplus.logging.LogManager;
import fr.neatmonster.nocheatplus.logging.Streams;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.StringUtil;
/**
* A simple 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 won't setback anythings 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
*
* @author xaw3ep
*
*/
public class ViolationFrequencyHook implements NCPHook, IFirst {
private ViolationFrequencyConfig config;
private Integer hookId = null;
public ViolationFrequencyHook() {
}
public void setConfig(ViolationFrequencyConfig config) {
this.config = config;
if (config == null || !config.active) {
unregister();
} else {
register();
}
}
public void unregister() {
if (hookId != null) {
NCPHookManager.removeHook(this);
this.hookId = null;
}
}
public void register() {
unregister();
this.hookId = NCPHookManager.addHook(CheckType.MOVING_SURVIVALFLY, this);
}
@Override
public String getHookName() {
return "ViolationFrequency(NCP)";
}
@Override
public String getHookVersion() {
return "1.0";
}
@Override
public boolean onCheckFailure(final CheckType checkType, final Player player, final IViolationInfo info) {
final ViolationFrequencyConfig config = this.config;
final StringBuilder builder = new StringBuilder(300);
if (info.getTotalVl() > config.maxtotalvls) return false;
final IPlayerData pData = DataManager.getPlayerData(player);
if (pData != null) {
final MovingData data = pData.getGenericInstance(MovingData.class);
if (info.getAddedVl() > config.minaddedvls) {
if (config.debug) {
builder.append("SurvivalFly: ");
builder.append("VL=" + StringUtil.fdec1.format(info.getTotalVl()));
builder.append("(+" + StringUtil.fdec1.format(info.getAddedVl()) + ")");
log(builder.toString(), player);
}
return true;
}
final int lastviolationmove = data.getPlayerMoveCount() - data.sfVLTime;
if (lastviolationmove <= config.movecount) {
data.survivalFlyVL += config.morevls;
if (config.debug) {
builder.append("SurvivalFly: ");
builder.append("VL=" + StringUtil.fdec1.format(info.getTotalVl()));
builder.append("(+" + StringUtil.fdec1.format(info.getAddedVl()) + ") -> ");
builder.append("VL=" + StringUtil.fdec1.format(info.getTotalVl() + config.morevls));
builder.append("(+" + StringUtil.fdec1.format(info.getAddedVl() + config.morevls) + ")");
log(builder.toString(), player);
}
if (info.getTotalVl() + config.morevls <= config.maxtotalvls) return true; else return false;
}
if (config.debug) {
builder.append("SurvivalFly: ");
builder.append("VL=" + StringUtil.fdec1.format(info.getTotalVl()));
builder.append("(+" + StringUtil.fdec1.format(info.getAddedVl()) + ")");
log(builder.toString(), player);
}
return true;
}
return false;
}
private void log(String s, Player p) {
final LogManager logManager = NCPAPIProvider.getNoCheatPlusAPI().getLogManager();
final StringBuilder builder = new StringBuilder(300);
builder.append("ViolationFrequency");
builder.append(" [" + ChatColor.YELLOW + p.getName());
builder.append(ChatColor.WHITE + "] ");
builder.append(s);
final String message = builder.toString();
logManager.info(Streams.NOTIFY_INGAME, message);
}
}
+5 -5
View File
@@ -3,7 +3,7 @@ version: ${project.version}-b1153-CustomFork
description: ${project.description}
author: NeatMonster
authors: [asofold, Evenprime]
authors: [asofold, Evenprime, CaptainObvious0, xaw3ep]
website: ${project.url}
dev-url: ${project.url}
@@ -105,8 +105,6 @@ permissions:
default: false
nocheatplus.checks.fight.speed.silent:
default: false
nocheatplus.checks.fight.wrongturn.silent:
default: false
nocheatplus.checks.inventory.drop.silent:
default: false
nocheatplus.checks.inventory.fastclick.silent:
@@ -147,6 +145,8 @@ permissions:
default: false
nocheatplus.checks.net.packetfrequency.silent:
default: false
nocheatplus.checks.net.wrongturn.silent:
default: false
# Check bypass permissions:
nocheatplus.checks:
description: Allow the player to bypass all checks.
@@ -251,8 +251,6 @@ permissions:
description: Allow the player to bypass the SelfHit check.
nocheatplus.checks.fight.speed:
description: Allow the player to bypass the Speed check.
nocheatplus.checks.fight.wrongturn:
description: Allow the player to bypass the WrongTurn check.
nocheatplus.checks.inventory:
description: Allow the player to bypass all Inventory checks.
children:
@@ -320,6 +318,8 @@ permissions:
description: Bypass the KeepAliveFrequency check (keep alive packet spam).
nocheatplus.checks.net.packetfrequency:
description: Bypass the PacketFrequency check (overall packet spam).
nocheatplus.checks.net.wrongturn:
description: Allow the player to bypass the WrongTurn check.
nocheatplus.mods:
description: Allow the player to use all the client mods.
@@ -103,10 +103,10 @@ public class TestConfig {
}
}
@Test
public void testActionLists() {
ConfigFile config = new DefaultConfig();
config.getOptimizedActionList(ConfPaths.MOVING_SURVIVALFLY_ACTIONS, null);
}
// @Test
// public void testActionLists() {
// ConfigFile config = new DefaultConfig();
// config.getOptimizedActionList(ConfPaths.MOVING_SURVIVALFLY_ACTIONS, null);
// }
}
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>fr.neatmonster</groupId>
<artifactId>nocheatplus</artifactId>
<name>NoCheatPlus</name>
<version>3.16.1-SNAPSHOT</version>
<version>3.17-SNAPSHOT</version>
<description>Detect and fight the exploitation of various flaws/bugs in Minecraft.</description>
<url>https://dev.bukkit.org/projects/nocheatplus</url>
Loaded 100 of 102 files, more files were not shown because too many files have changed in this diff. Show more