VoteSQL
VoteSQL [Requires Votifier!]
Version: 1.4
Craft Bukkit 1.5.1-R0.2
This plugin logs player votes to a MySQL table or a Flat-File! While your at it you might as well go ahead and add a custom message with colors for when they vote! Also, it logs the amount of times they vote in numerals. This can be used to set up a stats php page or something :).
Video
Soon!
Features
- Logs votes to a SQL table
- Config
- SuperPerms support
- Plugin Metrics
- Now can log with Flat-File Support!
- Make your own custom messages with colors and such!
- Gives money on vote!
Demo
Config
# Thanks for choosing VoteSQL! Simply change the info below. The FlatFileListener on the first vote may not record it! VoteSQL: onVote: Enabled: false # %P = Player Name %S = The Site they voted from! Message: '&2Thank you for voting %P from %S!' MySQL: Enabled: false Server: Server Address eg.Localhost Database: Place Database name here User: Place User of MySQL Database here Password: Place User password here Table_Prefix: votesql FlatFile: Enabled: false currency: Enabled: false Amount: 150 # %P = Player Name %M = Money received. Message: '&2%P, You received %M dollars!'
If some config options are not coming up delete the config and restart the server!
Commands
- /votesql - Displays help page
- /votesql reload - Reloads config.
- /votesql check <string> - Adds to the database with a vote of 1
- /votesql top - Shows the top 5 voters.
Permissions
- votesql.reload
- votesql.check
- votesql.top
Planned
- User Suggestions.
- Adding the Auto-Updater Option!
- Adding in game commands for leader-boards (Top 5 players and such! Amount will be Configurable)! See your individual placing and also your amount of votes you have!
Adding Vault support so they can receive money!- Give items on vote
Change Log
To see the change-log go on the files tab and click on the version to read any info on it!
Source
https://github.com/javoris767/VoteSQL
Metrics
Bugs
Find any? Please submit a ticket and post errors in a gist! Link to gist: https://gist.github.com/
PHP Code
<?PHP $user_name = "USERHERE"; $password = "PASSWORDHERE"; $database = "DATABASEHERE"; $server = "SERVERIPHERE"; $db_handle = mysql_connect($server, $user_name, $password); $db_found = mysql_select_db($database, $db_handle); if ($db_found) { $SQL = "SELECT * FROM votesql ORDER BY votes DESC"; $result = mysql_query($SQL); $value = 1; while ($db_field = mysql_fetch_assoc($result)) { print "<tr>"; print "<td>" . $value . "</td>"; print "<td>" . $db_field['playername'] . "</td>"; print "<td>" . $db_field['votes'] . "</td>"; $value = $value + 1; print "</tr>"; } mysql_close($db_handle); } else { print "Database NOT Found "; mysql_close($db_handle); } ?>
Donate
Donations are greatly appreciated :)
@Bugger56
anyone with this error please note; the creator made a mistake and the 'commands' section needs %p in lower case instead of %P
The give command does not work... It says cannot find %P...
I'm getting a rather unspecific error when using this and restarting the server:
CONSOLE: [SEVERE] Error occurred while enabling VoteSQL v1.4 (Is it up to date?)
It is indeed up to date. It also keeps logging things as usual, so I'm not sure what's up.
EDIT: After looking at my detailed logs, I found more on the subject:
java.lang.NullPointerException at me.javoris767.votesql.utils.VoteSQLAPI.loadDataFile(VoteSQLAPI.java:153) at me.javoris767.votesql.utils.VoteSQLAPI.<init>(VoteSQLAPI.java:45) at me.javoris767.votesql.VoteSQL.onEnable(VoteSQL.java:24) at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217) at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457) at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:382) at org.bukkit.craftbukkit.v1_6_R2.CraftServer.loadPlugin(CraftServer.java:286) at org.bukkit.craftbukkit.v1_6_R2.CraftServer.enablePlugins(CraftServer.java:268) at net.minecraft.server.v1_6_R2.MinecraftServer.l(MinecraftServer.java:319) at net.minecraft.server.v1_6_R2.MinecraftServer.f(MinecraftServer.java:296) at net.minecraft.server.v1_6_R2.MinecraftServer.a(MinecraftServer.java:256) at net.minecraft.server.v1_6_R2.DedicatedServer.init(DedicatedServer.java:164) at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:397) at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
But again, it still does logs things just dandy.
Im getting to following errors, I have entered in the SQL information correctly, using 1.4.7 version.. not sure what is the problem: using the default config other than changing sql to true and entering the connection information.
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 2013-06-29 23:28:10 [INFO] [VoteSQL] Vote Passed! 2013-06-29 23:28:22 [SEVERE] com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 2013-06-29 23:28:22 [SEVERE] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 2013-06-29 23:28:22 [SEVERE] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at java.lang.reflect.Constructor.newInstance(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.Util.handleNewInstance(Util.java:407) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:343) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2334) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2371) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2163) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) 2013-06-29 23:28:22 [SEVERE] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 2013-06-29 23:28:22 [SEVERE] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at java.lang.reflect.Constructor.newInstance(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.Util.handleNewInstance(Util.java:407) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:378) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305) 2013-06-29 23:28:22 [SEVERE] at java.sql.DriverManager.getConnection(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at java.sql.DriverManager.getConnection(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at me.javoris767.votesql.commands.VoteSQLCommand.handleVoteMySQL(VoteSQLCommand.java:85) 2013-06-29 23:28:22 [SEVERE] at me.javoris767.votesql.commands.VoteSQLCommand.onCommand(VoteSQLCommand.java:38) 2013-06-29 23:28:22 [SEVERE] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) 2013-06-29 23:28:22 [SEVERE] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:186) 2013-06-29 23:28:22 [SEVERE] at org.bukkit.craftbukkit.v1_4_R1.CraftServer.dispatchCommand(CraftServer.java:549) 2013-06-29 23:28:22 [SEVERE] at org.bukkit.craftbukkit.v1_4_R1.CraftServer.dispatchServerCommand(CraftServer.java:535) 2013-06-29 23:28:22 [SEVERE] at ho.al(DedicatedServer.java:353) 2013-06-29 23:28:22 [SEVERE] at ho.r(DedicatedServer.java:310) 2013-06-29 23:28:22 [SEVERE] at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:746) 2013-06-29 23:28:22 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:633) 2013-06-29 23:28:22 [SEVERE] at fy.run(ThreadMinecraftServer.java:16) 2013-06-29 23:28:22 [SEVERE] Caused by: java.net.ConnectException: Connection refused: connect 2013-06-29 23:28:22 [SEVERE] at java.net.DualStackPlainSocketImpl.connect0(Native Method) 2013-06-29 23:28:22 [SEVERE] at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at java.net.AbstractPlainSocketImpl.connect(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at java.net.PlainSocketImpl.connect(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at java.net.SocksSocketImpl.connect(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at java.net.Socket.connect(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at java.net.Socket.connect(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at java.net.Socket.<init>(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at java.net.Socket.<init>(Unknown Source) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:254) 2013-06-29 23:28:22 [SEVERE] at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:292) 2013-06-29 23:28:22 [SEVERE] ... 25 more
I've been using this for the past two weeks, and it's working absolutely awesomely! The only thing I've thought of that it could use is a random item reward feature. Adding that would make it the only vote listener I need!
Edit: I also just remembered an issue when using the /broadcast command with this. It doesn't work and shows %P instead of the player's name.
/votesql top isnt listing any names is this still in development?
Also when both command and money are enabled the command is not working.
When players are offline will they still get paid?
Looks like this could replace JCVaultlistener and Flatfilevotelistener im very intrigued but does it work with things like Essentials Group Manager and EssEco?
When the video is comming?
When a player votes while there offline, the console gives some errors (I don't have them right now, sorry) it shows the message saying the player voted but doesn't count it to the database or give them money. I'm guessing you get the vote from the vote data, then send the notification, then grab the username from the server again, that's all I can think of ( I'm not that great but I can figure things out ) thanks.
Got the command list working :P All I gotta do is fix the memory leak.
Please update. It seems there are some bugs.
Version 1.4 "Adding Commands on vote (May not work)" - Confirming that it doesn't and I would really like it to!
Though I'm sure you already know this: It seems to just send the %S and %P to the console instead of actually passing the website or players name.
So if I have a command for "say Thanks %P for voting on %S" it will actually say "Thanks %P for voting on %S" instead of "Thanks erilidon for voting on bukkit.org"
Also if you get this working would it be possible to have a list of commands and have it randomly choose from them? Thanks!
@ImToRich Sure add me on skype: javoris767
Can anyone help me set this up?
Hello,
Can I talk to the creator of this plugin over email or Skype?
Many thanks
~ Jamie
I see items on vote is planned, I would really like that! Posibly, the ability to just run a custom command?
HI javoris,
Votesql seems to cause some bad timings ;)
Could you have a look?
http://aikar.co/timings.php?url=5664399
VoteSQL v1.3 Total: 0.353 s Pct: 0.00%
Pct Total Pct Tick Total Avg Count Vio Event
0.00% 100.73% 0.353 s 50.3667 ms 0.01k 1.19% VotifierEvent
Votifier v1.9 Total: 0.353 s Pct: 0.00%
Pct Total Pct Tick Total Avg Count Vio Event
0.00% 100.77% 0.353 s 50.386 ms 0.01k 1.19% Task: Single
@Minecraftian_Servers
The rewards will be given to 1 server only due to the vote being called to 1 server. So, no. I might consider researching that a bit.
Just some questions before I try this plugin.. will this plugin work just as VoteSend but better? Will this plugin make it so if a person vote on 1 server the votes gets sent to the other servers using mySQL?
Mhm, its not building the table here, could you fix tha?
http://www.unitedfactions.com/votesql.php
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);
if ($db_found) {
$SQL = "SELECT * FROM votesql_ ORDER BY votes DESC";
$result = mysql_query($SQL);
$value = 1;
while ($db_field = mysql_fetch_assoc($result)) {
print "<tr>";
print "<td>" . $value . "</td>";
print "<td>" . $db_field['playername'] . "</td>";
print "<td>" . $db_field['votes'] . "</td>";
$value = $value + 1;
print "</tr>";
}
mysql_close($db_handle);
}
else {
print "Database NOT Found ";
mysql_close($db_handle);
}
?>