Commit Graph

688 Commits

Author SHA1 Message Date
asofold 56f1a37969 [BLEEDING][BREAKING] Swift way in to Bukkit shape models (slabs first).
Remains warnings, registry debugging output without checking config.
2018-08-21 11:45:15 +02:00
asofold 54c022f74d Prepare MCAccessBukkitModern (1.13). 2018-08-21 00:02:05 +02:00
asofold 40b0107cc8 Adjustments and fixes for BlockProperties.
* Reinstate itchy blocks being processed at all (MCAccessBukkit).
* Refine block dump: add non-air blocks with no flags set to missing.
* Adjust/re-add/alter various flags.
2018-08-21 00:01:48 +02:00
asofold 07368361e2 More smart block setup (first batch).
* Initialize fully solid (in terms of shape + passable) blocks
explicitly with full bounds and solid flags.
* Use MaterialUtil#addBlocks and BridgeMaterial#getAllBlocks where
appropriate.
* MCAccessBukkit(Base): don't touch fully solid nor fully passable ones.
2018-08-20 21:48:36 +02:00
asofold 0f3b4ae166 Don't use Material.GRASS. 2018-08-20 12:48:33 +02:00
asofold 62df128efd [BLEEDING][BREAKING] MC 1.13 Material changes, first batch.
First batch:
* Initialize blocks somehow, so no errors nor missing blocks happen
during startup.

Possibly Missing:
* There might be references of removed/renamed material (blocks/items)
throughout the code.
* Some blocks may behave different now/then.

Missing:
* Block#getData may not reflect (all?) properties anymore.
* Block shape getting is missing. Block shapes are now (potentially)
more complex to process. Concept might be to keep a double array for the
rough bounds, and add an (optional +- null) array of arrays for sub
shapes, if present (IBlockCacheNode). So a first rough update is more
simple/compatible.
2018-08-20 12:37:51 +02:00
asofold 56dbc7f21d ProtocolLib 4.4.0 for MC 1.13.x. 2018-08-10 17:16:32 +02:00
asofold bd24e12026 Add override tests. 2018-05-07 10:39:22 +02:00
asofold 6bddb1a834 Optimistic player data creation. Updating of world / player name. (+)
Create PlayerData instances if events allow proceeding:
* AsyncPlayerPreLogin.
* PlayerLogin (schedule for removal if denied).

Update world data:
* PlayerLogin
* (PlayerJoin, ...)

Update player name and log:
* PlayerLogin
* PlayerJoin

(+) PlayerData.updateCurrentWorld -> only do something if the WorldData
instance has changed.
2018-04-20 11:49:22 +02:00
asofold ad5be20eb6 Change packages for penalties.
So actions.types remains soemwhat consistent for now.
2018-04-17 12:42:35 +02:00
asofold 2bea03eaf0 Support cancel with probability (e.g. 25%cancel) for actions. 2018-04-15 18:57:30 +02:00
asofold cbfcecf2b4 Penalties: Redo Marianas Trench. 2018-04-10 09:40:06 +02:00
asofold ba13fa8c72 [BREAKING] Change ActionFactoryFactory related API. 2018-04-07 15:22:17 +02:00
asofold 0a373fb28b Block change tracking: add flags for use and redstone. (+)
Add block flags:
* F_VARIABLE_USE
* F_VARIABLE_REDSTONE

Add a test to ensure block flags are unique and not 0L.

(+) Use individual MiniListener instances.
(+) Track right click blocks (use block) and apply, aiming at trap door
issues.
2018-04-02 17:08:48 +02:00
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 4705f75fa0 Lock NCPAPIProvider against changing.
(Not really the best example application for ILockable.)
2018-02-11 13:52:56 +01:00
asofold eb41f4397a Add GPLv3 headers where missing. 2018-02-08 08:43:32 +01:00
asofold 6dbb7d4299 [BREAKING ] Lazy permission updating.
* Each asynchronous permission check yields an update request anyway,
thus frequent bulk update requests have been removed.
* With join and world change, lazy permission updating is requested.

