Commit Graph

1349 Commits

Author SHA1 Message Date
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
asofold 5a901e0f66 Add logDebugS. 2017-04-28 21:46:52 +02:00
asofold 53f534b3c6 Split off logOnce to StaticLog. 2017-04-28 21:44:17 +02:00
asofold 180cf8a3c3 Let blockinteract.direction check queued packets. Unify loop (visible).
* Add a class to loop the flying queue with a block as target (look
only).
* Pass the flyingHandle to sub checks (doesn't necessarily make sense
with reach - should probably re-check reach with the used flying queue
state, but that's more complicated due to the possibility of split pos
vs. look).
* Use the loop class both for visible and direction (not reach).

Likely similar has to be done with BlockPlace and BlockBreak - would be
good to find a skipping heuristic for blockbreak.direction etc., so we
know we have successfully checked that block from that exact position
for this player and nothing has happened between (and so on, or a more
relaxed heuristic).
2017-04-28 19:03:10 +02:00
asofold 970ed6b126 Remove ominous count - all that remainded from the original was...
skipping redundant checking (limiting the number of visited packets
doesn't work - instead 'good candidated' for packet inversion with dig
packets should be stored together, so it's easy to just check vs. the
first/last stored one).
2017-04-28 17:20:24 +02:00
asofold 956c7ca803 Pass a handle for the flying queue to sub checks of blockinteract.
To be done:
* Use yaw and pitch of past packjets for Direction and Reach.
* If block break mathes the last interacted block (+ moving sequence
indicates no change), skip some checks like direction and reach there,
possibly keep track if those were run at all.
2017-04-28 00:27:36 +02:00
asofold 1655a90b2b [BLEEDING] Make use of the 'confirm teleport' packet. Cancel WAITING.
If the teleport confirm packet is available, flying packets with
AckResolution.WAITING will be cancelled.

This is real bleeding edge and might need other adjustments not to
freeze players for to be discovered edge cases. The TeleportQueue
already does contain a timeout mechanism and should return
AckResolution.IDLE after some time.
2017-04-27 12:53:47 +02:00
asofold 6ea30131ca Reduce (player) morepackets data on confirmed set back teleport.
Distantly related: Often an extra flying packet is sent to confirm a
teleport.
Here: Reduce effect of set-back loops with morepackets involved.
2017-04-27 10:34:41 +02:00
asofold 7d7a0bf010 Add method to pass thread-indicator via an extra argument. 2017-04-26 18:45:28 +02:00
asofold 1c8c3a8c3a Count all flying packets and PlayerMoveEventS, simplify.
* Count all events/packets regardless of settings.
* MovingListener: Remove pos/look counting for move events.
* MovingFlying: Call the counter method according to primaryThread flag.
2017-04-26 18:21:24 +02:00
asofold 9339ccc0ef Error log the interpreted packet types (simplified). 2017-04-26 14:27:22 +02:00
asofold 0969a5c939 Log packets cancelled by FlyingFrequency. Adjust comments/log messages. 2017-04-26 14:02:21 +02:00
asofold 792bed452c [BREAKING] Ignore set-back override, if cancel is not set.
Seems better, cancel actions can be set manually.
2017-04-26 10:49:26 +02:00
asofold 34e3548ec5 [BLEEDING] Allow to override the set-back via MovingData.setTeleported.
This way, you can calculate a more interesting set-back location from
within a hook during violation handling. All you need to do to adjust
the set-back location is to call MovingData.setTeleported(newSetBack)
and NoCheatPlus should recognize this as the location to set back to.

Please do:
* Test if the check in question would set back at all
(IViolationData.wilCancel() returns true).

