Jump to content

iAlreadyExist

Members
  • Posts

    350
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

Everything posted by iAlreadyExist

  1. yeap but i cant adapt it to work for my server :C i dont understand you put codes but dont say where to put it its so confusing if you can help me with this where i give
  2. can you tell me how to make class master again to have first class second class and 3d class? becouse when someone spawn 1 lvl they no class :C and also toggle skils cant be dissabled wtf
  3. hello there can u make this code check works for hopzone /* * 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 Extensions.Vote; import java.io.BufferedReader; 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 java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.Level; import java.util.logging.Logger; import Extensions.Vote.Tasks.MonthlyResetTask; import Extensions.Vote.Tasks.TriesResetTask; import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.thread.ThreadPoolManager; import com.l2jfrozen.gameserver.model.L2World; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; import com.l2jfrozen.util.database.L2DatabaseFactory; public class VoteManager { protected static final Logger _log = Logger.getLogger(VoteManager.class.getName()); private static boolean hasVotedHop; private static boolean hasVotedTop; public VoteManager() { } public static void load() { _log.log(Level.INFO, "VoteManager: initialized."); TriesResetTask.getInstance(); MonthlyResetTask.getInstance(); } protected static int getHopZoneVotes() { int votes = -1; String Hopzonelink = Config.VOTE_LINK_HOPZONE; InputStreamReader isr = null; BufferedReader br = null; try { URLConnection con = new URL(Hopzonelink).openConnection(); con.addRequestProperty("User-Agent", "Mozilla/4.76"); isr = new InputStreamReader(con.getInputStream()); br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) { if (line.contains("rank anonymous tooltip")) { votes = Integer.valueOf(line.split(">")[2].replace("</span", "")); break; } } br.close(); isr.close(); } catch (Exception e) { if (Config.DEVELOPER) { e.printStackTrace(); } } return votes; } 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.VOTE_LINK_TOPZONE); 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(">")[3].replace("</div", "")); break; } } } catch (Exception e) { if (Config.DEVELOPER) { e.printStackTrace(); } } return votes; } public static String hopCd(L2PcInstance player) { long hopCdMs = 0; long voteDelay = 43200000L; PreparedStatement statement = null; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT lastVoteHopzone FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { hopCdMs = rset.getLong("lastVoteHopzone"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm"); Date resultdate = new Date(hopCdMs + voteDelay); return sdf.format(resultdate); } public static String topCd(L2PcInstance player) { long topCdMs = 0; long voteDelay = 43200000L; PreparedStatement statement = null; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT lastVoteTopzone FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { topCdMs = rset.getLong("lastVoteTopzone"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm"); Date resultdate = new Date(topCdMs + voteDelay); return sdf.format(resultdate); } public static String whosVoting() { for (L2PcInstance voter : L2World.getInstance().getAllPlayers()) { if (voter.isVoting()) { return voter.getName(); } } return "None"; } public static void hopvote(final L2PcInstance player) { long lastVoteHopzone = 0L; long voteDelay = 43200000L; final int firstvoteshop; firstvoteshop = getHopZoneVotes(); class hopvotetask implements Runnable { private final L2PcInstance p; public hopvotetask(L2PcInstance player) { p = player; } @Override public void run() { if (firstvoteshop < getHopZoneVotes()) { p.setIsVoting(false); p.setIsImobilised(false); VoteManager.setHasVotedHop(player); p.sendMessage("Thank you for voting for us!"); VoteManager.updateLastVoteHopzone(p); VoteManager.updateVotes(p); } else { p.setIsVoting(false); p.setIsImobilised(false); p.sendMessage("You did not vote.Please try again."); VoteManager.setTries(player, VoteManager.getTries(p) - 1); } } } PreparedStatement statement = null; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT lastVoteHopzone FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { lastVoteHopzone = rset.getLong("lastVoteHopzone"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } if (getTries(player) <= 0) { player.sendMessage("Due to your multiple failures in voting you lost your chance to vote today"); } else if (((lastVoteHopzone + voteDelay) < System.currentTimeMillis()) && (getTries(player) > 0)) { for (L2PcInstance j : L2World.getInstance().getAllPlayers()) { if (j.isVoting()) { player.sendMessage("Someone is already voting.Wait for your turn please!"); return; } } player.setIsVoting(true); player.setIsImobilised(true); player.sendMessage("Go fast on the site and vote on the hopzone banner!"); player.sendMessage("You have " + Config.SECS_TO_VOTE + " seconds.Hurry!"); ThreadPoolManager.getInstance().scheduleGeneral(new hopvotetask(player), Config.SECS_TO_VOTE * 1000); } else if ((getTries(player) <= 0) && ((lastVoteHopzone + voteDelay) < System.currentTimeMillis())) { for (L2PcInstance j : L2World.getInstance().getAllPlayers()) { if (j.isVoting()) { player.sendMessage("Someone is already voting.Wait for your turn please!"); return; } } player.setIsVoting(true); player.setIsImobilised(true); player.sendMessage("Go fast on the site and vote on the hopzone banner!"); player.sendMessage("You have " + Config.SECS_TO_VOTE + " seconds.Hurry!"); ThreadPoolManager.getInstance().scheduleGeneral(new hopvotetask(player), Config.SECS_TO_VOTE * 1000); } else { player.sendMessage("12 hours have to pass till you are able to vote again."); } } public static void topvote(final L2PcInstance player) { long lastVoteTopzone = 0L; long voteDelay = 43200000L; final int firstvotestop; firstvotestop = getTopZoneVotes(); class topvotetask implements Runnable { private final L2PcInstance p; public topvotetask(L2PcInstance player) { p = player; } @Override public void run() { if (firstvotestop < getTopZoneVotes()) { p.setIsVoting(false); p.setIsImobilised(false); VoteManager.setHasVotedTop(p); p.sendMessage("Thank you for voting for us!"); VoteManager.updateLastVoteTopzone(p); VoteManager.updateVotes(p); } else { p.setIsVoting(false); p.setIsImobilised(false); p.sendMessage("You did not vote.Please try again."); VoteManager.setTries(p, VoteManager.getTries(p) - 1); } } } PreparedStatement statement = null; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT lastVoteTopzone FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { lastVoteTopzone = rset.getLong("lastVoteTopzone"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } if (getTries(player) <= 0) { player.sendMessage("Due to your multiple failures in voting you lost your chance to vote today"); } else if ((getTries(player) <= 0) && ((lastVoteTopzone + voteDelay) < System.currentTimeMillis())) { for (L2PcInstance j : L2World.getInstance().getAllPlayers()) { if (j.isVoting()) { player.sendMessage("Someone is already voting.Wait for your turn please!"); return; } } player.setIsVoting(true); player.setIsImobilised(true); player.sendMessage("Go fast on the site and vote on the topzone banner!"); player.sendMessage((new StringBuilder()).append("You have ").append(Config.SECS_TO_VOTE).append(" seconds.Hurry!").toString()); ThreadPoolManager.getInstance().scheduleGeneral(new topvotetask(player), Config.SECS_TO_VOTE * 1000); } else if (((lastVoteTopzone + voteDelay) < System.currentTimeMillis()) && (getTries(player) > 0)) { for (L2PcInstance j : L2World.getInstance().getAllPlayers()) { if (j.isVoting()) { player.sendMessage("Someone is already voting.Wait for your turn please!"); return; } } player.setIsVoting(true); player.setIsImobilised(true); player.sendMessage("Go fast on the site and vote on the topzone banner!"); player.sendMessage((new StringBuilder()).append("You have ").append(Config.SECS_TO_VOTE).append(" seconds.Hurry!").toString()); ThreadPoolManager.getInstance().scheduleGeneral(new topvotetask(player), Config.SECS_TO_VOTE * 1000); } else { player.sendMessage("12 hours have to pass till you are able to vote again."); } } public static void hasVotedHop(L2PcInstance player) { int hasVotedHop = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT hasVotedHop FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { hasVotedHop = rset.getInt("hasVotedHop"); } if (hasVotedHop == 1) { setHasVotedHop(true); } else if (hasVotedHop == 0) { setHasVotedHop(false); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void hasVotedTop(L2PcInstance player) { int hasVotedTop = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT hasVotedTop FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { hasVotedTop = rset.getInt("hasVotedTop"); } if (hasVotedTop == 1) { setHasVotedTop(true); } else if (hasVotedTop == 0) { setHasVotedTop(false); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void updateVotes(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET monthVotes=?, totalVotes=? WHERE obj_Id=?"); statement.setInt(1, getMonthVotes(activeChar) + 1); statement.setInt(2, getTotalVotes(activeChar) + 1); statement.setInt(3, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void setHasVotedHop(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedHop=? WHERE obj_Id=?"); statement.setInt(1, 1); statement.setInt(2, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void setHasVotedTop(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedTop=? WHERE obj_Id=?"); statement.setInt(1, 1); statement.setInt(2, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void setHasNotVotedHop(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedHop=? WHERE obj_Id=?"); statement.setInt(1, 0); statement.setInt(2, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void setHasNotVotedTop(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedTop=? WHERE obj_Id=?"); statement.setInt(1, 0); statement.setInt(2, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static int getTries(L2PcInstance player) { int tries = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT tries FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); for (ResultSet rset = statement.executeQuery(); rset.next();) { tries = rset.getInt("tries"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return tries; } public static void setTries(L2PcInstance player, int tries) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET tries=? WHERE obj_Id=?"); statement.setInt(1, tries); statement.setInt(2, player.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static int getMonthVotes(L2PcInstance player) { int monthVotes = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT monthVotes FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); for (ResultSet rset = statement.executeQuery(); rset.next();) { monthVotes = rset.getInt("monthVotes"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return monthVotes; } public static int getTotalVotes(L2PcInstance player) { int totalVotes = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT totalVotes FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); for (ResultSet rset = statement.executeQuery(); rset.next();) { totalVotes = rset.getInt("totalVotes"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return totalVotes; } public static int getBigTotalVotes(L2PcInstance player) { int bigTotalVotes = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT SUM(totalVotes) FROM characters"); for (ResultSet rset = statement.executeQuery(); rset.next();) { bigTotalVotes = rset.getInt("SUM(totalVotes)"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return bigTotalVotes; } public static int getBigMonthVotes(L2PcInstance player) { int bigMonthVotes = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT SUM(monthVotes) FROM characters"); for (ResultSet rset = statement.executeQuery(); rset.next();) { bigMonthVotes = rset.getInt("SUM(monthVotes)"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return bigMonthVotes; } public static void updateLastVoteHopzone(L2PcInstance player) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET lastVoteHopzone=? WHERE obj_Id=?"); statement.setLong(1, System.currentTimeMillis()); statement.setInt(2, player.getObjectId()); statement.execute(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void updateLastVoteTopzone(L2PcInstance player) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET lastVoteTopzone=? WHERE obj_Id=?"); statement.setLong(1, System.currentTimeMillis()); statement.setInt(2, player.getObjectId()); statement.execute(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } // Getters and Setters public static boolean hasVotedHop() { return hasVotedHop; } public static void setHasVotedHop(boolean hasVotedHop) { VoteManager.hasVotedHop = hasVotedHop; } public static boolean hasVotedTop() { return hasVotedTop; } public static void setHasVotedTop(boolean hasVotedTop) { VoteManager.hasVotedTop = hasVotedTop; } }
  4. please tell me what to edit im newbie in java develop :C
  5. http://prikachi.com/images.php?images/304/7991304l.png http://prikachi.com/images.php?images/307/7991307P.png http://prikachi.com/images.php?images/308/7991308B.png
  6. errors :C Map<Integer, Long> commandUsages = new ConcurrentHashMap<>(); if(commandUsages.getOrDefault(activeChar.getObjectId(), 0L) > currentTime) commandUsages.put(activeChar.getObjectId(), currentTime + TimeUnit.MINUTES.toMillis(5L))
  7. when u can fix it :( or im wrong something
  8. why give me this error http://prikachi.com/images/862/7990862W.png
  9. can you tell me where to put this codes where you give me.
  10. hello there can you help me make this when people die when they type .res and after that he must wait 5 minutes till use it again there is code Index: java/com/l2j/frozen/gameserver/handler/VoicedCommandHandler.java =================================================================== --- java/com/l2j/frozen/gameserver/handler/VoicedCommandHandler.java +++ java/com/l2j/frozen/gameserver/handler/VoicedCommandHandler.java import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Wedding; + import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Res; if(Config.ALLOW_ONLINE_VIEW) { registerVoicedCommandHandler(new Online()); } + if(Config.RES_COMMAND) + { + registerVoicedCommandHandler(new Res()); + } Index: java/com/l2j/frozen/Config.java =================================================================== --- java/com/l2j/frozen/Config.java +++ java/com/l2j/frozen/Config.java public static String FARM1_CUSTOM_MESSAGE; public static String FARM2_CUSTOM_MESSAGE; public static String PVP1_CUSTOM_MESSAGE; public static String PVP2_CUSTOM_MESSAGE; + public static boolean RES_COMMAND; + public static int RES_ITEM; + public static int RES_COUNT; FARM1_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("Farm1CustomMeesage", "You have been teleported to Farm Zone 1!"); FARM2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("Farm2CustomMeesage", "You have been teleported to Farm Zone 2!"); PVP1_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP1CustomMeesage", "You have been teleported to PvP Zone 1!"); PVP2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!"); + RES_COMMAND = Boolean.parseBoolean(L2JFrozenSettings.getProperty("ResCommandEnabled", "False")); + RES_ITEM = Integer.parseInt(L2JFrozenSettings.getProperty("ResItem", "57")); + RES_COUNT = Integer.parseInt(L2JFrozenSettings.getProperty("ResAmount", "1")); Index: java/config/l2jmods.properties =================================================================== --- java/config/functions/l2jfrozen.properties +++ java/config/functions/l2jfrozen.properties # Allows user to use command .online # Displays The Number of The Players That are Currently Online. # Default : False AllowOnlineView = False #Allow user to use command.res #Resurrects a corpse. In addition, restores about 30 percent of Exp. ResCommandEnabled = False #Id of Item Need When user use .res command ResItem = 57 #Ammount Of Item. ResAmount = 1 Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Res.java =================================================================== --- java/com/l2j/frozen/gameserver/handler/voicedcommandhandlers/Res.java +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Res.java /* 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 com.l2jfrozen.gameserver.handler.voicedcommandhandlers; import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler; import com.l2jfrozen.gameserver.managers.CastleManager; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; public class Res implements IVoicedCommandHandler { private static final String[] VOICED_COMMANDS = { "res" }; public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) { if (command.equalsIgnoreCase("res")) { if (!activeChar.isAlikeDead()) { activeChar.sendMessage("You cannot be ressurected while alive."); return false; } if(activeChar.getClan() != null && CastleManager.getInstance().getCastleByOwner(activeChar.getClan()) != null && CastleManager.getInstance().getCastleByOwner(activeChar.getClan()).getSiege().getIsInProgress()) { activeChar.sendMessage("You cannot use this feature during Siege."); return false; } if(activeChar.isInOlympiadMode()) { activeChar.sendMessage("You cannot use this feature during olympiad."); return false; } if(activeChar.getInventory().getItemByItemId(Config.RES_ITEM) == null) { activeChar.sendMessage("You Cant Use This Command without Some Items."); return false; } activeChar.sendMessage("You have been ressurected!"); activeChar.getInventory().destroyItemByItemId("RessSystem", Config.RES_ITEM, Config.RES_COUNT, activeChar, activeChar.getTarget()); activeChar.doRevive(); activeChar.getInventory().updateDatabase(); activeChar.broadcastUserInfo(); activeChar.sendMessage("Item has dissapeared! Thank you!"); } return true; } public String[] getVoicedCommandList() { return VOICED_COMMANDS; } }
  11. can you tell me again where is the html of this http://prikachi.com/images.php?images/360/7990360A.jpg i search it but i dont found :C i found only pin.java but have one more i hope you tell me :C
  12. well thank you but i dont understand where to put this where is this files Config.java and config.property public static boolean CUSTOM_RESPAWN; public static int CSPAWN_X; public static int CSPAWN_Y; public static int CSPAWN_Z; CUSTOM_RESPAWN = Boolean.parseBoolean(altSettings.getProperty("RespawnAfterDeath", "false")); CSPAWN_X = Double.parseDouble(altSettings.getProperty("SpawnX", "your choose")); CSPAWN_Y = Double.parseDouble(altSettings.getProperty("SpawnY", "your choose")); CSPAWN_Z = Double.parseDouble(altSettings.getProperty("SpawnZ", "your choose")); and this # Custom Respawn When You Die. RespawnAfterDeath = false SpawnX = your choose SpawnY = your choose SpawnZ = your choose
  13. i dont understand you can you give me code to add or remove i try this http://www.maxcheaters.com/topic/180110-respawn-location-after-death/ butits not working
  14. hello there can you give me code for make my server when someone death and when they press to vilage to go my location where i set.
  15. yes the code is right now that you give me. /* * 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 Extensions.Vote; import java.io.BufferedReader; 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 java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.Level; import java.util.logging.Logger; import Extensions.Vote.Tasks.MonthlyResetTask; import Extensions.Vote.Tasks.TriesResetTask; import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.thread.ThreadPoolManager; import com.l2jfrozen.gameserver.model.L2World; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; import com.l2jfrozen.util.database.L2DatabaseFactory; public class VoteManager { protected static final Logger _log = Logger.getLogger(VoteManager.class.getName()); private static boolean hasVotedHop; private static boolean hasVotedTop; public VoteManager() { } public static void load() { _log.log(Level.INFO, "VoteManager: initialized."); TriesResetTask.getInstance(); MonthlyResetTask.getInstance(); } protected static int getHopZoneVotes() { InputStreamReader isr = null; BufferedReader br = null; try { if(!Config.VOTE_LINK_HOPZONE.endsWith(".html")) Config.VOTE_LINK_HOPZONE+=".html"; URLConnection con = new URL(Config.VOTE_LINK_HOPZONE).openConnection(); con.addRequestProperty("User-L2Hopzone", "Mozilla/4.76"); isr = new InputStreamReader(con.getInputStream()); br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) { if (line.contains("no steal make love")||line.contains("no votes here")||line.contains("bang, you don't have votes")|| line.contains("la vita e bella")) { int votes = Integer.valueOf(line.split(">")[2].replace("</span", "")); return votes; } } br.close(); isr.close(); } catch (Exception e) { System.out.println("[VoteRewardManager]: Problem occured while getting Hopzone votes. Error Trace: " + e.getMessage()); } return -1; } 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.VOTE_LINK_TOPZONE); 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(">")[3].replace("</div", "")); break; } } } catch (Exception e) { if (Config.DEVELOPER) { e.printStackTrace(); } } return votes; } public static String hopCd(L2PcInstance player) { long hopCdMs = 0; long voteDelay = 43200000L; PreparedStatement statement = null; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT lastVoteHopzone FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { hopCdMs = rset.getLong("lastVoteHopzone"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm"); Date resultdate = new Date(hopCdMs + voteDelay); return sdf.format(resultdate); } public static String topCd(L2PcInstance player) { long topCdMs = 0; long voteDelay = 43200000L; PreparedStatement statement = null; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT lastVoteTopzone FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { topCdMs = rset.getLong("lastVoteTopzone"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm"); Date resultdate = new Date(topCdMs + voteDelay); return sdf.format(resultdate); } public static String whosVoting() { for (L2PcInstance voter : L2World.getInstance().getAllPlayers()) { if (voter.isVoting()) { return voter.getName(); } } return "None"; } public static void hopvote(final L2PcInstance player) { long lastVoteHopzone = 0L; long voteDelay = 43200000L; final int firstvoteshop; firstvoteshop = getHopZoneVotes(); class hopvotetask implements Runnable { private final L2PcInstance p; public hopvotetask(L2PcInstance player) { p = player; } @Override public void run() { if (firstvoteshop < getHopZoneVotes()) { p.setIsVoting(false); p.setIsImobilised(false); VoteManager.setHasVotedHop(player); p.sendMessage("Thank you for voting for us!"); VoteManager.updateLastVoteHopzone(p); VoteManager.updateVotes(p); } else { p.setIsVoting(false); p.setIsImobilised(false); p.sendMessage("You did not vote.Please try again."); VoteManager.setTries(player, VoteManager.getTries(p) - 1); } } } PreparedStatement statement = null; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT lastVoteHopzone FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { lastVoteHopzone = rset.getLong("lastVoteHopzone"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } if (getTries(player) <= 0) { player.sendMessage("Due to your multiple failures in voting you lost your chance to vote today"); } else if (((lastVoteHopzone + voteDelay) < System.currentTimeMillis()) && (getTries(player) > 0)) { for (L2PcInstance j : L2World.getInstance().getAllPlayers()) { if (j.isVoting()) { player.sendMessage("Someone is already voting.Wait for your turn please!"); return; } } player.setIsVoting(true); player.setIsImobilised(true); player.sendMessage("Go fast on the site and vote on the hopzone banner!"); player.sendMessage("You have " + Config.SECS_TO_VOTE + " seconds.Hurry!"); ThreadPoolManager.getInstance().scheduleGeneral(new hopvotetask(player), Config.SECS_TO_VOTE * 1000); } else if ((getTries(player) <= 0) && ((lastVoteHopzone + voteDelay) < System.currentTimeMillis())) { for (L2PcInstance j : L2World.getInstance().getAllPlayers()) { if (j.isVoting()) { player.sendMessage("Someone is already voting.Wait for your turn please!"); return; } } player.setIsVoting(true); player.setIsImobilised(true); player.sendMessage("Go fast on the site and vote on the hopzone banner!"); player.sendMessage("You have " + Config.SECS_TO_VOTE + " seconds.Hurry!"); ThreadPoolManager.getInstance().scheduleGeneral(new hopvotetask(player), Config.SECS_TO_VOTE * 1000); } else { player.sendMessage("12 hours have to pass till you are able to vote again."); } } public static void topvote(final L2PcInstance player) { long lastVoteTopzone = 0L; long voteDelay = 43200000L; final int firstvotestop; firstvotestop = getTopZoneVotes(); class topvotetask implements Runnable { private final L2PcInstance p; public topvotetask(L2PcInstance player) { p = player; } @Override public void run() { if (firstvotestop < getTopZoneVotes()) { p.setIsVoting(false); p.setIsImobilised(false); VoteManager.setHasVotedTop(p); p.sendMessage("Thank you for voting for us!"); VoteManager.updateLastVoteTopzone(p); VoteManager.updateVotes(p); } else { p.setIsVoting(false); p.setIsImobilised(false); p.sendMessage("You did not vote.Please try again."); VoteManager.setTries(p, VoteManager.getTries(p) - 1); } } } PreparedStatement statement = null; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT lastVoteTopzone FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { lastVoteTopzone = rset.getLong("lastVoteTopzone"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } if (getTries(player) <= 0) { player.sendMessage("Due to your multiple failures in voting you lost your chance to vote today"); } else if ((getTries(player) <= 0) && ((lastVoteTopzone + voteDelay) < System.currentTimeMillis())) { for (L2PcInstance j : L2World.getInstance().getAllPlayers()) { if (j.isVoting()) { player.sendMessage("Someone is already voting.Wait for your turn please!"); return; } } player.setIsVoting(true); player.setIsImobilised(true); player.sendMessage("Go fast on the site and vote on the topzone banner!"); player.sendMessage((new StringBuilder()).append("You have ").append(Config.SECS_TO_VOTE).append(" seconds.Hurry!").toString()); ThreadPoolManager.getInstance().scheduleGeneral(new topvotetask(player), Config.SECS_TO_VOTE * 1000); } else if (((lastVoteTopzone + voteDelay) < System.currentTimeMillis()) && (getTries(player) > 0)) { for (L2PcInstance j : L2World.getInstance().getAllPlayers()) { if (j.isVoting()) { player.sendMessage("Someone is already voting.Wait for your turn please!"); return; } } player.setIsVoting(true); player.setIsImobilised(true); player.sendMessage("Go fast on the site and vote on the topzone banner!"); player.sendMessage((new StringBuilder()).append("You have ").append(Config.SECS_TO_VOTE).append(" seconds.Hurry!").toString()); ThreadPoolManager.getInstance().scheduleGeneral(new topvotetask(player), Config.SECS_TO_VOTE * 1000); } else { player.sendMessage("12 hours have to pass till you are able to vote again."); } } public static void hasVotedHop(L2PcInstance player) { int hasVotedHop = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT hasVotedHop FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { hasVotedHop = rset.getInt("hasVotedHop"); } if (hasVotedHop == 1) { setHasVotedHop(true); } else if (hasVotedHop == 0) { setHasVotedHop(false); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void hasVotedTop(L2PcInstance player) { int hasVotedTop = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT hasVotedTop FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { hasVotedTop = rset.getInt("hasVotedTop"); } if (hasVotedTop == 1) { setHasVotedTop(true); } else if (hasVotedTop == 0) { setHasVotedTop(false); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void updateVotes(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET monthVotes=?, totalVotes=? WHERE obj_Id=?"); statement.setInt(1, getMonthVotes(activeChar) + 1); statement.setInt(2, getTotalVotes(activeChar) + 1); statement.setInt(3, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void setHasVotedHop(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedHop=? WHERE obj_Id=?"); statement.setInt(1, 1); statement.setInt(2, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void setHasVotedTop(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedTop=? WHERE obj_Id=?"); statement.setInt(1, 1); statement.setInt(2, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void setHasNotVotedHop(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedHop=? WHERE obj_Id=?"); statement.setInt(1, 0); statement.setInt(2, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void setHasNotVotedTop(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedTop=? WHERE obj_Id=?"); statement.setInt(1, 0); statement.setInt(2, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static int getTries(L2PcInstance player) { int tries = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT tries FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); for (ResultSet rset = statement.executeQuery(); rset.next();) { tries = rset.getInt("tries"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return tries; } public static void setTries(L2PcInstance player, int tries) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET tries=? WHERE obj_Id=?"); statement.setInt(1, tries); statement.setInt(2, player.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static int getMonthVotes(L2PcInstance player) { int monthVotes = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT monthVotes FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); for (ResultSet rset = statement.executeQuery(); rset.next();) { monthVotes = rset.getInt("monthVotes"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return monthVotes; } public static int getTotalVotes(L2PcInstance player) { int totalVotes = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT totalVotes FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); for (ResultSet rset = statement.executeQuery(); rset.next();) { totalVotes = rset.getInt("totalVotes"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return totalVotes; } public static int getBigTotalVotes(L2PcInstance player) { int bigTotalVotes = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT SUM(totalVotes) FROM characters"); for (ResultSet rset = statement.executeQuery(); rset.next();) { bigTotalVotes = rset.getInt("SUM(totalVotes)"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return bigTotalVotes; } public static int getBigMonthVotes(L2PcInstance player) { int bigMonthVotes = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT SUM(monthVotes) FROM characters"); for (ResultSet rset = statement.executeQuery(); rset.next();) { bigMonthVotes = rset.getInt("SUM(monthVotes)"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return bigMonthVotes; } public static void updateLastVoteHopzone(L2PcInstance player) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET lastVoteHopzone=? WHERE obj_Id=?"); statement.setLong(1, System.currentTimeMillis()); statement.setInt(2, player.getObjectId()); statement.execute(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void updateLastVoteTopzone(L2PcInstance player) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET lastVoteTopzone=? WHERE obj_Id=?"); statement.setLong(1, System.currentTimeMillis()); statement.setInt(2, player.getObjectId()); statement.execute(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } // Getters and Setters public static boolean hasVotedHop() { return hasVotedHop; } public static void setHasVotedHop(boolean hasVotedHop) { VoteManager.hasVotedHop = hasVotedHop; } public static boolean hasVotedTop() { return hasVotedTop; } public static void setHasVotedTop(boolean hasVotedTop) { VoteManager.hasVotedTop = hasVotedTop; } }
  16. well i put the code you give me i put some random server from l2.hopzone i vote and they still say me you didnt vote.. :C
  17. /* * 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 Extensions.Vote; import java.io.BufferedReader; 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 java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.Level; import java.util.logging.Logger; import Extensions.Vote.Tasks.MonthlyResetTask; import Extensions.Vote.Tasks.TriesResetTask; import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.thread.ThreadPoolManager; import com.l2jfrozen.gameserver.model.L2World; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; import com.l2jfrozen.util.database.L2DatabaseFactory; public class VoteManager { protected static final Logger _log = Logger.getLogger(VoteManager.class.getName()); private static boolean hasVotedHop; private static boolean hasVotedTop; public VoteManager() { } public static void load() { _log.log(Level.INFO, "VoteManager: initialized."); TriesResetTask.getInstance(); MonthlyResetTask.getInstance(); } protected static int getHopZoneVotes() { int votes = -1; String Hopzonelink = Config.VOTE_LINK_HOPZONE; InputStreamReader isr = null; BufferedReader br = null; try { URLConnection con = new URL(Hopzonelink).openConnection(); con.addRequestProperty("User-Agent", "Mozilla/4.76"); isr = new InputStreamReader(con.getInputStream()); br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) { if (line.contains("rank anonymous tooltip")) { votes = Integer.valueOf(line.split(">")[2].replace("</span", "")); break; } } br.close(); isr.close(); } catch (Exception e) { if (Config.DEVELOPER) { e.printStackTrace(); } } return votes; } 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.VOTE_LINK_TOPZONE); 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(">")[3].replace("</div", "")); break; } } } catch (Exception e) { if (Config.DEVELOPER) { e.printStackTrace(); } } return votes; } public static String hopCd(L2PcInstance player) { long hopCdMs = 0; long voteDelay = 43200000L; PreparedStatement statement = null; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT lastVoteHopzone FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { hopCdMs = rset.getLong("lastVoteHopzone"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm"); Date resultdate = new Date(hopCdMs + voteDelay); return sdf.format(resultdate); } public static String topCd(L2PcInstance player) { long topCdMs = 0; long voteDelay = 43200000L; PreparedStatement statement = null; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT lastVoteTopzone FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { topCdMs = rset.getLong("lastVoteTopzone"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm"); Date resultdate = new Date(topCdMs + voteDelay); return sdf.format(resultdate); } public static String whosVoting() { for (L2PcInstance voter : L2World.getInstance().getAllPlayers()) { if (voter.isVoting()) { return voter.getName(); } } return "None"; } public static void hopvote(final L2PcInstance player) { long lastVoteHopzone = 0L; long voteDelay = 43200000L; final int firstvoteshop; firstvoteshop = getHopZoneVotes(); class hopvotetask implements Runnable { private final L2PcInstance p; public hopvotetask(L2PcInstance player) { p = player; } @Override public void run() { if (firstvoteshop < getHopZoneVotes()) { p.setIsVoting(false); p.setIsImobilised(false); VoteManager.setHasVotedHop(player); p.sendMessage("Thank you for voting for us!"); VoteManager.updateLastVoteHopzone(p); VoteManager.updateVotes(p); } else { p.setIsVoting(false); p.setIsImobilised(false); p.sendMessage("You did not vote.Please try again."); VoteManager.setTries(player, VoteManager.getTries(p) - 1); } } } PreparedStatement statement = null; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT lastVoteHopzone FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { lastVoteHopzone = rset.getLong("lastVoteHopzone"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } if (getTries(player) <= 0) { player.sendMessage("Due to your multiple failures in voting you lost your chance to vote today"); } else if (((lastVoteHopzone + voteDelay) < System.currentTimeMillis()) && (getTries(player) > 0)) { for (L2PcInstance j : L2World.getInstance().getAllPlayers()) { if (j.isVoting()) { player.sendMessage("Someone is already voting.Wait for your turn please!"); return; } } player.setIsVoting(true); player.setIsImobilised(true); player.sendMessage("Go fast on the site and vote on the hopzone banner!"); player.sendMessage("You have " + Config.SECS_TO_VOTE + " seconds.Hurry!"); ThreadPoolManager.getInstance().scheduleGeneral(new hopvotetask(player), Config.SECS_TO_VOTE * 1000); } else if ((getTries(player) <= 0) && ((lastVoteHopzone + voteDelay) < System.currentTimeMillis())) { for (L2PcInstance j : L2World.getInstance().getAllPlayers()) { if (j.isVoting()) { player.sendMessage("Someone is already voting.Wait for your turn please!"); return; } } player.setIsVoting(true); player.setIsImobilised(true); player.sendMessage("Go fast on the site and vote on the hopzone banner!"); player.sendMessage("You have " + Config.SECS_TO_VOTE + " seconds.Hurry!"); ThreadPoolManager.getInstance().scheduleGeneral(new hopvotetask(player), Config.SECS_TO_VOTE * 1000); } else { player.sendMessage("12 hours have to pass till you are able to vote again."); } } public static void topvote(final L2PcInstance player) { long lastVoteTopzone = 0L; long voteDelay = 43200000L; final int firstvotestop; firstvotestop = getTopZoneVotes(); class topvotetask implements Runnable { private final L2PcInstance p; public topvotetask(L2PcInstance player) { p = player; } @Override public void run() { if (firstvotestop < getTopZoneVotes()) { p.setIsVoting(false); p.setIsImobilised(false); VoteManager.setHasVotedTop(p); p.sendMessage("Thank you for voting for us!"); VoteManager.updateLastVoteTopzone(p); VoteManager.updateVotes(p); } else { p.setIsVoting(false); p.setIsImobilised(false); p.sendMessage("You did not vote.Please try again."); VoteManager.setTries(p, VoteManager.getTries(p) - 1); } } } PreparedStatement statement = null; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); statement = con.prepareStatement("SELECT lastVoteTopzone FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { lastVoteTopzone = rset.getLong("lastVoteTopzone"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } if (getTries(player) <= 0) { player.sendMessage("Due to your multiple failures in voting you lost your chance to vote today"); } else if ((getTries(player) <= 0) && ((lastVoteTopzone + voteDelay) < System.currentTimeMillis())) { for (L2PcInstance j : L2World.getInstance().getAllPlayers()) { if (j.isVoting()) { player.sendMessage("Someone is already voting.Wait for your turn please!"); return; } } player.setIsVoting(true); player.setIsImobilised(true); player.sendMessage("Go fast on the site and vote on the topzone banner!"); player.sendMessage((new StringBuilder()).append("You have ").append(Config.SECS_TO_VOTE).append(" seconds.Hurry!").toString()); ThreadPoolManager.getInstance().scheduleGeneral(new topvotetask(player), Config.SECS_TO_VOTE * 1000); } else if (((lastVoteTopzone + voteDelay) < System.currentTimeMillis()) && (getTries(player) > 0)) { for (L2PcInstance j : L2World.getInstance().getAllPlayers()) { if (j.isVoting()) { player.sendMessage("Someone is already voting.Wait for your turn please!"); return; } } player.setIsVoting(true); player.setIsImobilised(true); player.sendMessage("Go fast on the site and vote on the topzone banner!"); player.sendMessage((new StringBuilder()).append("You have ").append(Config.SECS_TO_VOTE).append(" seconds.Hurry!").toString()); ThreadPoolManager.getInstance().scheduleGeneral(new topvotetask(player), Config.SECS_TO_VOTE * 1000); } else { player.sendMessage("12 hours have to pass till you are able to vote again."); } } public static void hasVotedHop(L2PcInstance player) { int hasVotedHop = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT hasVotedHop FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { hasVotedHop = rset.getInt("hasVotedHop"); } if (hasVotedHop == 1) { setHasVotedHop(true); } else if (hasVotedHop == 0) { setHasVotedHop(false); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void hasVotedTop(L2PcInstance player) { int hasVotedTop = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT hasVotedTop FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); ResultSet rset = statement.executeQuery(); while (rset.next()) { hasVotedTop = rset.getInt("hasVotedTop"); } if (hasVotedTop == 1) { setHasVotedTop(true); } else if (hasVotedTop == 0) { setHasVotedTop(false); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void updateVotes(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET monthVotes=?, totalVotes=? WHERE obj_Id=?"); statement.setInt(1, getMonthVotes(activeChar) + 1); statement.setInt(2, getTotalVotes(activeChar) + 1); statement.setInt(3, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void setHasVotedHop(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedHop=? WHERE obj_Id=?"); statement.setInt(1, 1); statement.setInt(2, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void setHasVotedTop(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedTop=? WHERE obj_Id=?"); statement.setInt(1, 1); statement.setInt(2, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void setHasNotVotedHop(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedHop=? WHERE obj_Id=?"); statement.setInt(1, 0); statement.setInt(2, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void setHasNotVotedTop(L2PcInstance activeChar) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET hasVotedTop=? WHERE obj_Id=?"); statement.setInt(1, 0); statement.setInt(2, activeChar.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static int getTries(L2PcInstance player) { int tries = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT tries FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); for (ResultSet rset = statement.executeQuery(); rset.next();) { tries = rset.getInt("tries"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return tries; } public static void setTries(L2PcInstance player, int tries) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET tries=? WHERE obj_Id=?"); statement.setInt(1, tries); statement.setInt(2, player.getObjectId()); statement.execute(); statement.close(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static int getMonthVotes(L2PcInstance player) { int monthVotes = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT monthVotes FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); for (ResultSet rset = statement.executeQuery(); rset.next();) { monthVotes = rset.getInt("monthVotes"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return monthVotes; } public static int getTotalVotes(L2PcInstance player) { int totalVotes = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT totalVotes FROM characters WHERE obj_Id=?"); statement.setInt(1, player.getObjectId()); for (ResultSet rset = statement.executeQuery(); rset.next();) { totalVotes = rset.getInt("totalVotes"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return totalVotes; } public static int getBigTotalVotes(L2PcInstance player) { int bigTotalVotes = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT SUM(totalVotes) FROM characters"); for (ResultSet rset = statement.executeQuery(); rset.next();) { bigTotalVotes = rset.getInt("SUM(totalVotes)"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return bigTotalVotes; } public static int getBigMonthVotes(L2PcInstance player) { int bigMonthVotes = -1; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT SUM(monthVotes) FROM characters"); for (ResultSet rset = statement.executeQuery(); rset.next();) { bigMonthVotes = rset.getInt("SUM(monthVotes)"); } } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } return bigMonthVotes; } public static void updateLastVoteHopzone(L2PcInstance player) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET lastVoteHopzone=? WHERE obj_Id=?"); statement.setLong(1, System.currentTimeMillis()); statement.setInt(2, player.getObjectId()); statement.execute(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } public static void updateLastVoteTopzone(L2PcInstance player) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET lastVoteTopzone=? WHERE obj_Id=?"); statement.setLong(1, System.currentTimeMillis()); statement.setInt(2, player.getObjectId()); statement.execute(); } catch (Exception e) { _log.warning(" "); } finally { try { if (con != null) con.close(); } catch (SQLException e) { _log.warning("Failed to close database connection!"); } } } // Getters and Setters public static boolean hasVotedHop() { return hasVotedHop; } public static void setHasVotedHop(boolean hasVotedHop) { VoteManager.hasVotedHop = hasVotedHop; } public static boolean hasVotedTop() { return hasVotedTop; } public static void setHasVotedTop(boolean hasVotedTop) { VoteManager.hasVotedTop = hasVotedTop; } } can u help me its my file Votemanager.java sorry but im newbie in l2j develop
  18. i use this pack http://www.maxcheaters.com/topic/184816-lineage-psd-interlude-pvp-packsource/and its same vote manager can u tell me what did you change or its big?
  19. can you tell me from where i can increase buff slots i check all config and dont found it..
×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock