NameBlacklister - Punish people for having names you don't want!

Avatar

By Stealth_^ 12 Jul 2016 21:18

Member · 55 comments

NameBlacklister - Punish people for having names you don't want!

Author: stealth_^

Usage:


This bot will kick clients out of your server who have names you don't want. It checks on every connect, and also checks after a certain amount of time. It is very versatile and allows for editing almost every feature within the plugin.

Installation


  • Download the Latest version of NameBlacklister
  • Put the plugin in your plugins folder
  • Start the bot - a configuration will be generated for you that's where you will add blacklisted names
  • After configuring the plugin - restart your bot

Example Configuration

[Settings]
#Message that will be in the kick reason for having an illegal name
kickMessage = Kicked for having the following in your username\:
#Time in seconds the plugin will check usernames. Default = 60 seconds
timer = 60
#See what the plugin is doing
debug = false

[Names]
#If client's username CONTAINS the following string, they will be punished
name = bob
name = joe
name = smith

Source Code


GitHub

Changelog


Version 1.0.2 - Fixed crucial bug where plugin would do nothing /fail
Version 1.0.1 - Changed Timer to use getTasker method instead.
Version 1.0 - Initial Creation

Last edited by Stealth_^ (13 Jul 2016 09:53)

Avatar

By Scrumplex 13 Jul 2016 00:20

Admin · 2,147,483,647 comments

EDIT: Sorry for the long post
Hey there,
thanks for the plugin submission. That plugin is well coded and has a good functionality. But I have one thing you should improve.

Because Java cannot completely unload a plugin, the Sprummlbot has to let the JVM think, that all classes of unloaded plugins do not exist. The Java garbage collector checks for those "non existent" classes and completely removes them from classpath, if they are not in use. But, if you start a Timer in your plugin, the JVM won't unload the class and the Sprummlbot won't be able to stop that timer. So there are some options.

The easiest, but not recommended way: Stop the timer in the onDisable() method.
Not recommended, because timers in java are old and likely deprecated. They have been replaced by ExecutorServices.

The other way, which is also easy:
Instead of creating own timers, use the ones, the Sprummlbot provides. These get automatically shut down, if your plugin gets unloaded.
Basic usage:

getTasker().createScheduledTimerRunnable(new Runnable() {
 @Override
 public void run()  {
   //do what you want
 } 
}, delay, tick, TimeUnit.SECONDS) ;

//Could contain mistakes. Completely written on a phone...


The Developer of the Sprummlbot and the Admin of this forum.

Avatar

By Stealth_^ 13 Jul 2016 09:32

Member · 55 comments

Thanks for the suggestion! It completely makes sense, and with that, it's also nice to know about the getTasker Method! I have updated the plugin's source as well as the Latest Release link.

Avatar

By Scrumplex 13 Jul 2016 15:11

Admin · 2,147,483,647 comments

One thing: The Sprummlbot.jar is included in the jar file of your plugin. Just remove it completely from the artifact. You don't need to add the Sprummlbot to the classpath. The Sprummlbot adds your plugin to his classpath.


The Developer of the Sprummlbot and the Admin of this forum.