*Added socket function (not tested, but should work)
This commit is contained in:
@@ -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());
|
System.out.println("Got vote from " + vote.getServiceName() + " Username: " + vote.getUsername() + " with Adress: " + vote.getAddress() + "@" + vote.getTimeStamp());
|
||||||
try {
|
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()) {
|
if (!rs1.next()) {
|
||||||
System.out.println("Database doesn't contain player!");
|
System.out.println("Database doesn't contain player!");
|
||||||
return;
|
return;
|
||||||
@@ -65,7 +65,7 @@ public class VotifierListener implements Listener, PluginMessageListener {
|
|||||||
}
|
}
|
||||||
Core.getMySql().queryUpdate("UPDATE `voteUsers` SET `dateOfLastVote`=" + timestampInt + ",`votesInARow`=" + votesInRow + " WHERE playerId=" + playerId);
|
Core.getMySql().queryUpdate("UPDATE `voteUsers` SET `dateOfLastVote`=" + timestampInt + ",`votesInARow`=" + votesInRow + " WHERE playerId=" + playerId);
|
||||||
} else {
|
} 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) {
|
} catch (SQLException ex) {
|
||||||
Errors.reportException(ex);
|
Errors.reportException(ex);
|
||||||
|
|||||||
Reference in New Issue
Block a user