Commit Graph
642 Commits
Author SHA1 Message Date
Philip Cass 27866504c3 Merge branch 'master' into issue-442
- Update PR to use Actor system
- Amend actorFromProjectileSource to choose a friendly name when a block is the source of a projectile
- Added util method to try to suggest an appropriate item as the "weapon" in a projectile kill

Closes #442
Fixes #470 Fixes #471
2015-03-08 18:50:34 +00:00
Thundaklap 6b4be88181 Fixed bow kills not being traceable 2015-03-08 16:49:10 +00:00
Philip Cass 9d344b9401 Merge pull request #581 from frymaster/merge-rows
Batch execution code and consumer timing optimising - massive DB insertion speedup
2015-03-02 20:30:16 +00:00
Philip Cass 6a38708a32 Merge identically-formed db INSERT rows into a single batch statement
This increases insert speed by up to 6 times when the DB server is on the same
box as the minecraft server, and many HUNDREDS of times when it is accessed via
a network connection.

This creates a new kind of BlockRow which is a collection of many similar rows, each
of which uses the same PreparedStatement.  As such, when asked to run, it can
use the executeBatch() method.  It also adds code to BlockRow to see if they are mergeable
(it won't if they have sign or chest actions associated) and to merge two rows into one of
these new objects.  The consumer processing loop is altered to check for merges, and do so if
possible.

Also, prevent consumer race condition on shutdown

On shutdown, LogBlock invokes the consumer's run() method up to twn times on
the main thread.  However, the consumer may still be running from the last
scheduled task, and this could result in two threads running the run() code
simultaneously, resulting in inconsistent row insertion order.

Another scenario is that the consumer has just started processing the last
row in the queue.  With the queue empty, the server will terminate, but the
consumer could still not have fully executed the databse query.

To solve this, the run() method is syncronized, so it can only be run on the
object by one thread at a time, and is made to run at least once (to force LB
to wait on any already processing run)

Also, the pause between consumer runs was altered to be in ticks (50ms) rather than
in seconds, to prevent needless pauses between runs.

Fixes #580 Fixes #56
2015-03-02 20:12:49 +00:00
Philip Cass 143bcf6d76 Add missing index on playername column 2015-02-28 12:12:27 +00:00
Philip Cass df8bc51437 Use custom names in block lookups
Currently will search only using block type ie searching for prismarine_brick
will search for all prismarine blocks

Also removed pluralisation of prismarine_brick
2015-02-26 16:44:46 +00:00
Mahagon 1cb32d26ed Check if WorldEdit Version is above WE 5 2015-02-25 11:00:46 +00:00
Philip Cass 32c5e16de6 - Massively expand the friendly names for data values
- Print warning if the pre-existing file doesn't contain one of the new names
- Make name lookup in plugin startup to force the MaterialName static code to be run
2015-02-24 22:53:13 +00:00
Mahagon 951bed3743 Added new material data values 2015-02-24 20:09:08 +00:00
Mahagon 8c232b5997 use getClickedBlock instead of getTargetBlock 2015-02-23 22:40:19 +00:00
Philip Cass 32ef8756f3 Merge branch 'DarkArc-worldedit-6.0.0'
Supports WorldEdit 6 API
Drops support for legacy WorldEdit
2015-02-22 15:03:23 +00:00
Philip Cass d48d042279 Directly use the UUID of the player responsible for event, if possible
Directly get the Bukkit World object of the event, if possible
Move Worldedit World -> Bukkit World conversion to a separate method
2015-02-22 14:55:58 +00:00
Philip Cass 82b4ffc2a2 Support utf8mb4 if the database does. Fixes #535
What MySQL calls "UTF8" is actually a subset of the full unicode specification.
It doesn't accept 4-byte UTF-8 characters.  Proper support is called "utf8mb4"
and is, these days, fairly common (Ubuntu 10.04LTS's bundled MySQL does not
support it, but later ones do)

Detection of utf8mb4: "SHOW CHARACTER SET WHERE charset='utf8mb4';" returns at
least one row

Conversion of pre-existing DBs: this was easy, we already had code in the
updater for this for when we started enforcing utf8. It was version-bumped and
set to update to either utf8mb4 or utf8, depending

Making it use utf8mb4 in the database connection: Actually hard.  Connector/J
5.1.13 or newer should autodetect this, but in my testing it didn't
(http://dev.mysql.com/doc/relnotes/connector-j/en/news-5-1-13.html)

As such, if utf8mb4 has been detected, I've added code that should manually
execute "SET NAMES utf8mb4;" on all new connections.

If a database does not support utf8mb4 (rare these days) I've added code to
strip these characters before DB insertion; they won't be recorded correctly,
but it'll avoid the exception from issue #535
2015-02-20 22:48:40 +00:00
frymaster 3711aa3890 Always update player name even if not logging player info. Fixes #577 2015-02-18 21:02:35 +00:00
frymaster be06056d5f Corrected very broken Actor equality check 2015-02-17 20:44:56 +00:00
Philip Cass ed5e40f469 Merge branch 'worldedit-6.0.0' of https://github.com/DarkArc/LogBlock into DarkArc-worldedit-6.0.0
Conflicts:
	src/main/java/de/diddiz/LogBlock/LogBlock.java
	src/main/java/de/diddiz/LogBlock/listeners/ExplosionLogging.java
	src/main/java/de/diddiz/worldedit/LogBlockEditSession.java

Update Worldedit 6.0 hook to support UUIDs
2015-02-17 20:25:02 +00:00
Philip Cass a4e4c35371 Bukkit API version bump for projectile source 2015-02-16 20:09:58 +00:00
Mahagon 4effd8c9fe log fire by playerinteractevent only on leftclick 2015-02-16 19:54:16 +00:00
Mahagon f46751aecd Also log the deletion of fire by a player 2015-02-16 19:54:16 +00:00
Mahagon a9ff27a2a0 fireball logging did not work with 1.8 2015-02-16 19:30:44 +00:00
Philip Cass c3f5ce9a5b Get the UUID column when summing by players 2015-02-16 15:25:02 +00:00
Philip Cass 7e49094699 Revert "Reduce UUID migration batch size. Fixes #576"
As per https://github.com/LogBlock/LogBlock/issues/576#issuecomment-74503498 the limit is confirmed at 100 names per request.

This reverts commit b3977d3e00.
2015-02-16 14:13:43 +00:00
Philip Cass b3977d3e00 Reduce UUID migration batch size. Fixes #576 2015-02-15 21:59:37 +00:00
Philip Cass e07038acee Missed version bump 2015-02-15 03:06:55 +00:00
Philip Cass 050a17506a UUID migrration fixes
Firstly, remove incorrect unique index on playername (and UUID, just in case) columns, and add a non-unique index on the UUID column

Secondly, account for setups not logging onlinetime - in that case, try to look up ALL names, and give any not found the log_ prefix rather than the noimport_ prefix
2015-02-15 02:50:12 +00:00
Philip Cass 543c55e32b Merge pull request #574 from frymaster/uuid
UUID integration
2015-02-14 14:11:50 +00:00
Philip Cass e3dc430931 Identify players by UUID and migrate existing databases to include this. Fixes #538, fixes #568
This creates a new column in the lb-players table called UUID. If this is in the form of a UUID,
it's assumed to be a player. If not, it's assumed to be a server entity (zombie, sheep, or
WaterFlow, LavaFlow etc.). LogBlock will set the UUID of entities to "log_" plus their name
(i.e. log_zombie or log_sheep)

To assist this is a new class Actor, which wraps a name/UUID pair, with constructors that will
generate one from server entities, or SQL results. Every listener and every class in Consumer
needed to be updated to deal with this

As of yet, only the playername is displayed in results (although the queries do return UUID data).
Similarly, you can only query by name (the database stores the last name they have logged in as).
In addition, the WorldEdit hook has been disabled (is not compiled) since LB needs to be updated
to use their new API, and the LB code hook has to extract UUID information for insertion.

The UUID importer assumes any player with an onlinetime of 0 is a server-generated source, and set
the UUID as above (log_sheep etc.).  For everything else, it sends 100 names at a time to Mojang's
name->UUID service, and records them if available.  If no result is found, it records their UUID as
noimport_theirname.  As this is more likely than other updates to be interrupted mid-way, the
importer is tolerant of e.g. the column already being added, and will resume where it left off.
2015-02-14 14:01:21 +00:00
Ammar Askar 6e12d159b4 Verbose logging for PreparedStatements 2015-02-08 16:34:46 +05:00
Dark Arc fa1e1b777a Updated for WorldEdit 6.0 2014-09-01 23:19:57 -04:00
frymaster d7f2ac5a65 Merge pull request #506 from DarkArc/1_7_2
Updated Smart Logging for 1.7.2 and resolved a bug with door logging
2014-01-20 02:16:41 -08:00
Philip Cass 05fe4f2144 Move null check in tool code one level out. This means it will guard against trying to use worldedit for querying double chests when worldedit is not loaded. Fixes #511
Long-term, perhaps rather than using a worldedit object directly, we should use our own interface which supports similar methods and have two implementations, one which uses a worldedit selection and one which takes two corner coordinates for use in double chests.  That might also allow for custom queries along those lines.
2014-01-15 14:06:27 +00:00
frymaster 6902ffb373 Merge pull request #516 from frymaster/worldeditor-changes
Improvements to checks for inventory blocks and double inventory blocks
2014-01-14 02:56:12 -08:00
Philip Cass bbe7989878 Improvements to checks for inventory blocks and double inventory blocks
These commits replace all checks of the form type == someInventoryBlockId || type = anotherOne
with a call to getContainerBlocks().contains(Material.getMaterial(type))

This was done by searching the code for 54 which is the chest ID.
Remaining explicit mentions of id 54 are in regards to special-casing for double chests -
the code there has been expanded to also consider id 146, the trapped chest.
I didn't think it worth making a collection for double-block inventories, but if more are
added it should be considered - looking forward, this might be necessary when the mod API
comes in, assuming we have a way of figuring out what double inventories are anyway.

This fixes many blocks not having inventories logged when destroyed due to explosions,
or not being rollbackable, and tools not querying both sides of double trapped chests.
Rolling back e.g. a furnace is glitchy - the fuel, raw material and product do not get
placed in the correct slots.

- Update list of container blocks
- Make tool treat trapped chests as potential double chests
- Replace explicit id checks with a call to getContainerBlocks()
2014-01-14 10:51:47 +00:00
bm01 4519c79e68 Made "trapped chest" content rollbackable 2013-12-16 14:54:40 +00:00
Dark Arc 3cffeccedb Updated Smart Logging for 1.7.2 and resolved a bug with door logging 2013-12-09 15:32:09 -05:00
Philip Cass 0c5fbd7fff Replace overlooked getByte calls with getShort for itemdata. Fixes #508 2013-12-09 09:32:47 +00:00
frymaster cb5741dd73 Merge pull request #505 from frymaster/itemdata-expansion
Allow for logging of item data greater than 256.  Fixes #96, #235
2013-12-05 02:19:34 -08:00
Philip Cass 0d5607be43 Update PR for new version number 2013-12-05 08:42:20 +00:00
Philip Cass 9e1fc1f9a1 Merge branch 'master' of https://github.com/LogBlock/LogBlock into itemdata-expansion
Conflicts:
	src/main/resources/plugin.yml
2013-12-05 08:40:42 +00:00
md-5 28b4c2f60c Bump to release 1.80 2013-12-05 13:26:03 +11:00
Philip Cass 38e1c6059f NBT (and Java) shorts are signed 2013-12-04 11:52:00 +00:00
Philip Cass 2ff6da183b Use modern column widths if upgrading from very old version 2013-12-04 11:34:25 +00:00
Philip Cass c0b983e8e8 Allow for logging of item data greater than 256. Fixes #96, #235
This change involves refactoring many instances of "byte" to "short and altering a few ItemStack calls to use the int,int,short form instead of int,int,0,byte
Significantly it also involves altering the MaterialName system to allow shorts instead of bytes, and altering the rawdata() function to return the durability of an ItemStack rather than the data value of its Material.

One side effect of this is that tool durability is now logged, which will make for more accurate rollbacks.
2013-12-04 11:29:02 +00:00
Philip Cass d50c48f79d Check sign text is being logged before attempting to update table 2013-12-04 09:45:38 +00:00
Philip Cass d055d2af86 Increase width of kill table coordinate fields to mirror the block table increase 2013-12-04 09:32:36 +00:00
frymaster 8d820783a1 Merge pull request #499 from frymaster/nonentity-kill-logging
Implement logging for environmental (non-entity) kills
2013-11-19 05:50:06 -08:00
Philip Cass fa9a86a3b9 Implement logging for environmental (non-entity) kills, such as suffocation. Adds #80
This change adds a new config option, logEnvironmentalKills.  When set to true,
Logblock will record entity deaths not directly caused by another entity.
(for example, suffocation, or burning to death)
2013-11-13 14:28:42 +00:00
Philip Cass ab53755eaf Typo in config error message 2013-11-13 12:00:22 +00:00
Philip Cass 459a95fd1e Merge remote branch 'origin/master' 2013-11-12 13:23:05 +00:00
Philip Cass eb84fd1380 Various minor improvements to querying and logging
- Allow use of "both" as a query parameter. This will search for created and destroyed blocks, but not chestaccess. This is useful for situations where the query defaults to "all" e.g. rollbacks. Fixes #210, #252
- Add block negation query parameter. Like with player names, you can now precede a block name with "!" to query for all except the specified blocks. Fixes #452, #216
- Allow use of area parameter with location parameter, as long as location is specified first. Fixes #458
- Better error when asking for kill log without world specified
- Don't try to process events where the block is null.  Fixes #463
- Replace problematic characters in world names with underscores when deciding on a default table name.  Fixes #409
- Adjust for cocoa beans having reversed attachment direction in smart logging
- Prevent out of bounds exception if a single-word timespec ends in a number.  Fixes #354
- Prevent error when specifying a killer or victim in a teleport lookup.  Fixes #333
2013-11-12 13:08:52 +00:00