[API 5/6] ClearMob [ClearLag Port] [Vanilla/Modded]

MC Version 1.10.2

Able to define list of entities the plugin clears.

Has a passive mode that runs the clear in intervals (Asynchronously), which can be disabled or set to different intervals. Also has a customizable warning message that can be enabled to run a minute before passive mode clears entities.

Added Passive Group Killer. Checks if groups of animals are larger than 5 in a 20 block radius, leaving 5.

Crash Chunk Load Clearing (Disabled by default for obvious reasons)
New Feature added in 1.0.4. Used to help try and remove an entity causing the server to crash. Using the LoadChunkEvent, it will make a list of all entities in the chunk when it loads and clears them. This ignores the list altogether For modded Minecraft, this means it can clear Thaumcraft Auranodes and Botania Sparks (To name a few)
Should only be used when server is whitelisted as it will run for every chunk loaded.

-NPE Fix from version 1.3.0
Removed ListType (Will always remove whats on the list)
Added Info Command.
Added features to run command.
Fixed Colored messages.

  • Further Explanation on Command Reference.

Added Hostile Entity Limiter
Various Bug Fixes.

Huge rewrite. Split a lot of clearers into their own classes. Added more null checks.

Added Passive Group killing. (Removes Animals when groups)

Added Support for Tile Entities (Like torcherino)
Changed dump and run commands.
Updated passive mode for new change to run command. (Passive mode does not support tile entities)

Added Features:
clearmob tps command.
clearmob reload command
Restructure of config (Done automatically)
Added CrashChunkClear mode (Removes entities on chunk load, disabled by default)
Added Warning message for passive mode
Added Killallmobs and Killdrops options. (Higher priotity than defined list)


  • An ‘add’ command, to add entities to the config without having to manually edit it.
  • Clear 80% of a group of neutral mobs, filter ones with nametags.

Source Code
Issue Tracker/Feature Requests
Config Explained

All Future Updates will be posted on Ore



Sponge API 5.0.0 is for MC 1.10.2.
Sponge API 4.1.0 is for MC 1.8.9.


dependencies {
compile ‘org.slf4j:slf4j-api:1.7.13’
testCompile ‘junit:junit:4.12’
compile ‘org.spongepowered:spongeapi:4.1.0’

Running it on both a test 1.10.2 Vanilla server and a public 1.10.2 Modded server.

OK, but it’s still built for 1.8.9. It runs on 1.10.2 simply because it doesn’t depend on anything that broke (yet).
Also, your project’s a bit borked. There’s class files in the git repo, and none of the standard gradle paraphernalia is present.

Edit: Oh, I see. You’ve added them to .gitignore, but you’re supposed to keep settings.gradle, gradlew, and gradlew.bat in your project - they’re necessary for people to be able to build it locally. I just use Sponge’s gitignore myself.

There’s also a slightly borked gradle init - you’ve got a Library.java file in your source root, which is autogenerated by gradle and therefore pointless.

Should look a bit better now. Thanks for the tip.

A couple of notes on the project:

  • You’re injecting the logger, but not actually using it. Don’t send stuff to the console, just log it.
  • Do different things at different times. For example: Config stuff is available at GamePreInitializationEvent.
  • For the above point, it’s important that you remember: In singleplayer, the server can stop and start multiple times, or not ever start, meaning that your commands and config and stuff might never get registered, or may get done multiple times. This is not a good idea. All things relating to loading should be done in events related to initialization, e.g. config in pre init, commands in init, etc.
  • You don’t need to initialize list_entities with an ArrayList if you’re just going to load it from the config at the earliest opportunity.
  • Your commands can be improved - this describes a better way of making your CommandSpec. You then make different classes for different executors, eliminating parsing entirely.
  • Absolutely none of the statics in Config need to be static.
  • You’re injecting the configuration loader, and then not using it. This throws away Sponge’s custom configuration settings, such as being able to retrieve objects like Text directly from the config, as well as hardcoding where files go. Other things that you can load directly from the config include EntityTypes, which mean that you can use them directly instead of your strings.
  • In accordance with the above point, you should be injecting the default config for the path as well as the configuration loader, instead of the config dir - this lets Sponge decide where the configuration file goes.
  • Your code has some interesting quirks. For instance, why are you creating a new Object[] in your getNode calls, when it’s a vararg? Why are you using a numerical iterator over list_entities?
  • Just type args.checkPermission(src, “clearmob.run”) and it’ll do the permission checking for you.
  • Don’t return null in commands, ever. You should be throwing CommandException if the command failed.
  • CommandResults should be useful; why not do CommandResult.builder().queryResult(removedEntities).build()?
  • You have a lot of exception catchers that do nothing. At the very least you should print a stack trace.
  • Just a minor gripe, but Java conventions for variables are camelCase instead of under_score.
  • Instead of making your own reload command, listen for GameReloadEvent and do your logic there.
  • I am confused as to why you map the entity list to lower case, and proceed to ignore the case during your equality checking.

Checked everything pie mentioned and agree with all of it.

Also as a feature request, could you have a config option to change it from a whitelist to a blacklist?
When some new modpacks come out with 100+ entities it’ll be a pain to list all that I want gone, rather than add the ones I want to keep.

I’m currently working on changing the source code to pie’s list. After I’m through that, I can add a config option for white/black list rather easily.

@rojo8399 This version: 1.0.2a has a fully working Whitelist/blacklist in it. Sorry it took a bit XD I got stuck on something, which turned out to me being dumb.

I am getting this error using the latest version… http://pastebin.com/WEEugBG0

Did you do this: When updating from 1.0.0 to 1.0.2, you need to add ListType=Whitelist to the end of your config.

Or more specifically, does your config contain this phraise:

I tried to add some code to automatically apply that line… didn’t want to take… maybe a future release will work properly lol

[Edit] Got that code working now, so any future config changes will be automatically done. Dunno why it didn’t work last time, I did the same thing…

It was a fresh install and it doesn’t create a config file. :frowning:

Okay, I tried another test and I see what happened… I should have a new version for tomorrow… I dont know how this got broke during the creation.

1 Like

@TreasureIsland Try this one: Here

I fixed the issue with the config, and tested it 5 times. It properly gens the folder and the config, sorry about that.

1 Like

This version also has a few things added such as Passive Mode. Which is now automatically added to any old version of the config. It adds 2 nodes

The PassiveMode node allows you to disable passive mode, while the Interval is how many seconds between it running the clear automatically.

All of this is done asynchronously.

1 Like

New Update: Adds several features including the Crash Chunk Load Entity Clear.

New Update: Add’s support for clearing Tile Entities.

item on ground not clear or delete automatic. How to config?
clearlag easy to use.

Config Explained

You could have added “minecraft:item” to the entitylist or… could have toggled KillDrops to true…

If another item in another mod.
Example item of immersive mod.