Commit Graph

911 Commits

Author SHA1 Message Date
asofold
3c3ae4b351 Quick workaround for split moves (disable handling).
https://hub.spigotmc.org/jira/browse/SPIGOT-1646
2016-03-02 18:53:20 +01:00
asofold
bb6672630e Delegate testing for presence and level to generic methods. 2016-02-28 22:10:30 +01:00
asofold
557373ad0e Fix NPE with time running backwards. 2016-02-18 10:03:51 +01:00
asofold
5f41715fe2 [BLEEDING] Add early check for extreme moves (sub check of sf/cf). 2016-02-16 12:18:02 +01:00
asofold
10a1d1ffed Allow using blocks with boat in hand. 2016-02-16 12:07:44 +01:00
asofold
4599194eb0 Clarify javadocs. 2016-02-16 10:46:42 +01:00
asofold
e958e6ef7a Add Check.executeActions with IPenaltyList as extra argument. 2016-02-14 13:35:19 +01:00
asofold
0915acdee6 Use a provided interface to fill in input-specific penalties.
This seems to be more appropriate, for the case of multiple checks
triggering, but also for better performance, in case the check doesn't
even support input-specific penalties.
2016-02-12 00:51:18 +01:00
asofold
851203edb9 [BREAKING][BLEEDING] Adjust the API to the upcoming penalty framework.
This is a first step in, which doesn't change the default behavior,
however it might break plugins that rely on certain internals.

PenaltyAction allows to do something with probabilities to consider,
including the possibility to select the first applicable penalty or
applying several penalties. There will be player-specific penalties,
which are applied during ViolationData.executeActions always, and there
will be input-specific penalties, e.g. for applying within the event
listener.

Potentially breaking:
* Return value of executeActions is now void for Action + ViolationData.
* Return value of Check.executeActions is ViolationData now.
* CancelAction is now extending PenaltyAction.
* CancelPenalty may cancel, but might not, due to probability.
* IViolationInfo.hasCancel -> deprecated, now returns willCancel().
* IViolationInfo.willCancel is now used, applicable penalties are
estimated on creation of ViolationData.
* Custom actions can no longer be used to cause cancel. Only penalties
can do so now (due to the return type change). CancelAction is still
there to keep a simple action for canceling.

