Commit Graph

623 Commits

Author SHA1 Message Date
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
asofold
bddd898857 [BREAKING] Demand build profile ncp_base to be activated.
In order to simplify the pom.xml files, we now work with a ncp_base
(formerly 'minimal')
profile for the minimal configuration and demand this to be activated in
addition to other profiles. This means the build parameter 'ncp_base'
can/should be used as well. See the README.md for a table of build
profiles).
2016-06-13 12:45:50 +02:00
asofold
8ae36791a9 Let's not debug log these.
Perhaps later there will be extra settings and an extra log file for
registry/setup related output, while real errors would still be logged
to file/console.
2016-06-13 11:05:28 +02:00
asofold
d948357b46 Destructive hot fix for item duplication via end portals.
Configurable. Falling blocks, piston, end portal, roughly. Destructive:
the entity is removed.

(In addition some of the feature tags are added regardless activation
flags, because 'ncp reload' could change things anyway.)

Feel free to suggest alternatives/variations...
2016-06-13 00:14:15 +02:00
asofold
052e8c13ee Log supported version of ProtocolLib for MC 1.10. 2016-06-11 16:51:43 +02:00
asofold
1e3620ac38 Re-add/repair reflection based attribute access. 2016-06-11 10:26:24 +02:00
asofold
e0d6585f67 More flexible registration (fall-backs for dedicated and reflection). 2016-06-10 15:44:44 +02:00
asofold
19312bdbfa [BREAKING] More on passable and ray tracing.
* Make RayTracing and PassableRayTracing implement interfaces. (rough,
not used in tests yet etc.).
* Optimize ray tracing use in BlockProperties.
* Add an axis-wise implementation (buggy, hardly tested, thus not used
yet).
2016-06-10 00:23:56 +02:00
asofold
f18e7e46d1 [BLEEDING] Guards for activation of IAtributeAccess implementations. 2016-06-09 23:40:09 +02:00
asofold
765383834b [BREAKING] Generic instance based attribute access.
MCAccess will be split into smaller providers with time, so do expect
more breaking changes of this type. If this is an issue, please contact
us, so we can see how to smoothen things. E.g. we could still make
MCAccess an aggregate, that just delegates to the more fine grained
providers, or we could provide other 
(default) aggregates.

This also adds a Bukkit-based provider for future updates.
2016-06-09 20:14:39 +02:00
asofold
8ba1f2cf74 Minimize code for one generic instance factory instance. 2016-06-09 18:22:23 +02:00
asofold
f12aa93454 Update CompatCBDev to MC 1.10. 2016-06-09 13:02:37 +02:00
asofold
e4f02595ba Dedicated module for Spigot (CB) 1_9_r2 (MC 1.9.4).
(+ Prepare 1_10_r1 build parameters.)
2016-06-09 12:41:33 +02:00
asofold
294afd4f89 Allow ProtocolLib 4.0.2 and later on MC 1.10. 2016-06-09 12:12:11 +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
9a6a890932 Do check for the expected size as well. 2016-05-31 07:06:51 +02:00
asofold
2ade022179 Change implementation of LocationTrace. No merging based on distance.
Since merging by distance only creates false positives (one would have
to increase the bounding box for an entry, but the angles would never be
100% right), we never merge, instead we don't add a new entry if the
position is the same, the time value is not updated in this case. For
validity of an entry you always have to consider the time span until the
previous (younger) entry or until now for the latest entry.

Rough changes:
* Use an interface for accessing trace entries.
* Use a linked structure for the actual trace.
* Use maximum age and size to limit the number of stored entries.
* Use a pool to somewhat limit object creation (size may need
configuration or scaling with number of players).
* Since the trace starts empty, have the field be final.
* Keep trace elements if settings are changed, cut size if necessary.
* Remove obsolete tests.

Potentially missing:
* Usage of LocationTrace has not been checked if we need to account for
the time of the latest entry not necessarily being updated (!).
* New tests, e.g. accounting for the expiration of entries.

Follow ups:
* (Extend fight/loop checks to a latency window mechanism.)
2016-05-29 19:35:52 +02:00
asofold
75aa1b500b Use an interface for trace entries: ITraceEntry
Upcoming changes will roughly be:
* Change implementation to a double linked structure.
* Implement/use something like ListIterator.
* Never merge entries, instead use some pool and time/extre-n as limits.
* A basic latency window implementation just for the LocationTrace for
preliminary experiments. [Track hit/miss all time + recent so and so
seconds, some extra cancelling/invalidation mechanics, allow to test
complement 0->window start and possibly window-end-> max latency for
some cases, cancelling mechanics may contain a buffer or a mixture of a
buffer relating to average miss rate]
2016-05-29 15:02:28 +02:00
asofold
2abb502a60 Add configurability for exemption settings. 2016-05-29 13:34:09 +02:00
asofold
a32bc257f3 Also recognize ProtocolLib versions just with build number prefix. 2016-05-16 22:11:32 +02:00
asofold
c36f68a829 [BLEEDING][INCOMPLETE][BREAKING][NOT_COMPILING] Changes towards v-thing.
Prepare using VehicleUpdate and PlayerMove instead of VehicleMove for
vehicle moving. This change isn't intended to change
anything/much on the surface.

* Implement native IEntityAccessPositionAndLook for 1.9_R1 and 1.9_R2.
* Alter method visibility and parameters.
* Common pre-conditions.
* Route contents of both VehicleUpdateEvent and PlayerMoveEvent through
a common related method (also named onVehicleUpdate).
* Remove RichLivingEntityLocation, to be able to simplify more.
* Refine interfaces for locations (IGet... ISet... vs, I... for both).
* Implement location related interfaces in some places, related changes.
* Override hashCode for some of the location related classes. Use that
for storing location hashes instead of Location.hashCode. Auxiliary
methods for hashCode in LocUtil.
* Add onIce to LocationData.
* Renaming player vs. vehicles (likely incomplete).
* Possibly other related/random changes.

Line count is high for this change, despite not so complex. Next step is
to change VehicleChecks to use past move tracking to estimate from where
a vehicle is moving (left not compiling). Due to the lack of teleport
events, and due to entity last location being mostly useless, we have no
choice but to hard-set-back on anything that looks strange.
2016-05-15 00:54:15 +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
0bcb994040 [BLEEDING] Compatibility module for Spigot/CraftBukkit on MC 1.9.4. 2016-05-11 00:58:54 +02:00
asofold
0280db5010 Dedicated compat module for Spigot/CraftBukkit 1.9-1.9.3 (1.9_R1). 2016-05-11 00:27:21 +02:00