Please in such a case do not:
* Don't call setTeleported if IViolationData.willCancel() returns false
:).
* Cancel violation processing.
* Teleport the player.
* Do something complicated with MovingData otherwise :).
2017-04-25 23:58:48 +02:00
asofold 8fc9b1df91 [BREAKING] Change boolean mightBeMultipleMoves to int multiMoveCount.
Especially developers adding set-back alterations should have a look:
https://gist.github.com/asofold/b05c0a17c605e7c69bb30ee5e79a6e7b
2017-04-25 22:25:47 +02:00
asofold fe233d82ea Reorder the remainders of the previous draft. Keep an item array.
Store an extra array of items internally and allow fast fetching (for
fastest processing, where necessary). The sortedItemNodes array is kept
for future purpose.
2017-04-25 10:31:42 +02:00
asofold 2d25265588 Use an array for the output internally. 2017-04-25 09:51:48 +02:00
asofold 730d09aa78 [BLIND] Extend API further.
Despite having an interface yet, add things like unregister many objects
(items) and getting all registered items, e.g. for dealing with
sub-registries efficiently (at first code-wise).
2017-04-25 00:36:57 +02:00
asofold 2b51dfa8b8 [BLIND] Fixes for unregister + extend API.
Fix: Wrong object used for get, such.
Add: More convenience methods to remove items and types completely, clear, isRegistered variants.
2017-04-25 00:11:32 +02:00
asofold 190309e5f3 Add an auxiliary class, to delegate IRegisterWithOrder setup to. 2017-04-24 23:21:53 +02:00
asofold 6ce8e62e7e Support SetupOrder still (to be deprecated). 2017-04-24 20:16:49 +02:00
asofold f82d387a88 Don't create order twice. 2017-04-24 20:12:16 +02:00
asofold d2ed656409 Revert last minute change. 2017-04-24 20:09:25 +02:00
asofold be877c7e9b [BLIND] Sketch a registry helper for storing sorted lists by type.
Store items in lists by type, sort by RegistrationOrder either lazily on
fetch or upon request. Allow registering an item multiple times, but
only once per type.

Tests, adaption of signatures, additions and variants should follow.
2017-04-24 19:40:22 +02:00
asofold d0c42ab061 [BLEEDING] Prepare internal registry lists overhaul to support sorting.
* Add RegistrationOrder for order.
* Add sorting functionality with some tests. (See
RegistrationOrder.AbstractRegisTrationOrderSort.)
* (Except for test cases, all this is not yet in use.)

(Perhaps the sorting should be changed to use an array for output
instead of iterators, this just represents a quick way in.)

Further direction:
* Replace all the registry lists like for INotifyReload and
IDisableListener and so on within registries by a generic storage that
uses this for sorting. This way every such thing will support both
priority-based and tag-based order at the same time.
* To support different order definitions depending on what type an
interface like IRegisterWithOrder might be supported by a registry.
* Later generic event listeners might also use this, simply.
2017-04-24 18:58:36 +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 2ff5415601 Have a RegistryException super class. 2017-04-21 18:45:53 +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 563ce080c6 [BLEEDING] Make improbable check configurable for inventory.instantbow.
feedonly: allow to only feed, instead of check
weight: allow to alter the weight and disable altering improbable (0.0).
2017-04-18 19:21:22 +02:00
asofold ca2d2398e4 [BLEEDING] Model (noob) tower with lost-ground only.
* lostGroundAscend: new condition.
* lostGroundStill: some precondition checks moved inside, new condition.
* vdistrel: Extra case with decreased lift-off gain, but second move as
if normal lift off.
* With from being on ground, and last move not having touched ground,
setSetBack(from).
2017-04-18 18:13:46 +02:00
asofold 6a4c75460a enoughFrictionEnvelope: Compare with the absolute change of distance. 2017-04-18 16:14:53 +02:00
asofold a5b0bd0fae Account for null blocks in PlayerInteractEvent handling.
Before elytra boost these events had been ignored for most, now instead
of an early return, just the checks/logging using the block are skipped.
2017-04-15 17:04:37 +02:00
asofold 0262ac4ccd Fix .silent permissions set up wrongly.
* The construction routine for ActionListS is to by passed the silent
permission already, so getting optimized copies will not add another
'.silent' to the already passed permission. (Correct me if i am
mistaken). 
* Clarified javadocs/names.
* Further null permissions are handled, even if not (yet) necessary.

Still to be called with the ordinary check bypass permission:
* ConfigFileWithActions: The convenience methods to obtain
(Optimized)ActionListS from the
configuration.
* AbstractActionFactory.createNewActionList: will then create actual
lists, extending the permission by '.silent', unless the permission is
null.

(Stumbled onto, while looking for optimization potential with log action
execution.)
2017-04-14 20:45:36 +02:00
asofold f262a831b0 Support setting values for any ParameterName key explicitly.
Previously the "dynamically" evaluated result would always have been
used, even if a value had been set explicitly before execution of
actions.
2017-04-14 19:56:38 +02:00
asofold 23f9ac5689 [BREAKING] Enable more precise sub check data removal (see details).
[BREAKING]
* Due to adding a method to CheckDataFactory.
* Might alter data removal (less is removed, might've overlooked
something).

For MOVING, FIGHT, COMBINED, data removal for sub checks now is
possible, allowing for more precise resetting via commands. Other check
groups may follow on request / randomly.

Data removal for check data is logged now (only CheckData, not
IRemoveData in general), in case the debug flag is set in the data.