Breaking:
* Remove CheckConfig.getCachePermissions().
2018-02-08 01:27:47 +01:00
asofold 5d5e45e2df Set default child permissions in plugin.yml. 2018-02-07 16:54:03 +01:00
asofold 6f4c61d8f3 [BREAKING] Remove legacy behavior for notify permissions.
* Remove the old per-world permission cache.
* Use the new permission caching feature.
* Always use permission subscriptions.

Pitfalls:
* Permission subscriptions might fail under certain conditions
(legacy?).
2018-02-07 15:15:34 +01:00
asofold c50cc4f052 Add child permissions within onEnable already. 2018-02-07 14:46:00 +01:00
asofold c45a31b979 [BLIND] Switch rule definition to a list of strings. (+)
(+) Extend/alter slightly, e.g. added a regex example.

Replacement characters are not needed, and default values won't keep
reappearing.

Tests pending, e.g. dump with the upcoming registry log.
2018-02-02 23:49:58 +01:00
asofold 08aaa5fb1c PermissionPolicy: Rename to/from config. Clarify defaults. 2018-02-02 22:43: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 37127c1f2b [BLEEDING][BREAKING] Use a new internal event registry.
The old ListenerManager is removed, new system in place. Removed
doesManageListeners(). (The new system isn't that new, but it's been
fixed and adapted to using RegistrationOrder.)

New
* Register all Bukkit events via the new EventRegistryBukkit.
* This way listeners can be ordered by numeric priority and tags
(regular expressions for beforeTag and afterTag).
* Unregistering listeners is possible (a listener node stays in the
Bukkit registry, but only one per event).
* It's possible to add listeners with minimal impact (MiniListener).
* The registry registers by event class 'hard' i.e., no relations
between already registered classes are checked.
* Order isn't necessarily stable nor even reproducible for randomized
start conditions with the same elements.

Point
* Compatibility hooks can easily place event listeners
before/after/between NCP default listeners, without resorting to tricks
like 'load-before'.
* Future registry of NCP itself: unregistering listeners is necessary
for runtime-removable checks, order is useful if not necessary, to be
able to add check listeners at any point of time.

Breaks:
* Anything relying on the previous (optional) managelisteners feature.

Missing:
* Lots of testing/inspection.
* Ensure all NCP listeners are coming with name/tag at least.
* Provide meaningful tags/RegistrationOrder for fine grained access
(e.g. after feature.moving but before feature.inventory).
* Change cncp to hard depend on NCP and use listener priorities.
2018-01-17 12:42:32 +01:00
asofold 30b293e735 Rename DummyNoCheatPlusAPI to UnitTestNoCheatPlusAPI for the prefix.
Allows determining the state of the system more easily.
2018-01-15 21:45:41 +01:00
asofold 04a751510f Scrap activation for include/build. 2018-01-10 02:32:00 +01:00
asofold e5c8bec62b Obtain the "non free" modules via a pre-built jar by default.
This way testing changes to the core checks will be easier:
* By default NCPCompatNonFree is fetched from the repository (prevent
via -Dno_nonfree).
* To build "non free" modules, -P nonfree_build is needed. In addition
you need to specify the profiles for what to build, such as -P all an
the like.
2018-01-10 01:54:08 +01:00
asofold 05928747fb Multiple iterations of fumbling reveal...
magic looks different.
2018-01-09 21:26:12 +01:00
asofold 68160c8424 Remove ncp_base profile in favor of default moduels and dependencies. 2018-01-09 20:50:51 +01:00
asofold 17293c70b2 No need to specify ncp_base anymore. 2018-01-07 22:22:35 +01:00
asofold 7e80cd580c Reverse order of dependency/profile definitions within pom.xmlS.
Entries to add are near to each other now.
2018-01-07 22:21:20 +01:00
asofold 5da5689f85 Get rid of parameters for maven profile activation. 2018-01-07 22:10:04 +01:00
asofold c101bc631f Add a native access module for 1.12.2. 2018-01-07 16:35:44 +01:00
asofold 7f1d744092 Add a dedicated compat module for 1.11.2 (1_11_R1). 2017-12-21 23:11:40 +01:00
md_5 3a111dc4a5 Remove Block IDs 2017-12-06 16:55:29 +11: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 6e4a1c08da Don't activate ProtocolLib hooks until issues are resolved. 2017-05-14 15:08:10 +02:00
asofold 5cccd4c190 Allow ProtocolLib 4.2.2 and later on MC 1.12.x.
(ProtocolLib b357 crashes the client on localhost though.)
2017-05-14 12:42:14 +02:00
asofold 9e763c2584 [BLIND] Add 1.12 blocks. 2017-05-14 12:07:49 +02:00
asofold 4522bc0cb8 Registration for 'itself' - log as such. 2017-05-04 15:39:46 +02:00
asofold 8cecf92eff [BREAKING] Move Activation to the registry.activation sub-package. 2017-04-29 10:29:46 +02:00
asofold bb96f63f7d Quick config notify overhaul.
* Reduce details and only send a configurable amount of lines in
notify/chat, default to 5, just state to check logs in the end,
instead of lengthy hints.
* Log detailed output to STATUS (file/s).
* Fix wrong build number printed to set configversion.created to.
2017-04-19 12:34:06 +02:00
asofold 3d73a54fcd Fix faulty config notifications.
The per-config-path notifications would keep showing up, even if you
removed the paths, then run 'ncp reload', then alter any of them and run
'ncp reload'.

