My vote system was working correctly,but today it doesnt? any help? thanks
/*
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/
package com.l2jfrozen.gameserver.handler;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.apache.log4j.Logger;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.entity.Announcements;
import com.l2jfrozen.gameserver.network.serverpackets.ExShowScreenMessage;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
import com.l2jfrozen.util.CloseUtil;
import com.l2jfrozen.util.database.L2DatabaseFactory;
public class VoteHandler
{
protected static final Logger LOGGER = Logger.getLogger(VoteHandler.class);
public VoteHandler()
{
}
protected static int getTopZoneVotes()
{
int votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
url = new URL(Config.VOTES_SITE_TOPZONE_URL);
con = url.openConnection();
con.addRequestProperty("User-Agent", "L2TopZone");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
{
if (inputLine.contains("Votes"))
{
String votesLine = inputLine;
votes = Integer.valueOf(votesLine.split(">")[2].replace("</div", ""));
break;
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
return votes;
}
public static void tzvote(final L2PcInstance player)
{
long LastTZVote = 0L;
long voteDelay = 43200000L;
final int actualvotes;
actualvotes = getTopZoneVotes();
class tzvotetask implements Runnable
{
private final L2PcInstance p;
public tzvotetask(L2PcInstance player)
{
p = player;
}
@Override
public void run()
{
if (actualvotes < getTopZoneVotes())
{
p.setIsVoting(false);
VoteHandler.updateLastTZVote(p);
p.sendPacket(new ExShowScreenMessage("Thanks for Voting. You are rewarded with 10 Vote Stone.", 6000));
p.sendMessage("Thanks for Voting. You are rewarded with 10 Vote Stone.");
player.getInventory().addItem("TZreward", 7570, 10, player, null);
}
else
{
p.setIsVoting(false);
p.sendPacket(new ExShowScreenMessage("You didn't vote. Try Again Later", 6000));
p.sendMessage("You didn't vote. Try Again Later.");
}
}
}
PreparedStatement statement = null;
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
statement = con.prepareStatement("SELECT LastTZVote FROM characters WHERE obj_Id=?");
statement.setInt(1, player.getObjectId());
ResultSet rset = statement.executeQuery();
while (rset.next())
{
LastTZVote = rset.getLong("LastTZVote");
}
rset.close();
rset = null;
statement.execute();
statement.close();
statement = null;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
CloseUtil.close(con);
con = null;
}
if ((LastTZVote + voteDelay) < System.currentTimeMillis())
{
for (L2PcInstance actualchar : L2World.getInstance().getAllPlayers())
{
if (actualchar.isVoting())
{
player.sendPacket(new ExShowScreenMessage(actualchar.getName()+", is voting now. Please wait for a while.", 6000));
player.sendMessage(actualchar.getName()+", is voting now. Please wait for a while.");
return;
}
}
player.setIsVoting(true);
player.sendPacket(new ExShowScreenMessage("You have 40 Seconds to vote on Topzone.", 6000));
player.sendMessage("You have 40 Seconds to vote on Topzone.");
ThreadPoolManager.getInstance().scheduleGeneral(new tzvotetask(player), 40 * 880);
}
else
{
player.sendPacket(new ExShowScreenMessage("You can vote only once every 12 hours.", 6000));
player.sendMessage("You can vote only once every 12 hours.");
}
}
public static void updateLastTZVote(L2PcInstance player)
{
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
PreparedStatement statement = con.prepareStatement("UPDATE characters SET LastTZVote=? WHERE obj_Id=?");
statement.setLong(1, System.currentTimeMillis());
statement.setInt(2, player.getObjectId());
statement.execute();
statement.close();
statement = null;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
CloseUtil.close(con);
con = null;
}
}
protected static int getHopZoneVotes()
{
int votes = -1;
try
{
final WebClient webClient = new WebClient(BrowserVersion.CHROME);
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
webClient.getOptions().setThrowExceptionOnScriptError(false);
webClient.getOptions().setPrintContentOnFailingStatusCode(false);
webClient.setJavaScriptEngine(new JavaScriptEngine(webClient));
final HtmlPage page = webClient.getPage(Config.VOTES_SITE_HOPZONE_URL);
String fullPage = page.asXml();
int constrainA = fullPage.indexOf("rank anonymous tooltip") + 24;
String voteSection = fullPage.substring(constrainA);
int constrainB = voteSection.indexOf("span") - 2;
voteSection = voteSection.substring(0, constrainB).trim();
votes = Integer.parseInt(voteSection);
page.cleanUp();
webClient.getJavaScriptEngine().shutdown();
webClient.closeAllWindows();
}
catch (IOException e)
{
System.out.println("[VoteRewardManager]: Problem occured while getting Hopzone votes. Error Trace: " + e.getMessage());
}
return votes;
}
public static void HZvote(final L2PcInstance player)
{
long LastHZVote = 0L;
long voteDelay = 43200000L;
final int actualvotes;
actualvotes = getHopZoneVotes();
class hpvotetask implements Runnable
{
private final L2PcInstance p;
public hpvotetask(L2PcInstance player)
{
p = player;
}
@Override
public void run()
{
if (actualvotes < getHopZoneVotes())
{
p.setIsVoting(false);
VoteHandler.updateLastHZVote(p);
p.sendPacket(new ExShowScreenMessage("Thanks for Voting. You are rewarded with 10 Vote Stone.", 6000));
p.sendMessage("Thanks for Voting. You are rewarded with 10 Vote Stone.");
player.getInventory().addItem("TZreward", 7570, 10, player, null);
}
else
{
p.setIsVoting(false);
p.sendPacket(new ExShowScreenMessage("You didn't vote. Try Again Later", 6000));
p.sendMessage("You didn't vote. Try Again Later.");
}
}
}
PreparedStatement statement = null;
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
statement = con.prepareStatement("SELECT LastHZVote FROM characters WHERE obj_Id=?");
statement.setInt(1, player.getObjectId());
ResultSet rset = statement.executeQuery();
while (rset.next())
{
LastHZVote = rset.getLong("LastHZVote");
}
rset.close();
rset = null;
statement.execute();
statement.close();
statement = null;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
CloseUtil.close(con);
con = null;
}
if ((LastHZVote + voteDelay) < System.currentTimeMillis())
{
for (L2PcInstance actualchar : L2World.getInstance().getAllPlayers())
{
if (actualchar.isVoting())
{
player.sendPacket(new ExShowScreenMessage(actualchar.getName()+", is voting now. Please wait for a while.", 6000));
player.sendMessage(actualchar.getName()+", is voting now. Please wait for a while.");
return;
}
}
player.setIsVoting(true);
player.sendPacket(new ExShowScreenMessage("You have 40 Seconds to vote on Hopzone.", 6000));
player.sendMessage("You have 40 Seconds to vote on Hopzone.");
ThreadPoolManager.getInstance().scheduleGeneral(new hpvotetask(player), 40 * 880);
}
else
{
player.sendPacket(new ExShowScreenMessage("You can vote only once every 12 hours.", 6000));
player.sendMessage("You can vote only once every 12 hours");
}
}
public static void updateLastHZVote(L2PcInstance player)
{
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
PreparedStatement statement = con.prepareStatement("UPDATE characters SET LastHZVote=? WHERE obj_Id=?");
statement.setLong(1, System.currentTimeMillis());
statement.setInt(2, player.getObjectId());
statement.execute();
statement.close();
statement = null;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
CloseUtil.close(con);
con = null;
}
}
protected static int getL2NetworkVotes()
{
int votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
url = new URL(Config.VOTES_SITE_L2NETWORK_URL);
con = url.openConnection();
con.addRequestProperty("User-Agent", "L2Network");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
{
if (inputLine.contains("color:#e7ebf2"))
{
votes = Integer.valueOf(inputLine.split(">")[2].replace("</b", ""));
break;
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
return votes;
}
public static void NZvote(final L2PcInstance player)
{
long LastNZVote = 0L;
long voteDelay = 43200000L;
final int actualvotes;
actualvotes = getL2NetworkVotes();
class nzvotetask implements Runnable
{
private final L2PcInstance p;
public nzvotetask(L2PcInstance player)
{
p = player;
}
@Override
public void run()
{
if (actualvotes < getL2NetworkVotes())
{
p.setIsVoting(false);
VoteHandler.updateLastNZVote(p);
p.sendPacket(new ExShowScreenMessage("Thanks for Voting. You are rewarded with 10 Vote Stone.", 6000));
p.sendMessage("Thanks for Voting. You are rewarded with 10 Vote Stone.");
player.getInventory().addItem("NZreward", 7570, 10, player, null);
}
else
{
p.setIsVoting(false);
p.sendPacket(new ExShowScreenMessage("You didn't vote. Try Again Later", 6000));
p.sendMessage("You didn't vote. Try Again Later.");
}
}
}
PreparedStatement statement = null;
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
statement = con.prepareStatement("SELECT LastNZVote FROM characters WHERE obj_Id=?");
statement.setInt(1, player.getObjectId());
ResultSet rset = statement.executeQuery();
while (rset.next())
{
LastNZVote = rset.getLong("LastNZVote");
}
rset.close();
rset = null;
statement.execute();
statement.close();
statement = null;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
CloseUtil.close(con);
con = null;
}
if ((LastNZVote + voteDelay) < System.currentTimeMillis())
{
for (L2PcInstance actualchar : L2World.getInstance().getAllPlayers())
{
if (actualchar.isVoting())
{
player.sendPacket(new ExShowScreenMessage(actualchar.getName()+", is voting now. Please wait for a while.", 6000));
player.sendMessage(actualchar.getName()+", is voting now. Please wait for a while.");
return;
}
}
player.setIsVoting(true);
player.setIsVoting(true);
player.sendPacket(new ExShowScreenMessage("You have 40 Seconds to vote on Network.", 6000));
player.sendMessage("You have 40 Seconds to vote on Network.");
ThreadPoolManager.getInstance().scheduleGeneral(new nzvotetask(player), 40 * 880);
}
else
{
player.sendPacket(new ExShowScreenMessage("You can vote only once every 12 hours.", 6000));
player.sendMessage("You can vote only once every 12 hours.");
}
}
public static void updateLastNZVote(L2PcInstance player)
{
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection(false);
PreparedStatement statement = con.prepareStatement("UPDATE characters SET LastNZVote=? WHERE obj_Id=?");
statement.setLong(1, System.currentTimeMillis());
statement.setInt(2, player.getObjectId());
statement.execute();
statement.close();
statement = null;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
CloseUtil.close(con);
con = null;
}
}
}
autovoterewardhandler
package com.l2jfrozen.gameserver.handler;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
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.Set;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.model.entity.Announcements;
import com.l2jfrozen.gameserver.powerpak.PowerPakConfig;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
public class AutoVoteRewardHandler
{
protected static final Logger LOGGER = Logger.getLogger(AutoVoteRewardHandler.class);
private int _l2networkVotesCount = 0;
private int hopzoneVotesCount = 0;
private int topzoneVotesCount = 0;
protected List<String> already_rewarded;
protected static boolean l2network = false;
protected static boolean topzone = false;
protected static boolean hopzone = false;
private AutoVoteRewardHandler()
{
LOGGER.info("Vote Reward System Initiated.");
if (hopzone)
{
int hopzone_votes = getHopZoneVotes();
if (hopzone_votes == -1)
{
hopzone_votes = 0;
}
setHopZoneVoteCount(hopzone_votes);
}
if (l2network)
{
int l2network_votes = getL2NetworkVotes();
if (l2network_votes == -1)
{
l2network_votes = 0;
}
setL2NetworkVoteCount(l2network_votes);
}
if (topzone)
{
int topzone_votes = getTopZoneVotes();
if (topzone_votes == -1)
{
topzone_votes = 0;
}
setTopZoneVoteCount(topzone_votes);
}
ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), 1000 * 60 * PowerPakConfig.VOTES_SYSYEM_INITIAL_DELAY, 1000 * 60 * PowerPakConfig.VOTES_SYSYEM_STEP_DELAY);
}
protected class AutoReward implements Runnable
{
@Override
public void run()
{
final int minutes = (PowerPakConfig.VOTES_SYSYEM_STEP_DELAY / 1000) / 60;
if (hopzone)
{
final int hopzone_votes = getHopZoneVotes();
if (hopzone_votes != -1)
{
LOGGER.info("Server on HopZone have: " + hopzone_votes +" Votes!");
Announcements.getInstance().gameAnnounceToAll("[Vote System] L2Server Votes on Hopzone " + hopzone_votes);
if (hopzone_votes != 0 && hopzone_votes >= getHopZoneVoteCount() + PowerPakConfig.VOTES_FOR_REWARD)
{
already_rewarded = new ArrayList<>();
final Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
Announcements.getInstance().gameAnnounceToAll("[Vote System] Great Work! Check your inventory for Reward!!");
// L2ItemInstance item;
for (final L2PcInstance player : pls)
{
if (player != null && !player.isInOfflineMode() && player.isOnline() == 1)
{
if (player._active_boxes <= 1 || (player._active_boxes > 1 && checkSingleBox(player)))
{
final Set<Integer> items = PowerPakConfig.VOTES_REWARDS_LIST.keySet();
for (final Integer i : items)
{
// item = player.getInventory().getItemByItemId(i);
// TODO: check on maxstack for item
player.addItem("reward", i, PowerPakConfig.VOTES_REWARDS_LIST.get(i), player, true);
}
}
}
}
setHopZoneVoteCount(hopzone_votes);
}
Announcements.getInstance().gameAnnounceToAll("[Vote System] Next Reward in " + minutes + " minutes at " + (getHopZoneVoteCount() + PowerPakConfig.VOTES_FOR_REWARD) + " votes");
Announcements.getInstance().gameAnnounceToAll("[Vote System] " + PowerPakConfig.SERVER_WEB_SITE);
}
}
if (topzone && hopzone && PowerPakConfig.VOTES_SYSYEM_STEP_DELAY > 0)
try
{
Thread.sleep(PowerPakConfig.VOTES_SYSYEM_STEP_DELAY / 2);
}
catch (final InterruptedException e)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
}
if (topzone)
{
final int topzone_votes = getTopZoneVotes();
if (topzone_votes != -1)
{
LOGGER.info("Server on TopZone have: " + topzone_votes +" Votes!");
Announcements.getInstance().gameAnnounceToAll("[Vote System] L2Server Votes on Topzone " + topzone_votes);
if (topzone_votes != 0 && topzone_votes >= getTopZoneVoteCount() + PowerPakConfig.VOTES_FOR_REWARD)
{
already_rewarded = new ArrayList<>();
final Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
Announcements.getInstance().gameAnnounceToAll("[Vote System] Great Work! Check your inventory for Reward!!");
// L2ItemInstance item;
for (final L2PcInstance player : pls)
{
if (player != null && !player.isInOfflineMode() && player.isOnline() == 1)
{
if (player._active_boxes <= 1 || (player._active_boxes > 1 && checkSingleBox(player)))
{
final Set<Integer> items = PowerPakConfig.VOTES_REWARDS_LIST.keySet();
for (final Integer i : items)
{
// item = player.getInventory().getItemByItemId(i);
// TODO: check on maxstack for item
player.addItem("reward", i, PowerPakConfig.VOTES_REWARDS_LIST.get(i), player, true);
}
}
}
}
setTopZoneVoteCount(topzone_votes);
}
Announcements.getInstance().gameAnnounceToAll("[Vote System] Next Reward in " + minutes + " minutes at " + (getTopZoneVoteCount() + PowerPakConfig.VOTES_FOR_REWARD) + " votes");
Announcements.getInstance().gameAnnounceToAll("[Vote System] " + PowerPakConfig.SERVER_WEB_SITE);
}
}
if (topzone && hopzone && l2network && PowerPakConfig.VOTES_SYSYEM_STEP_DELAY > 0)
{
try
{
Thread.sleep(PowerPakConfig.VOTES_SYSYEM_STEP_DELAY / 2);
}
catch (final InterruptedException e)
{
if (Config.ENABLE_ALL_EXCEPTIONS)
e.printStackTrace();
}
}
if (l2network)
{
final int l2network_votes = getL2NetworkVotes();
if (l2network_votes != -1)
{
LOGGER.info("Server on L2NetWork have: " + l2network_votes +" Votes!");
Announcements.getInstance().gameAnnounceToAll("[Vote System] L2Server Votes on L2Network " + l2network_votes);
if (l2network_votes != 0 && l2network_votes >= getL2NetworkVoteCount() + PowerPakConfig.VOTES_FOR_REWARD)
{
already_rewarded = new ArrayList<>();
final Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers();
Announcements.getInstance().gameAnnounceToAll("[Vote System] Great Work! Check your inventory for Reward!!");
// L2ItemInstance item;
for (final L2PcInstance player : pls)
{
if (player != null && !player.isInOfflineMode() && player.isOnline() == 1)
{
if (player._active_boxes <= 1 || (player._active_boxes > 1 && checkSingleBox(player)))
{
final Set<Integer> items = PowerPakConfig.VOTES_REWARDS_LIST.keySet();
for (final Integer i : items)
{
// item = player.getInventory().getItemByItemId(i);
// TODO: check on maxstack for item
player.addItem("reward", i, PowerPakConfig.VOTES_REWARDS_LIST.get(i), player, true);
}
}
}
}
setL2NetworkVoteCount(l2network_votes);
}
Announcements.getInstance().gameAnnounceToAll("[Vote System] Next Reward in " + minutes + " minutes at " + (getL2NetworkVoteCount() + PowerPakConfig.VOTES_FOR_REWARD) + " votes");
Announcements.getInstance().gameAnnounceToAll("[Vote System] " + PowerPakConfig.SERVER_WEB_SITE);
}
}
}
}
protected boolean checkSingleBox(final L2PcInstance player)
{
if (player.getClient() != null && player.getClient().getConnection() != null && !player.getClient().getConnection().isClosed() && !player.isInOfflineMode())
{
final String playerip = player.getClient().getConnection().getInetAddress().getHostAddress();
if (already_rewarded.contains(playerip))
return false;
already_rewarded.add(playerip);
return true;
}
return false;
}
protected int getHopZoneVotes()
{
int votes;
votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
String inputLine;
url = new URL(PowerPakConfig.VOTES_SITE_HOPZONE_URL);
con = url.openConnection();
con.addRequestProperty("User-Agent", "Mozilla/4.76");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
while ((inputLine = in.readLine()) != null)
{
if (!inputLine.contains("rank anonymous tooltip"))
continue;
votes = Integer.valueOf(inputLine.split(">")[2].replace("</span", ""));
break;
}
}
catch (final Exception e)
{
LOGGER.warn("[AutoVoteReward] Server HOPZONE is offline or something is wrong in link");
Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] HOPZONE is offline. We will check reward as it will be online again");
}
finally
{
if (in != null)
try
{
in.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
if (isr != null)
try
{
isr.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
if (is != null)
try
{
is.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
}
return votes;
}
protected int getTopZoneVotes()
{
int votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
url = new URL(PowerPakConfig.VOTES_SITE_TOPZONE_URL);
con = url.openConnection();
con.addRequestProperty("User-Agent", "L2TopZone");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
{
votes = Integer.valueOf(inputLine);
break;
}
}
catch (final Exception e)
{
LOGGER.warn("[AutoVoteReward] Server TOPZONE is offline or something is wrong in link");
// Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] TOPZONE is offline. We will check reward as it will be online again");
// e.printStackTrace();
}
finally
{
if (in != null)
try
{
in.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
if (isr != null)
try
{
isr.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
if (is != null)
try
{
is.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
}
return votes;
}
protected int getL2NetworkVotes()
{
int votes = -1;
URL url = null;
URLConnection con = null;
InputStream is = null;
InputStreamReader isr = null;
BufferedReader in = null;
try
{
url = new URL(PowerPakConfig.VOTES_SITE_L2NETWORK_URL);
con = url.openConnection();
con.addRequestProperty("User-Agent", "L2Network");
is = con.getInputStream();
isr = new InputStreamReader(is);
in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null)
{
if (inputLine.contains("color:#e7ebf2"))
{
votes = Integer.valueOf(inputLine.split(">")[2].replace("</b", ""));
break;
}
}
}
catch (final Exception e)
{
LOGGER.warn("[AutoVoteReward] Server L2NETWORK is offline or something is wrong in link");
// e.printStackTrace();
}
finally
{
if (in != null)
try
{
in.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
if (isr != null)
try
{
isr.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
if (is != null)
try
{
is.close();
}
catch (final IOException e1)
{
e1.printStackTrace();
}
}
return votes;
}
protected void setHopZoneVoteCount(final int voteCount)
{
hopzoneVotesCount = voteCount;
}
protected int getHopZoneVoteCount()
{
return hopzoneVotesCount;
}
protected void setTopZoneVoteCount(final int voteCount)
{
topzoneVotesCount = voteCount;
}
protected int getTopZoneVoteCount()
{
return topzoneVotesCount;
}
protected void setL2NetworkVoteCount(final int voteCount)
{
_l2networkVotesCount = voteCount;
}
protected int getL2NetworkVoteCount()
{
return _l2networkVotesCount;
}
public static AutoVoteRewardHandler getInstance()
{
Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF);
if (PowerPakConfig.VOTES_SITE_HOPZONE_URL != null && !PowerPakConfig.VOTES_SITE_HOPZONE_URL.equals(""))
{
hopzone = true;
}
if (PowerPakConfig.VOTES_SITE_TOPZONE_URL != null && !PowerPakConfig.VOTES_SITE_TOPZONE_URL.equals(""))
{
topzone = true;
}
if (PowerPakConfig.VOTES_SITE_L2NETWORK_URL != null && !PowerPakConfig.VOTES_SITE_L2NETWORK_URL.equals(""))
{
l2network = true;
}
if (topzone || hopzone || l2network)
return SingletonHolder._instance;
return null;
}
@SuppressWarnings("synthetic-access")
private static class SingletonHolder
{
protected static final AutoVoteRewardHandler _instance = new AutoVoteRewardHandler();
}
}
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.
❖Items that are sent by physical delivery are sent using someone else's data. That is, if you are not able to accept the parcel, we will not be able to return it. Please keep this in mind.
READY IN STOCK
PAYMENT SYSTEMS
4x4 io, Weststein, Paysafecard, Paysend, Genome, Conotoxia, Mybrocard, Payz Silver, Pockit UK, NagaPay, Volet com, SpectroCoin, SwissMoney, Yuh, Lydia / Sumeria, Ka.App, Wittix, Western Union, MyGuava, Xapo Bank, Bunq on emulator (DE, NL, FR, ES, IE ibans), Revolut on emulator (UK/EU), ICard, BlackCatCard, Vivid DE, Bankera, Bitsa, Wise EU/UK, N26 DE/ES on emulator, Skrill, Neteller, Trasta, Wirex, Lama, Paysera, Moneyjar
CRYPTOEXCHANGE
BINGX com, Bybit LVL 2, KuCoin, Binance LVL 2, Mexc, Latoken, Poloniex, Bitmart, Kraken, WhiteBit, Quppy, Nexo, Gate, OKX, Paybis, Paxful, Huobi (HTX), xcoins com, Bit2Me
BUSINESS ACCOUNTS
Stripe, Payoneer EU, Wise Business UK/EU, Revolut Business EU/UK, N26 Business DE, Wallester Business EU, Kraken Business Pro, Monzo Business, Vivid Business, Zen Business EU, Millennium Business PL, AirWallex EU/UK, Finom business, PayPal business, Payset business
NATIONAL BANKS / BANKS
BBVA, CommerzBank, ING, Santander, Kaspi Bank, Sberbank, AlfaBank, Tbank, Raiffeisen, mBank, Paribas, Bereke Bank, Kapital Bank
DISCORD :
utchiha_market
telegram :
https://t.me/utchiha_market
SELLIX STORE :
https://utchihamkt.mysellix.io/
Join our server for more products :
https://discord.gg/hood-services
https://campsite.bio/utchihaamkt
Question
Saruman
My vote system was working correctly,but today it doesnt? any help? thanks
autovoterewardhandler
0 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.