Later, a more flexible method may get implemented, accepting a String
id, so not only check type related data, but also any type of special
data can be removed (e.g. moving.locationtrace would not be a check
type, but allow resetting the location trace of a player).
2017-04-14 15:48:03 +02:00
asofold f5d2cbc880 Add COMBINED_YAWRATE (allows exemption, later: remove data precisely).
No bypass permission is set. The yawrate part depends on multiple other
checks. Checking for exemption is a hack within feedYawRate, fastest way
to implement.
2017-04-14 14:14:16 +02:00
asofold 32589987c9 Spaces + some formatting. 2017-04-14 14:02:34 +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 c53d3f1521 Fix NullpointerException. 2017-04-13 11:02:32 +02:00
asofold eb5db36dfd Fix survivalfly and creativefly actions.
Could bugs possibly fit in between?
2017-04-12 21:13:52 +02:00
asofold 83887a7836 Remove the prehistoric global build number reference.
Switch all to per-path build number references.
2017-04-12 21:10:42 +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 4b9e7c9fe3 Extend PlayerSetBackMethod (allow to skip risk, specify default ids).
A NO_RISK flag has been added, to allow skipping workarounds such as
packet level ack for skipping a set-back teleport. This remains
so-and-so, because in this case the set-back still would stay 'to be
done' and moves setting off from elsewhere would get cancelled, leading
to re-scheduling it, still:
* There could remain potential with micro moves, intentionally getting
set back.
* There remains an uncertainty with the telported logic initially not
having been made for a set-back location getting kept 'to be done' over
multiple server side ticks potentially.
* Having the ability to turn off this rare (?) case, allows faster
reaction, if issues should arise.

The default settings can be referenced by their ids:
* default.legacy for pre-1.9.
* default.cautious for not taking risks (such as packet level workaround
disabled, otherwise it's currently post-1.9 handling, working but not
optimal on pre-1.9).
* default.modern for the latest thing (currently post-1.9).

The defaults have been adjusted, according to so far experience:
* default.cautious contains flags SCHEDULE and NO_RISK now.
* default.modern is the default now, and contains SCHEDULE (but not
NO_RISK). This is used if nothing is specified in the configuration.
2017-04-12 12:51:09 +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 4b5cca3fe4 Reduce calls to Bukkit.isPrimaryThread(). Provide optimized methods.
Where it's known that it's the primary thread, that test should be
omitted.

A remaining problem is the Check class, where the convenience methods
all will lead to testing for Bukkit.isPrimaryThread(). This needs to be
done differently.

It'll be hard/impossible to work around, if we have to check permissions
and meta data. For permissions we could do some kind of bulk/context
dependent caching and updating policy and check via PlayerData, but meta
data needs the Bukkit API to state thread safety. Future design could
also do without knowledge of the thread, if permissions are cached and
exemption by meta data is turned off (or also cached, but this only
works if other plugins don't use it for temporary exemption), a lazy
approach could pass on an AlmostBoolean isPrimaryThread.

For now, at least some of the frequently run moving checks use the
optimized approach.
2017-04-11 12:07:12 +02:00
asofold def24ac1f1 Headers missed. 2017-04-11 00:06:35 +02:00
asofold b41c267b15 Random. 2017-04-10 23:03:57 +02:00
asofold b11ae340b5 Fix wrong precondition for handling cancelled moves.
Mostly affected moves cancelled by other plugins.
2017-04-10 18:10:35 +02:00
asofold 73a62a1e13 Add DualCollection, for future use. 2017-04-10 14:19:11 +02:00
asofold f221086729 Distinguish method by Minecraft version. Skip packet level pre-1.9. 2017-04-08 23:54:53 +02:00
asofold 5be2f45ba7 [BLEEDING] Switch to HashMapLOW for PlayerData storage. Fix removal.
* HashMapLOW for thread-safe access to PlayerData instances.
* PlayerData removal now used the UUID. More changes pending for storing
the UUID for reference rather.
* Use bulk removal for expiration of entries (one time lock).
2017-04-08 17:55:34 +02:00
asofold 2f59297621 Do data.resetTeleported(), if the player is there on tick.
Can't do much better than being there already. Thinkable trouble could
be with high latency and multiple teleports to different locations in
quick succession, so that cancelling the teleport will lead to the
player violating survivalfly again in the future, which means longer
freezing/rubberbanding than if we teleport now. However, current
assumption is, that it's better not to keep teleporting players around.
2017-04-08 15:50:56 +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 bf6c3ff753 Comment on a possible step forward. 2017-04-08 02:05:54 +02:00
asofold 19e5e6f154 Remove deprecated method: clear(CheckType) 2017-04-08 00:49:00 +02:00
asofold 4f1573c83d Better name for onLeave, INotifyConfig extends INotifyReload. 2017-04-08 00:36:25 +02:00
asofold 87621f7d28 Old arrows. 2017-04-07 22:21:26 +02:00
asofold 1b79889dd4 Fix pre-horse. 2017-04-07 22:17:59 +02:00
asofold 464e374c10 Add capability to mostly ignore certain vehicle types (default: arrows).
Configuration setting is hidden for now.
2017-04-07 22:11:21 +02:00
asofold 718f991832 More skipping conditions for "set back on tick".
* The player is at the coordinates.
* The last received ACK for an outgoing teleport has been received on
packet level. This is experimental, to be confirmed to a) do something
b) not allow abuse.
2017-04-07 16:37:38 +02:00
asofold d06e658c7a Demand the minimally needed type for isSamePos variants. 2017-04-07 16:23:00 +02:00
asofold ae80e20457 Make set back method configurable.
We do need to fix behavior to move on, so the intention rather is to
react more flexibly towards debugging results, rather than having people
use random configurations early on. Still this does allow for fall-back
configuration, e.g. for live servers.

