Have you ever wanted to run a vanilla server but hate not being able to actually log and enforce griefing rules? This datapack can help by logging a wide variety of player actions such as opening chests, placing TNT, using flint and steel, and more. All you have to do is place the datapack in your world/datapacks folder and then run /vanillog:setup to create all the required scoreboard objectives. Then you'll be able to see in your server log every time a player does one of the tracked actions.
The log might look a little convoluted and confusing (because truthfully it is, vanilla minecraft doesn't have a easy way to simply log something without saying it to every player), but all the relevant information is there:
VanilLog isn't intended to stop or prevent griefing, but give admins the information to determine who may have done the griefing. I made it specifically to have as little impact on gameplay as possible, you're free to modify it to log whatever else you might want to log and if you have any suggestions please let me know, this is the first datapack I've ever made so I'm open to constructive criticism.
A complete list of actions that VanilLog currently logs:
Opening Shulker Boxes
Breaking Shulker Boxes
Placing TNT and TNT Minecarts
Picking up item frames. Unfortunately due to bugs.mojang.com/browse/MC-128473 minecraft.killed:minecraft.item_frame and much more doesn't work, so this is the best I can do to track people breaking item frames.
Picking up filled maps. This is a problem for me cuz people keep breaking map art and stuff.
Using Lava and Water Buckets
Using Flint and Steel and Fire Charges
Breaking Iron, Gold, Emerald, Diamond, and Netherite Blocks
To briefly explain how it works, it monitors scoreboard objectives for all the actions you want to log. When a player does something you want to log, the datapack summons a baby pig with a name describing the action exactly 1000 blocks above the player. It then spawns a harming area effect cloud at the pig and sets the "owner" of the cloud to the player. The potion kills the pig, and the pigs death message serves as the log entry.
Fixed a problem where potions could just fall all the way down and hit players (this happened if it logged multiple events too fast. The first potion summoned would kill all the villagers and then the other potions simply fell out of the sky). I just kill all the potions tagged with "killpot" below y level 850 (though it was funny to see a griefer get confused in the logs and start talking thinking I was invisible and watching them)
added the setup function to load.json so it'll set itself up on first run. thanks 4P5. Also added a message when it's starting up that says the version. Also this means when you update the datapack you won't have to re run the setup function to make any new scoreboard values.
removed a bunch of unnecessary scoreboard checks, also thanks to 4P5.I'll look into putting the scoreboard checks on a schedule and see how that turns out for the next update.
very minor update, while playing I realized I forgot to give splash potions the "killpot" tag in version 1.1 when breaking gold blocks and breaking chests (meaning splash potions could still fall all the way down to players when they did those 2 specific actions). Maybe I didn't have those files open when I used find + replace to add the tag. It's fixed now.
If you've previously downloaded the datapack you can simply unzip the file in your datapacks folder and overwrite existing files. You'll know you're successful if you see "Starting VanilLog v1.1.1" in chat when reloading or restarting the server.
This release changes some file names and removes some files. If you are updating from a previous version, remove the old resource pack completely before installing this version.
Huge thanks to github user 2mal3, they're responsible for most of these changes and I pretty much just polished them.
The scoreboard values are now checked every 10 game ticks (0.5 seconds) instead of constantly. This should improve performance.
VanilLog now respects villager human rights (it now logs by killing baby pigs instead of villagers. This also means events are no longer logged twice, because for some reason villagers get 2 death messages)
Using AreaEffectClouds instead of Potions, it just works better idk why I didn't think of it before.
Split a few things into their own separate functions.