Not yet:
* InputSpecificPenalty support for fight checks and using them in the
default actions.
* Configuration for penalties (currently only a plugin could override
the action factories, later penalties may have a probability to apply,
reference each other, allow first match, apply several at once).
2016-02-10 00:28:57 +01:00
asofold
8d6b930166 isHeadObstructed: Throw an IllegalArgumentException on margin < 0.
(Shouldn't fix anything.)
2016-02-09 14:46:07 +01:00
asofold
14e4620b76 Fix violation being added twice for display. 2016-02-08 20:36:16 +01:00
asofold
5e1c71b451 Just start small (Bukkit.getServer() fails on tests). 2016-02-08 01:53:40 +01:00
asofold
302b1ec824 PlayerPortalEvent: add to debug log, don't reset data if to is null. 2016-02-08 01:10:34 +01:00
asofold
f6a004015d [BLEEDING] Prepare 'data removal light' for time running backwards.
Introduce an interface to indicate if a CheckDataFactory or IRemoveData
instance can do something better than removing all data, in case the
system time ran backwards. An extra method in data manager is used
instead of clearAllData, which will test for implementation of that
interface. Concerns CheckDataFactory instances accessible via CheckType 
and IRemoveData instances registered with DataManager (via
NoCheatPlusAPI or directly).

Implementation details and related changes:
* TickTask: Let ActionFrequency handle time running backwards (spikes).
* NetData/Factory: Use HashMapLOW. Selectively clear/adjust.
* MovingData: Keep past move tracking (and some other).
2016-02-08 01:03:27 +01:00
asofold
7360e33930 Set version to 3.13.7-RC for release.
Just to have something above the too old releases.
2016-01-31 17:15:19 +01:00
asofold
cc68a52ac4 Use one generic instance for Random. 2016-01-30 14:32:28 +01:00
asofold
f87870b1a8 Adjust things for a low ceiling. 2016-01-29 00:06:08 +01:00
asofold
9aabb113e0 Change all protected visibility to private for now. 2016-01-28 12:33:04 +01:00
asofold
27e30ce29a Javadocs/comments. 2016-01-28 10:26:32 +01:00
asofold
f057f39fde Can't increase to 0. 2016-01-27 10:14:43 +01:00
asofold
f22bf88824 Adjust checking for 'head obstructed'.
Remove ambigue method, apply a different default margin, up to the next
block in steps of 0.25, if within 0.35 reach.

Default methods use this correction now, so some places might check with
too high a margin now.
2016-01-27 00:34:12 +01:00
asofold
36c018bc3c Use the bounds coordinates as intended. 2016-01-26 23:51:01 +01:00
asofold
c20d593d42 Fix stepping onto boats. 2016-01-26 21:36:37 +01:00
asofold
8985b67668 [BLEEDING] Reduce fp with blockinteract.visible using ProtocolLib.
Not entirely sure this will still protect from anything, shortish:
* Remove cancelling due to coarse pre-checks.
* Rather correct the end location back onto the end block somehow.
* Retry ray-tracing with the pitch and yaw of past flying packets.
* Let the direction check handle the off-too-far part and let people
blame that one for remaining amounts of false positives.

Missing:
* Should confine by distance to last move, perhaps.
2016-01-26 01:53:40 +01:00
asofold
e278e01a3c Replace ( and ) by ~ in /ncp version. Just BLOCKSMC1_4, no (base).
Doesn't look better ingame/console, but might on GitHub.
2016-01-25 21:49:06 +01:00
asofold
0a32d55039 Swap player name and check type for standard format. 2016-01-25 21:23:30 +01:00
asofold
d62ff6754a Move moving specific logging methods back to the moving listener.
* Make them private methods.
* Use standard log message prefix (add a method for that to CheckUtils).
2016-01-25 21:10:42 +01:00
asofold
f6dfa51efe Alter tags in blockinteract.visible. 2016-01-25 20:40:05 +01:00
asofold
544e1ad14e Switch debug messages to a standard format.
Use check-specific debug methods for convenience.
Add to: Check, CheckListener, BaseAdapter.
Relay to: CheckUtils.

Side effects:
* Remove constructor: CheckListener().
2016-01-25 20:35:43 +01:00
asofold
9118aa023a Enable hooks to test for presence of applicable log actions.
This is half a guess on base of a request. Hooks can now check if there
are any log actions, or cast IViolationInfo to ViolationData and query
if anything would be logged to a certain stream.

Alterations pending (allow query for multiple streams or just get
streams/configs, what to have in the official API in IViolationInfo).
2016-01-25 11:00:20 +01:00
asofold
6282a9afbe Add isOptimized() test to Action, GenericLogAction.
This allows testing if the there will be lookups of configuration values
for GenericLogAction instances.
2016-01-25 10:19:51 +01:00
asofold
822cb90410 Allow friction based horizontal distance in creativefly. 2016-01-19 00:20:00 +01:00
asofold
57378a1f11 Make one method for all the oddXYZ stuff. 2016-01-18 18:12:50 +01:00
asofold
2e216c4ada Exclude violation on clearly accepted envelopes early. 2016-01-18 16:17:34 +01:00
asofold
02137600b7 [BLEEDING] Make use of workarounds for a specific case, test-wise. 2016-01-18 00:40:51 +01:00
asofold
567ef1b971 Rough sketch of workaround confinement and statistics support.
Untested, unused. Intentions are:
* Be able to count any use of workarounds.
* Confine workarounds to side conditions, such as 'use once until
conditions are reset' and/or 'only use once conditions are set'.
* Have per-player objects and (attached) global counters.
* (Might think of: disable workarounds by configuration.)
2016-01-17 02:12:00 +01:00
asofold
027079320e Too fast +-. 2016-01-14 23:52:04 +01:00
asofold
88c204dd40 Log the stack trace (once) for improper API access. 2016-01-14 23:47:51 +01:00
asofold
3bcfeffdbf Reset fall distance and NoFall data on a fly-nofly transition. 2016-01-12 00:06:27 +01:00
asofold
3f4cd1008f Cherry pick from pr https://github.com/NoCheatPlus/NoCheatPlus/pull/37
(@Samistine).

Slight deviations:
* Random formatting changes.
* Use a linked list for changedCommands at first.
* Use list.clear after iteration, instead of calling remove repeatedly.
* descendingIterator instead of ListIterator + (has+) previous.
2016-01-07 10:54:33 +01:00
asofold
222a983e34 More margin for falling after data reset. 2016-01-06 23:32:40 +01:00
asofold
6b1277e981 Fix various cases with velocity around lava (swimup, vdistrel). 2016-01-06 10:33:22 +01:00
asofold
1c580c1b08 Attempt to fix bounce with carpet above slime block. 2016-01-06 00:44:47 +01:00
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
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
794fb99d99 Prefer not to use DebugUtil.debug for non-temporary use. 2015-12-07 08:21:23 +01:00
asofold
b2b3ca8dcc Other special cases for water. 2015-12-07 08:18:13 +01:00
asofold
eb3a86857f Sketch block change tracking (incomplete, deactivated by default).
Represents the first "simplistic" approach to block change tracking,
only attempting to make vertical push/pull work.

It seems that we need to add on-ground checking accounting for piston
moves as well, otherwise anything with pistons retracting will lead to
survivalfly violations. Pistons extending and retracting may also
randomly move around players, including dragging them into the piston
block with the bounding box (not center of player).

In order to make on-ground work, we might need to check in another
place, possibly check where resetFrom an resetTo are set. Performance
questions might remain, there might also be a slight redesign necessary,
in order to run some sub-routines more side-effect free, to check
several branches, including after-failure checking.
2015-12-07 07:44:00 +01:00
asofold
dfcc30aed9 Adjust liquid height, fixes jumping on fence with water above. 2015-12-07 07:35:40 +01:00
asofold
4d3ee38881 Remove the strapackets cancel part, only skip FlyingFrequency on ACK. 2015-12-06 23:53:50 +01:00
asofold
067d6298d9 Do move AttackFrequency to NCPCore. 2015-12-06 17:25:34 +01:00
asofold
1d8d2f66c7 Set ignorestance to true on 1.8 and later. 2015-12-05 21:38:52 +01:00
asofold
1053c21e56 [BLEEDING] Partly fix up bunny hop conditions.
Conditions have been warped for some time. Could lead to more false
positives on hdist.
2015-11-29 14:54:24 +01:00
asofold
2e11cdac0b Confine the bunnyhop envelopy by y-Distance further.
* Below 1.7 allow ground-to-ground hop with moderate speed. Might be
there is more speed possible, shortly tested on 1.6.4.
* From 1.7.10 on, hitting the jump envelope or having the head
obstructed is demanded.
2015-11-29 13:04:22 +01:00
asofold
567647fd12 Remove some commented out parts. 2015-11-29 12:36:57 +01:00
asofold
1c07adef1a Account for GROUND_HEIGHT in isPassableWorkaround. Fix end portal frame.
* The GROUND_HEIGHT flag indicates, that players are on ground (and can
walk on) from getGroundMinHeight on, once a block collides. Thus an
extra case for isPassableWorkaround is necessary.
* Set GROUND_HEIGHT for ENDER_PORTAL_FRAME, return the minimal height of
the ENDER_PORTAL_FRAME block for getGroundMinHeight. (Also add XZ100,
just to be sure.)
2015-11-29 09:51:12 +01:00
asofold
7057f8f984 Log getGroundMinHeight, where it differs from maxY. 2015-11-29 09:19:40 +01:00
asofold
56fa75168c Use LogManager or comment Bukkit logger use. 2015-11-29 09:18:58 +01:00
asofold
8cecf230df Legacy compat: Use BridgeHealth for health. 2015-11-29 09:06:27 +01:00
asofold
fdf15fc33e Typo. 2015-11-29 09:03:51 +01:00
asofold
4a8f19ef7a Log all violations for on-the-fly debugging by default, configurable.
This reduces the complexity of explanation :). Performance savers can
turn it off, to prevent the hook registering at all.
2015-11-28 21:10:09 +01:00
asofold
6e602af816 Remove the unused velocitygraceticks thing. 2015-11-28 09:54:27 +01:00
asofold
92b5d0ff60 Legacy compat: Move THORNS to BridgeEnchant. 2015-11-26 11:21:35 +01:00
asofold
2c5accef0c Do set to GenericVersion.UNKNOWN_VERSION, if the input equals it. 2015-11-26 09:56:34 +01:00
asofold
282024f3a8 [BREAKING] Move several methods from MinecraftVersion to GenericVersion.
This breaks testing for UNKNOWN_VERSION, if that is used externally.
Access methods are added for testing for unknown versions.

