Commit Graph

647 Commits

Author SHA1 Message Date
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
asofold
5b0807847f Don't give silent permissions as child permissions by default. 2017-01-17 01:03:55 +01:00
asofold
8465c40d93 Register .silent check permission in postEnable.
Issue: https://github.com/NoCheatPlus/Issues/issues/353)
2016-12-28 10:37:34 +01:00
asofold
11be3c7c0d Register the inventory.open permission.
Found via auto-generating .silent check permissions :p.
2016-12-28 10:30:35 +01:00
asofold
5089447aa1 Add a dedicated compatibility module for 1.10.x (1.10 R1).
* Auto generate the sub-module file structure.
* Add rest manually.

Rest
* Enter new classes into factories.
* Add entries for modules and dependencies to the root pon and the
NCPPlugin pom, to make the new module represent 1.10 R1.
* Point the 1.10_r1 build profiles to the new module.
* Add a new module for 1.11, point to cbdev (which still is 1.10.2,
though).

Next steps (next MC release, probably):
* At least auto generate a file, containing all entries to make for the
new module, for convenient use with copy and paste.
* (Later: alter the files automatically, possibly interactive. Needs
more care, e.g. if profile entries already exist. The factory entries
can have a marker each.)
2016-12-27 23:36:03 +01:00
asofold
21eb53f7f2 Guard vs. ReflectBase not being available. 2016-12-19 07:51:12 +01:00
asofold
3cd7625516 [BREAKING] Make an extra package for block change tracking.
* Split off the BlockChangeReference, BlockChangeListener.
2016-12-05 14:29:57 +01:00
asofold
e7aab4272e Use https for dbo. 2016-12-04 14:35:07 +01:00
asofold
5939e1e206 Add per-path build numbers. Activate BlockChangeTRacker by default. 2016-11-26 14:16:08 +01:00
asofold
892af50209 Ensure to keep handles forever, once fetched.
(Less headaches with reloading the configuration and similar.)
2016-11-25 22:25:51 +01:00
asofold
6c73ab005e Properly unregister disabled handles, lazily.
Actually, proper would be to unregister the handle properly on disabling
it, not with the next fetch.
2016-11-24 00:40:58 +01:00
asofold
1058a45bbe Ensure we don't attempt to hand out disabled handles.
https://github.com/NoCheatPlus/Issues/issues/313
2016-11-24 00:25:56 +01:00
asofold
7db3a7d45a Note on order of registration. 2016-11-24 00:24:58 +01:00
asofold
f2b245010f Allow ProtocolLib 4.2.0 on MC 1.11.x. 2016-11-22 12:49:48 +01:00
asofold
da40bd06e2 Keep track of past block states within BlockChangeTracker.
We only have pistons for now, previous states of blocks are not yet used
for anything with this commit.
2016-11-21 01:09:37 +01:00
asofold
e3304141b2 Add MCaccess to registry early, also add a BlockCache instance. 2016-11-21 00:42:40 +01:00
asofold
b8746efcb7 Include the entire MC 1.10.x range with ProtocolLib 4.1 and later. 2016-11-02 19:10:46 +01:00
Gabriele C
84763fa113 Allow latest version of protocollib on 1.8+ servers 2016-08-16 22:37:02 +02:00
asofold
4b76522b06 Add [NoCheatPlus] tag for earliest/latest log messages. 2016-08-11 22:38:16 +02:00
asofold
20779443a2 Allow higher ProtocolLib versions for MC 1.10. 2016-07-11 01:06:01 +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
28f2a8928e Allow thread-safe fetching of instances (for now).
Using a LinkedHashMapCOW for now, fetching instances should be
thread-safe. This isn't such a big issue, but there might be handles in
asynchronously processed threads later on, and the handle will
initialize lazily. Copy on write won't be nice during registry setup, if
we have hundreds of objects registered at some point in the future,
neither would locking be too nice to have - but locking could be
acceptable with using handles, as those get updated by overriding the
instance field. Using locking would affect static utilities, but this
could be mended. An alternative could be to have some registration stage
'setup', during which fetching will yield the old state, while new
registrations will be added to a new map. Upon changing the registration
stage to 'live', the map reference is switched simply, this could be
acceptable even with a completely new setup after reloading the
configuration.
2016-06-26 14:12:12 +02:00
asofold
89dcd79327 Consistency fixes.
* Only unregister once really.
* Don't count to below 0.
* Throw a RuntimeException in getNewHandle, if already disabled.

(+ Allow checking if disabled for sub classes.
2016-06-26 14:03:49 +02:00
asofold
c9efd7b76c Add locking against changes to generic registrations.
Let default implementation use registration nodes.
2016-06-22 23:04:44 +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
bfc6422115 Move entity last position and look access to another package. 2016-06-20 22:14:35 +02:00
asofold
4653b46579 Quickly add box margins to LocationTrace/ITraceElement.
* Remove SharedContext.
2016-06-20 22:07:53 +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
92252a9dc4 [BREAKING] Rename the new DisableListener to IDisableListener.
(Plus call in reverse order of registration.)
2016-06-19 12:29:53 +02:00
asofold
d4acad924a Change order in onDisable (DisableListener, exemption, hooks).
The idea is to change internals towards having a 'default'
DisableListener executing onDisable before the data removal of checks
and DataManager have been called, thus plugins or even checks might
still access all sorts data with disabling the plugin.
2016-06-19 12:01:37 +02:00
asofold
931c02714a Register MCAccess with the GenericInstanceFactory as well. 2016-06-18 22:01:45 +02:00
asofold
bb8c8f4156 Add missing GPLv3 headers + accidentally add useless javadoc comments. 2016-06-18 17:57:16 +02:00
asofold
d6bb1e84bc Implement more efficient handles. 2016-06-16 23:34:52 +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
0868e30994 Allow to detect delegate players for some contexts. Other fix(es).
Attempt to treat fake players less Concept is subject to change, might
want fall-back methods or skipping native access in general where it's
not needed (thus not need to check for native entities).

Other
* Don't insert dataMan into disableListeners twice.
2016-06-16 01:30:19 +02:00
asofold
d5b45e53f9 Add support for IPostRegisterRunnable.
Allows to register with the generic instance registry for another class,
after component registration, with implementing this method.
2016-06-16 00:04:46 +02:00
asofold
d521a99ffc Remove legacy compatibility module for glowstone.
(Should have a look at GlowstonePlusPlus, perhaps.)
2016-06-15 23:08:59 +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
bcbab97f71 [BREAKING] Move default factories to a registry sub-package. 2016-06-15 14:03:55 +02:00
asofold
48bc795fd5 Make limiting parameters for block change tracking accessible.
(Not yet in use by default.
2016-06-15 13:51:36 +02:00
asofold
6f78eba4c4 Add build profile for 1.7_r4 (1.7.10). 2016-06-14 23:36:51 +02:00
asofold
8aced9d116 Use a class for version checking with ProtocolLib. 2016-06-14 00:16:30 +02:00