Hello so recently i started working on my server again but i have problems with one vote script it doesnt want to start and check for votes
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package net.sf.l2j.gameserver.voteengine;import java.io.BufferedReader;import java.io.InputStreamReader;import java.net.URL;import java.net.URLConnection;import java.util.ArrayList;import java.util.Collection;import java.util.List;import java.util.logging.Logger;import net.sf.l2j.Config;import net.sf.l2j.gameserver.ThreadPoolManager;import net.sf.l2j.gameserver.model.L2World;import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;import net.sf.l2j.gameserver.network.L2GameClient;import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;import net.sf.l2j.gameserver.util.Broadcast;publicclassAutoVoteReward{publicstaticLogger _log =Logger.getLogger(AutoVoteReward.class.getName());privateint hopzoneVotesCount =0;privateint topzoneVotesCount =0;privateint networkVotesCount =0;protectedList<String> already_rewarded;protectedstatic boolean topzone =false;protectedstatic boolean hopzone =false;protectedstatic boolean network =false;privateAutoVoteReward(){
_log.info("VoteRewardSystem: Initialized.");if(hopzone){int hopzone_votes = getHopZoneVotes();if(hopzone_votes ==-1){
hopzone_votes =0;}
setHopZoneVoteCount(hopzone_votes);}if(Config.VOTE_TOPZONE_ENABLED){if(topzone){int topzone_votes = getTopZoneVotes();if(topzone_votes ==-1){
topzone_votes =0;}
setTopZoneVoteCount(topzone_votes);}}if(Config.VOTE_NETWORK_ENABLED){if(network){int network_votes = getNetworkVotes();if(network_votes ==-1){
network_votes =0;}
setNetworkVoteCount(network_votes);}}ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(newAutoReward(),Config.VOTES_SYSTEM_INITIAL_DELAY,Config.VOTES_SYSTEM_STEP_DELAY);}protectedclassAutoRewardimplementsRunnable{@Overridepublicvoid run(){if(hopzone){int hopzone_votes = getHopZoneVotes();if(hopzone_votes !=-1){
_log.info("Hopzone Votes: "+ hopzone_votes);
announce("[Hopzone] Actual Votes are "+ hopzone_votes +"...");if(hopzone_votes !=0&& hopzone_votes >= getHopZoneVoteCount()+Config.VOTES_FOR_REWARD){
already_rewarded =newArrayList<>();Collection<L2PcInstance> pls = L2World.getInstance().getPlayers();
announce("[Hopzone] Great Work! Check your inventory for Reward!!");for(L2PcInstance player : pls){if(player !=null){if(checkSingleBox(player)){
player.addItem("reward",Config.HOPZONE_REWARD_ID,Config.HOPZONE_REWARD_COUNT, player,true);}}}
setHopZoneVoteCount(hopzone_votes);}
announce("[Hopzone] Next Reward will be on - "+(getHopZoneVoteCount()+Config.VOTES_FOR_REWARD)+" Votes!!");
announce("[Hopzone] For Vote Visit our website - ");}}if(hopzone &&Config.VOTES_SYSTEM_STEP_DELAY >0){try{Thread.sleep(Config.VOTES_SYSTEM_STEP_DELAY /2);}catch(final InterruptedException e){
e.printStackTrace();}}if(Config.VOTE_TOPZONE_ENABLED){if(topzone){int topzone_votes = getTopZoneVotes();if(topzone_votes !=-1){
_log.info("TopZone Votes: "+ topzone_votes);
announce("[Topzone] Actual Votes are "+ topzone_votes +"...");if(topzone_votes !=0&& topzone_votes >= getTopZoneVoteCount()+Config.VOTES_FOR_REWARD){
already_rewarded =newArrayList<>();Collection<L2PcInstance> pls = L2World.getInstance().getPlayers();
announce("[Topzone] Great Work! Check your inventory for Reward!!");for(L2PcInstance player : pls){if(player !=null){if(checkSingleBox(player)){
player.addItem("reward",Config.TOPZONE_REWARD_ID,Config.TOPZONE_REWARD_COUNT, player,true);}}}
setTopZoneVoteCount(topzone_votes);}
announce("[Topzone] Next Reward will be on - "+(getTopZoneVoteCount()+Config.VOTES_FOR_REWARD)+" Votes!!");
announce("[Topzone] For Vote Visit our website - ");}}}if(topzone && hopzone &&Config.VOTES_SYSTEM_STEP_DELAY >0){try{Thread.sleep(Config.VOTES_SYSTEM_STEP_DELAY /2);}catch(final InterruptedException e){
e.printStackTrace();}}if(Config.VOTE_NETWORK_ENABLED){if(network){int network_votes = getNetworkVotes();if(network_votes !=-1){
_log.info("Network Votes: "+ network_votes);
announce("[Network] Actual Votes are "+ network_votes +"...");if(network_votes !=0&& network_votes >= getNetworkVoteCount()+Config.VOTES_FOR_REWARD){
already_rewarded =newArrayList<>();Collection<L2PcInstance> pls = L2World.getInstance().getPlayers();
announce("[Network] Great Work! Check your inventory for Reward!!");for(L2PcInstance player : pls){if(player !=null){if(checkSingleBox(player)){
player.addItem("reward",Config.NETWORK_REWARD_ID,Config.NETWORK_REWARD_COUNT, player,true);}}}
setNetworkVoteCount(network_votes);}
announce("[Network] Next Reward will be on - "+(getNetworkVoteCount()+Config.VOTES_FOR_REWARD)+" Votes!!");
announce("[Network] For Vote Visit our website - ");}}}if(topzone && hopzone && network &&Config.VOTES_SYSTEM_STEP_DELAY >0){try{Thread.sleep(Config.VOTES_SYSTEM_STEP_DELAY /2);}catch(final InterruptedException e){
e.printStackTrace();}}}}protected boolean checkSingleBox(L2PcInstance player){
L2GameClient client = player.getClient();if(player.getClient()!=null&& player.getClient().getConnection()!=null&&!client.isDetached()&&!player.getClient().getConnection().isClosed()){String playerip = player.getClient().getConnection().getInetAddress().getHostAddress();if(already_rewarded.contains(playerip))returnfalse;
already_rewarded.add(playerip);returntrue;}returnfalse;}protectedint getHopZoneVotes(){InputStreamReader isr =null;BufferedReader br =null;try{URLConnection con =new URL(Config.VOTES_SITE_HOPZONE_URL).openConnection();
con.addRequestProperty("User-Agent","Mozilla/4.76");
isr =newInputStreamReader(con.getInputStream());
br =newBufferedReader(isr);String line;while((line = br.readLine())!=null){if(line.contains("<li><span class=\"rank anonymous tooltip\" title")){int votes =Integer.valueOf(line.split(">")[2].replace("</span",""));return votes;}}
br.close();
isr.close();}catch(final Exception e){
_log.warning("[AutoVoteReward] Server L2Hopzone is offline or something is wrong in link");
announce("[Hopzone] is offline. We will check reward as it will be online again");}return-1;}protectedint getTopZoneVotes(){InputStreamReader isr =null;BufferedReader br =null;try{URLConnection con =new URL(Config.VOTES_SITE_TOPZONE_URL).openConnection();
con.addRequestProperty("User-Agent","L2TopZone");
isr =newInputStreamReader(con.getInputStream());
br =newBufferedReader(isr);String line;while((line = br.readLine())!=null){int votes =Integer.valueOf(line);return votes;}
br.close();
isr.close();}catch(Exception e){if(topzone)System.out.println("TOPZONE is offline. We will check reward as it will be online again.");
announce("[Topzone] is offline. We will check reward as it will be online again");}return-1;}protectedint getNetworkVotes(){InputStreamReader isr =null;BufferedReader br =null;try{URLConnection con =new URL(Config.VOTES_SITE_NETWORK_URL).openConnection();
con.addRequestProperty("User-Agent","Mozilla/5.0");
isr =newInputStreamReader(con.getInputStream());
br =newBufferedReader(isr);String line;while((line = br.readLine())!=null){if(line.contains("<div class=\"tls-in-sts\"><b style")){int votes =Integer.valueOf(line.split(">")[2].replace("</b",""));return votes;}}
br.close();
isr.close();}catch(Exception e){if(network)System.out.println("NETWORK is offline. We will check reward as it will be online again.");
announce("[Network] is offline. We will check reward as it will be online again");}return-1;}protectedvoid setHopZoneVoteCount(int voteCount){
hopzoneVotesCount = voteCount;}protectedint getHopZoneVoteCount(){return hopzoneVotesCount;}protectedvoid setTopZoneVoteCount(int voteCount){
topzoneVotesCount = voteCount;}protectedint getTopZoneVoteCount(){return topzoneVotesCount;}protectedvoid setNetworkVoteCount(int voteCount){
networkVotesCount = voteCount;}protectedint getNetworkVoteCount(){return networkVotesCount;}publicstaticAutoVoteReward getInstance(){if(Config.VOTES_SITE_HOPZONE_URL !=null&&!Config.VOTES_SITE_HOPZONE_URL.equals("")){
hopzone =true;}if(Config.VOTES_SITE_TOPZONE_URL !=null&&!Config.VOTES_SITE_TOPZONE_URL.equals("")){
topzone =true;}if(Config.VOTES_SITE_NETWORK_URL !=null&&!Config.VOTES_SITE_NETWORK_URL.equals("")){
network =true;}if(topzone || hopzone || network)returnSingletonHolder._instance;returnnull;}staticvoid announce(String msg){CreatureSay cs =newCreatureSay(0,18,"", msg);Broadcast.toAllOnlinePlayers(cs);}@SuppressWarnings("synthetic-access")privatestaticclassSingletonHolder{protectedstatic final AutoVoteReward _instance =newAutoVoteReward();}
PROFESSIONAL VIDEO EDITING SERVICES
1️⃣ SERVER PROMOTION VIDEOS
2️⃣ LOGO ANIMATIONS
3️⃣ LOOP GIFS
➡️ CONSTANT PARTY INTROS
➡️ OLYMPIAD/PVP VIDEOS
⏩ MORE INFO: https://discord.gg/YW8a6AmT8N
Thank you! I really missed this option when was exploring bots and their features.
I tried to find L2Net for Interlude, but the official GitHub page has the only H5 compiled version. It doesn't work with my L2J IL. I tried to google a proper version, but nothing worked for me (different errors like DirectX not found etc.)
Do you know where can I get a working version of L2Net IL ?
📢 OBT Success – Get Ready for Launch: November 28!!
The Open Beta was an absolute blast!
Over 160+ Master Accounts successfully claimed their reward from The Judge, proving once again how strong and loyal this community truly is.
🔥 Missed the event?
Don’t worry — because so many players asked for another chance, we will host an additional Event very soon! Stay tuned for details.
Community Growth
We’ve already surpassed 500 Master Accounts registered on our forums — and the numbers keep rising every hour.
It feels like the old days… the same energy, the same hype, the same love for Lineage II.
Let’s rebuild L2Elixir the way we remember it:
No shortcuts, no nonsense — just pure old nostalgic gameplay, community spirit, and that classic adventure we all grew up with.
✨ The journey continues…
Launch: November 28, 21:00 UTC+2
Be there when the legend returns.
🔗 Website: https://l2elixir.org/
💬 Discord: https://discord.gg/5ydPHvhbxs
Question
iAlreadyExist
Hello so recently i started working on my server again but i have problems with one vote script it doesnt want to start and check for votes
Edited by haskovo5 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now