NOTES:
* Later we will make the configuration set at 'default' adjust to server
mod and version.
* Overriding checks.moving.setback.method with SET_TO can lead to
PlayerTeleportEvents with TeleportCause.PLUGIN on newer versions of
Spigot, which may conflict with other plugins assuming feature-based
teleportation (possibly resulting in /back locations getting overridden
wrongly). For legacy setups this will be similar to restoring the state
of build 1066 for most.

There could still be places where distinction of the used method is
necessary, which would mean bugs.
2017-04-07 15:56:43 +02:00
asofold c1b12c3fb8 Clarify INeedConfig. 2017-04-07 14:59:57 +02:00
asofold 4e2ab0164e Towards configurable set back behavior.
* Don't unset teleported, if event.getTo is the same position as the
teleported (set back) location.
* Prepare (with) comments.

(Main driver is to be able to adjust quickly without shifting code
to-fro legacy etc., while dealing with much differing side conditions
for server mod + version, client versions with multi protocol support,
and other like bungee or not bungee.)
2017-04-07 14:45:32 +02:00
asofold b9aab8513a Hint at something extensible for how to set back technically.
Versions, mods, ...
2017-04-07 13:27:12 +02:00
asofold ef1d811a4b Set back preparation + confirmation: slight cleanup
* MovingListener.prepareSetBack makes more sense than the previous
ambiguous naming.
* On confirming a set back, don't update the setBack field, only set if
null.

The aim is to have a more consistent handling and naming for set back
stages.
2017-04-07 12:49:23 +02:00
asofold d88b36d4bc Treat a position (coordinates) match as confirmation of a set back.
More light weight, more lenient (not sure if relevant).
2017-04-07 12:31:32 +02:00
asofold a5bbd54925 Format javadocs: 2017-04-06 22:38:28 +02:00
asofold fb056d8e43 Have isLocked be static.
Until it's remade to be all instance...
2017-04-06 20:47:24 +02:00
asofold aa445edc36 Attempt a hybrid approach for set back handling.
Both schedule a set back and update PlayerMoveEvent.getFrom() with the
set back location coordinates. This way, either the next incoming move
or a teleport event can confirm the set back location.
2017-04-06 19:31:21 +02:00
asofold 6e41730135 [BLEEDING] Quick overhaul for handling scheduled set backs.
When a set back is scheduled:
* Cancel other teleports early. (x)
* Prevent Portal use. (x)
* Vehicle enter (not on vehicle set back). (x)
* Prevent attacking.
* Interact block. (x)
* Break block.
* Damage block. (x)
* Launch projectile.
* Place Block.
* Interact entity.
* Open inventory. (x)

The list is incomplete and adding/removing items remains subject to
discussion, having differing impact/severity for different actions. As
long as setting back rolls back to last ground, it might be better to
prevent some type of actions. Not all cancelling is logged.

(x) Probably most important for consistency, avoiding some types of
potential abuse.

A common framework
for "prevent types of action" during whatever-handling also is something
to consider.

Optimizations: 
* Move handling some rare cases to methods (MovingListener,
PlayerTeleportEvent handling).
2017-04-05 14:31:31 +02:00
asofold ed6db25338 Comment: More abstraction feasible for loop checks? 2017-04-05 12:43:05 +02:00
asofold ba4001a0b5 Fix NPE with legacy vehicle API. Use a stored list for null passenger. 2017-04-03 12:16:54 +02:00
asofold 1ac29ee052 [BLEEDING] Try to update passive player passengers data in a useful way.
When the captain leaves the boat, the vehicle data of a passive player
passenger may be set now, so it won't set them back to where they
entered the vehicle.

