Commit Graph

111 Commits

Author SHA1 Message Date
asofold
82d6f94230 [BLEEDING][BREAKING][BROKEN] Continue data registry + API. (+)
Likely incomplete/broken somewhere.

Implement/extend/use/fix new data caches and factories.
(+) Fixes related to recent commits (e.g. log listener exceptions
properly, fight.wrongturn).

Missing:
* Debug logging (registry), consider a registry log file.
* Proper naming/tags for listeners.
* Consistency: ICheckData should probably be used with
removeData(CheckType)? Registration is arbitrary though.
* Consistency: clearData() vs clearData(CheckType.ALL) - should check
type related data be ICheckData only ?
* Data expiration stages and PlayerOfflineData - impact on memory...
* (...)

Further:
* WorldData inheritance issue: implement passing on changes to children.
(Current line of thought: rather extend IWorldDataManager to allow
change default+inherited only.)
* Shrink exposed API - uncertain: rather have a registration context
object or expose individual methods for factory registration and
grouping types?
* (...)
* Planned breakage: Project + package organization redone: move stuff
where it is best for having an API (components -> split to top level or
name it api, utilities ... parts belong into API, and the like...,
possibly split project further: commons, api(+-bukkit), core/checks,
plugin-bukkit).
2018-04-02 01:25:10 +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
4a7efdc3a4 Add identity checks with various implementations of equals(Object). 2018-02-11 14:21:14 +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
1de1c37d29 Add getMergePrimaryThreadAndClear. 2018-01-28 17:33:53 +01:00
asofold
09a963ed49 Add GPLv3 headers where missing. 2018-01-17 23:52:50 +01:00
asofold
0306e2c982 Add getKeys(), similar to to keySet(), but without option to alter. 2018-01-14 15:47:53 +01:00
asofold
adf8c2b949 Supress this warning. 2017-04-29 14:23:08 +02:00
asofold
68a7eab297 Allow join with a StringBuilder passed. Simplify some method signatures. 2017-04-26 14:26:24 +02:00
asofold
f02a11e404 Move stray tests to a test sub package. Reduce tests in TestCoordMap.
TestCoordMap: Use less samples with extra testing not being set.
2017-04-24 17:27:06 +02:00
asofold
b3a9898900 Add the method getClassDescription for debugging purposes. 2017-04-19 14:08:21 +02:00
asofold
8077b4a0dc Extend HashMapLOW interface. Put PlayerData FCFS under lock.
HashMapLOW
* Add a constructor for using an external lock.
* Add putIfAbsent.

DataManager
* Use playerDataMap.putIfAbsent, return the PlayerData instance that has
been there first.
2017-04-13 12:39:18 +02:00
asofold
ea5a064132 Prevent npe before use. 2017-04-11 13:18:13 +02:00
asofold
53649f9001 Add containsAsynchronous, move to NCPCommons into utilities.ds.corw.
It's some kind of copy on read/write (+ delete after read).
2017-04-11 12:32:16 +02:00
asofold
def24ac1f1 Headers missed. 2017-04-11 00:06:35 +02:00
asofold
2de5f2fd3a IQueueRORA as interface, add an implementation using a Lock.
+ Use in AbstractLogNodeDispatcher.
2017-04-10 14:56:09 +02:00
asofold
12ce099eb1 [BLEEDING] Reflection module: access entity bounds/height etc.
This should fix more issues with horse type.
2016-11-22 19:25:13 +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
bb8c8f4156 Add missing GPLv3 headers + accidentally add useless javadoc comments. 2016-06-18 17:57:16 +02:00
asofold
2bf3e14ab9 More on GenericInstanceRegistry.
* Add a way to stay updated about the latest registration state for a
class.
* Add a class for the registry.
* Let the registry log all registrations.
* Make super interfaces for LogManager (simple logging of
String/Throwable).

