Pwn9 / PwnFilter

PwnFilter is a JAVA Plugin for Bukkit, a multiplayer server API for the game Minecraft. Pwnfilter implements Regular Expressions created in a user defined "rules.txt" as an in-game chat filter to remove profane language, spam and caps, for fun and as an effective command alias creator.
GNU General Public License v3.0
15 stars 25 forks source link

Major code cleanup #3

Closed minecrafter closed 10 years ago

minecrafter commented 10 years ago

This is a major code cleanup.

I have eliminated most uses of concurrent collections that are unnecessary, and removed some unnecessary data cache collections.

ptoal commented 10 years ago

Hi there,

May I ask what prompted the desire to make these changes? Was there some symptom that you were encountering? My guess is that perhaps you have a server with a large number of players? Admittedly, my knowledge of the google collections library is limited, so I'm currently investigating the usage you are making of it.

Some of the code you removed was placeholder for the switch to UUID's, though it probably shouldn't have been in the main code branches. Other code, is there because we can't call bukkit APIs from async events safely, so we have to cache data that we might need.

I am actually working on a major refactor right now, that will separate the bukkit plugin from the filter engine, as well as update the DSL we use for the rules file, to make it more capable.

I will consider the changes you made, but it would have been really helpful if you had taken some time to document why you changed the things you did. Nonetheless, I appreciate the contribution!

Regards, Sage

minecrafter commented 10 years ago

May I ask what prompted the desire to make these changes?

It's mostly clean-ups for standard Java practice. Examples include proper usage of ConcurrentHashMap, and other standard tweaks.

My guess is that perhaps you have a server with a large number of players?

It's actually a Bungee network, with many servers.

Other code, is there because we can't call bukkit APIs from async events safely, so we have to cache data that we might need.

Some of these calls are actually safe to invoke. I should also note that AFAIK PwnFilter doesn't need an UUID update.

minecrafter commented 10 years ago

Forgot this:

Admittedly, my knowledge of the google collections library is limited, so I'm currently investigating the usage you are making of it.

Guava's collection set makes collections a lot less painful. I think you'll like that change.