PR mentioning access methods:
94c4da3267
2015-11-26 09:51:11 +01:00
asofold
473ec3873c Set Bukkit dependency to 1.8.8-R0.1-SNAPSHOT, scope to 'provided'.
(That means adding Bukkit as a dependency to several modules.)
2015-11-25 08:58:15 +01:00
asofold
55cf5c0a6b Add convenience methods for comparison with the set minecraft version. 2015-11-25 08:16:21 +01:00
asofold
218fdc46c4 [BREAKING] Move ActionFrequency and ActionAccumulator to a sub-package. 2015-11-24 07:33:30 +01:00
asofold
8b1eb86543 Move AttackFrequency and KeepAliveFrequency as checks to NCPCore.
+ Add adapters to "packet-listeners" in feature tags.
2015-11-24 06:36:57 +01:00
asofold
98ae3fb192 Fix LogAction, let it extend a more generic one. 2015-11-24 04:01:08 +01:00
asofold
1c608ecda1 Clarify, potentially. 2015-11-23 08:30:32 +01:00
asofold
ea0e9e1ade Make FlyingFrequency a standard check in NCPCore. 2015-11-23 07:54:28 +01:00
asofold
88d3741cbd Work around issues with switching from flying to survivalfly. 2015-11-22 02:41:37 +01:00
asofold
83c8d52631 Let fly speed apply with flying upwards.
Might be different with earlier versions of MC. Can be made
version-dependent on request.
2015-11-22 02:40:49 +01:00
asofold
5e17ce05ff Count moves inside media other than water. Add lava special case. 2015-11-22 01:33:55 +01:00
asofold
fb66ea7335 Refine interact event cancelling.
* Still check cancelled events, if using the block is allowed.
* Allow using food and potions, even if the event is cancelled.
2015-11-20 08:47:55 +01:00
asofold
c08a670288 Add oddLiquid case for moving out of water with velocity. 2015-11-17 01:34:57 +01:00
asofold
6c74fa0cea Pull through lava friction + fixes and changes for friction in general.
Could add an issue or two...
2015-11-16 17:10:32 +01:00
asofold
76ef40f6fb Adjust block height for liquid. 2015-11-16 15:39:56 +01:00
asofold
c1cd680108 Feed combined.improbable from net.attackfrequency.
Adds the infrastructure to the TickTask.
2015-11-16 13:05:03 +01:00
asofold
8ff29c2575 Add check: net/AttackFrequency (without improbable). 2015-11-16 12:30:22 +01:00
asofold
d899334d8f Log fight.speed violations only for higher vls (legacy). 2015-11-16 10:37:06 +01:00
asofold
7286df5875 Also check steps done with the split move. 2015-11-16 02:30:27 +01:00
asofold
2d24049db9 Passable split move: Always test vertical-first, never horizontal-first.
Vertical part first was ineffective due to yDiff never being > 0.0 and
<= 0.0 at the same time, beside vertical-first is what the client is
doing. Might want to check the full bounding box with the simplified
y-first model, also checking x and z parts in the right order, from
there on.
2015-11-16 02:28:18 +01:00
asofold
bbe20a4d84 Config order: captcha before color. 2015-11-15 21:15:55 +01:00
asofold
11811697a5 Fix colors for the ingame chat prefix. 2015-11-15 03:21:47 +01:00
asofold
d62951ade7 Don't use method name shorteners. 2015-11-15 03:18:46 +01:00
asofold
af5fbd900a Move prefixes to loggers. 2015-11-15 02:44:01 +01:00
asofold
528410f6f3 Encapsulate Player instance lookup in a PlayerMap object.
Mostly for legacy Player instance getting, future aims are:
* Efficient lookup by name.
* Efficient lookup by prefixes of names (e.g. for command use).
* Efficient lookup name->uuid and uuid->name.
* Keep name->uuid mappings for history lookup and similar.
2015-11-14 21:34:04 +01:00
asofold
2ac98f7db9 Repair accidental commit of CheckType (throw permissions at'em). 2015-11-13 22:23:11 +01:00
asofold
f3a6ba9cbc Allow to skip commands on captcha. 2015-11-13 22:06:31 +01:00
asofold
b8577e1891 Use ICaptcha and CheckUtils instead of Captcha. 2015-11-13 21:52:41 +01:00
asofold
1fc775219a Add [health] tag for logging, allow health and world be set by checks.
Display health in fastheal and godmode.
2015-11-13 21:46:22 +01:00
asofold
f1c5808cb7 Adjust isEnabled and hasBypass use.
Refactor
* Move hasBypass code to CheckUtils.

Efficiency
* Alter/add methods for testing with with optional check data/config.
* Use more efficient calls in several places (unfinished).

Consistency
* Log an error, if calling hasBypass off main thread unexpectedly.
* (Mostly irrelevant null checks.)
2015-11-09 03:01:18 +01:00
asofold
66070532b2 Revert to using the same vertical friction for lava and water, for now. 2015-11-09 00:39:39 +01:00
asofold
4fd834ed25 Workarounds for moving down (-stream) in lava. 2015-11-09 00:21:47 +01:00
asofold
5d4c71eaae Only count in depth strider with water. 2015-11-08 23:16:03 +01:00
asofold
eef50d0b33 Let lava have a dedicated vertical friction factor. 2015-11-08 23:03:30 +01:00
asofold
22a7492623 Use a higher vertical component for pvp-knockback. 2015-11-07 21:27:06 +01:00
asofold
0a7d4c6d7d Fix vdistrel with head obstructed. 2015-11-02 00:08:01 +01:00
asofold
cb4f1a89bf Allow all speed modifiers to apply with depth strider in water. 2015-11-01 22:22:45 +01:00
asofold
8adab538c4 Add LiftOffEnvelope.UNKNOWN as default, to distinguish from web. 2015-10-26 02:32:36 +01:00
asofold
0febcfef66 Cap bounce effect by last y-distances. Set last h/v dist differently.
This should prevent bouncing higher and higher (cheat).

Missing:
* The bounce effect should be set considering the last yDistance, in
order to allow negative vertical velocity to work.
2015-10-26 02:08:07 +01:00
asofold
bb25a0da0b Workarounds for cobweb and slime blocks.
* Add workaorunds for gravity with exiting cobweb.
* Allow multiple times zero y-distance (cobweb several times, slime 2).

Cobweb may need adjusting the bounding box to check with, instead.
2015-10-26 00:31:35 +01:00
asofold
377689b0bd Also set passable. 2015-10-25 21:24:13 +01:00
asofold
18ddb34ace Use moveInfo.useLoc for player move. 2015-10-25 20:55:51 +01:00
asofold
f578b4da53 More fixes four bouncing off slime blocks.
* The server might reset the fall distance with preceding micro-moves,
so use NoFall data already on checking pre-conditions for bounce.
* Cap the bounce effect slightly smaller.
* Renew the bounce effect under certain conditions.
* Gravity, odds.

Remaining:
* Two consecutive times yDist = 0 at the maximum of a jump.
2015-10-22 12:45:52 +02:00
asofold
16698090fb Fix processingEvents use. Reorder conditions for bounce. Comments. 2015-10-22 03:02:56 +02:00
asofold
6ee9528fe7 Add convenience methods to DebugUtil. 2015-10-22 00:48:02 +02:00
asofold
8de7907522 [BLEEDING] Split off untracked moves. Elaborate on slime blocks.
MISSING:
* Micro move onto ground, fall distance resets before sf check is run.

Done:
* Split PlayerMoveEvent processing to from -> loc + from -> to. Just if
from isn't the same coordinates as player.getLocation. This
reduces the complexity of workarounds.
* You do take fall damage falling onto slime blocks while sneaking.
* Queue bounce effect, only if the move is valid. Skip NoFall then.
* Apply bounce effect once moving up, to allow overriding.
* Cover more odd cases.

Unrelated:
* Use data.debug instead of cc.debug.
2015-10-21 01:13:37 +02:00
asofold
537b387fbf Part-repair slime block trampoline support.
Adjust workarounds, confine velocity activation to next tick.

Cases missing:
* Lost ground cases (yOnGround has been reduced, strikes here).
* Two consecutive yDist = 0.
2015-10-19 01:30:11 +02:00
asofold
4d59f67d34 Switch the default asynchronous CallContext to ASYNCHRONOUS_TASK.
This will preserve the order of debug messages sent from multiple
threads. As a side effect, this might be better for performance, given
that on constant input the logging task will stay registered, so there
is little overhead and the file-io is taken off the asynchronous packet
and chat handler threads.Hopefully the thread switching is less
expensive than the gain by not delaying chat/packet threads, in case of
servers with few cores. We might adapt the used policy later, based on
cores and/or config.
2015-10-18 18:31:52 +02:00
asofold
b179dba908 Ouch(.) 2015-10-18 17:38:06 +02:00
asofold
1e70dc0730 Add essential configurability for "stray-packet" cancelling (TP-ACK). 2015-10-18 17:26:43 +02:00
asofold
0b7a259985 Allow updating set-back, when small-range TP leads to a safe position. 2015-10-18 17:07:24 +02:00
asofold
343b5ac9e3 [BLEEDING] Teleports: Cancel incoming position, until receiving an ACK.
* Queue outgoing positions in order to detect ACK on incoming.
* Since we can't detect relative teleports, positions are only queued,
if they match an absolute location from a teleport event (Bukkit).
* The queue is kept simple: only store the latest position.
* Cancel incoming flying/pos/look until ACK is received.

Missing:
* Are yaw/pitch are ever sent back changed.
* Configuration to turn it off.
* Might use this to just skip all violation handling until ACK.
2015-10-18 16:35:02 +02:00
asofold
b6a5d76a44 Add slowness effect level to debug log. 2015-10-11 00:01:28 +02:00
asofold
2c48e0f60d Increase compatibility with more extreme jump effects (see below).
This is a quick go with little testing, roughly up to level 60. Above
that there may be more false positives, also "no jumping" is not
enforced there.

A suggestion for the future could be to just use/part-calculate an array
for all the typical effects.
2015-10-06 13:19:36 +02:00
asofold
52058363ec Adjust expected near-zero gravity behavior for jump effect. 2015-10-06 13:16:25 +02:00
asofold
854f70a10e Remove duplicate cleanup call. 2015-10-06 09:49:52 +02:00
asofold
c3ab80cd74 Reset last distances to Double.MAX_VALUE. 2015-10-06 09:49:10 +02:00
asofold
b21ca2093e Alter bunnyhop preconditions. Remove lostground stairs.
* Don't let doubleBunny bypass other conditions.
* Don't allow bunnyhop when lowjump is set.
2015-10-05 00:02:43 +02:00
asofold
7f8740bf30 Override block height for farmland (soil). 2015-10-04 22:08:10 +02:00
asofold
289d72757b Set a lower Y_ON_GROUND_DEFAULT.
Used to be 0.0625 for a while, but intentions are to cover ground-loss
as lostground workarounds. Later switch to calculate the distance to
ground (with a given max-distance).
2015-10-03 00:40:31 +02:00
asofold
ee2df3f05b Allow normal gravity slope after having been on ground. 2015-10-03 00:29:48 +02:00
asofold
7bcae640e9 Do debug log for block break and place and dig/place packets.
Dig/place is only logged if a debug flag is set in the config, it won't
activate with on-the-fly per player debug logging.
2015-10-03 00:21:37 +02:00
asofold
49c08c453a Only check vdistsb if moving upwards and not stepping. Confine vcollide. 2015-09-28 16:56:57 +02:00
asofold
222c6bd537 Add lostground_vcollide.
For efficiency (several?) other cases will be removable, once we model
the per-move ground/medium properties more accurately also for the past
move(s). At least lostground_pyramid should be removed then.
2015-09-28 15:46:06 +02:00
asofold
9efcf01766 [BREAKING] Move maps into a maps package. Prepare a linked CoordMap.
Splits CoordMap into interface, abstract hash map, implementations.
Sketch Linked version, hinting at access order, e.g. with
tracking piston effects with timeouts.

Missing:
* Implementation of a linked version.
2015-09-28 12:56:58 +02:00
asofold
01671a04fd Add yaw and pitch to getLocation. 2015-09-28 00:03:56 +02:00
asofold
95c6af9741 Optimize reset (no need for using per-count locks). 2015-09-27 22:09:11 +02:00
asofold
444fcb9761 Remove cancelling redundant packets, re-organize, debug log flying.
Cancelling redundant packets has to big problems:
* The normal case is to not run in the primary thread.
* For legit players a missed micro move could mean that survivalfly can
not detect ground properly.

Better approaches could be:
* Cancel asynchronous packets if they match the last sent one (only
simple hacks).
* Check for moves passing block borders, request block shapes and such
from the main thread.
* Detect actual cheating or unusual patterns instead.
* Queue packets for processing in the main thread.

Missing:
* Actually detect ACK packets for previous outgoing teleports.
* Do something upon detecting illegal coordinates (asynchronous
disconnect? queue kicking, config).
2015-09-27 21:54:36 +02:00
asofold
5f47eab770 Use more fine grained locks. Fix a couple of consistency issues. 2015-09-26 14:13:28 +02:00
asofold
7110d0ecca Adjust breaking times for DRAGON_EGG. 2015-09-24 19:28:55 +02:00
asofold
8230a13fc0 [BLEEDING][BREAKING] Rework much of y-axis handling.
* In addition to the "distance from set-back" check, we have a check of
the per-move distance for in-air checks, taking account of friction.
* In-air and liquid checks should consume vertical velocity once needed.
* Model vertical velocity "exact", i.e. positive and negative, use an
entry once a sub-check fails, quite strict invalidation of not matching
values, matching against the y-distance directly.
* Vertical accounting has been sharpened for the moment. The new
per-move checking might make it superfluous.
* Remove MediumLiftOff in favor of a LiftOffEnvelope carrying basic
lift-off max-gain/max-height/max-phase, enabling to distinguish between
normal lift-off and liquid near ground.
* Rename others (e.g. sfLastYDist -> lastYDist). Thus breaking internal
naming, adding velocity via MovingData still works, but should behave
slightly differently.
* Fixes (waterwalk with head obstructed, resetting of sfDirty, possibly
others).

Issues.
* Edge cases with velocity, water.
* Lava needs friction, at least with velocity.
* Lostground_edge(ydist < 0.0) ->
bunny with yDistance > 0.0. Need more flags or better model for keeping
past moves information.
* Plain ground misses (layered snow).
* lostground with yDist == 0.0, then seemingly in-air yDist== 0.0, then
bunny/lifft-off (similar to above). Needs better modeling of past moves,
because several lostgorund cases mean "the move has been on ground".
Also includes geting the distance to ground for hack-proof set-back-y.
* Vertical velocity is now matched with a margin, because the client
seems to add randomly.
* Possibly new loopholes/exploits (extreme large moves?).
* Cleanup pending.
2015-09-21 00:27:33 +02:00
asofold
f3a137709b Part-revert activating vertical accounting once velocity is used up.
* Don't activate accounting (velocity downwards issue, needs recode).
* Do still check yDirChange once velocity effects are gone.
2015-09-13 14:47:31 +02:00
asofold
b2caae38d2 [BREAKING] Group several classes into sub packages for moving. Renames.
* Group selected classes into sub-packages of moving.
* Rename classes.
* Must use LinkedList for velocity entries.
* Prepare SimpleAxisVelocity + entry for use-once accounting.

(Might not be the final naming.)
2015-09-13 14:39:25 +02:00
asofold
122e0727b8 Losen bounds for edgeasc5/7. 2015-09-12 23:22:23 +02:00
asofold
0a5f590801 [BLEEDING] Re-activate accounting once vertical velocity is used up. 2015-09-12 23:21:13 +02:00
asofold
6d1c56675b Rough coverage of another false postive (edgeasc5 and edgeasc7). 2015-09-12 15:39:00 +02:00
asofold
b288afa6e6 Test for depth strider on all armor items. 2015-09-12 12:37:44 +02:00
asofold
382ecd9f05 Add a lostground case for untracked (micro) moves. Reorder a few things. 2015-09-10 18:34:21 +02:00
asofold
134b8e7b3d Attempt to fix 1st move bunny and couldstep+vdist. 2015-09-10 14:09:13 +02:00
asofold
fbfa11be20 Don't wildcard allow bunny hop (seems not needed anymore). 2015-09-10 13:41:59 +02:00
asofold
ba40cfb6aa Do apply the cap for lostground_edgeasc1. 2015-09-10 11:05:19 +02:00
asofold
3db2484920 Revive lostground-interpolate as edgeasc1, slightly altered. 2015-09-09 13:49:43 +02:00
asofold
d37961ed49 Attempt to refine lostground/edge. 2015-09-09 01:20:37 +02:00
asofold
f2f66c1572 Another special case bunny (@Iceee). 2015-09-07 00:23:45 +02:00
asofold
30abbe0225 [BLEEDING] Remove "interpolate" workaround.
Instead adjust to client-side code, parameters still need adaption.
2015-09-07 00:08:13 +02:00
asofold
8c79309c7d Allow sprinting during flight, disregarding food level. 2015-08-11 18:30:01 +02:00
asofold
389df1aa86 Only ignore the first block of the primary line, if ignoreFirst is set. 2015-08-09 23:39:21 +02:00
asofold
0b89cdd90a Allow sfStepHeight for lostground_step. 2015-08-09 23:37:34 +02:00
asofold
463d16b0fd Demand moving up first for lowjump detection. Refine tag use. 2015-08-09 18:52:55 +02:00
asofold
56d32c4f3e Remove the "bedstep" workaround in favor of a configurable step height. 2015-08-09 16:17:43 +02:00
asofold
c9df8238f7 SF + set-back policy: Set back to void, group "falldamage" here. 2015-08-08 23:22:23 +02:00
asofold
2151d9d365 Adjustments to bunnyhop / bump.
* Use BlockProperties.collides to use the actual bounds of blocks.
* Don't test for sfLowJump to set allowHop.
* Set head bump margin to match 2-high spots and to prevent lowjump fps.
* Tighten conditions for actual hop.
2015-08-01 22:07:36 +02:00
asofold
c5574b5978 Bunny fix and bumping the head into the ceiling, various adjustments.
* Don't x > 1.314 * x.
* Add height, eyeHeight, isHeadObstructed to PlayerLocation.
* lowjump detection: from is higher than to, test both locations.
* Remove bunny reset within lowjump detection (defeated flying bunny).
* Check isHeadObstructed directly in the bunnyHop method.

Issues remaining:
* Moderate acceleration ground to ground, after having landed (+1st).
* Possibly transitions between 2-high and other.
* More edge cases with slowness potion.
2015-08-01 14:47:57 +02:00