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.
- 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: 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
- whitelist.admin - Gives players access to any of the /whitelist commands.
- whitelist.[command] - Gives players access to specific commands.
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.
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;
If you want to use MySQL, you might need the MySQL Connector/J. It can be found here.
- 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.
Okay, I am officially a dummy because I apparently overwrote that line with the last one you gave me, the one for listing the database. I put it back and it is working! I've tested it on three accounts and they are all connecting if they are registered. Then I removed one from the website and they couldn't connect.
This is great! This is a great plugin. Thank you so much for making this work. I may finally be able to open my server soon.
If you have a Steam account, I would like to give you some games for helping me. Look me up under the same name and tell me who you are. I have these for you. They may be on sale now but usually costs about $23. Not BF3 but pretty fun gaming.
Includes 3 items: Renegade Ops, Renegade Ops - Coldstrike Campaign, Renegade Ops - Reinforcement Pack
Almost perfect. Two things:
1) Can I get more than one line in the kick message? I need about three. How can I format this?
2) Any way around the fact that WP is adding new users to the database before the user has confirmed registration via email? Right now, they only have to register and are instantly on the whitelist with never having to confirm. This means they could put a bogus email in :(
It still appears that I still can't add a player with the 'whitelist add' command. This is not as big a deal as long as the site registration is working, but would be nice.
Can you paste your latest "sql-query=SELECT ... " option here again? That error makes it look like the query is empty.
Yes, I had it on because I was using it. I also saw a tutorial video on this plugin that stated it needed to be set to "true" to work.
I have turned it off and restarted the server. I got someone to try and join who is registered on my WP site. They still get "You are not on the whitelist". Here is the console:
2012-07-19 15:17:32 [INFO] Whitelist: Player WinstonWolfe is trying to join...
2012-07-19 15:17:33 [INFO] Whitelist: SQLException: Can not issue empty query.
2012-07-19 15:17:33 [INFO] Whitelist: SQLState: S1009
2012-07-19 15:17:33 [INFO] Whitelist: VendorError: 0
2012-07-19 15:17:33 [INFO] kick!
2012-07-19 15:17:33 [INFO] Disconnecting WinstonWolfe [/184.108.40.206:52603]: Sorry, you are not on the whitelist!
And here is the 'dblist' showing he is indeed in the database:
2012-07-19 15:18:38 [INFO] bigdude
2012-07-19 15:18:38 [INFO] blindwolf
2012-07-19 15:18:38 [INFO] creeperman1010
2012-07-19 15:18:38 [INFO] da-fort
2012-07-19 15:18:38 [INFO] dillonbmx
2012-07-19 15:18:38 [INFO] dr-bonesaw
2012-07-19 15:18:38 [INFO] palerider365
2012-07-19 15:18:38 [INFO] te5la
2012-07-19 15:18:38 [INFO] winstonwolfe
I've searched this error. Does any of this seem like a possible solution? Could this have something to do with the java thing?
P.S. what is it with these "Markup Types" in this forum? They all look like the format from hell.
Do you by chance have the server built in whitelist enabled? Make sure your server.propertires has "white-list=false". The server whitelist will take precedence over the whitelist plugin.
Yes, dblist works. Can we assume my connection is good? I'll have to test the other stuff, don't have time right now.
Still can't connect even if I'm on the physical whitelist.txt Can't add players:
2012-07-19 09:40:09 [INFO] Whitelist: SQLException: Can not issue empty query.
2012-07-19 09:40:09 [INFO] Whitelist: SQLState: S1009
2012-07-19 09:40:09 [INFO] Whitelist: VendorError: 0
2012-07-19 09:40:09 [INFO] Could not add player "BigDude"
Add this to your whitelist.properties file and download the latest test version from here.
I added a command "/whitelist dblist" that will run the query from sql-query-list and return all of the results. This will effectively tell you if it can access the database and see all of the users.
Okay, here is a dumb idea. Is there a query we can put in the properties file that would perhaps display a list of the users in the user_nicename column? There are only a few. Wouldn't this determine if it's actually accessing the database?
Not sure how to do that but I've been speaking with my hosting tech support and they don't see where the plugin is connecting to the database.
One thing, if this makes a difference: The MySQL database is not on the same server as the Minecraft server. Does the plugin care where the MC server is? With this line:
sql-query=SELECT user_nicename FROM wp_users WHERE user_nicename\='<%USERNAME%>'
How does it know where to be looking for the database? Is it supposed to be actively connected already via the "driver-connection" line?
Also, when this is connecting, does it need to use the password for FTP/SSH or MySQL? Because those are different passwords.
The <%USERNAME%> is a special token used by the plugin. It replaces that with the username to build the select statement to query the database. When you do your test just out the actual username instead of <%USERNAME%>.
What is the <%USERNAME> related to in the sql-query? Is that for your plugin? It doesn't seem to be used in WP.
I recommend not using the /reload command. I haven't had time to verify that the plugin works correctly with a /reload. A clean stop and start is best.
The whitelist.txt is used in addition to the mysql database. Any time a user is added to the txt file the plugin adds the user to the in-memory whitelist. If a person tries to join the MC server the plug in will check the txt file and the mysql database.
I think what you need to do is use a commnnd line mysql tool to verify that your select statement is accurate.
Okay, now you've lost me. What is the whitelist.txt file for then? I removed myself (only one on it) and I can still login, but I have another account and registered it on my WP site and that user can't login.
To be sure, I asked another person to try. They registered and can't login either. Whatever is supposed to happen, it isn't working with MySQL.
Actually, I was able to login after removing myself only because I didn't restart the server. When I did, I can no longer login.
And since I rebooted, it no longer complete reloading (Whitelist) and I can't add a user from the console.
Okay, this is interesting: If I do a reload, it doesn't complete. I can't add a user. If I add the user to the list maually, they still can't login. Everything that was working earlier isn't now. The only thing working now (that never worked before) is 'whitelist list'.
That is exactly correct. The plugin will not add users to the txt file automatically as they are added to the database. Instead the plugin will just check the database each time a player logs on. To test this just create a user account on WP that matches your minecraft username. Then delete your name from the txt file and try to log on. It should work.
So, if after a player registers and I look at the whitelist.txt file, I should not see it in the list?
That looks good.
By default the add command will just add users the to the whitelist.txt file. If you have SQL enabled the add command will attempt to add to the database. If someone is added to the database, like signs up on WP, the plugin will not automatically reload. There will be no message on the console. The only indication it works is when a player tries to log on. When the player logs on the plugin will run the select against the database to see if the player is valid.
The trick to making this work with WP is that the "nice name" should match the player's username.
I got this with the "verbose" version (edited my personal stuff):
2012-07-18 22:19:49 [INFO] Whitelist: Trying to load whitelist and settings...
2012-07-18 22:19:49 [INFO] Reading whitelist.txt
2012-07-18 22:19:49 [INFO] Adding TE5LA to allow list.
2012-07-18 22:19:49 [INFO] Reading whitelist.properties file.
2012-07-18 22:19:49 [INFO] Kick Message: Sorry, you are not on the whitelist!
2012-07-18 22:19:49 [INFO] Admin: TE5LA
2012-07-18 22:19:49 [INFO] List Command: false
2012-07-18 22:19:49 [INFO] Use SQL: true
2012-07-18 22:19:49 [INFO] SQL Driver: com.mysql.jdbc.Driver
2012-07-18 22:19:49 [INFO] Connect String: jdbc:mysql://myuser.site.nfoservers.com/xtc_homefront?user=MyUserName&password=*********
2012-07-18 22:19:49 [INFO] Select Query: SELECT user_nicename FROM wp_users WHERE user_nicename='<%USERNAME%>'
2012-07-18 22:19:49 [INFO] Add Query:
2012-07-18 22:19:49 [INFO] Remove Query:
2012-07-18 22:19:49 [INFO] SQL Driver Jar: lib/mysql-connector-java-5.1.21-bin.jar
2012-07-18 22:19:49 [INFO] done.
2012-07-18 22:19:49 [INFO] Settings and whitelist reloaded
I noticed it said list=false, but in properties it is "disable list=false".
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
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.
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)?
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.
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.
I fixed a bug in the the "/whitelist list" command. Please try this version. http://dl.dropbox.com/u/30679730/Whitelist.jar