Commit Graph

1310 Commits

Author SHA1 Message Date
asofold
c2dcc600b5 Use public visibility for event handler methods. 2018-01-20 00:37:20 +01:00
asofold
09a963ed49 Add GPLv3 headers where missing. 2018-01-17 23:52:50 +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
f7571dcf2f [BREAKING] Move std. annotations into RegistrationOrder. Add more.
* The annotations made for RegistrationOrder are defined in there.
* Add RegisterMethodWithOrder (method) for event handlers.
* Add RegisterEventsWithOrder (type) for default order with listeners.
2018-01-16 21:08:45 +01:00
asofold
243d8dd6c8 Fix premature non-abort. Return boolean for simplicity with traversal. 2018-01-16 12:02:29 +01:00
asofold
2b469a4613 Add traversal methods. 2018-01-16 11:31:54 +01:00
asofold
c9d2a5de74 Simplify using CheckTypeUtils. 2018-01-16 11:02:34 +01:00
asofold
361b37962d Move methods from hooks.APIUtils to utilities.CheckTypeUtil.
(Not specific to hooks anymore.)
2018-01-16 10:18:55 +01:00
asofold
1d96fb32a1 An unmodifiable list. 2018-01-16 09:53:30 +01:00
asofold
3e81499fa6 Add a CheckTypeTree for fully spanned check-type-related structures. 2018-01-16 00:18:17 +01:00
asofold
532eef14a2 [BLEEDING] Partial overhaul for CheckType.
Yes
* Remove the UNKNOWN type.
* All types except ALL have a parent now.
* All types have a type now.
* APIUtils: Add getDirectChildren for distinction.

No
* APIUtils doesn't collect the descendants in a generic way yet.
2018-01-16 00:10:33 +01:00
asofold
073220cc01 Clarify APIUtils methods meaning by renaming, deprecate former. 2018-01-15 23:19:41 +01:00
asofold
adc0d16d73 Add a type for check types (future may have multiple levels). 2018-01-15 23:07:04 +01:00
asofold
a25dc44501 [BLIND] Include other blocks in the multi protocol block patch, rename. 2018-01-15 22:16:09 +01:00
asofold
e8cf861150 Disable the MultiClientProtocolWaterLilyPatch with unit tests. 2018-01-15 22:00:17 +01:00
asofold
01aaccbf54 Fixes and extension for Activation. (+)
(+) Always return Activation, not IActivation.
(+) Add unitTest() and notUnitTest().
2018-01-15 21:59:39 +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
13b00a6b8e Fix APIUtils not returning an unmodifiable collection. Change to Set.
Using the LinkedHashSet directly.
2018-01-15 21:20:50 +01:00
asofold
5cf2613f36 Should mention... 2018-01-15 13:10:44 +01:00
asofold
def7d61bc5 Test for NPCs with the Inventory.Open check. (+)
(+) Note: If it's fired asynchronously, meta data isn't checked, due to
that not being thread-safe. In future extra checks for (demanded to be)
thread-safe external plugin APIs can be added (reflection only).
(+) Add comments to PlayerData, concerning future treatment of name-uuid
mappings and retaining data.
2018-01-15 13:02:30 +01:00
asofold
7fdd6a586b Register the ExemptionSettings instance in use as generic instance. 2018-01-15 12:31:00 +01:00
asofold
dc4849f3a8 [BLEEDING] Do not delete PlayerData instances for online players. (+)
(+) Add getPlayerName for exact case name getting from internal storage.
2018-01-14 16:31:38 +01:00
asofold
8e11fe8184 removeDataPrecisely: Don't create ANY debug text if debug is false. (+)
(+) Add/alter comments with PlayerData removal.
(+) Remove comment to store PlayerData by UUID.
2018-01-14 14:39:12 +01:00
asofold
01f6db48b0 Correct javadocs. 2018-01-04 00:04:08 +01:00
asofold
c6aec5ed09 Implement F_MIN_HEIGHT16_1 and F_MIN_HEIGHT16_15. Clarify javadocs.
Only applying with GROUND_HEIGHT set, these flags allow setting a
minimum height for passability and ground workarounds, covering two
typical cases.

