Commit Graph

2638 Commits

Author SHA1 Message Date
asofold
e54d7a207e Move some code into a method. 2016-01-03 12:41:02 +01:00
asofold
5bbd22db38 [BLIND] Fix after-data-reset workaround (skip_paper): bypass vdistrel
* Add mightBeMultipleMoves to MoveData.
* Use a utility method to test for skip_paper, both on setting
vAllowedDistance for vdistrel and in vdistsb.
* Set the skip_paper tag during setting vAllowedDistance for vdistrel,
as that is always run.
2016-01-03 12:34:43 +01:00
asofold
dcc0ac354b Add oddFriction case (near zero yDistance). 2016-01-02 00:48:35 +01:00
asofold
56666bc8b3 Move most static stuff from SurvivalFly to a Magic class. 2016-01-01 23:38:53 +01:00
asofold
856e723908 Change the 'step' detection.
Catch yDistance between step height and minimum jump gain, let vdistrel
and vdistsb catch the rest. Use the more precise flags of data.thisMove.
2016-01-01 21:02:08 +01:00
asofold
2bb605a497 Add special case using two past moves (rare). 2016-01-01 19:58:58 +01:00
asofold
37c35cd271 vDistLiquid: Extend workaround for second in-medium move (swimdown). 2016-01-01 19:13:55 +01:00
asofold
9e3e1b9774 Add oddGravity case (slightly too small decrease, moving up, velocity). 2016-01-01 18:41:33 +01:00
asofold
daf6ab78d6 Adjust oddLiquid case (moving out of water with velocity). 2016-01-01 18:30:12 +01:00
asofold
6110e9301f [BLEEDING] Split teleport handling to using multiple priorities.
* Cancel/alter on lowest.
* Override cancel on set-back on highest.
* Adjust data on monitor.

Partly simplify, e.g. by just cancelling the event (nothing should
happen) - can't recall if there has been a reason to setTo(setBack)
instead of event.setCancelled(true).
2016-01-01 00:51:22 +01:00
asofold
99598b9490 onPlayerTeleport: Only use ref locally, where needed. 2015-12-30 21:57:04 +01:00
asofold
539294c599 Further simplify onPlayerTeleport (early return). 2015-12-30 21:22:21 +01:00
asofold
65e655a989 vDistAir: Fix envelope for missing/reset past move data. 2015-12-30 20:26:38 +01:00
asofold
6c797f8561 Make 'related plugins' a headline in the 'ncp version' command. 2015-12-28 22:41:48 +01:00
asofold
1dad595faa Reset positions with extra properties, also set medium properties.
* Call both most of the time.
* A convenience measure to have last move ground set, at the cost of
setting it 'too often' (players might not get checked by survivalfly at
all).
* Wrap calls with one PlayerLocation instance, for efficiency.
2015-12-28 22:11:10 +01:00
asofold
67071b3fad [BLEEDING] Add/move typical flags to past move tracking.
Move location-dependent properties from MovingData and MoveData to
LocationData.

Rough list of related Changes:
* Represent from and to positions as LocationData inside of MoveData.
* Have flags for onGround, inLiquid and the like in LocationData.
* Change noFallAssumeGround to touchedGroundWorkaround within MoveData.
* Add touchedGround to MoveData (to|from|workaround).
* (Remove involved properties from MovingData and use MoveData.from/to
instead.)
* Use MoveData and LocationData flags instead of PlayerLocation methods
in more places.
* Adjust various special case pre-conditions, based on past move data.

Other changes made on the fly:
* Allow maximum of jump gain and step height for ground -> ground.
* Add envelopes for vDistAir after teleport/join/respawn.
* Add cases for vdistrel.
* Extend logging on teleport (add cause, log set-back too).
* Reorder/fix vdistsb workaround checking.
* Reorder teleport handling.
* Remove small-range workaround for teleport [uncertain effect].

