*Added socket function (not tested, but should work)

This commit is contained in:
Lukas
2015-01-06 19:03:52 +01:00
parent c373f3b971
commit 315f4493e7

View File

@@ -42,7 +42,7 @@ public class VotifierListener implements Listener, PluginMessageListener {
System.out.println("Got vote from " + vote.getServiceName() + " Username: " + vote.getUsername() + " with Adress: " + vote.getAddress() + "@" + vote.getTimeStamp());
try {
ResultSet rs1 = Core.getMySql().querySelect("SELECT * FROM `players` WHERE name = '" + vote.getUsername() + "'");
ResultSet rs1 = Core.getMySql().querySelect("SELECT id FROM `players` WHERE name = '" + vote.getUsername() + "'");
if (!rs1.next()) {
System.out.println("Database doesn't contain player!");
return;
@@ -65,7 +65,7 @@ public class VotifierListener implements Listener, PluginMessageListener {
}
Core.getMySql().queryUpdate("UPDATE `voteUsers` SET `dateOfLastVote`=" + timestampInt + ",`votesInARow`=" + votesInRow + " WHERE playerId=" + playerId);
} else {
Core.getMySql().queryUpdate("INSERT INTO `voteUsers`(`playerId`, `dateOfLastVote`, `votesInARow`) VALUES (" + playerId + "," + timestampInt + ",1)");
Core.getMySql().queryUpdate("INSERT INTO `voteUsers`(`playerId`, `dateOfLastVote`, `votesInARow`) VALUES (SELECT id FROM `players` WHERE name = '" + vote.getUsername() + "'," + timestampInt + ",1)");
}
} catch (SQLException ex) {
Errors.reportException(ex);