Is there any way to censor people posting their servers in chat? I find people come in to my server and post their IP's begging people to join. Obviously, I haven't seen many people following but it's the morals. I don't want people advertising on my server. There's a reason server lists exist.
This is possible, tough its very hard since this will happen: *Thinking* What i mean is that the player will just use spaces or anything, so that the censor doesnt detect it as a ip.
First replace all spaces with nothing,then replace all xxx.xxx.xxx.xxx:xxxx and similar format strings with *Censor*
@ZephyrSigmar: Then I'll write xxx,xxx,xxx,xxx:xxxxx ... block this and I'll write IP: xxx:xxx:xxx:xxx port: xxxxx and so on...
I've already made this as a plugin request for someone else, it blocks IP's based on a RegEx filter, if any of you have ever used that before. http://forums.bukkit.org/threads/ad...r-all-your-anti-publicity-needs-1-1-r1.52457/ As a quick explanation (if you don't want to look at the source code) it pretty much deletes anything that doesn't match the RegEx filter and deletes all spaces, then checks if it's a VALID IPv4 address, along with if it has any sort of port attached to the end of it. I still need to improve on it, but it's most likely that it'll block almost every time someone posts an IP address. HOWEVER, people always figure out ways to get around things such as placing something like 192[dot]168[dot]1[dot]1 or something along those lines, but I think they'd most likely be banned before going through all the trouble to do that in the first place. tl;dr read the source code and you'll be able to find out how it works.
I assume you were meaning to ask what would happen if someone were to try and give their coordinates? If you're using the correct RegEx filter and replacing the correct characters it wouldn't be a problem as coordinates wouldn't come out to any sort of IPv4 address.
V10lator , jorisk322 Yepp,people are tricky :/ How about replacing everything with nothing,except numbers,then check for xxxxxxxxxxxxxxx format? (Yes,it should censor the message if someone writing a lot of numbers in their message but it looks like we cannot avoid that)
@ZephyrSigmar: Then I will replace 1 eith l, 0 with O, maybe 3 with E, 4 with A, ... xD But this is going off topic and there is a plugin from @Wolfy9247.
You just use a RegEx filter to delete anything that's not a number or dot and if it matches it then it'll do the specified action. There's really no way to check (without a lot of complications) a long string of numbers to match any valid IPv4 address and/or format of one.
How about not allowing new users to chat at all until they pass a test, just solved every verbal abuse, idiot question, spamming problem. pex+modifyworld = win
You could just use regex and see if text matches the pattern. A pattern you could use if anyone is interested in doing this String pattern = "(\\d{1,3}\\.){3}(\\d{1,3})"; It may not be exactly right, you may want to test it.
It *should* be compatible with it, but I can't gurantee you 100%. Try it out! If it doesn't, I can try and implement the HeroChat API with it, if it's up to date now, since last time I checked HC hadn't updated. Either way, to discuss that further PM me or respond to the topic itself. Thanks!
OP's get around the filters by default, if you look at my plugin there are in-fact permission nodes though.