Immediate future follow ups:
* Attempt to only accept PlayerLocation for various setPositions methods
in MovingData (ensure to set MoveData with extra properties +
simplify/cleanup (public) methods with MoveData/LocationData).
* Relate to past move tracking for more workarounds, either to confine
pre-conditions more (inLiquid instead of toWasReset~somehow), or just to
be able to track a false positive at all (thisMove + 2 past moves
needed).
* (Fixes, etc.)

Distant future follow-up:
* Somehow merge with PlayerLocation, e.g. using LocationData inside
PlayerLocation internally, which means changing raw types to Object
versions, just like it's done inside of PlayerLocation right now.
* Possibly PlayerLocation is transformed to static methods with
BlockCache and LocationData as input.

Expected trouble:
* New/old false positives, due to replacing the fromWasReset and
toWasReset by more distinct flags from past move tracking.
 * A workaround may have prevented other false positives
unintentionally, e.g. had been intended for liquid, but the
to/fromWasReset flags previously did include ground/noFallAssumeGround,
thus the workaround will not cover that case anymore, after the change. 
 * Forgetting something like checking touchedGround and to/from.onGround
or similar as a replacement for xyWasReset.
* Mixing up thisMove and lastMove for touchedGround.
* Mixing up touchedGround and touchedGroundWorkaround in MoveData.
2015-12-28 15:46:31 +01:00
asofold
73cdef5b56 Collect block flags on adjustMediumProperties. 2015-12-26 00:09:22 +01:00
asofold
7be8a9c053 Add convenience methods. 2015-12-25 13:55:03 +01:00
asofold
9b71b25191 Invalidate past move data on leave. 2015-12-25 13:20:24 +01:00
asofold
4730b35c17 Add cncp and ProtocolLib versions to 'ncp version' output. 2015-12-25 00:58:23 +01:00
asofold
b2aae768b6 Support (wildcard) exemption by meta data 'nocheat.exempt'.
This is a first version without any safeguards and without any settings.
A player who has any meta data for 'nocheat.exempt' is regarded exempt
from all checks. Suggestion is a boolean value (true), but setting
anything will do for the moment. Later String values or List<String>
might be supported to allow some kind of generic categories for
exemption (to be discussed with skill plugin developers).

 This is not meant for permanent marking, but rather for "extra" events
like area damage with entity.damage(amount, damagerPlayer). The plugin
setting the metadata should also remove the metadata. In order not to
remove all protection by NoCheatPlus, plugins should fire extra events
or cancel events on a higher priority level than EventPriority.LOWEST.
2015-12-21 22:52:09 +01:00
asofold
d3778bb67c Check for base allowed distance instead of actual in some places. 2015-12-20 22:29:02 +01:00
asofold
ea9198c6fe Set thisMove.flyCheck as early as possible. 2015-12-20 00:45:44 +01:00
asofold
b7af1be275 Store allowed base + actual hDistanceS in MoveData, use on bunny.
To be continued: 
* Relating to the 'allowed base distance' for horizontal moving allows
to judge speed without taking friction or bunny-hopping into account.
* Make use in bunny hop (seems to make 2-high ceiling + sprint jump a
little better).
* Later more workarounds should be confined to a minimum, using
MoveData.
2015-12-19 22:32:11 +01:00
asofold
aaa7f635ab Move more properties to MoveData.
* Namely walkSpeed, downStream.
* SurvivalFly: Alter method signatures to use thisMove rather.
* MoveData: Only initialize the necessary minimum.
* Add MoveData.alwaysInvalidated, to indicate random future purpose.
2015-12-19 19:37:38 +01:00
asofold
3cfa6cfb06 Invalidate currently processed move, if a teleport happened.
Should only be possible to happen, if an actions entry doesn't use 'ncp
delay ...' for teleporting, or if a hook teleports the player (both
discouraged).
2015-12-16 18:39:36 +01:00
asofold
16a1e08f57 [BREAKING] Use MoveData for more 'last123'-type properties.
Does break use of MovingData for last coordinates and distances (not
officially exposed API).