Due to a range of hard coded workarounds being in place already, these
flags won't apply for all blocks. See getGroundMinHeight.
2018-01-03 23:57:12 +01:00
md_5
df3344409b Fix server version detection logic 2017-12-21 14:00:27 +11:00
asofold
af44f13fbd [BREAKING] BlockCache: rename getTypeId to getType. 2017-12-18 01:19:49 +01:00
asofold
ce98d2aa54 [BLEEDING] Fix native access modules. 2017-12-18 01:14:23 +01:00
asofold
7fb960275d [BLIND] Use MinecraftServer.getVersion, if no version was detected. 2017-12-16 16:51:46 +01:00
asofold
7c5d67b1d4 Fixes and adjustments with String ids.
* Start renaming methods internally (getType for getting Material) -
unfinished.
* Temporary fix for the NCPCompatbukkit/cbreflect module: fetch NMS
blocks by id until we have a mapping and/or something efficient and
future proof in place.
2017-12-16 16:14:41 +01:00
md_5
c564289ef3 Fix default message params 2017-12-08 14:59:55 +11:00
md_5
1e988f24a0 Fix import location 2017-12-06 21:45:58 +11:00
md_5
3a111dc4a5 Remove Block IDs 2017-12-06 16:55:29 +11:00
asofold
7e43deaa28 Cancel interaction for players who are not online. 2017-05-31 21:03:46 +02:00
asofold
afe080f1c2 Use cancel.dead as id instead of canceldead. 2017-05-31 21:00:42 +02:00
asofold
0b2882c58b Revert allowing placing boats on ground.
Placing boats on ground is possible at least down to CraftBukkit
1.4.5-R1.0, thus the reason for having the boatsanywhere feature solely
is to prevent abuse. Thus allowing to place boats on ground does not
really provide a 'fix'. In order to allow placing boats anywhere, the
configuration flag has to be altered.

It may be worth a discussion, if we want checks to prevent Minecraft
features at all. A proper fix for abuse would be more complicated,
involving checking the estimated bounding box of the placed boat not to
collide with blocks neither with entities while being on ground-.
Determining the bounding box and re-checking with entity spawn might be
the more complicated part, as for the rest API/Infrastructure exists.
2017-05-31 14:22:51 +02:00
asofold
b441c1ea88 Allow placing boats on ground for MC 1.12 with protocol support plugins.
Allowing it with protocol support plugins is added, assuming that
they'll allow 1.12 too.

Missing:
* The vehicle.envelope check must be made (more) precise, as moving on
ground is possible with a boat since 1.12, specifically on ice they can
reach high speeds. Without more close modeling, they'll be able to use
this for speeding.
2017-05-28 21:30:44 +02:00
asofold
049a925fb3 Move multi protocol plugin activation to a utility. 2017-05-28 21:03:21 +02:00
asofold
ddc0436e43 Fix boatsanywhere not recognizing other than oak boats.
Other:
* Add and use BlockProperties.isWater.
2017-05-26 14:13:02 +02:00
asofold
8b02a7ce4c Fix fastbreak/grace not being read correctly. 2017-05-17 11:11:44 +02:00
asofold
982eecbfcf Remove unused member. 2017-05-17 10:56:47 +02:00
asofold
135d3e812b Change usage to resemble the format of other descriptions and documents. 2017-05-14 14:34:17 +02:00
asofold
416a2d4ef3 Extend the capabilities of the 'ncp log stream ...' command.
* Allow specifying to remove color definitions (both Minecraft default
and with '&') and to replace color definitions that use '&'. Append
?color or ?nocolor after the level definition. (Shortcuts: c, col / nc,
noc, nocol, nocolor). Either of both can be set, not both.
* Log to multiple streams with individual levels and color flags by
separating stream definitions with '+'.
2017-05-14 14:07:30 +02:00
asofold
89ae23997d Fix CONCRETE_POWDER id. 2017-05-14 12:14:50 +02:00
asofold
8ea1d9e664 Detect Minecraft version with -pre suffix (MC 1.12-pre...). 2017-05-14 12:13:56 +02:00
asofold
9e763c2584 [BLIND] Add 1.12 blocks. 2017-05-14 12:07:49 +02:00
asofold
b5b6e782ed Add cmdc action - like cmd just with replacing color codes. 2017-05-13 20:45:21 +02:00
asofold
b0161dfac8 Don't use super.getMessage. Format/clarify. 2017-05-13 20:31:52 +02:00
asofold
620b5ea40b Add command: ncp log stream stream_id[@level] message....
Any registered stream id can be used (default streams are defined in
fr.neatmonster.nocheatplus.logging.Streams, in theory other plugins
might register their own ones).