Missing:
* More streams (REGISTRY, PLAYER/CHECK_STATUS/EVENTS or just CHECKS at
least). Make status rather the plugin status. Registry could have an
extra file.
* More efficient IGenericInstanceHandle use (wrap + reference counting).
2016-06-16 22:23:54 +02:00
asofold
087d800de4 Provide the block position hash we use via a static utility. 2016-06-11 19:05:13 +02:00
asofold
64dedf3434 Explicitly implement CoordMap<V>.
Getting rid of compiler warnings, not sure why this appears to be
necessary.
2016-06-11 12:50:24 +02:00
asofold
57cb4580f9 Only clear the map if there are entries at all. 2016-06-11 12:29:09 +02:00
asofold
016d5894de Add the 'ncp stopwatch' command.
Taken from CG/customplg.
2016-06-03 21:43:08 +02:00
asofold
4e91a9d5fc Ready for UEFA EC: GPLv3 headers.
Might need more training still.
2016-06-02 20:33:21 +02:00
asofold
b1b30aba9b Reduce warning level for NoCheatPlus. 2016-06-01 21:30:50 +02:00
asofold
554c8635e7 Sketch a reflection based provider for IEntityAccessLastPositionAndLook.
Directly following:
* Boat fly check based on VehicleUpdateEvent and fetching last pos.
* Implement a native access based provider for
EntityAccessLastPositionAndLook, after testing the reflection based one.

Likely following:
* Implement the same fly checks based on PlayerMoveEvent for horses and
pigs too, for the case server-side fly checking is disabled.
* Configurability for individual types of enbtities, at least a flag for
activation.
* Not sure if a fall-back to VehicleMoveEvent should be kept, setup
shouldn't be all too complicated.
2016-05-11 11:24:11 +02:00
asofold
a00b6a53b5 Fix issues with respawning ender dragons (block place reqach+distance). 2016-03-26 02:42:35 +01:00
asofold
81b0c9441a Log just used workarounds on debug. 2016-03-26 01:01:44 +01:00
asofold
752e130640 Adjustments for elytra and creativefly default model configs.
* Allow moderate ascending with elytra.
* Let ground be true by default.
* Disable some stuff for spectator mode by default.
* Alter logging.
2016-03-26 00:19:20 +01:00
asofold
10cf788acd Duplicate javadocs. 2016-03-18 14:31:47 +01:00
asofold
c22126449b [BLEEDING] Dedicated MCAccess for 1.9.
This won't cover all effects of internal changes, some blocks might be
interpreted wrongly still, some shapes may have changed in an
incompatible way (e.g. skulls).
2016-03-03 20:11:46 +01:00
asofold
5d72a51001 Fix hash code use. 2016-02-08 01:35:24 +01:00
asofold
6c977edacf Sketch out another storage map (not yet in use). 2016-01-28 22:51:41 +01:00
asofold
02137600b7 [BLEEDING] Make use of workarounds for a specific case, test-wise. 2016-01-18 00:40:51 +01:00
asofold
228ed2f74a Add tests for WorkaroundSet. Related fixes/changes. 2016-01-17 23:37:30 +01:00
asofold
aacb97b26b Add tests for SimpleWorkaroundRegistry. Related fixes. 2016-01-17 21:52:40 +01:00
asofold
db462091d0 Add tests for workarounds. 2016-01-17 18:49:07 +01:00
asofold
8a70ad939b Rename interface to I... 2016-01-17 17:50:51 +01:00
asofold
f0dd67590d Don't override use in WorkaroundCountDown. Adjust java docs. 2016-01-17 16:36:03 +01:00
asofold
d2b151af99 Second iteration on the workaround infrastructure (not in use).
* Rename interfaces to I...
* Split off the statistics counting to accept/deny counters.
* Remove support for parent workarounds.
* Do use a testUse method for overriding in AbstractWorkaround.
* Add a stage counter to WorkaroundCountDown, for meta checks per stage.
* Extend/alter/implement default method signatures and interfaces.

Missing:
* Tests for the workaround package.
* Add a primary thread / moving checks registry instance.
* Add default sets and use in moving checks (primary thread only).
2016-01-17 16:27:57 +01:00
asofold
f337538ce3 A blueprint. 2016-01-17 02:31:14 +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
a216a940d6 Fixes and tests for LinkedCoordHashMap.
* Default order: order of first put (first put is first on iteration).
* Fix order being done right for all cases.
* Fix linking.
* Override clear.
* Add more tests.
2015-11-30 10:12:44 +01:00
asofold
64b4f30696 Set scope to provided for external jars. 2015-11-25 08:47:11 +01:00
asofold
218fdc46c4 [BREAKING] Move ActionFrequency and ActionAccumulator to a sub-package. 2015-11-24 07:33:30 +01:00
asofold
5fe02d75d2 Random: Add join for an array. 2015-11-15 05:32:00 +01:00
asofold
af5fbd900a Move prefixes to loggers. 2015-11-15 02:44:01 +01: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
f0c6ab69b5 Don't call move, if there is no entry. 2015-09-28 15:16:54 +02:00