Likely other places still need adjusting.
2017-04-03 01:15:32 +02:00
asofold 29e05fe09b Left over set back teleport cause. 2017-04-03 00:34:01 +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 6a7d56c5ac IEntityAccessVehicle.addPassenger, reduce warnings.
Supposedly just making use of altered internal+external API. No
substantial change.
2017-04-02 20:47:24 +02:00
asofold 386d484939 Change TeleportUtil.teleport to PassengerUtil.teleportWithPassengers.
* Removes TeleportUtil.
* Hasn't implemented handling multiple passengers, yet.
2017-04-02 20:24:34 +02:00
asofold 5e751e492b Make PassengerUtil non static.
Some more handling of multiple passengers, incomplete.
2017-04-02 20:05:59 +02:00
asofold 30c3a40622 Towards vehicles with multiple passengers. 2017-04-02 18:55:32 +02:00
asofold f7a11bbc95 Comments: Attribute.GENERIC_MAX_HEALTH / IGenericInstanceHandle. 2017-04-02 17:49:53 +02:00
asofold 0491fa7805 Use getWidth and getHeight for Bukkit entities, once available.
* Simplify MC version string.
2017-04-02 17:23:17 +02:00
asofold c017d00866 Don't run legacy sweep attack detection, if the DamageCause exists. 2017-04-02 16:43:01 +02:00
asofold 4d84a9f512 Use MovingData.debug here. 2017-04-02 15:08:27 +02:00
asofold c5e1f6ba2b [BLEEDING][BREAKING] Player move set back: cancel event + schedule TP.
Because Spigot changed to fire the teleport following an altered move
end point with TeleportCause.PLUGIN, we have to alter set back handling,
so we can ensure to keep TeleportCause.UNKNOWN for setting back players.

Instead of altering the move end point, the event is just cancelled, and
a teleport is scheduled (with a dedicated TickTask method). Uncancelled
moving events mean removing scheduled teleports.

[BLEEDING]
* Comparably simple change - more places and special cases may still be
uncovered.

[BREAKING]
* Plugins that may rely on the exact sequence of things within NCP, as
it used to be.

Random
* Change "set-back" to "set back" everywhere for simplicity, and to
obfuscate the actual code changes.
* Set backs are now going through MovingListener.onCancelledMove instead
of MovingListener.onMoveMonitorNotCancelled.
* Illegal move handling would still use event.setTo.
2017-04-02 15:01:23 +02:00
asofold 8b3dcff7c4 Simplify onTick, let JIT decide. 2017-04-01 18:52:09 +02:00
asofold d324fc02fd Log details in flylong, and always for file+console.
* Split log messages: ingame vs. console+file
* Alter flylong to contain tags.

Performance-wise, it's not optimal that flylong is the same as flyfile
at this stage. Not sure if to remove flylong in favor of using flyfile,
to indicate it means details - main objective is to get minimal details
into the violation log, even if people edit it out of the ingame chat
messages.
2017-04-01 16:10:11 +02:00
asofold 6aeef95fb7 [BREAKING] Don't use TelelportCause.PLUGIN to avoid confusion (p+v).
Players and vehicles:
Instead always use UNKNOWN, as that is what results from
PlayerMoveEvent.setTo(newTo), as we use it for setting back players.

This should break functionality that relies on TeleportCause.PLUGIN
being used, possibly more likely with vehicles.
2017-04-01 14:29:57 +02:00
asofold e3d5b70db8 Order.
(See if hooks work now.)
2017-02-22 23:16:38 +01:00
asofold c046658c86 Allow the elytra model for creative mode, when not flying. 2017-02-22 22:51:04 +01:00
asofold 7ee946c899 [BLIND] Slowness hack for walkSpeed and attributes.
And:
* Move default walkSpeed/dlySpeed constants to Magic.
2017-02-21 19:26:46 +01:00
asofold 0ae9e962ab Add a method to remove all block change entries for certain coordinates. 2017-02-07 22:30:31 +01:00
asofold 514945f936 Cap additum for hacc at 10. 2017-02-05 12:54:25 +01:00
asofold 6f1b97c932 Add a simplified method to add custom (fake) block changes.
Internally, the tick is stored with a change id, so we can reuse a
changeId, if the tick is still the same, preserving rough order, as the
changeId should at least increase with the tick.
2017-02-03 23:49:26 +01:00
asofold 6f51fc531b isRedundant: Do check for null before calling equals.
(So far intended use always has an IBlockCacheInstance set.)
2017-02-03 22:58:47 +01:00
asofold e129b58a6f Expire entries based on interval of validity, if set.
If a position has many entries, the oldest valid state deserves being
accounted for.
2017-02-03 22:07:29 +01:00
asofold 4cc747d8f4 Provide a public method to add custom/fake block change entries.
This isn't the last word on a public API, there likely will be the
following additions.
* One more simplified method with a minimal signature for simple
(non-push) entries (worldId, x, y, z, previousState).
* Optimized methods for adding multiple entries at once. Likely for
adding multiple entries of the same type/data/shape. Plus perhaps
simplified signatures to do without changeId and tick.