Shortcuts are:
* ncp log stream notify message... (ingame notification, info level)
* ncp log stream debug message... (trace file, fine level)
* ncp log stream status message... (file + console, info level)
* ncp log stream init message... (file + console, info level)

Shortcuts do support setting the level, e.g. status@severe.

Due to string parsing these are not as efficient as hooking into the API
would be, naturally.
2017-05-13 13:22:50 +02:00
asofold
861ead1cac Set both NoFall and MC fall distance both on UNKNOWN teleport and ...
when appropriate.
2017-05-12 23:24:17 +02:00
asofold
076bf52e24 Fix undoing of cancelled set-back teleports. 2017-05-12 21:16:59 +02:00
asofold
9478daaa02 Prepare new block flags. Add comments.
To model differing behavior of fluids, i.e. half fall distance per
in-lava move vs. zero fall distance once in water, block flags will be
used. To really do this the NoFall check will be altered to account for
new flags. Once at it, the check should also treat from and to
independently of each other - there are some inconsistencies, such as
how oFallMaxY is set.

Further flags are reserved for MIN_HEIGHT..., indicating that
compatibility will be improved without compromising protection too much.
Thus instead of making a block entirely passable, you could set a
specific min height flag alongside ground_height (and possibly height
for max. height), in order to allow walking between level x and y but
not below (think of grass_path).
2017-05-12 21:11:41 +02:00
asofold
6347527c1c Set thisMove.flyCheck only when the/a check is run. 2017-05-09 23:30:25 +02:00
asofold
0c6cb6577d Use the lower eye height when gliding with elytra (selected checks).
* Block checks (interact/place/break): reach and direction.
* Random other places, like BlockProperties.getBreakingDuration.
2017-05-09 22:04:50 +02:00
asofold
344b032d49 Fix / "refine" elytra handling. Set all maxheight to 128.
* Lift-off side conditions.
* Force stop gliding for some side conditions, to avoid freezing.
* Set maxheight to 128 for elytra and levitation too (mods/plugins/etc)
- better refine checks to catch stuff.
* Fix special flags not getting set with initializing ModelFlying from
config.
* Debug log exceeding the maxheight setting.
* Mostly harmless: Add interfaces and access methods, including
convenience methods.
* Don't store methods in Bridge1_9.

Issues left, not limited to:
* Boost not recognized on occasion.
* Gliding state kept when submerged in water and moving normally like
when not gliding, e.g. ascending (head in water / fully submerged).
* Elytra lift off not accepted: Gliding state set near the water
surface, but survivalfly check runs. Might be fixed already, though.
2017-05-09 15:31:13 +02:00
asofold
9505c0747d Use another special flag for ascension while gliding. Do/fix locking. 2017-05-07 21:45:47 +02:00
asofold
87374fe396 [BREAKING] Change ModelFlying to a more flexible method of setup.
Breaks what used ModelFlying in any other way than setting up by config.

