L2JMobius

C6 Lineage 2 vote reward system - l2.topgameserver.net

l2.topgameserver.net · 21 · 9857

Offline l2.topgameserver.net

  • Heir
  • **
    • Posts: 10
    • Top Lineage 2 Servers
Hello everyone, I wanted to inform you that I have made a few adjustments to the voting system in which the validation of the votes has been corrected and the issue of multiple claims that sometimes occurred in the voting system, also add the adaptation of the system to package l2jfrozen 1132 https://pastebin.com/YczLkpUp
I will be making the adaptation to all the chronicles of L2JMobius, L2Mythras, if anyone has any suggestion of a known and open source package that has not yet been adapted let me know.





Offline l2.topgameserver.net

  • Heir
  • **
    • Posts: 10
    • Top Lineage 2 Servers
Hello @everyone, apparently the problem of undefined claims has been generated by a bad calculation of the remaining times, so to correct this, you must go to: votesystem.Handler.VoteManager and search public long getTimeRemaining (individualVote iv) and replace the old method with this: public long getTimeRemaining (individualVote iv) { long timeRemaining = 0L; timeRemaining = ((iv.getVotingTimeSite () + Config.INTERVAL_TO_NEXT_VOTE) - ((iv.getDiffTime ()> 0)? (System.currentTimeMillis () + iv.getDiffTime ()): (System.currentTimeMillis () - iv.getDiffTime () - iv.getDiffTime ()))); System.out.println ("Remaining time:" + timeRemaining); return timeRemaining; }


Online Strelook66

  • Knight
  • ***
    • Posts: 82
Hi,

The code works ok, the rewards work but the only problem that I have is this:

Code: [Select]
java.sql.SQLSyntaxErrorException: (conn=137753) Could not set parameter at position 5 (values was true)
Query - conn:137753(M)  - "INSERT INTO individualvotes(voterIp,voteSite,votingTimeSite,alreadyRewarded) VALUES(?,?,?,?) ON DUPLICATE KEY UPDATE voterIp = VALUES(voterIp), voteSite = VALUES(voteSite), votingTimeSite = VALUES(votingTimeSite),alreadyRewarded = VALUES(alreadyRewarded)"
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:171)
at org.mariadb.jdbc.ClientSidePreparedStatement.setParameter(ClientSidePreparedStatement.java:482)
at org.mariadb.jdbc.BasePrepareStatement.setBoolean(BasePrepareStatement.java:1342)
at org.l2jmobius.gameserver.votesystem.DB.individualVoteDB.SaveVotes(individualVoteDB.java:104)
at org.l2jmobius.gameserver.votesystem.Handler.voteManager.AutoUpdateIndividualVotes(voteManager.java:301)
at org.l2jmobius.gameserver.votesystem.Handler.voteManager$AutoUpdateIndividualVotesTask.run(voteManager.java:400)
at org.l2jmobius.commons.threads.RunnableWrapper.run(RunnableWrapper.java:38)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:831)

After you press "Get reward", everything works fine. But after a few seconds in the GameServer, the above error happens, and the individualvote table remains empty. The voting is not saved. The value returned is true but the table does not update.
Which means if the server is restarted, the player can benefit from the rewards again.