(Not sure if there will be need for a method allowing for a collection
of a to be defined class combining x+y+z+previousState.)

This will evolve based on feedback from GitHub issues.
2017-02-03 21:36:41 +01:00
asofold a4596ede1a Don't skip processing if blocks are there (...). 2017-02-01 17:53:23 +01:00
asofold 72b454bbab [BLEEDING] Elytra boost: Who tested the other version!? 2017-01-29 19:20:47 +01:00
asofold c2449ac08a [BLEEDING] Elytra boost: track and allow ascend.
Lots of issues remain with elytra, with and without boost. Selection:
* maxheight will trigger with the rocket feature, naturally. Mendable by
increasing it via configuration
(checks.moving.creativelfly.model.elytra.vertical.maxheight). Not sure
we'll just increase the limit or alter how it's dealt with (e.g. also
for sf: lock to a max / high slope value, independently of the set-back
and world height, alter as necessary).
* All sorts of transitions, e.g. onto ground, into water.
* Loss of boost right after adding (not sure if already fixed).
* What with hover, actually?
* Is the flight duration infinite with power 127?
* Issues with ascending after descending, even without boost?
2017-01-29 19:00:52 +01:00
asofold 8237fbca57 Fix NoFall issues on Spigot/MC 1.7.10.
Changes contain:
* MCAccess.dealFallDamageFiresAnEvent -> true
* Always log basic data on (handled) fall damage events.
* Add a tag for the cancel reason with NoFall. Alter the default alert
message.
* Move 3.0 to Magic.
* Set the skipping flag correctly on allowFlight being set.
2017-01-22 23:36:55 +01:00
asofold 5b0807847f Don't give silent permissions as child permissions by default. 2017-01-17 01:03:55 +01:00
asofold 272aaf3063 Don't test block change activity before the extreme move check runs.
(+ only test activity, if the extreme move check was passed.)
2017-01-08 16:17:21 +01:00
asofold 6bcaef9057 Disambiguate + fix redundant method call. 2017-01-08 16:08:21 +01:00
asofold f560e756f5 isSameShape: with early return on either parameter being null. 2016-12-30 19:16:24 +01:00
asofold cf04ee5a5d Track the current world name in ChatData for now. 2016-12-29 14:43:10 +01:00
asofold b6ae8049b7 [BLEEDING] Ignore Minecraft fall distance if it's greater than tracked.
Fall damage is adjusted or cancelled, if the Minecraft fall distance is
greater than the distance(s) tracked by NCP (per move diffs, maximum y).
Intention is to prevent (speeding by) self damage by abusing Minecraft
dealing fall for untracked moves.
Issue: https://github.com/NoCheatPlus/Issues/issues/338
2016-12-29 00:19:55 +01:00
asofold d85ee35d99 8465c40d93 (commitcomment-20312231) 2016-12-28 21:52:15 +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 1ba300f3af [BREAKING] Move matchBlockFace to MapUtil.
(Likely no one is using this by now.)
2016-12-27 15:33:36 +01:00
asofold b406204ce2 [BREAKING] Move isBadCoordinate to LocUtil. 2016-12-27 15:30:51 +01:00
asofold 68eec44f14 [BREAKING] Move LocUtil to utilities.location 2016-12-27 15:28:36 +01:00
asofold d69dc0b44d [BLEEDING] Double trouble potential: NaN, infinity.
+ random Formatting + random fix (same angle checked twice in TrigUtil).
2016-12-27 15:26:26 +01:00
asofold 17db0bdcfe Comment: More work needed towards null world compatibility. 2016-12-27 15:04:28 +01:00
asofold 9d01191bcd cleanup: null checks. 2016-12-19 07:42:50 +01:00
asofold dcfdec79e2 Intercept UnsupportedOperationException in getWorldConfig.
TemporaryPlayer issue: https://github.com/NoCheatPlus/Issues/issues/335
2016-12-19 00:11:22 +01:00
asofold 0ea8d379d0 Fix magic not used correctly. Indicate stuff. 2016-12-18 15:11:04 +01:00
asofold 1c024c072c [BLEEDING] First version of horizontal push.
New issue:
* Horizontal push can lead to vdistrel violations with yDistance = 1,
even with air blocks next to the foot position.
2016-12-18 00:33:13 +01:00
asofold 7646476993 Fix nested vehicle check on vehicle enter. 2016-12-17 19:44:40 +01:00
asofold c9a744a7d3 [BLEEDING][BREAKING] Next step on past bounce with pistons.
Steps done:
* Add more velocity with less preconditions.
* Handle push with the player being just above the block where a slime
block is pushed to.
* Exception for vdistrel.
* Breaking:Move verVelUsed from MovingData to PlayerMoveData.

