New Update to the plugin
In the next day I am adding a feature that will allow players to vote IN GAME simply by typing /vote. The vote will be sent back to the list site vote page for that server and the vote can then be recorded. A "key" will be generated by the plugin that should be used to authenticate the votes.
More details to follow.
The NEW and Greatly Improved Votifier! RPGVotifier or Votifier2 OPEN BETA TEST
I have released 2 versions of the plugin.. these are BETA releases!
One for 1.6.4-1.7.2 and one for 1.2.5 (Tekkit)
Please report any difficulties.
It will be RE STARTED now!!!!
IF YOU HAVE A LIST ENGINE AND WANT TO IMPLEMENT THIS PLUGIN: Send me a message and I will be happy to help you put the vote page together.
Why this was done
As we all know, Votifier is pretty much outdated and dead.. It is unstable and unreliable. Recently I was contacted to either fix the old one or make a new one. I opted to make a new version, that is easier to use, more verbose and very easy to implement.
Notes about Security
A few people have expressed concern about not using AES and only using a password. If you do as well ask yourself what exactly is that encryption is protecting. The answer is nothing important. Aside from encrypting pointless data the AES encryption of the old votifier acted as sort of an authentication system for votes.
For both of those roles it was overkill and pointless, but for the old version it was needed because the old version did not protect itself from false votes, in fact if a player managed to get the public key they could vote as much as they wanted to.
So in this plugin the simple password does nothing more than authenticate an actual vote, as much as it can, and honestly it really is not needed. This plugin protects itself with an authentication system and a time based vote rule, which you can read about below.
I have also been told that this program is a possible exploit for bad voting or vote flooding. To those who think that let me assure you that ANY public IP with a listener of any sort, thats exposed to the cloud is or can be a target, just like the game server/port.
This plugin will NOT accept votes on a server for any player that has not played, so trying to flood it with fake names won't work.
When the protection is on it will reject all votes that have not waited the hours required for a new vote, they are also simply rejected.
In other words can this IP/Port be attacked.. well YES just like any other public IP/Port. It is no more or less vulnerable than any other.
Encryption is POINTLESS.. What are you trying to hide? A username seriously....?
Anyway thats all for now, if you have more question feel free to PM me or post them below in the comments.
Key Features
- NO MORE Public Key encryption, it was pointless and stupid. Instead we will just use a password.
- This Votifier is completely thread based it launches the socket listener in its own thread and when a vote comes in the handler is also launched on a separate thread.
- It implements a Sentry thread that "watches" the listener thread and will restart it if it is lost, dead or becomes unstable.
- It saves votes, so if the player votes offline and is a player on the server it will remember them so when they next log in they can collect the rewards.
- No more listeners! As a threaded application RPGVotifier also handles the player rewards as defined by a simple config file.
- Rewards also do an inventory check. Before giving the rewards to a player their inventory is checked for space. If not enough exists the player is asked to clear their inventory and try again.
- Slash commands with perm nodes were added to allow a use to see if they have rewards waiting ad to collect them. Op's can add or remove votes via slash commands as well.
- RPGVotifier implements a protection system, based upon player name to prevent abuse. This is an option you can set to allow voting after so many hours (0-???). Setting this to 0 turns off the feature. If a vote comes in and this is on it will check to be sure the player name has not voted in the set time frame.
I have also implemented a verbose response system so server lists can get detailed information about the vote as well as modes in which to send the vote.
Vote Modes
- normal: Normal rewards, if not online the rewards are saved and can be collected when the player returns.
- test: Return validation of connection and password
Vote Packet
[For listing site owners]
packet structure [mode:vote_site:player_name:password] as string.
You build the packet from strings. There is no set length however all four parts must be present, and separated with a colon(:)
Example Vote Packet
"normal:pixelmonservers.info:boduzapho:MyStr0ngpa55w0rd"
Vote Response Messages
- Bad Packet
- Bad Password
- Bad Vote Mode
- Test success
- No Such Player
- User Already Voted
- Vote processed okay
Misc.
There is much more and I will add to this later. The plugin is almost done testing and when i release it Ill will provide code samples for the following languages to use it (Its less complicated and less code than the old Votifier scripts):
- .Net C#
- .Net VB
- PHP
- Python
Also Database integration is VERY simple to do.
Thats all for now I will be adding more later.
How to send votes
* I am looking for a PHP person to convert this to PHP
If you want to help the community by sending me a conversion of the code below to PHP, that would be very helpful! Also conversion to any other relative languages would be very helpful as well.
In these examples, IP.Text and IPPort.Text are variables that represent the IP/Port to send the vote to. You can easily pass them to these functions as parameters or use a Public Variable in their place.
THESE EXAMPLES WERE A DIRECT CONVERSION!
YOU WILL OBVIOUSLY HAVE TO CHANGE SOME OF THE CODE BELOW, IT IS HERE TO GET YOU STARTED!
C# Example
Vote.Click += SendVote; public void SendVotesender, EventArgs e { byte[] bytes = new byte[1025]; IPAddress ipAddress = ipAddress.Parse(IP.Text); IPEndPoint remoteEP = new IPEndPoint(ipAddress, IPPort.Text); Socket sender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { sender.Connect(remoteEP); byte[] msg = Encoding.ASCII.GetBytes(IPsend.Text.Trim + Environment.NewLine); int bytesSent = sender.Send(msg); int bytesRec = sender.Receive(bytes); Session("RES") = Encoding.ASCII.GetString(bytes, 0, bytesRec); sender.Shutdown(SocketShutdown.Both); sender.Close(); } catch (Exception ex) { Session("RES") = "Failed to connect, Check the settings for IP and Port."; } }
Java Example
private Vote.Click += SendVote; public final void SendVotesender, EventArgs e { byte[] bytes = new byte[1025]; IPAddress ipAddress = ipAddress.Parse(IP.Text); IPEndPoint remoteEP = new IPEndPoint(ipAddress, IPPort.Text); Socket sender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { sender.Connect(remoteEP); byte[] msg = Encoding.ASCII.GetBytes(IPsend.Text.Trim + Environment.NewLine); int bytesSent = sender.Send(msg); int bytesRec = sender.Receive(bytes); Session("RES") = Encoding.ASCII.GetString(bytes, 0, bytesRec); sender.Shutdown(SocketShutdown.Both); sender.Close(); } catch (RuntimeException ex) { Session("RES") = "Failed to connect, Check the settings for IP and Port."; } }
VB.net Example
Public Sub SendVote() Dim bytes(1024) As Byte Dim ipAddress As IPAddress = ipAddress.Parse(IP.Text) Dim remoteEP As New IPEndPoint(ipAddress, IPPort.Text) Dim sender As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) Try sender.Connect(remoteEP) Dim msg As Byte() = Encoding.ASCII.GetBytes(IPsend.Text.Trim & vbNewLine) Dim bytesSent As Integer = sender.Send(msg) Dim bytesRec As Integer = sender.Receive(bytes) Session("RES") = Encoding.ASCII.GetString(bytes, 0, bytesRec) sender.Shutdown(SocketShutdown.Both) sender.Close() Catch ex As Exception Session("RES") = "Failed to connect, Check the settings for IP and Port." End Try End Sub
The BETA has been sent in for Approval
If you wish to beta test, you will need a Bukkit 1.6.2-1.6.4 Bukkit server or a compatible Forge or MCPC+ server.
For sending a vote you have TWO options.
1. Build a send vote page using the code above
2. Visit http://pixelmonservers.info/V2.aspx and use the public test form.
VOTE PACKET EXAMPLES
Normal vote: "normal:Pixelmonservers.info:boduzapho:w3s0m3pa55w0rd"
Test Vote "test:Pixelmonservers.info:boduzapho:w3s0m3pa55w0rd"
These are the format the plugin expects. There is no length requirement, but the syntax IS VERY important!!
It is four strings separated by colons{:} mode:server:name:password
Be sure the password you send matches the config file password.
How to Install
- Stop your server
- Place the jar file into your plugins folder.
- Start your server
- Wait for the server to completely start
- Stop the server
- Navigate to plugins/votifier2
- Modify the config file
Config File Sample
ip: 192.168.1.33 port: '8192' password: w3s0m3pa55w0rd protect: 1 debug: true Sentury: 60
- The IP that should be the ip of the server you're running it on.
- The port should be changed to one that will not conflict with other plugins, like votifier.
- The password is a string go nuts. (no really the crazier the better for YOU).
- Protect is an integer or number representing how many HOURS a user has to wait before voting again. 0 = no restriction
- Debug is a boolean (true or false) that when on will display verbose messages in the console window.
- Sentury is an integer that represents how often the save thread runs and saves the required data files in SECONDS.
execute.ini sample
simply add console commands, one per line and use <NAME> where the players name would be.
say <NAME> thanks for your vote! give <NAME> 264 2 eco give <NAME> 100
You will need to use the test site to send votes or build your own. Vote Test Page