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();}
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
I wouldn't be so quick to dismiss a claim, especially as strongly worded as mine because I might not be talking nonsense afterall. But I suggest you check for yourself, first.
Line 195 looks pretty crucial to me:
https://github.com/sdrak94/inertiax/blob/main/src/controller/InertiaController.java#L195
Yet, I don't see the L2PcInstance on the Github repo. Either I'm blind, or it is missing, and if I had to choose one or the other, I'd bet my life on the latter. 😄
Here's another example - the method below (Line 161), as crucial as it seems, looks empty to me:
https://github.com/sdrak94/inertiax/blob/main/src/model/InertiaAct.java#L161
Hello, Adena is for sale in the r33team.com store
L2classic.club Talking island x3 - 5€/bil
L2classic.club Dion x3 - 27.00€/100mil
l2reborn.com Origin x1 - 0,25€/1mil
L2Reborn.org - x15 Forever - 0.05€/1mil
L2Reborn.org - x1 Signature -0.11€/1k
elmorelab.com x2 - 0.46€/1mil
elmorelab.com x3 - 0.15€/1mil
elmorelab.com x1 - 2.06€/1mil
Scryde.net x2 - 9.18€/100mil
Payment method:
Paypal
Visa/Mastercard
Crypto
You can find out more information on our website: https://r33team.com/
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
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.