Commit Graph

30 Commits

Author SHA1 Message Date
asofold 30902ec352 [BROKEN] Data storage overhaul (basics). (+)
(SAFETY COMMIT)

Largely breaking change.
* Interfaces in front of data types (and 'managers'), some interfaces
removed.
* Data and configuration fetching.
* Check activation checking (config flags, isEnabled, hasBypass).
* CheckType (activation checks, factories removed).
* Lots of collateral signature changes, including IPlayerData.

The (I)WorldDataManager stores per-world data (+ per world per check
type).
* Raw configurations.
* Typical flags: check activation, debug, lag adaption.
* Generic data, such as check configurations or per world check data.

The (I)PlayerDataManager stores per player data.
* Check Data.
* Typical flags: debug
* Exemption
* Check data (and config cache).
* Further mappings and later OfflinePlayerData.
* The registration interface will allow defining, how instances are
handled for registered types (factory, proxy, what on world change, what
on logout, global removal handler, per player removal handler).

(I)PlayerData is intended to be/become the central access point.
* External interface is IPlayerData now.
* Per player debug flags, exemptions.
* Fetching configuration and data: local cache, relaying fetching to
registered factories and proxy-registries/storage (e.g. fetching
configuration from per world storage).

Other fixes/changes:
(+) Extend the debug player command (set true/false, reset to world
default, arbitrary check types).
(+) PlayerData maintains a currentWorldIdentifier (to be used instead of
ChatData in future).
(+) The WorldConfigProvider getAll implementation returns a
LinkedHashSet now, avoiding duplicates.
(+) Move DefaultGenericInstanceRegistry to NCPCore.
(+) Thread-safety considerations for DefaultGenericInstanceRegistry.
(+) Don't log errors on hasBypass checking. TBD: Instead intercept
during listener methods (or even as a feature within the listener node:
e.g. @ThreadContext(primaryThread=true, skipOffContext=true,
cancelOffContext=true).
(+) Add fight.wrongturn permissions to plugin.yml.
(+) Missing GPLv3 headers.

Broken/Missing:
* WorldData inheritance from default: propagate all changes done
directly to the default config to children (all worlds that don't have
an explicit world_config.yml set) - possibly add an OverrideState or
similar, (NONE, FROM_DEFAULT, EXPLICIT) and don't override EXPLICIT if
coming from the default. Calling override on the default WorldData is
not to be confused with calling override for WorldDataManager (override
for all worlds as EXPLICIT).
* Organize overriding for special circumstances (version dependent
activation  and the like). Might want to add registered override
handlers to be called on reload automatically.
* Store generic per check type per world data in the WorldDataManager,
such as configurations and per-world check data. TBD: Factories, cleanup
(!).
* Most efficient referencing (IWorldCheckTypeNode, IHandle<something>?).
* All the registry stuff (see PlayerData).
* Use interfaces for auto registry (and a flag within
RegistrationContext?) - world unload, world change, player join / leave.
* (Data expiration handling including transition to IOfflinePlayerData,
because now data is a little heavier.)
* Further details.
2018-02-26 12:15:53 +01:00
asofold 0c6cb6577d Use the lower eye height when gliding with elytra (selected checks).
* Block checks (interact/place/break): reach and direction.
* Random other places, like BlockProperties.getBreakingDuration.
2017-05-09 22:04:50 +02:00
asofold e5f6370705 Integrate current look into flying queue checking. Include invalidation. 2017-05-03 15:42:12 +02:00
asofold e6cc1bad05 Store passed checks with the last block. 2017-04-29 14:40:44 +02:00
asofold 180cf8a3c3 Let blockinteract.direction check queued packets. Unify loop (visible).
* Add a class to loop the flying queue with a block as target (look
only).
* Pass the flyingHandle to sub checks (doesn't necessarily make sense
with reach - should probably re-check reach with the used flying queue
state, but that's more complicated due to the possibility of split pos
vs. look).
* Use the loop class both for visible and direction (not reach).

Likely similar has to be done with BlockPlace and BlockBreak - would be
good to find a skipping heuristic for blockbreak.direction etc., so we
know we have successfully checked that block from that exact position
for this player and nothing has happened between (and so on, or a more
relaxed heuristic).
2017-04-28 19:03:10 +02:00
asofold 970ed6b126 Remove ominous count - all that remainded from the original was...
skipping redundant checking (limiting the number of visited packets
doesn't work - instead 'good candidated' for packet inversion with dig
packets should be stored together, so it's easy to just check vs. the
first/last stored one).
2017-04-28 17:20:24 +02:00
asofold 956c7ca803 Pass a handle for the flying queue to sub checks of blockinteract.
To be done:
* Use yaw and pitch of past packjets for Direction and Reach.
* If block break mathes the last interacted block (+ moving sequence
indicates no change), skip some checks like direction and reach there,
possibly keep track if those were run at all.
2017-04-28 00:27:36 +02:00
asofold 68eec44f14 [BREAKING] Move LocUtil to utilities.location 2016-12-27 15:28:36 +01:00
asofold a38e63d4a9 Let DataLocation extend IGetPositionWithLook.
(+Implement DataLocation.hashCode.)
2016-06-24 19:15:14 +02:00
asofold 863b89763d [BREAKING] Move more classes around.
This time the focus is on the utilities package.

Possibly used, but not really official API:
* Move block cache to a 'map' sub-package.
* Move RichBounds/RichEntity/Player-Location and TrigUtil to a location
sub-package.

Not really official API, likely not used:
* Move AttribUtil to compat, since it belongs there.
* Split off direction check methods to collision.CollisionUtil.
* Move static BlockCache methods to map.MapUtil.
* Move food related methods from CheckUtils to InventoryUtil.
* Move vehicle/passenger related methods from CheckUtils to
PassengerUtil.

Not breaking:
* Move IdUtil to commons.
2016-06-21 09:56:50 +02:00
asofold b6088c3e3a [BLEEDING][BREAKING] Registry changes concerning MCAccess.
Main objective is to get rid of too complex setMCAccess methods and to
be able to store handles rather permanently instead.

* Remove MCAccessHolder.
* Add/refine interfaces and implementations.
* Change constructors.
2016-06-19 16:55:44 +02:00
asofold 19312bdbfa [BREAKING] More on passable and ray tracing.
* Make RayTracing and PassableRayTracing implement interfaces. (rough,
not used in tests yet etc.).
* Optimize ray tracing use in BlockProperties.
* Add an axis-wise implementation (buggy, hardly tested, thus not used
yet).
2016-06-10 00:23:56 +02:00
asofold 4e91a9d5fc Ready for UEFA EC: GPLv3 headers.
Might need more training still.
2016-06-02 20:33:21 +02:00
asofold 96d95dff8e [BLEEDING][INSTABLE][BREAKING] Changes (see detailed commit message).
Major: Sketch vehicle envelope check.
* Renaming fields, methods, packages. Moving classes to other packages.
* Additions and refactoring for set-back handling and location tracking.
* Increase amount of debug logging.
* Adjustments to current vehicle set back handling.
* AuxMoving: call clear() on setMCAccess.

Minor: Adjust block change tracking implementation.
* Use a class instead of an id, in order to keep track of used entries.
* Allow reuse of an id, if the block still is intersecting.
* Improves situation for simple setup, issues remaining:
 * Random UNKNOWN teleport by server potentially interfering.
 * Distances > 1.0, possibly resulting from split move handling.
 * On-ground estimation and passable.
 * Blocks with gravity are worse (likely on-ground).
 * More in-depth checking of constraints of implementation.
 * Note that the block change tracker currently is disabled by default.
2016-04-26 13:31:20 +02: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 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 f6dfa51efe Alter tags in blockinteract.visible. 2016-01-25 20:40:05 +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 14049200a2 Keep adjusting time and offsets in raytracing.
* Not actually a fix for anything we encountered.
* Nailed down blockinteract.visible raytracing issues to bad end-points
for raytracing.
* Also test/prepare logging test-cases for raytracing in general. Not
enabled, because we should have some flag/permission/command to check
before logging ~ 5KB per interact event.
2015-06-30 01:04:45 +02:00
asofold aa147f692b Add framework for (debug-) logging map parts with ray-tracing / cuboids.
Not very efficient in terms of code-output, but enabling us to log test
cases for visible (and potentially passable too), using real-life
examples.
* Add the capability to log a FakeBlockCache as java code.
* Add utility to record map parts (cuboid, ray-tracing with margin) to a
FakeBlockCache.

Missing:
* Actually log stuff (visible).
2015-04-11 00:57:33 +02:00
asofold e0318a6df3 [BLEEDING/INSTABLE] Recode blockinteract.visible/ray-tracing.
The workarounds in InteractRayTracing and using multiple
reference-targets in Visible have all been removed in favor of using the
actual looking direction for ray-tracing.

On quick testing, there remain false positives, allowing to somewhat
escalate violation levels, if intended to. On normal playering false
positives seem to happen very near the very edges between blocks on
occasion.
2015-03-13 01:14:40 +01:00
asofold a5d6594591 Fixes, more tests and more to do for RayTracing.
* More tests for PassableRayTracing (room, rays from outside).
* Alter InteractRayTracing to account for the block interacted with.
* Added tests for InteractRayTracing.

Problems:
* RayTracing may end x-th digit off target, thus in the wrong block.
Suggested fix is to keep correcting t by the absolute coordinates of the
blocks, i.e. calculate the absolute position rather than adding up.
* InteractRayTracing with strict set to false (like in the
blockinteract.visible check) will be too lenient with 1-thick wall
setups and fail test cases.
2015-03-11 11:36:12 +01:00
asofold 04d2896f7e [API CHANGE] Add debug flags to check data [missing: use that one].
For debug output now data.debug is used instead of config.debug, so the
data is initialized with the config.debug value. As an effect of this,
removing the data or reloading will override flags that have been set by
means of API-access only.

Affected:
* Adds getDebug and setDebug to ICheckData.
* Adds appropriate configs to all constructors of check data.
* Some per-check debug flags have been removed.

Extras: 
* spaces
* import cleanup.
2014-12-04 02:24:20 +01:00
Alastair Lynn 4d310d352a Switch to gender-neutral pronouns 2014-01-22 19:16:27 +00:00
asofold f7d2d44070 Fix two bounds issues for blockinteract.visible.
* Correct offset for null-bounds.
* NPE with null bounds in checkCollision.
2013-06-08 06:13:45 +02:00
asofold 36711fc98f Cleanup. 2013-06-07 19:30:10 +02:00
asofold bd043f407d [Bleeding] Reduce false positives for blockinteract.visible.
Alternate positions are checked for both passable and ray-tracing. This
lacks a little bit abuse prevention, because up to nine times
ray-tracing can be checked, which can be used to cause load for the
server, limited by blockinteract.speed.
2013-06-07 19:24:33 +02:00
asofold b8141f5f32 Adjust interact.visible to use bounds (read details below!).
* Uses unmodified block bounds as returned by the server, this is not
the final version but does fix the door problem.
* Users that use the CompatBukkit (bukkitapionly) module should beware
of the current dev-line, because the block shapes can not be retrieved
with using the Bukkit-API only, thus some blocks squeezed between other
blocks can not be interacted with in a reliable way. This concerns
interacting with the sides that are directed towards solid blocks
mostly, so in most cases there still is a side possible to interact
with, but it might be the short side of a door, not convenient.
2013-06-01 14:48:23 +02:00
asofold 430915e377 [BLEEDING/INCOMPLETE] Attempt to fix issues with blockinteract.visible.
Done: Check if the end point of ray-tracing is passable.

Problem: Might lead to problems with non-full blocks squeezed between
full blocks.

Missing: Implement corrected outer bounds getting for use with this.
2013-05-26 21:10:47 +02:00
asofold ce834675d7 Move most code to NCPCore, removes NCPCompat.
Factories are now on NCPPlugin level, thus all the core stuff can be in
one module, giving better source code browsing.

Updates has been moved into an updates package, because there is to be
expected more content, and to make utilities less fat.

To indicate the direction, the basic infra-structure has been added to
allow adding components to the DefaultComponentFactory. Further
processQueuedSubComponents is now called after each components adding in
order to allow more flexible registry features.
2013-05-22 12:24:48 +02:00