Commit Graph

3325 Commits

Author SHA1 Message Date
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
672c6cf71f Fix AttackFrequency for MC 1.7.10 and MC 1.7.2. 2017-04-19 14:59:23 +02:00
asofold
b3a9898900 Add the method getClassDescription for debugging purposes. 2017-04-19 14:08:21 +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
45210e1a25 Build against ProtocolLib-API 4.2.1. 2017-04-18 20:32:47 +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
55715b0a9a Set version to 3.15.2-SNAPSHOT for a development iteration. 2017-04-18 13:04:01 +02:00
asofold
9714790250 Set version to 3.15.1-RC for release. 2017-04-16 19:34:07 +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
cc066292c8 More space available!
(Fuck headers, UEFA.)
2017-04-13 21:24:53 +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
ea5a064132 Prevent npe before use. 2017-04-11 13:18:13 +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
2de5f2fd3a IQueueRORA as interface, add an implementation using a Lock.
+ Use in AbstractLogNodeDispatcher.
2017-04-10 14:56:09 +02:00
asofold
73a62a1e13 Add DualCollection, for future use. 2017-04-10 14:19:11 +02:00
asofold
f4a401dbe1 More spaces. 2017-04-09 12:40:44 +02:00
asofold
395165a95a Correct space. 2017-04-09 12:36:40 +02:00
asofold
ed22d5b43b A sensible choice. 2017-04-09 00:08:46 +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
74674b551b Catch UnsupportedOperationException for getWorld. 2017-04-07 22:41: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