Use setters with chaining and a lock() method to lock against changes,
provide copy-constructor.
2017-05-07 21:31:22 +02:00
asofold
d306c32922 Adjust the vertical ascend speed for spectator mode. 2017-05-07 16:26:33 +02:00
asofold
7cd2303c45 Increase the default horizontal speed for spectator mode by 30. 2017-05-07 15:58:01 +02:00
asofold
c87e878311 [BLEEDING] Adjust to the lowered height when gliding with elytra.
This is incomplete, as some pre-checks are still done with the full
bounds (flying just under web will put you to sf). Efficiency-wise there
could also be a more light-weight adjustment.

Attack areas are left too, e.g. flying (with or without boost) to
underwater, then end gliding to effectively clip with the head into
/through the block above. 

With the lowered height it's also possible to get into odd spots, so
after stopping to glide you'll not be able to get out anymore.
2017-05-07 14:20:54 +02:00
asofold
c0b0a2fac3 Allow precise setting of all the height-related properties. 2017-05-07 14:16:43 +02:00
asofold
bff58b83db Reduce false positives with elytra: lift off and boost.
Missing (false positives):
* Bounding box, eye height.

Missing (cheating):
* Better abort conditions (e.g. inside water / lava).
* Friction inside water / lava.
2017-05-06 22:38:23 +02:00
asofold
8c6ebbaad8 Elytra before levitation. 2017-05-06 17:38:28 +02:00
asofold
bfaa71fa5b Use a common method for judging if gliding with elytra is valid. 2017-05-06 17:30:20 +02:00
asofold
c59b4ac11a Hot fix: allow minecraft fall damage in lava. 2017-05-06 15:15:39 +02:00
asofold
7c11fcda9c Comments / format. 2017-05-05 09:35:22 +02:00
asofold
2f66eab079 Reach doesn't need to use the flyingQueue. 2017-05-05 09:24:44 +02:00
asofold
b62f310717 Work around "server-side-only blocking after respawn". 2017-05-04 15:14:04 +02:00
asofold
6584398d21 Re-check with alternate axis order on collision.
This will not check all possibilities, if default=YXZ fails:
* X or Z collision: test YZX as alternative.
* Y collision: test XZY then ZXY as alternatives.

Would need to check client code, possible of multiple client versions,
considering widespread use of protocol support plugins.
2017-05-04 13:19:56 +02:00
asofold
b38cb4da99 Passable: Prepare fixes. Remove legacy code and options.
New
* Define a couple of default lists for axis order.
* Allow setting axis order via a list.

Removed
* Configuration option to disable ray-tracing.
* Configuration option 'blockchangeonly' - there may be an equivalent
later on, where checking accounts for the entire bounding box(es).
* Legacy code option (things have stabilized and axis order switching
should fix false positives).

Random
* Accidentally commit FastConsume (whitespace).
2017-05-04 13:17:36 +02:00
asofold
e5f6370705 Integrate current look into flying queue checking. Include invalidation. 2017-05-03 15:42:12 +02:00
asofold
54f9d42ca1 Use unified actions for block reach/direction checks, use constants. 2017-05-03 14:59:56 +02:00
asofold
b9a73ae801 Fix blockplace.against. Confine isInteractBlock by tick as well.
(+ Pass tick fetched in listener to other checks as well.)
2017-05-03 13:46:05 +02:00
asofold
e852fb03d2 Fix elytra model not being used when in creative mode.
Levitation will now apply when a player is in creative but not flying -
trial and error!
2017-05-03 11:44:25 +02:00
asofold
73f420527c [BREAKING] Unify block (interact/place/break) direction checks.
Might break configurations.
2017-05-03 00:40:37 +02:00
asofold
2cca81f39a CreativeFly: Test if the player is gliding with elytra not just wearing.
While i can't use the elytra while in creative mode, others might be
able to do so with a plugin.
2017-05-02 21:50:47 +02:00
asofold
bd370ba633 Skip redundant checks within BlockBreak and BlockPlace.
Reach and Direction are near-identical to the variants in BlockInteract
and will be
replaced by implementing an abstract class.
2017-05-02 21:10:18 +02:00
asofold
3ff207d487 Debug log relation with BlockInteract.
Currently typically blockbreak.direction will fail, if blockinteract
used a (the first) flying packet.

