Commit Graph

108 Commits

Author SHA1 Message Date
asofold 481d2c060f Ignore the null Sound. 2018-05-23 09:31:47 +02:00
asofold d0235e2358 Catch NullPointerException. 2018-05-09 10:17:42 +02:00
asofold 500544c32b More safe IPlayerData getting for the net checks. 2018-04-20 12:17:24 +02:00
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 97d59045ae [BLEEDING][BREAKING][INSTABLE] Swiftly throw in permission caching.
Benefits:
* Improves performance, where permission lookup has major impact, with
timeout based lookup, static permissions (skip permission check
entirely), and world/offline based invalidation. (Once fully
implemented.)
* Hopefully more efficient: use Bukkit Permission for faster defaults.
* (Allows control over how which permission is to be
updated/invalidated, which is useful per se.)

Risks:
* Complex changes yield bugs.
* Other plugins depending on NCP might break.
* Cache incoherence might happen (permissions are changed dynamically +-
unintended malconfiguration, or in case of bugs).
* (Endless loops certainly have all been fixed.)

Breaking:
* Lots of more or less internal API has been changed or removed: Check,
CheckType, CheckUtils, TickTask, ...
* Permission checking behavior has been altered.

Rough points:
* Implement a permission cache within PlayerData.
* Remove the player tasks and permission updates in favour of handling
those within DataManager and PlayerData.
* Adjust everything else to it (partly TBD).
* Updating sets of permissions (e.g. for CHAT) is done more lazily now,
i.e. one per 10 ticks). An actual permission check would still yield an
update next tick (asynchronous).
* Fixed/extended random spots (DualCollection, MiniListener registration
support, StringUtil).

Missing:
* Basic implementation
  * Cleanup after logout (stages: 1. non-essential like permissions,
2. unrecoverable like set-back location, 3. complete data removal).
* Coverage
  * Might have missed spots.
  * NoCheatPlus.nameSetPerms should be replaced by caching + default
config for world-wise updating.
  * Command permissions are always checked. At least for players,
cache based lookup should get implemented.
  * More unit tests.
* Extended configurability: Per-world settings/policies.
* Efficiency
  * Not all parts of the implementation are 100%/optimal yet.
2018-01-30 23:09:34 +01:00
asofold b3edd089a6 ProtocolLib 4.3.0 for Minecraft 1.12. Build against API 4.3.0-SNAPSHOT. 2017-05-14 20:40:17 +02:00
asofold c07b1fb8a3 Fix exceptions with the teleport confirm packet (also log cause). 2017-05-01 12:46:37 +02:00
asofold c7d72101c2 Make cancelling flying/waiting packets configurable. 2017-04-29 10:12:18 +02:00
asofold 1655a90b2b [BLEEDING] Make use of the 'confirm teleport' packet. Cancel WAITING.
If the teleport confirm packet is available, flying packets with
AckResolution.WAITING will be cancelled.

This is real bleeding edge and might need other adjustments not to
freeze players for to be discovered edge cases. The TeleportQueue
already does contain a timeout mechanism and should return
AckResolution.IDLE after some time.
2017-04-27 12:53:47 +02:00
asofold 64c347f801 Don't hesitate: make use of the primaryThread flag. 2017-04-26 18:49:21 +02:00
asofold 65fc88f41a Use Bukkit.isPrimaryThread and log inconsistencies. 2017-04-26 18:41:43 +02:00
asofold 1c8c3a8c3a Count all flying packets and PlayerMoveEventS, simplify.
* Count all events/packets regardless of settings.
* MovingListener: Remove pos/look counting for move events.
* MovingFlying: Call the counter method according to primaryThread flag.
2017-04-26 18:21:24 +02:00
asofold 458358f611 This is not a counter. 2017-04-26 14:29:53 +02:00
asofold 9339ccc0ef Error log the interpreted packet types (simplified). 2017-04-26 14:27:22 +02:00
asofold 0969a5c939 Log packets cancelled by FlyingFrequency. Adjust comments/log messages. 2017-04-26 14:02:21 +02:00
asofold ad934f3a43 Continue checking if a packet can't be interpreted, log every minute.
Since the normal function is to interpret packets, it's not really a
performance hit, if we always try to interpret packets.

