Commit Graph

2801 Commits

Author SHA1 Message Date
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
22072a2175 SetExemptionSettings has to be a static method. 2016-05-29 13:09:45 +02:00
asofold
fb687970f7 Scrolling to the right. 2016-05-29 12:36:42 +02:00
asofold
347d4d3795 ExemptionSettings: meta data and npcs (no config yet).
Wild card exempt NPCs by default, encapsulate meta data checks here (if
exempted, if is NPC).

With these default settings Citizens NPCs should be exempted by default,
also all custom Player implementations that extend the Bukkit interface
NPC (not sure if such still exists).

Follow ups:
* Configurability.
* Exemption tickets to prevent others overriding your exemptions
(later).
2016-05-29 12:30:30 +02:00
asofold
a161609f14 Ensure we're not the idiots, this time. 2016-05-29 11:25:11 +02:00
asofold
51893791d6 Account for off-hand item in FightListener.
Affects:
* Assumptions about knock back.
* Illegal items check (despite probably obsolete/outdated).
2016-05-27 14:22:45 +02:00
asofold
8cb046a1b3 Cover higher levels of the levitation effect.
Hard-coded-ish.
2016-05-26 12:57:28 +02:00
asofold
ba91842122 Fix dealing damage if getAllowFlight returns true. Keep configurable.
Kept configurable to enable increasing difficulty for fly plugins use,
e.g. to allow players to fly within certain regions, but still deal fall
damage on falling.
2016-05-25 18:55:45 +02:00
asofold
0c6617d636 Player moving: Debug log for states of allowFlight, flying and gliding. 2016-05-25 14:21:53 +02:00
asofold
ec193117ce Debug log view and bottom/top inventory on inventory click. 2016-05-24 17:45:39 +02:00
asofold
f009a14fab Clarify function of this method. 2016-05-23 09:24:33 +02:00
asofold
696b0509c1 Fix npe. 2016-05-22 22:29:27 +02:00
asofold
0d0b42d247 Add hidden configuration for horizontal speed cap for vehicles.
Section at: checks.moving.vehicle.envelope.hdistcap
Default is 4 (extreme move fall-back) at 'default'.
Other entries by bukkit entity type name, if desired.

This allows forcing set backs for testing in a convenient way, e.g. with
setting the value to 0.3 for boat/default.
2016-05-22 21:03:44 +02:00
asofold
a575a9bc05 Review vehicle position resetting.
Main objective was to not reset the set-backs on setting back a vehicle
with a player, plus data resetting cleanup.

Specific changes:
* Prefer an existing set-back, in case the default one has been
invalidated.
* Do not cancel a vehicle set back task, in case no set-back is present.
* Avoid multiple resetting and redundant calls for resetting positions.
* Ensure the location set back to is set as a set-back location after
set back.
* Skip changing vehicle data with player moving resetting (e.g. player
teleport, player morepackets disabled).

Review and possibly correct/alter use of:
* MovingData.vehicleMoves.invalidate
* MovingData.vehicleSetBacks
* MovingData.clearMostMovingData
* AuxMoving.resetXYPositions
* MovingData.clearVehicleData
* MovingData.clearVehicleMorePacketsData
* MovingData.clearAllMorePacketsData
* MovingData|AuxMoving.resetVehiclePositions
2016-05-22 20:10:32 +02:00
asofold
dfb65b23fb Distinguish original vs. final damage for ENTITY_ATTACK check.
This doesn't really change anything, except that it may be performing
slightly better and that it'll log both values if differing on
debugging.
2016-05-22 11:54:43 +02:00
asofold
6f53b63db2 Reset the actual morepackets (vehicle) data on calling that method. 2016-05-21 19:30:31 +02:00
asofold
4818d95d60 Tie "can't handle vehicle..." message to the allow-flight setting. 2016-05-21 17:06:49 +02:00
asofold
c19cd8c435 Don't wrongly return null here. 2016-05-21 16:18:39 +02:00
asofold
2b8dade7d2 More on vehicles (see details).
* Fix scheduling vehicle set-backs: disabled by default.
* Adjust detecting already set set back in morepackets (vehicle).
* Always warn if a set-back gets overridden.
* Adjust debug logging and comments.
* Some data loss.
2016-05-21 16:15:47 +02:00
asofold
a32bc257f3 Also recognize ProtocolLib versions just with build number prefix. 2016-05-16 22:11:32 +02:00
asofold
980af8d664 Notes, adjust comments. 2016-05-16 22:07:23 +02:00
asofold
23f5e0cc06 [BLEEDING] Force direct teleportation on vehicle set back by default.
Looks like we're running into set-back loops, unless we can control this
otherwise. It's more safe and consistent for our context, however it
leads to nested events. Vehicle exit, player teleport and vehicle enter
will fire from within handling whichever event the vehicle checks got
called from, such as vehicle update, player move, vehicle move.