Gameplay issues remaining:
* Still too often fall damage is dealt.
* Friction envelope gets hidden with past-ground being set too often
(vdistsb).
* Potential for more edge cases.

Missing abuse prevention:
* Reinstate invalidation of past entries (currently turned off to
progress at all, will need another iteration).
* More confined preconditions.
* More/better invalidation conditions for velocity set for bounce
effects.
2016-12-17 15:39:54 +01:00
asofold cf3ea4a1e2 [BLEEDING] One more step on slimes with pistons.
* Less fall damage.
* Flag all velocity added due to slime bouncing appropriately.
* Experimental concept for splitting up velocity, likely to be altered /
removed.
* Add a flag for (faked) pvp velocity.

NOTE: Invalidation of past entries has been deactivated to progress on detecting the stupid past bouncing at all. This will need another iteration.
2016-12-17 15:02:26 +01:00
asofold 6d28354f11 [BLEEDING] Consider an NPE fixed.
(Assume this doesn't result in an endless loop.)
2016-12-12 20:30:42 +01:00
asofold 6de231ac54 [BLEEDING][BREAKING] Shift entry points for past state bounce.
Lots of issues remain, but vertical push/bounce with pistons is much
improved. Still there are show stoppers (false positives remain, as well
as occasional fall damage).

Use same/similar entry points, like static/classic bounce checking in
MovingListener. SurvivalFly still keeps one exception with the
after-failure Y_POS block move check.

Also check: https://github.com/NoCheatPlus/Issues/issues/5
2016-12-10 21:49:57 +01:00
asofold 9dca93e650 Don't add bluntly redundant block change entries.
Match vs. the last entry of existing entries for those coordinates.
Seems to be better with piston retract events.
2016-12-07 22:18:53 +01:00
asofold 9a6a370f1d [BLEEDING] Adjustments + more slime+piston support (incomplete).
There are typical cases to cover:
* Extra falling height.
* Fall damage where a slime block had been.

Thus adding a specialized method for bounce (just foot position) instead
of using the full bounds would be better, preferably just check within
the MovingListener (set bounce / adjust velocity there).
2016-12-07 22:10:04 +01:00
asofold 06c2cadf7f Add skipping conditions for redstone current change. 2016-12-07 21:18:29 +01:00
asofold ef9492b0bc Use the activation flag(s). Comments. 2016-12-07 10:12:52 +01:00
asofold 5afcfdea96 Add access methods for getting a BlockChangeEntry matching flags.
(Slime blocks ahead, somehow.)
2016-12-07 00:34:40 +01:00
asofold 0cd07d2f2a COmments- 2016-12-06 15:21:33 +01:00
asofold 602abfe55b Fix margin not being used for hasActivity. Distinguish shuffle.
(+ Set useBlockChangeTracker before testing for bounce.)
2016-12-06 14:26:21 +01:00
asofold 068a523833 [BLEEDING] Cover blocks changed by entities for a change. 2016-12-06 14:11:17 +01:00
asofold e6673de09e [BLEEDING] Sketch one approach for on-ground with past states.
Still incomplete, could contain bugs (endless loops, perhaps).
Invalidation
mechanics may need to be refined.

Not covered:
* Exemption for moves resulting from horizontal push/pull.

*
2016-12-06 13:28:37 +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 da01ac1a48 Not AVR. 2016-12-01 13:09:17 +01:00
asofold cc52581437 Missing check for null. 2016-11-30 12:42:05 +01:00
asofold f5396e5d91 Split off lazy expiration from getBlockChangeEntry. 2016-11-30 11:32:48 +01:00
asofold 8e3c4d3b8c Tick should be int for now. 2016-11-30 11:13:22 +01:00
asofold 4e58ff980c Random/ alter on-ground logic (might fix fences+some abuse).
* In case of non-full bounds + variable, allow ground to be found
underneath. Can concern fences (tested on 1.11).
* There has been a probably misplaced/leftover check assuming the block
above to be passable, without checking for it (iMaxY). Since the
access.getMaxBlockY() has already been checked, this part appears to be
not of use, thus iMaxY has been removed from the signature together with
this exception.

If this causes something, please provide debug logs / circumstances :).
2016-11-30 00:35:08 +01:00
asofold 3a6c0a4945 Add block changes via redstone events for door/gate like blocks.
This is unfinished, but gives an outlook on what we may be able to do
with this.
* Double doors are not covered (upper/lower half are).
* Interaction with levers / directly with doors is not covered.
* Only doors + gates (not sure what else there is).
* More fine grained configurability is missing (+ only register
listeners if needed).
* Possibly other things.