This way at least FlyingFrequency can still run. For incompatible setups
FlyingFrequency can still be disabled.
2017-04-26 12:40:29 +02:00
asofold 672c6cf71f Fix AttackFrequency for MC 1.7.10 and MC 1.7.2. 2017-04-19 14:59:23 +02:00
asofold 45210e1a25 Build against ProtocolLib-API 4.2.1. 2017-04-18 20:32:47 +02:00
asofold 74674b551b Catch UnsupportedOperationException for getWorld. 2017-04-07 22:41:25 +02:00
asofold cf04ee5a5d Track the current world name in ChatData for now. 2016-12-29 14:43:10 +01:00
asofold b406204ce2 [BREAKING] Move isBadCoordinate to LocUtil. 2016-12-27 15:30:51 +01:00
asofold e7aab4272e Use https for dbo. 2016-12-04 14:35:07 +01:00
asofold 85460d5cca Comments (simplify/complement some, add headers). 2016-11-23 21:07:53 +01:00
asofold ec0d0878d9 Null players. 2016-11-05 22:14:03 +01:00
asofold 2cdf5ae8fb Only check teleport if any packet adapter is active. 2016-11-05 21:15:03 +01:00
asofold 5e2e11dd10 Keep track of the world name in NetData, for use with CatchAllAdapter.
Some packets arrive with a null world for a player, possibly sent by
plugins - thus attempt to use a stored world name.

This is just a hot fix attempt.
2016-11-05 21:13:43 +01:00
asofold eeb4922ca8 Proper activation check. 2016-06-26 22:25:35 +02:00
asofold fc24fe529c [BLEEDING] Overall packet spam check for pre-1.9.
Not sure if this really pays, if most people use protocol-support
plugins that limit packets anyway. There could be some future use, e.g.
generic rate limiting with configurable implementation.

Other:
* New methods for RawConfigFile+ConfigManager to check for
AlmostBooleanS.
* Add all net check permissions to plugin.yml.
2016-06-26 22:18:43 +02:00
asofold 2623a1ae5c Add a sequence count to DataPacketFlying.
Set with adding to the flyingQueue.
2016-06-25 10:57:43 +02: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 92252a9dc4 [BREAKING] Rename the new DisableListener to IDisableListener.
(Plus call in reverse order of registration.)
2016-06-19 12:29:53 +02:00
asofold 77465b09e3 [BREAKING] Move (registry) interfaces to sub-packages.
This is neither complete nor final. Intentions are to group interfaces
better, rather organizing packages in a flat way.

At some point there will be other major move-arounds, but that'll
hopefully be a point where we have a better idea of where to put what
(...). For now the approach is to move interfaces/things rather where
it's not interfering with profane exemption API use, preferably neither
taking down the top level API layer
(NoCheatPlusAPI). 

Added deprecated interfaces to prevent cncp to break too quickly.

Outlook:
* Classes that are rather only expected to be used internally for setup
will likely get moved around freely.
* Classes that have been added since last release might also get moved
around freely.
2016-06-15 16:13:59 +02:00
asofold 5ec8c2fe56 ProtocolLib: build vs. 4.0.2, reactivate SoundDistance. 2016-06-13 11:27:45 +02:00
asofold 4e91a9d5fc Ready for UEFA EC: GPLv3 headers.
Might need more training still.
2016-06-02 20:33:21 +02:00
asofold e5713ef93b Ignore null players in UseEntityAdaper. 2016-03-26 00:33:26 +01:00
asofold 0496af0ac1 Use the respawn location. 2016-03-20 11:28:45 +01:00
asofold 46b4641ba5 Expect outgoing teleport after respawn. 2016-03-19 23:01:36 +01:00
asofold 7dcbe3df6b [BREAKING] Create a common interface for per-player debug messages.
Breaking, because it alters Check, CheckListener and BaseAdapter. Not
really meant/possible to be used by external plugins, though.
2016-03-10 22:24:31 +01:00
asofold 9be2cd2400 [BLEEDING] Allow ProtocolLib 3.7 and disable SoundDistance on MC 1.9. 2016-03-02 19:49:02 +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 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 2fdd9911e8 Log untracked outgoing position. Simplify onPacketSending. 2016-01-18 10:52:19 +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 a2cba68b2e Not return here. 2015-12-07 00:03:54 +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 1e80b5320a Don't enable EntityUseAdapter on 1.6.4 and before. 2015-11-26 11:20:50 +01:00
asofold 6094bf8ca3 Fix moving/flying packet interpretation for before 1.8. 2015-11-26 11:03:26 +01:00
asofold 556ef2b0cd Set internal dependencies to provided for all the compat modules. 2015-11-25 15:26:32 +01:00