Possibly some justTeleported flag helps us here. Likely there is no
similar switch that we could use with scheduled set-backs. The proper
option would otherwise be, to use packet sending and/or even cancelling
packets selectively, which would more or less force us to hard depend on
ProtocolLib for supporting basic features of Minecraft, despite possibly
a
sensible move anyway.
2016-05-16 14:50:28 +02:00
asofold
ea4f86c250 Add convenience methods (set). 2016-05-16 14:16:23 +02:00
asofold
0726f9785e Change IEntityAccessLastPositionAndLook to have get and set. 2016-05-16 14:04:18 +02:00
asofold
a0386c6648 Alter selected debug log messages for easier recognition.
* 'set-back' -> 'set back', to get better highlighting with a certain
text editor.
* Log last vehicle position differently.
2016-05-16 13:33:07 +02:00
asofold
43f0201d76 Fix toString. 2016-05-16 12:13:09 +02:00
asofold
420d100150 Fix getLastNonPlayerVehicle use. Ensure positions on vehicle set-back.
Plus random clarify comments/javadoc, more/altered debug logging.
2016-05-16 12:08:21 +02:00
asofold
892944f807 Fix null world after set. 2016-05-16 10:41:00 +02:00
asofold
16647dedec Alter debug logging and exception throwing to track things. 2016-05-16 02:20:56 +02:00
asofold
6fb52915ab Fake vehicle enter on join. 2016-05-16 00:20:43 +02:00
asofold
ddc0111f73 Invalidate vehicle set-back locations on world change. 2016-05-16 00:04:45 +02:00
asofold
171a5ba070 Fix last position access activation when it shouldn't. 2016-05-15 23:28:43 +02:00
asofold
fff9f76980 [BLEEDING] Use past move data for vehicle move checking.
* Implement VehicleMoveInfo and provide via AuxMoving.
* Use MovingData.resetVehiclePositions to reset past location on enter.
* Some auxiliary functionality.
* Route vehicle update and move through the same checkVehicleMove
method, to initialize things, making some decision about what locations
to use for from and to, and to ensure that firstPastMove is set.
* Adjustments and fixes (workaround for generics with PlayerLocation,
LocUtil.hashCode).
2016-05-15 20:57:47 +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
8bc696afdb Vehicle update: Only debug log if debug is set. 2016-05-13 10:24:30 +02:00
asofold
d5658cfddf [BREAKING] MoveInfo as generic super class of PlayerMoveInfo. 2016-05-12 16:03:26 +02:00
asofold
929578acf5 [BLEEDING] Common super class for PlayerMoveData and VehicleMoveData.
* Now MoveData is the common super class of the above.
* MoveTrace has a generic type parameter for the MoveData sub class.
2016-05-12 01:00:13 +02:00
asofold
970915ccf7 Refactor past move tracking. Few related changes for resetting logic.
Roughly:
* Encapsulate past move tracking in a MoveTrace class.
* Have playerMoves and vehicleMoves (the latter unused).
* Resetting method for both player+vehicle including more packets each.
* Don't reset vehicle data on game mode change.
2016-05-11 23:30:30 +02:00
asofold
a41ff38c99 Attempt to fix cross-plugin StackOverflowError with inventory.open.
Not sure who started this, but apparently...
* NCP closes an open inventory, leading to an event for that.
* Due to the player having an item on the curser or similar, an item
drop event is fired.
* WorldGuard will kick the player due to a blacklist event.
* NCP will detect an open inventory and attempt to close it, resulting
in looping this.

Fix attempt (blind) stores the uuid of a player and skips further nested
closing of inventories.
2016-05-11 21:44:54 +02:00
asofold
368f2fb5f1 Dent into things: Towards unified data structures for moving.
Moving players and vehicles. Part evaluation, part preparations.
* Use more minimized types to demand for MoveData.

Likely future changes:
* Split MoveData into base MoveData extended by PlayerMoveData and
VehicleMoveData.

Might follow up:
* Might have a MoveDataStore providing the past move tracking in an
encapsulated way. To be used for players and vehicles.
* Attempt to have easy to share common auxiliary mechanics, so things
like 'mightBeMultipleMoves' and some of the associated resetting logic
can be a common routine for both players and vehicles.
* Similar.

Might follow up later:
* Don't laugh: consider lost ground to be made abstract enough to be
used for both players and vehicles.
* Track vehicles independently of players (tandem fly!).
2016-05-11 15:11:11 +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
bb2c2d0cb6 Note MC versions. 2016-05-11 09:48:49 +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
asofold
43db457a57 Fix getting the bottom vehicle. Added logging to discover. 2016-05-10 22:57:25 +02:00
asofold
e3aa28d388 Prepare accessing last position for entities. 2016-05-10 22:29:45 +02:00
asofold
2281ba9d29 Make the denylogin message configurable (strings section). 2016-05-07 14:13:43 +02:00
asofold
beac108456 Notes on notes. 2016-05-07 13:52:36 +02:00