AutoWhitelist
About AutoWhitelist
This is a continuation of the Whitelist plugin originally written by Silencium20. This plugin will automatically reload your whitelist when players are added to the whitelist file. This plugin will connect to Mojang servers for UUID lookups.
Features
- AutoWhitelist is automatically reloaded when changed outside of Minecraft (e.g. with a text editor)
- AutoWhitelist supports console commands
- SQL support
- Support for every SQL database that has a JDBC implementation available
- User-defined table and database layouts supported
- Ampersand color codes in the kick message. (&4 = red etc...)
- UUID support.
How to install
- In your server.properties file set whitelist to false.
- Drop the jar file in your plugins directory and restart your server.
Commands
Commands: These commands can be used by Ops ingame or in the server console. When used with the server console don't type '/' before the command.
- /whitelist help - Shows the help ;-)
- /whitelist reload - Reloads the whitelist and it's settings
- /whitelist add [playername(s)] - Adds a player to the whitelist)
- /whitelist info [playername] - Display information about a player
- /whitelist remove [playername(s)] - Removes a player from the whitelist)
- /whitelist on|off - Activates/deactivates the whitelist
- /whitelist list - Lists all whitelisted players (from txt file)
- /whitelist dblist - Lists all whitelisted players (from DB)
- /whitelist dbdump - Dumps users from database to whitelist.txt file
Permissions
- whitelist.admin - Gives players access to any of the /whitelist commands.
- whitelist.[command] - Gives players access to specific commands.
Basic Configuration
See config.yml
SQL Configuration
To support as many different database configurations as possible, Whitelist sets flexibility over simplicity. This way virtually every existing database can be used as a base for authentification.
Table Creation
The plugin will not automatically create tables for you. Below are a couple examples to get you started.
If you want to use UUIDs you can do something like this.
CREATE TABLE IF NOT EXISTS `tbl_users` ( `name` varchar(256) NOT NULL, `uuid` varchar(256) NOT NULL, `oper` varchar(256) NOT NULL, `time` varchar(256) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Or more basic without UUIDs.
CREATE TABLE IF NOT EXISTS `tbl_users` ( `name` varchar(256) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Dependencies
If you want to use MySQL, you might need the MySQL Connector/J. It can be found here.
Source
https://github.com/cnaude/Whitelist
Change Log
- v3.5-32
- Add DB reconnect logic.
- Update for MC 1.10.2.
- Info command should always respond.
- v3.5-26 - May 7, 2015
- Update for MC 1.8.3.
- v3.5-24 - February 20, 2015
- Don't allow null uuid when adding players.
- Automatically remove players with null uuid from json.
- NPE fixes.
- v3.5-22 - February 14, 2015
- Add support for offline mode.
- v3.5-20 - January 26, 2014
- Add support for UUID in SQL mode.
- v3.5-17 - September 1, 2014
- Fix player add message.
- Fix remove command.
- Make commands more verbose.
- v3.5-15 - August 27, 2014
- Add UUID support (whitelist.json)
- v3.4 - May 15, 2014
- Add %NAME% token for kick message.
- v3.3 - March 27, 2013
- Add dbdump command.
- v3.2 - October 11, 2012
- Changed from whitelist.properties to config.yml
- Fixed the list command
- Added dblist command
- v2.7b - June 15, 2012
- Added color code support. Use ampersand color codes in the kick message.
- v2.7a - June 12, 2012
- Initial version.
- Added support for CB 1.2.3-R0.1 and higher.
@cnaude
Should I try it? I removed the entire plugin, restarted the server, then put the plugin back and it seems to work now (from the console). I was able to add myself to the whitelist:
whitelist add te5la
This produced:
-------------------
2012-07-18 22:06:05 [INFO] Player "TE5LA" added
2012-07-18 22:06:06 [INFO] Whitelist: Whitelist.txt was updated. Whitelist was scheduled for reloading.
-------------------
(and I can login)
I then did: 'whitelist reload' and got:
--------------------
2012-07-18 22:06:24 [INFO] Whitelist: Trying to load whitelist and settings...
2012-07-18 22:06:24 [INFO] done.
2012-07-18 22:06:24 [INFO] Settings and whitelist reloaded
2012-07-18 22:09:03 [INFO] Whitelist: Executing scheduled whitelist reload.
2012-07-18 22:09:03 [INFO] Whitelist: Trying to load whitelist and settings...
2012-07-18 22:09:04 [INFO] done.
---------------------
Whitelist list is still saying "disabled".
I will try to add someone from WP.
{Edit}
No, it isn't working in WP. When it does, shouldn't it add the player and reload instantly? And you could see this in the console? Does it add as soon as player registers or does it wait until they return email verification (if you have that enabled)?
@TE5LA
I just uploaded another version to the same dropbox url. It will display a bunch of text on startup now. It should help isolate the problem.
@cnaude
No difference except now I can't login at all even though I'm admin and on the whitelist.
I appreciate your diligence in trying to get this to work for me. This would be one of the best plugins if I can get it nailed down.
@TE5LA
I fixed a bug in the the "/whitelist list" command. Please try this version. http://dl.dropbox.com/u/30679730/Whitelist.jar
@cnaude
Yes, I did that and I still get:
------------------
2012-07-18 21:06:40 [INFO] Whitelist: Trying to load whitelist and settings...
------------------
Which never continues. I did "whitelist on" (I had never set it to off) and at least players on whitelist can connect.
I'm wondering why it suddenly stopped completing the reload.
I've noticed now that I can't add a player from the console either. This worked before.
I'm listing the code again so you can see if I messed up some syntax from before I'm not seeing:
--------------------
#Auto generated config file, please modify
#Wed Jul 18 00:31:48 EDT 2012
kick-message=Sorry, you are not on the whitelist\!
disable-list-command=false
whitelist-admins=TE5LA
sql-enable=true
sql-driver=com.mysql.jdbc.Driver
sql-driver-jar=lib/mysql-connector-java-5.1.21-bin.jar
sql-driver-connection=jdbc\:mysql\://myuser.site.nfoservers.com/myWPdatabase?user\=myUsername&password\=myPassword
sql-query=SELECT user_nicename FROM wp_users WHERE user_nicename\='<%USERNAME%>'
@TE5LA
The list command is disabled when the mysql select fails.
Change this:
To this:
There is no need to add anything to the database. I tested this with my own WP install and it worked fine with the default table structures.
@cnaude
This is my entire file:
------------------------------------------------------------------------------
#Auto generated config file, please modify
#Wed Jul 18 00:31:48 EDT 2012
kick-message=Sorry, you are not on the whitelist\!
disable-list-command=false
whitelist-admins=TE5LA
sql-enable=true
sql-driver=com.mysql.jdbc.Driver
sql-driver-jar=lib/mysql-connector-java-5.1.21-bin.jar
sql-driver-connection=jdbc\:mysql\://user.site.nfoservers.com/WPdatabase?user\=**username**&password\=**password**
sql-query=SELECT name FROM wp_users WHERE user_nicename\='<%USERNAME%>'
----------------------------------------------------------------------------------------------------
I'm pretty sure I need to add a table or column to the database, just not sure how. I'm using phpMyAdmin, Windows Version 3.5.1. Maybe someone could "tutorial" me through it. In the meantime, I will try to hack it out, just don't want to blow my database.
And look at the line: disable-list-command=false
Shouldn't that mean the list command is enabled? But it says disabled when I use it (from console).
Hmm? Now it's giving this on reload and it's not letting on users even if they are already on the whitelist:
--------------------------
2012-07-18 21:00:16 [INFO] Whitelist: Trying to load whitelist and settings...
--------------------------
And I haven't changed anything since the last post.
@TE5LA
Definitely getting close. I think you're just selecting the wrong column. What does your "sql-query=" line look like?
SQLException: Unknown column 'name' in 'field list'
This this:
@cnaude
I believe I'm getting closer. When I do "whitelist reload" now, I get this:
--------------
2012-07-18 14:38:25 [INFO] Whitelist: Trying to load whitelist and settings...
2012-07-18 14:38:25 [INFO] done.
2012-07-18 14:38:25 [INFO] Settings and whitelist reloaded
--------------
Looks good?
When I register a player on WordPress, I see nothing in the console. Should I? The player isn't being added to whitelist and the console says:
---------------
2012-07-18 14:25:53 [INFO] Whitelist: Player BigDude is trying to join...
2012-07-18 14:25:54 [INFO] Whitelist: SQLException: Unknown column 'name' in 'field list'
2012-07-18 14:25:54 [INFO] Whitelist: SQLState: 42S22
2012-07-18 14:25:54 [INFO] Whitelist: VendorError: 1054
2012-07-18 14:25:54 [INFO] kick!
---------------
When I do "whitelist list", I get:
---------------
2012-07-18 14:39:51 [INFO] List command is disabled!
---------------
@TE5LA
I don't think you want to use the insert and remove. The select, however, should work. You could do something like this. This is assuming you left the default "wp_" tablename prefix.
The error you have appears to be from the mysql server not being reachable.
@cnaude
It would be lurrrrvly if you could help me get this working. I know the MySQL DNS, username, password, and database name for my WordPress website, which is hosted by the same company as my Minecraft server. I'm just not sure exactly how to enter it. I've tried modifying the lines you have here but I'm not getting it. Will I need steps 5 and 6?
This is what I'm getting. I know I have something wrong (maybe several somethings) and I need help with phpMyAdmin setting up the tables and queries, not real big on that.
@TE5LA
It is capable of that. Just modify the config file to use the same database.
How do you add this to a forum or application like WordPress so people registering will be added to a whitelist? Does this do this? If not, I'm not seeing the real value.
@RalphORama
I just noticed one other thing.
Change this:
To this:
@cnaude
I don't think this password is too complicated for it, all it has is letters (capital and lower case) and numbers.
@RalphORama
Another thing you can try is changing the database user password. Make sure it has no special characters. The connection string is very sensitive to special characters.
@cnaude
Still getting the
Error.
My current config:
@rodier
This should work as is. You would just need to include MSSQL jar file at runtime. Either by adding it to the whitelist.properties or adding it to the classpath.
@RalphORama
I think i see the problem.
This
Should be this
@cnaude
Still getting the same error. I put the line in so it looks like this:
Should I put it above the sql-driver line?