Commit Graph

33 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
md_5 3a111dc4a5 Remove Block IDs 2017-12-06 16:55:29 +11:00
asofold 7e43deaa28 Cancel interaction for players who are not online. 2017-05-31 21:03:46 +02:00
asofold afe080f1c2 Use cancel.dead as id instead of canceldead. 2017-05-31 21:00:42 +02: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 344b032d49 Fix / "refine" elytra handling. Set all maxheight to 128.
* Lift-off side conditions.
* Force stop gliding for some side conditions, to avoid freezing.
* Set maxheight to 128 for elytra and levitation too (mods/plugins/etc)
- better refine checks to catch stuff.
* Fix special flags not getting set with initializing ModelFlying from
config.
* Debug log exceeding the maxheight setting.
* Mostly harmless: Add interfaces and access methods, including
convenience methods.
* Don't store methods in Bridge1_9.

Issues left, not limited to:
* Boost not recognized on occasion.
* Gliding state kept when submerged in water and moving normally like
when not gliding, e.g. ascending (head in water / fully submerged).
* Elytra lift off not accepted: Gliding state set near the water
surface, but survivalfly check runs. Might be fixed already, though.
2017-05-09 15:31:13 +02:00
asofold bff58b83db Reduce false positives with elytra: lift off and boost.
Missing (false positives):
* Bounding box, eye height.

Missing (cheating):
* Better abort conditions (e.g. inside water / lava).
* Friction inside water / lava.
2017-05-06 22:38:23 +02:00
asofold 2f66eab079 Reach doesn't need to use the flyingQueue. 2017-05-05 09:24:44 +02:00
asofold b9a73ae801 Fix blockplace.against. Confine isInteractBlock by tick as well.
(+ Pass tick fetched in listener to other checks as well.)
2017-05-03 13:46:05 +02:00
asofold bd370ba633 Skip redundant checks within BlockBreak and BlockPlace.
Reach and Direction are near-identical to the variants in BlockInteract
and will be
replaced by implementing an abstract class.
2017-05-02 21:10:18 +02:00
asofold d8ab00dfb0 More details for last block. Consumed checks. Don't skip item use.
* Store complete event result state for interact.
* Store consumed checks as well.
* Still run the speed check, if only using the item in hand is allowed.
2017-05-01 02:03:00 +02:00
asofold 8bf207c112 Log to counters where look came from (current, first/other flying). 2017-04-29 15:19:42 +02:00
asofold 9f3c10951d The last block is now private.
* Add methods for checking/testing vs. last block.
* TrigUtil.isSameBlock for a block.
* Reset last block on cancel.
2017-04-29 14:27:22 +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 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 a5b0bd0fae Account for null blocks in PlayerInteractEvent handling.
Before elytra boost these events had been ignored for most, now instead
of an early return, just the checks/logging using the block are skipped.
2017-04-15 17:04:37 +02:00
asofold 6e41730135 [BLEEDING] Quick overhaul for handling scheduled set backs.
When a set back is scheduled:
* Cancel other teleports early. (x)
* Prevent Portal use. (x)
* Vehicle enter (not on vehicle set back). (x)
* Prevent attacking.
* Interact block. (x)
* Break block.
* Damage block. (x)
* Launch projectile.
* Place Block.
* Interact entity.
* Open inventory. (x)

The list is incomplete and adding/removing items remains subject to
discussion, having differing impact/severity for different actions. As
long as setting back rolls back to last ground, it might be better to
prevent some type of actions. Not all cancelling is logged.

(x) Probably most important for consistency, avoiding some types of
potential abuse.

A common framework
for "prevent types of action" during whatever-handling also is something
to consider.

Optimizations: 
* Move handling some rare cases to methods (MovingListener,
PlayerTeleportEvent handling).
2017-04-05 14:31:31 +02:00
asofold 72b454bbab [BLEEDING] Elytra boost: Who tested the other version!? 2017-01-29 19:20:47 +01:00
asofold c2449ac08a [BLEEDING] Elytra boost: track and allow ascend.
Lots of issues remain with elytra, with and without boost. Selection:
* maxheight will trigger with the rocket feature, naturally. Mendable by
increasing it via configuration
(checks.moving.creativelfly.model.elytra.vertical.maxheight). Not sure
we'll just increase the limit or alter how it's dealt with (e.g. also
for sf: lock to a max / high slope value, independently of the set-back
and world height, alter as necessary).
* All sorts of transitions, e.g. onto ground, into water.
* Loss of boost right after adding (not sure if already fixed).
* What with hover, actually?
* Is the flight duration infinite with power 127?
* Issues with ascending after descending, even without boost?
2017-01-29 19:00:52 +01:00
asofold 68eec44f14 [BREAKING] Move LocUtil to utilities.location 2016-12-27 15:28:36 +01: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 e543d905dd Extend debug logging for blockinteract (rate limited). 2016-06-13 13:44:21 +02:00
asofold 4e91a9d5fc Ready for UEFA EC: GPLv3 headers.
Might need more training still.
2016-06-02 20:33:21 +02:00
asofold 68c4ab2bf2 Review dual wielding.
* Account for off hand in more places.
* Use bridge methods to get rid of warnings for now.
* Adds utility methods to CheckUtils.
* Do not allow left click on off hand (knockback).
2016-06-01 20:00:37 +02:00
asofold 2145a6a0d3 Don't allow item use on blockinteract.speed violations. 2015-12-15 21:12:33 +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 c6c904254f Feed some counters for debugging purposes.
Some might get removed soon.

* Various sorts of silent cancelling (probably not caught all).
* Count PlayerMoveEvent with look/pos/look+pos changes.
2014-07-27 21:01:36 +02:00
asofold 75224adf63 Reduce use of using block-ids in more places.
* Use Material directly in more places.
* Hide id-getting within BlockProperties.

TODO:
* BlockInit, BlockFlags + use of those.
* Possibly other.
2014-06-13 12:01:44 +02:00
asofold 56bab0a3ae Cancel various actions for dead players. Config pending. 2014-06-04 23:52:07 +02:00
asofold abdeb12377 Less object creation with short-use Locations + other preparation.
* Make use of Entity.getLocation(Location) in most places, for starters.
* Prepare a check for moving location consistency.
2014-02-23 02:01:28 +01:00
MyPictures add2179dc9 Cleanup "ASCII art" from the sourcecode
Wiped every ASCII related thing that I could find in the NoCheatPlus
source.
2014-02-22 19:26:06 +01:00
asofold 9528b15f55 Avoid sign duplication due to a bug in CraftBukkit.
The cancelled BlockPlaceEvent will lead to an extra sign being dropped,
while the item in hand stays. Odd enough, the cactus is removed before
the BlockPlaceEvent - need to check if a ticket exists for CraftBukkit
already...
2014-02-17 01:58:44 +01: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