To fix this, the configversion.created value is set to the current
build, if no config warnings are there - which is the same, as what the
notification suggests as an alternative to removing the paths and
running 'ncp reload'.

To do this, isConfigUpToDate had to be moved from Updates to
ConfigManager, which makes more sense anyway. In addition the 'created'
and saved 'values' are set to the biggest thing found, instead of the
prehistoric static value.

Further a negative 'created' value will not be overridden anymore,
allowing to silence the config notifications forever. Not necessarily
recommended for the general case, but it can be useful/necessary with
maintained blueprints, e.g. with administering multiple servers.

One of the next steps will be to remove the DefaultConfig.buildNumber in
favor of setting a build number for each and every path added. All
provided we don't run into nasty issues here.

Another follow up could be to create an extra registry/config log file
and write all the values there, and only print the first 5 in ingame
chat.
2017-04-12 20:44:26 +02:00
asofold ed22d5b43b A sensible choice. 2017-04-09 00:08:46 +02:00
asofold 9a4b3f6f91 [BLEEDING][BREAKING] Store PlayerData by UUID, use a PlayerTickListener.
Instead of maps for each individual purpose, and the rather expensive
TickListener adding and removing, player specific task will be done via
one PlayerTickListener that can be registered with the TickTask. Thus
PlayerData has the access methods requestUpdateInventory and
requestPlayerSetBack, and so on, later more. For the
DataManager.playerData map it'll be UUID first now.

Consequently some calls have been altered to prefer passing Player or
UUID for PlayerData getting.
2017-04-08 15:47:06 +02:00
asofold 0cd0d508d1 [BREAKING] Add UUID to PlayerData creation. Outlook on data.
Breaks: DataManager.getPlayerData(String, boolean) has been removed, new
methods added to do the same without boolean or with UUID passed extra.

Following changes may repeatedly/randomly break PlayerData and check
data access (unless you use CheckType.getDataFactory), this may not
follow directly, but more or less soon. Even Later, CheckType will get
broken too :), in favor of class instances with dynamic registration
ability.

Basic direction is to concentrate stuff in PlayerData, getting rid of
all the static data stores, but also making access to shared data
more efficient (e.g. store last world id + name and permission cache in
PlayerData). Access will be more thread safe (only for PlayerData,
permissions cache, likely for fetching check data too, however returned
objects may have their own contracts).
2017-04-08 13:49:39 +02:00
asofold 30b9fe5290 [BLEEDING] Multi passenger vehicle set back.
Tested with a pig. It's not nice.
* Vehicle envelope needs a lot of overhaul.
* Force fall set backs may be more nice to have for in-air downwards.
* The set back locations can be from seconds ago, with different
passengers than at the time of the set-back.
2017-04-03 00:28:19 +02:00
asofold 30c3a40622 Towards vehicles with multiple passengers. 2017-04-02 18:55:32 +02:00