Other oddities: Block damage followed a cancelled interact event.
2017-05-02 14:29:17 +02:00
asofold
e5458465ac Attempt to patch up VehicleEnvelope (in-air, boat).
* Issues remain with "moved too quickly" interfering (TP loop with
waterfall/alternating, possible to escape).
* Not sure the previous modeling makes sense at all with allowing
friction now.
2017-05-02 13:41:24 +02:00
asofold
442634793c Keep track of moving event count. Re-introduce morepackets-set-back-age.
Configurable, default to 40 moving events for now. Later to be adjusted
~ e.g. with force-fall set-back policy.
2017-05-02 01:28:39 +02:00
asofold
90d6ab97c5 Change to individual methods to override event resolution. Shuffle. 2017-05-01 13:14:38 +02:00
asofold
c21f1075c9 Re-trigger against only if the last run failed.
This probably is too much of a special case (place without interact?),
might rather hit plugin features. Apart from that, consequently, other
checks should test for this too?
2017-05-01 13:01:57 +02:00
asofold
01b311bcd3 [BLEEDING] Typo.
[BLEEDING] just to note blockinteract changes may alter things.

Currently it looks like only blockplace.against is using the last move
of BlockInteractData - later other checks are intended to use that too,
in terms of a data source.
2017-05-01 12:54:01 +02:00
asofold
d8ab00dfb0 More details for last block. Consumed checks. Don't skip item use.
* Store complete event result state for interact.
* Store consumed checks as well.
* Still run the speed check, if only using the item in hand is allowed.
2017-05-01 02:03:00 +02:00
asofold
51d24d1a39 Add option to debug log command actions. 2017-04-30 20:20:42 +02:00
asofold
9f1f3d1525 Add a simplified logOnce method. 2017-04-30 20:14:05 +02:00
asofold
8bf207c112 Log to counters where look came from (current, first/other flying). 2017-04-29 15:19:42 +02:00
asofold
4ab4ebd331 Extend by convenience methods. 2017-04-29 15:18:38 +02:00
asofold
e6cc1bad05 Store passed checks with the last block. 2017-04-29 14:40:44 +02:00
asofold
9f3c10951d The last block is now private.
* Add methods for checking/testing vs. last block.
* TrigUtil.isSameBlock for a block.
* Reset last block on cancel.
2017-04-29 14:27:22 +02:00
asofold
e8c4c11bb2 Also activate with ProtocolSupport being present. Adjust message. 2017-04-29 12:19:40 +02:00
asofold
bdf5e7aa71 Extend functionality by adding conditions and allow set to AND/OR. 2017-04-29 12:19:08 +02:00
asofold
d670d8066c Add protocol support plugins, NTAC and PNCP to the related plugins.
Shouldn't have to ask back all the time...
2017-04-29 12:17:38 +02:00
asofold
4c3a9f6378 Suppressed a warning. 2017-04-29 11:54:08 +02:00
asofold
6d16bcea00 Prepare having more of the kind. 2017-04-29 11:22:46 +02:00
asofold
04d5253732 [BLIND] Add a patch for WATER_LILY activating with ViaVersion. 2017-04-29 10:55:15 +02:00
asofold
8cecf92eff [BREAKING] Move Activation to the registry.activation sub-package. 2017-04-29 10:29:46 +02:00
asofold
9d4b88d96a Convenience method added. 2017-04-29 10:24:36 +02:00
asofold
c7d72101c2 Make cancelling flying/waiting packets configurable. 2017-04-29 10:12:18 +02:00
asofold
de0cabd1b8 Set structure void block to instantly breakable and air-like. 2017-04-28 21:53:01 +02:00