Other changes:
* Position resetting on teleport events has been altered.
* Some blocks/methods are guarded by checking for lastMove.toIsValid.
* Possibly other.
2015-12-16 18:08:22 +01:00
asofold
2145a6a0d3 Don't allow item use on blockinteract.speed violations. 2015-12-15 21:12:33 +01:00
asofold
dab3229066 Add hack for slowness + sprint.
Still needs adjustments to only allow this speed on jumping.
2015-12-15 20:50:49 +01:00
asofold
98df033a7c Store if head is obstructed for past moves and make use of it.
Also:
* Rename the walkSpeed constant to WALK_SPEED (nuisance to mix up).
* Alter conditions slightly in some places by using
thisMove/lastMove.headObstructed.

Issues remaining:
* Moderate speed increase with yDist 0 and hDist like 0.35 -> 0.45.
* Transitions head blocked -> not, can trigger hspeed violations.
2015-12-13 23:19:29 +01:00
asofold
cfc2db97f3 Store past moves as MoveData (raw sketch, no change on logic). 2015-12-13 18:48:42 +01:00
asofold
742877dd6d Adjust use of isHeadObstructed.
* Remove extra conditions for from.isHeadObstructed in vDistAir.
* Account for yDistance in more places. Use the maximum of the default
margin and yDistance.
* Add a tag for not setting low jump, due to the head being obstructed.

Fixes:
* Issues with 2-high ceiling with normal ground.

Issues remaining:
* Ice floor + 2-high ceiling.
* Jump/bunny with head blocked, moving to where the head is not blocked.
2015-12-13 16:39:42 +01:00
asofold
532f8e3a4b Tickets are now on GitHub: https://github.com/NoCheatPlus/Issues/issues 2015-12-12 23:48:17 +01:00
asofold
b7825a15f9 Set version to 3.13.5-SNAPSHOT. 2015-12-12 16:07:31 +01:00
asofold
87ba5983e3 Set version to 3.13.4-BETA for release. 2015-12-12 16:06:04 +01:00
asofold
acc3376106 Expect an outgoing teleport for cancelled PlayerMoveEventS.
There is a small chance that other plugin cancel these events. Since the
server ignores event.setFrom for cancelled events and also won't fire a
teleport event, this remains a problematic case.
2015-12-12 15:58:02 +01:00
asofold
bd9f471102 More oddLiquid cases (moving down out of water). 2015-12-12 15:41:19 +01:00
asofold
9dbd721d12 Fight auto-indent. 2015-12-12 14:14:44 +01:00
asofold
71abb63641 Don't add a new entry after merging. 2015-12-12 14:03:31 +01:00
asofold
b0dd8b18ed Update time for stored entries, in case time ran backwards. 2015-12-12 14:02:58 +01:00
asofold
f9f04feee0 Extend margin for PaperSpigot workaround, confine by split move 1.
Add a tag.
2015-12-09 22:14:37 +01:00
asofold
4e0b617bea Add missing return value. 2015-12-09 11:55:25 +01:00
asofold
7db75f4d79 Faster return for packets missing position or look data. 2015-12-09 11:49:19 +01:00
asofold
0fe398c233 Confine PaperSpigot workaround by jumpphase instead of hDistance. 2015-12-09 10:38:04 +01:00
asofold
0ccfe9699f Increase default max age. 2015-12-08 19:24:40 +01:00
asofold
2ac4bc7939 Less comma. 2015-12-08 19:23:00 +01:00
asofold
e82a989119 Use a real queue for TeleportQueue.
Main purpose is to prevent FlyingFrequency false positives with teleport
loops/excess (typically server or NCP set-backs).
2015-12-08 19:18:56 +01:00
asofold
61d58406f7 [BLIND] Add special case to skip vdistsb to prevent a set-back loop.
~ Observed on PaperSpigot 1.7.10
2015-12-08 13:29:29 +01:00
asofold
0645922ad7 Set version to continued 3.13.4-SNAPSHOT. 2015-12-07 10:48:47 +01:00
asofold
023bddbbad Set version to 3.13.3-BETA for release. 2015-12-07 10:40:33 +01:00