Tracking BlockRedstone seems to be more promising than BlockPhysics, as
long as we don't have to inspect neighbour blocks to check for door like
blocks at all.
2016-11-29 15:18:45 +01:00
asofold 26b4c7a376 Prepare adding block changes without direction. 2016-11-29 14:01:57 +01:00
asofold 65777e0e32 Debug log the timing window for the BlockChangeTracker, Adjust comments.
Currently the oldest available entries are used, as if the player had
the maximum allowed latency always. Later on, at least attempting to hit
a global latency estimate (+window) should be attempted.

We'll still have a (moderate) fast-forward implementation to see what
opportunistic checking can do on live servers (elevators, doors etc.).
2016-11-29 13:20:38 +01:00
asofold 00b4dc5545 Format, adapt getCorrectedBounds to use a node. 2016-11-28 23:14:40 +01:00
asofold 380ed8a185 Log resetting of fastconsume data for the obvious spots. 2016-11-28 22:24:51 +01:00
asofold e926f34963 [BLEEDING][BREAKING] Rework internals to use IBlockCacheNode (rough).
Intention is to work towards passing stored IBlockCacheNode instances to
methods in BlockProperties, i.e. to have
isOnGroundInAnOverlyOpportunisticWay implemented.

If you need one of the old BlockProperties signatures (or a more
simplified one), just open a GitHub issue.

This is a slightly peculiar change.
* Passing node and nodeAbove is a little bit odd, despite seemingly
efficient at present.
* Later we might need a BlockCache instance that busies about past
states (currently too complicated to implement).
* Uncertain impact (could perform better, could perform worse).
* Possibly left out a couple of places.
* Might have introduced bugs (fast forward).

On the other hand there may be a lot of other types of changes, if we
ever go for a less opportunistic implementation, which can not be
estimated simply, so this may be about the best that can be done, to get
a quick step in.
2016-11-28 14:30:57 +01:00
asofold 21505cf4fa Use the appropriate variable here.
Wondering about Double.MAX_VALUE...
2016-11-28 10:14:17 +01:00
asofold c80ca6c8a6 Split off the per-block logic in isOnGround.
Already have the signature use IBlockCacheNode for node+nodeAbove, like
it will be done with other methods like collidesBlock.

This will allow calling this with past block states, once other methods
have been adapted as well.
2016-11-28 00:07:43 +01:00
asofold 511bcfd4ad More useful method naming and behavior for getting IBlockCacheNodeS. 2016-11-28 00:04:30 +01:00
asofold 4fdca46ccb Cap the message letter count (128 length), to allow 1.11 messages. 2016-11-27 12:14:46 +01:00
asofold a97ae0171c It's vertical here. 2016-11-26 23:42:18 +01:00
asofold baf09380f7 Check activity before using the BlockChangeTracker. 2016-11-26 22:57:28 +01:00
asofold d96abe9a3e Keep track of cuboids of block change activity (resolution of 32). 2016-11-26 22:38:00 +01:00
asofold c26c3cb0c6 Maintain a validity interval (ticks) of an entry in an efficient way. 2016-11-26 15:55:50 +01:00
asofold 371afd91d0 Need to call updateFinal within MovingListener.
Necessary with multiple checks updating the BlockChangeReference/span.
2016-11-26 14:41:22 +01:00
asofold 5939e1e206 Add per-path build numbers. Activate BlockChangeTRacker by default. 2016-11-26 14:16:08 +01:00
asofold 206d627e9b Skip the legacy bull shit.
(Let's hope this doesn't enable anything unwaynted :p.)
2016-11-25 23:08:49 +01:00
asofold dec6ef1412 Opportunistic passable checking. 2016-11-25 23:06:06 +01:00
asofold 93b71bb316 Clarify. 2016-11-25 21:29:47 +01:00
asofold 9abe1ae3d2 Move + rename updateBlockChangeRef. 2016-11-25 21:18:20 +01:00
asofold 30979935ce Ensure not to update with an older block change entry. +comments. 2016-11-25 21:08:01 +01:00
asofold c477f1af72 More neutral naming (rather blockMove than push). 2016-11-25 19:11:47 +01:00
asofold 574390f90d Add 1.11 blocks. Add/alter comments. 2016-11-25 11:32:26 +01:00