Now with API for Vote
This commit is contained in:
@@ -39,8 +39,7 @@ public class VotifierListener implements Listener, PluginMessageListener {
|
||||
} catch (NumberFormatException ex) {
|
||||
timestampInt = (int) (System.currentTimeMillis() / 1000);
|
||||
}
|
||||
|
||||
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 {
|
||||
ResultSet rs1 = Core.getMySql().querySelect("SELECT id FROM `players` WHERE name = '" + vote.getUsername() + "'");
|
||||
if (!rs1.next()) {
|
||||
@@ -54,7 +53,7 @@ public class VotifierListener implements Listener, PluginMessageListener {
|
||||
if (rs2.first()) {
|
||||
int lastVoteDate = rs2.getInt("dateOfLastVote");
|
||||
votesInRow = rs2.getInt("votesInARow");
|
||||
if (lastVoteDate > (System.currentTimeMillis() - 86400)) {
|
||||
if (lastVoteDate > ((System.currentTimeMillis() / 1000) - 86400)) {
|
||||
votesInRow++;
|
||||
if (votesInRow == 10) {
|
||||
addPlayerMoney(50, vote);
|
||||
@@ -81,7 +80,7 @@ public class VotifierListener implements Listener, PluginMessageListener {
|
||||
out.writeInt(money);
|
||||
|
||||
if (AnuraCore.getInstance().getServer().getOnlinePlayers().isEmpty()) {
|
||||
Socket so = new Socket("localhost", 26656);
|
||||
Socket so = new Socket("127.0.0.1", 27767);
|
||||
OutputStream os = so.getOutputStream();
|
||||
BufferedWriter ps = new BufferedWriter(new OutputStreamWriter(os));
|
||||
ps.write("X3Nw;a+F!R_p~(Wj#LZc");
|
||||
@@ -93,6 +92,8 @@ public class VotifierListener implements Listener, PluginMessageListener {
|
||||
ps.write(money + "");
|
||||
ps.newLine();
|
||||
ps.flush();
|
||||
ps.close();
|
||||
so.close();
|
||||
} else {
|
||||
Player p = Iterables.get(AnuraCore.getInstance().getServer().getOnlinePlayers(), 0);
|
||||
p.sendPluginMessage(AnuraCore.getInstance(), "BungeeCord", stream.toByteArray());
|
||||
|
||||
Reference in New Issue
Block a user