[API 5/6] CatClearLag (clearlag for Sponge)

Now avaliable on Ore.

:cat:
A recreation of clearlag for the SpongeAPI.
Tested on both api 5 and 6.

:arrow_down: Downloads
Downloads are avaliable on the github page: [Link]

:cat2: Source Code
Source code for CatClearLag is avaliable on Github.

:clipboard: Commands

/re <hostiles|all|living|xp> - Remove various types of entities.
/forcegc - Request garbage collection.
/laggychunks <tiles|entities> - Find the chunks with the most entities or tiles.
/unloadchunks - Unload all chunks.
/clwhitelist - Add an item to the item whitelist.

:tools: Permissions

catclearlag.command.removehostile - Use /re host.
catclearlag.command.removeentities - Use /re.
catclearlag.command.removeall - Use /re a.
catclearlag.command.removegitems - Use /re items.
catclearlag.command.forcegc - Use /forcegc.
catclearlag.command.laggychunks - Use /laggychunks.
catclearlag.command.unloadchunks - Use /unloadchunks.
catclearlag.command.whitelistitem - Use /clwhitelist.

Soon :tm:

  • Halt all server activity.
11 Likes

Couple of notes:

  • If you store services, like the PaginationService, and then the provider changes later, you’re using an outdated service provider. I’d recommend either not storing it locally and asking for it each time (maybe change the variable to a getter method), or changing the variable on a ChangeServiceProviderEvent.
  • Don’t check against string IDs like in removeHostile; they’re not guaranteed to have those IDs. That’s why the static fields exist, in EntityTypes.PLAYER.
  • MobEventHandler has a name suggesting hostile mobs, but that event will be called on every entity, up to and including Items. Maybe change the type of entity to Living?

I will work on that.Thanks! :smiley_cat:

What is the interval in the config? Is it ticks, hours, days?

Think its minutes for cleanup and in seconds for warnings.
I tried changing clean up to 30 minutes and making warnings 1740, 1770, 1790 but they always seemed to have a 10 minutes delay between them so made cleanup 10 minutes again and have a extra 10 second prior warning

The 10 minute interval will be fixed in the next update, it was being set 10 by default.

Interval is minutes, warnings are in seconds.

Hi, can you add the feature to translate the phrases of your plugin, like the auto clear message?
Thabks in advance and congratulations for your nice job

Update 0.7:

I noticed the new item whitelisting config How does the adding items from other mods other than basic minecraft work? I’ve currently have:
whitelist=[
“minecraft:diamond”,
“minecraft:redstone”,
“minecraft:quartz”,
“appliedenergistics2:crystal_seed:0”,
“appliedenergistics2:crystal_seed:600”,
“appliedenergistics2:crystal_seed:1200”,
“appliedenergistics2:material:1”,
“appliedenergistics2:material:10”,
“appliedenergistics2:material:11”,
“appliedenergistics2:material:12”,
“appliedenergistics2:material:46”,
“appliedenergistics2:material:47”
]
But it doesn’t seem to work for the ae2 items. Am I missing something?

That’s because data values aren’t supported, due to the string being directly converted into an ItemType. In fact they aren’t really supported anywhere in Sponge; you have to manually edit the memory in items and whatnot to turn a raw data value into something of any use.

So in simple terms whitelisting ae2 crystals isn’t all that simple.

It is, you just have to get the string value of the block state,
so something like so:
appliedenergistics2:material[variant=foo,direction=bar]

That is, if the plugin supports not just BlockType id’s but also BlockState ids.

Hi,

Awesome plugin! I do have a suggestion. It would be really useful if your plugin had a command to unload chunks. Like with Bukkit’s ClearLagg, they had the command /lagg unloadchunks and it would clear “unnecessary chunks.”

I hope you implement something along this line, it would be incredibly useful.

But that can only generate customized BlockTypes, not ItemTypes.

Current problem with that is I am not quite sure how to find the chunks that “Need to be unloaded”, if I did do something like that I would have to find a way to do it, which I currently do not have time to do.

just don’t put the :1200 or whatever at the end and it should work fine.

I tried removing the :1200 and it still removed the entities.

Did you restart the server?

I did restart the server.