Commit Graph

111 Commits

Author SHA1 Message Date
asofold
08c5aa2d7c Implement a linked coord hash map, custom order, tests.
Can't implement "dumb" access order, because we will have to move
entries to the front with setting and altering data, but we don't want
the data to be changed every time get is called, e.g. with piston
tracking.

Efficiency could be increased, using the entry as reference instead of
duplicate calls with coordinates.
2015-09-28 15:10:02 +02:00
asofold
f70151d8c7 Use an iterator for remove. 2015-09-28 13:09:45 +02:00
asofold
9efcf01766 [BREAKING] Move maps into a maps package. Prepare a linked CoordMap.
Splits CoordMap into interface, abstract hash map, implementations.
Sketch Linked version, hinting at access order, e.g. with
tracking piston effects with timeouts.

Missing:
* Implementation of a linked version.
2015-09-28 12:56:58 +02:00
asofold
866a2248cf Use tabs for all the pom.xml. 2015-08-01 00:58:33 +02:00
asofold
7da874ad66 Attempt to deploy only the final plugin jar. 2015-07-30 11:27:30 +02:00
asofold
2f50cca03d [BLEEDING] Fixes and additions for the compatibility layer.
* Make attribute methods consistent (remove the sprint boost modifier
from the generic speed multiplier, because it's inconsistent).
* Add missing implementations.
* Adjust default sprinting speed modifier.
* Add more guards for the latest compat module (1.8_R3).
* Add a reflection based compat module for CB, to cover minor updates.
* Possibly other minor fixes/changes.

[Hail "insufficient data written"!]
2015-06-06 16:14:36 +02:00
asofold
de3b95de5d More on ActionFrequency.
* lastUpdate is always set calling update().
* Negative diff can not affect update (time ran backwards).
* Use lastUpdate instead of lastAccess where appropriate.
* More comments/formatting.
2015-02-09 18:02:24 +01:00
asofold
75cc31e786 Clarifications for ActionFrequency. 2015-02-09 17:08:55 +01:00
asofold
e0a8ef21d6 Revert module dependency versions to 1.1-SNAPSHOT.
(LATEST would use the old static ones.)
2015-02-06 02:05:48 +01:00
asofold
a7127336a8 Use LATEST as version for internal dependencies. 2015-02-04 23:42:05 +01:00
asofold
2cecd50961 Change all "static" pom versions to "1.1-SNAPSHOT", to allow deploy. 2015-02-04 18:49:52 +01:00
asofold
bd5794d0bd Spaces. 2015-01-05 22:07:04 +01:00
asofold
c00347c894 More test coverage. 2014-12-20 16:27:27 +01:00
asofold
fb6ac2ad5a [BLEEDING] Prevent noclip using commands with untracked moves.
A cheat client could move such that they are inside of a block, but
CraftBukkit will not fire an event, because the distance and looking
direction don't change enough. Teleporting other players or yourself to
that location would result in getting someone into a block. Consequently
 we also have to block commands like /sethome at such locations.

Our first attempt to patch that will monitor teleports that use the
TeleportCause.COMMAND (might miss out on plugins that are not using the
appropriate cause, and on plugins that use items for teleportation), in
addition we monitor certain commands (configurable prefixes), to catch
things like "sethome" and "sethome2". The world spawn is exempted. Only
teleports into blocks are monitored.

This does not yet sanity-check the distance to the last tracked
location, but it will ignore if none is set.
2014-12-17 20:16:28 +01:00
asofold
ea5b249197 Alter how command lists are interpreted. Might fix some issues.
Details:
* Only trim commands from the left side (both on feed and check).
* Ensure versions with and without leading '/' are fed into trees.
* Move methods to feed CharPrefixTree from configs to CommandUtil.

Potentially fixes (untested):
* Only deny the sub-commands for a prefix, example: feed 'version ' to
consoleonly, in order to allow 'version' but not 'version NoCheatplus'.
* Might fix some plugin/server specific prefixes not being detected,
example: feed "/version" and expect "/bukkit:version" to be blocked.
2014-12-17 18:54:04 +01:00
asofold
c0a188d2c1 Make LogManager an interface.
* Some cleanups (spaces, commented out references updated).
* LogManager implement INotifyReload, but gets processed extra (not
added with addComponent).
2014-12-04 15:56:16 +01:00
asofold
a41b7a6329 Interpret a file name without extension as a directory, if not existent. 2014-12-04 15:04:11 +01:00
asofold
04d2896f7e [API CHANGE] Add debug flags to check data [missing: use that one].
For debug output now data.debug is used instead of config.debug, so the
data is initialized with the config.debug value. As an effect of this,
removing the data or reloading will override flags that have been set by
means of API-access only.

Affected:
* Adds getDebug and setDebug to ICheckData.
* Adds appropriate configs to all constructors of check data.
* Some per-check debug flags have been removed.

Extras: 
* spaces
* import cleanup.
2014-12-04 02:24:20 +01:00
asofold
ea57e5c3e1 Move Streams to NCPCore. 2014-11-19 08:36:53 +01:00
asofold
ec36e879d3 [BLEEDING] Use the new logging framework from now on (read details).
* All logging is also going into the log file (always), debug output is
mostly/only going into the log file. File logging uses an asynchronously
processed queue now (!).
* Specify an existing directory (e.g. logs) and log files will named
after date + sequence number, changing with every reloading of the
configuration.
* Console and ingame logging remain within the primary thread.
* No extra configurability for customization, yet.
* Not all places have been cleaned up, concerning log levels. target
streams and package naming.
* Work in progress.
2014-11-19 00:07:52 +01:00
asofold
2f4d689722 [PLACEBO] Raw sketch of the upcoming logging framework, doing nothing. 2014-11-18 23:54:43 +01:00
asofold
f49c64e89d Move StaticLogFile to NCPCommons, make use of the useBukkitLogger flag. 2014-11-17 15:40:04 +01:00
asofold
37c1da73ff Rename LogUtil to StaticLog. 2014-11-17 11:25:51 +01:00
asofold
1a88df80c5 Trim exceptions (depth 1), add tabs if header is used. 2014-11-12 19:53:44 +01:00
asofold
780d59d8a7 Use a utility method to get a String of a Throwable. 2014-11-11 20:28:49 +01:00
asofold
0201e4178b Spaces. 2014-11-11 20:23:49 +01:00
asofold
1d78b4eac0 Update comments on cow mappings (problematic: equals/hashCode). 2014-10-31 11:57:50 +01:00
asofold
1b55d91736 Spaces. 2014-08-17 22:01:18 +02:00
asofold
76cdf40485 Allow to prevent auto reset with in ActionFrequency.
This may/will be better for long term counting, because a seconds-range
"time ran backwards" will not erase all.
2014-08-12 12:17:57 +02:00
asofold
24120f306a Ensure ActionFRequency does reset if time ran backwards. 2014-07-31 10:05:15 +02:00
asofold
b498f993dd Array then. 2014-07-29 22:56:00 +02:00
asofold
c2722abc19 Add the "ncp top" command, allowing to search all the violation history.
Original pull request:
https://github.com/NoCheatPlus/NoCheatPlus/pull/24

This probably is not the final implementation, but it allows some
minimal freedom:
* Specify number of entries to show.
* Specify check types (and groups!).
* Specify what to sort by.

There might be need for some merged view, combining several different
check types somehow, or just shortcuts for specific selections, e.g. for
fighting-related checks.

----

+ Fix root command not showing sub commmand usage.
2014-07-29 13:49:43 +02:00
asofold
bf0b515889 Add removeAll.
Considering to use this map for otherwise fully synchronized maps, e.g.
with the chat checks.
2014-07-17 14:40:33 +02:00
asofold
923f08c308 Add an insertion ordered COW version of a LinkedHashMap. 2014-07-16 15:42:09 +02:00
asofold
1ada725476 import time 2014-06-04 21:54:48 +02:00
asofold
dcb48c8800 Add method for Collection. 2014-04-07 09:46:49 +02:00
asofold
4031cb55e8 [MEANWHILE] Refactor penalty time handling + add one for "item change".
Refactored penalty time handling to use a PenaltyTime object, taking
into account time running backwards, also unify attack (close combat)
penalties to a generic attack penalty. Combined.yawrate still keeps the
timeFreeze penalty, due to also cancelling other actions than melee,
still changed to a PenaltyTime object.

Changing the item in hand now leads to an attack penalty (that also goes 
for not changing the item, but changing the slot).

"Quick" addition, not much testing, except few unit tests.

Note that this could change false detection behavior of other sub-checks
of fight, because the penalty time is checked last. Previously checks
like direction or reach would have cancelled already if the player was 
within their penalty time. Hard to say if this creates new false
positives, but it will be more strict on continuous violations.
2014-02-02 23:37:29 +01:00
asofold
61a1d963b4 comment. 2013-12-09 19:58:02 +01:00
asofold
d202d73cab Changes for command lists, opinconsoleonly -> consoleonly.
The command lists for handleaschat and exclusions are now also fed with
 a leading "/" if missing. Allows more convenient setup and less 
 confusion potential for relating comamnd lists in "protect plugins" to 
 other lists.
 
opinconsoleonly has been made a list of commands:
	protection.commands.consoleonly.
Further the message sent to the player is the permission message,
 if the player does not have permission to use the command,
 provided NCP can find the command.

All three command lists are also checked with the original 
command label.
2013-08-11 13:05:24 +02:00
asofold
86da983cf8 Add test for SimpleCharprefixTree. 2013-08-11 12:10:05 +02:00
asofold
adf9bcb9be Adjust a compatibility method for speed and probably compatibility. 2013-07-16 19:56:06 +02:00
asofold
d8d5992569 Update some javadocs. 2013-07-13 12:31:07 +02:00
asofold
c00117a0ad Check some method signatures with MCAccess implementations.
Minimum safeguard: Check the getMinX etc. methods for proper signatures,
to avoid use with mods that have incomplete CraftBukkit mappings.
2013-07-13 09:52:06 +02:00
asofold
9edfb14103 Move workarounds for health-API changes to a utility. 2013-07-06 20:37:11 +02:00
asofold
a7581d509d [TEST] Fix reflection for health changes. 2013-07-06 18:53:21 +02:00
asofold
f315336005 [TEST] Attempt to fall back to reflection for health issues (one spot). 2013-07-06 15:48:26 +02:00
asofold
e60006d6a3 Update pom.xml descriptions. 2013-07-06 14:49:24 +02:00
asofold
ce834675d7 Move most code to NCPCore, removes NCPCompat.
Factories are now on NCPPlugin level, thus all the core stuff can be in
one module, giving better source code browsing.

Updates has been moved into an updates package, because there is to be
expected more content, and to make utilities less fat.

To indicate the direction, the basic infra-structure has been added to
allow adding components to the DefaultComponentFactory. Further
processQueuedSubComponents is now called after each components adding in
order to allow more flexible registry features.
2013-05-22 12:24:48 +02:00
asofold
6e6b198188 Move auxiliary code. 2013-05-21 15:51:51 +02:00
asofold
de5f152df9 [BLEEDING] Flesh out aspects of ComponentRegistry.
* Fixes data removal ignoring chat.logins and chat.text for a part.
* Move some components interfaces and ReflectionUtil to NCPCommons.
* Unregister components in reverse order.
* Add ComponentRegistryProvider for generic sub-registries (DataManager
for instance).
* Add IHoldSUbComponents for delayed sub-component registration
(convenient for iteration over parent-components with later registration
of sub components not missing out any registered parent components for
those). [Partly implemented: Using this during runtime does not yet
work, only used in onEnable.]
* Let CheckListener implement IHoldSubComponents and use this with
addCheck to register the queued checks after all the listeners.
* Register the core system components in a bunch before the
CheckListenerS, to allow sub-registries to work directly and to allow
getAPI().addComponent on the plugin class during construction of
CheckListeners.
2013-04-15 16:11:08 +02:00
asofold
31faf7f11e Adjust available build parameters: TEST_LEVEL and DEBUG_LEVEL
Not yet too much in use, though.
2013-02-28 18:09:42 +01:00
asofold
7a84ed371b Add module for build parameter info.
This is needed with the current technique in order to have it available
at the time of testing NCPCommons.
2013-02-27 00:46:56 +01:00
asofold
33af656b29 Add support for build parameters (example: EXTENSIVE_TESTING).
We can put through build parameters for testing and other purposes so
NCP can see them during testing or runtime otherwise. Not sure this is
the final version, though.
2013-02-26 23:14:33 +01:00
asofold
33abae929b Should have used a regex :p. 2013-02-20 22:04:43 +01:00
asofold
c16ccd8435 Add convenience method to StringUtil for splitting by chars. 2013-02-20 21:18:16 +01:00
asofold
ca0fe64688 Add new accumulator class.
This allows accumulating values grouped by number of events rather than
real-time.
2013-02-01 17:27:44 +01:00
asofold
ee1f410dae [SAFETY COMMIT, REFACTOR, BREAKING]
Moving big parts of code between sub-projects. Some refactoring was
needed to unlink some classes. Deprecated methods removed. Some utility
methods were moved to differently named utilities. Few signatures
changed (e.g. BlockProperties.init). Most changes should only concern
bugs or developers who dug into some NCP deeply (not sure those exist).
It should still all be there.
2013-01-20 04:18:08 +01:00
asofold
923b4ebdca No brain necessary for parent pom version, hahaha! 2012-12-17 17:37:42 +01:00
asofold
c433bfe215 Update pom descriptions. 2012-12-14 10:36:58 +01:00
asofold
42521cbb1c Add resources. 2012-12-13 22:57:21 +01:00
asofold
f21ffd68cb RAW split setup (does not compile in eclipse). 2012-12-13 22:48:56 +01:00