Jump to content

Recommended Posts

Posted

still getting error.

 

this is how it looks like for me. [ gameserver\data\scripts\custom\AutoVoteRewardHandler\AutoVoteRewardHandler.java

 

    /*
     * This is a script completely developed by Rain^ (?)
     * You are not allowed to sell any copies of it.
     * Since 2.0 (by Zoey76 for L2J Forums):
     * Added logger instead of System.out.println()
     * Moved to Datapack.
     * Reworked AutoReward class.
     * Reworked getVotes() method.
     * Time is in minutes instead of milliseconds.
     * Uses different a-beep-t for each item.
     * Only rewards online players, not offline shops.
     * Rewarded players count.
     */
    package custom.VoteEngine;
     
    import java.io.*;
    import java.net.*;
    import java.util.Collection;
    import java.util.logging.Level;
    import java.util.logging.Logger;
     
    import net.sf.l2j.gameserver.Announcements;
    import net.sf.l2j.gameserver.ThreadPoolManager;
    import net.sf.l2j.gameserver.model.L2World;
    import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
     
    /**
     * @author Zoey76
     * @version 2.0
     */
    public class AutoVoteRewardHandler
    {
            protected static final Logger _log = Logger.getLogger(AutoVoteRewardHandler.class.getName());
            //URL from your server site at HopZone.net
            //Example: http://l2.hopzone.net/lineage2/moreinfo/YourServer/ID.html
            private final static String _url = "http://l2.hopzone.net/lineage2/details/91914/L2NetherWorld";//Add your URL from HopZone here!
            //Reward all online players each '_votesRequiredForReward' votes.
            private final int _votesRequiredForReward = 1;//
            //Initial check, time in minutes:
            //Default: 1 minute
            private final int initialCheck = 5;
            //Delay interval, time in minutes (do not set it too low):
            //Default: 10 minutes
            private final int delayForCheck = 5;
           
            //Item Id, A-beep-t.
            private final static int[][] ITEMs =
            {
                    { 5575, 10 }, //10 Ancient Adena
                    { 57, 1000000 }, //1kk Adena
            };
           
            //Do not change
            private int _lastVoteCount = 0;
           
            private AutoVoteRewardHandler()
            {
                    _log.info("[AutoVoteRewardHandler]: Vote Reward System Initiated.");
                    ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoReward(), initialCheck * 60000, delayForCheck * 60000);
            }
           
            private class AutoReward implements Runnable
            {
                    public void run()
                    {
                            int votes = getVotes();
                            int rewardedPlayers = 0;
                            if (votes > -1)
                            {
                                    if  ((getLastVoteCount() != 0) && (votes >= (getLastVoteCount() + _votesRequiredForReward)))
                                    {
                                            Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
                                            for (L2PcInstance player : pls)
                                            {
                                                    if ((player != null) && !player.getClient().isDetached())
                                                    {
                                                            for (int[] reward : ITEMs)
                                                            {
                                                                    if (player.getInventory().validateCapacityByItemId(reward[0]))
                                                                    {
                                                                            player.addItem("reward", reward[0], reward[1], player, true);
                                                                    }
                                                            }
                                                            rewardedPlayers++;
                                                    }
                                            }
                                            setLastVoteCount(getLastVoteCount() + _votesRequiredForReward);
                                    }
                                    else if (getLastVoteCount() == 0)
                                    {
                                            setLastVoteCount(votes);
                                    }
                                    _log.info("[AutoVoteRewardHandler]: Server Votes: " + votes + ", Rewarded players: " + rewardedPlayers);
                                    Announcements.getInstance();
			    Announcements.announceToAll("Server Votes: " + votes + " | Next Reward on " + (getLastVoteCount() + _votesRequiredForReward) + " votes!");
                            }
                            else
                            {
                                    _log.log(Level.WARNING, "[AutoVoteRewardHandler]: Error retreiving server votes count!");
                            }
                    }
            }
           
            private static int getVotes()
            {
                    InputStreamReader isr = null;
                    BufferedReader in = null;
                    int votes = -1;
                    try
                    {
                    URLConnection conn = new URL(_url).openConnection();
                    conn.addRequestProperty("User-Agent", "Mozilla/4.76");
                    isr = new InputStreamReader(conn.getInputStream());
                    in = new BufferedReader(isr);
                            String inputLine;
                            while (((inputLine = in.readLine()) != null) && (votes == -1))
                            {
                                    if (inputLine.contains("Anonymous User Votes"))
                                    {
                                            try
                                            {
                                                    votes = Integer.valueOf(inputLine.split(">")[2].replace("</span", ""));
                                            }
                                            catch (Exception e)
                                            {
                                            }
                                    }
                            }
                            in.close();
                    }
                    catch (Exception e)
                    {
                            _log.log(Level.WARNING, "[AutoVoteRewardHandler]: " + e.getMessage(), e);
                    }
                    return votes;
            }
           
            private void setLastVoteCount(int voteCount)
            {
                    _lastVoteCount = voteCount;
            }
           
            private int getLastVoteCount()
            {
                    return _lastVoteCount;
            }
           
            public static AutoVoteRewardHandler getInstance()
            {
                    return SingletonHolder._instance;
            }
           
            @SuppressWarnings("synthetic-access")
            private static class SingletonHolder
            {
                    protected static final AutoVoteRewardHandler _instance = new AutoVoteRewardHandler();
            }
           
            public static void main(String[] args)
            {
                    //System.out.println("Server votes: " + getVotes());//Just a test.
                    AutoVoteRewardHandler.getInstance();
            }
    }

 

this error i get

 

error2.png

 

Error on: D:\Lineage2 Server\SERVER acis\gameserver\data\scripts\custom\AutoVoteRewardHandler\AutoVoteRewardHandler.java.error.log

Line: -1 - Column: -1

 

java.lang.ClassNotFoundException: custom.AutoVoteRewardHandler.AutoVoteRewardHandler

 

 

whole day i try to make it work and still errors :D

Posted

Well, my bad.

 

package custom.VoteEngine;

 

Folder name should be VoteEngine and not AutoVoteRewardHandler. So simply rename it.. :P

 

One guy at aCis forum asked about the same, the same error. That's not you, olo? ^^

Posted

got 2 errors pls help me

 

----------
1. ERROR in /AutoVoteRewardHandler.java (at line 72)
Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type mismatch: cannot convert from L2PcInstance[] to Collection<L2PcInstance>
----------
2. ERROR in /AutoVoteRewardHandler.java (at line 95)
Announcements.announceToAll("Server Votes: " + votes + " | Next Reward on " + (getLastVoteCount() + _votesRequiredForReward) + " votes!");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Cannot make a static reference to the non-static method announceToAll(String) from the type Announcements
----------
2 problems (2 errors)Type mismatch: cannot convert from com.l2jserver.gameserver.model.actor.instance.L2PcInstance[] to java.util.Collection<com.l2jserver.gameserver.model.actor.instance.L2PcInstance>
Cannot make a static reference to the non-static method announceToAll(java.lang.String) from the type com.l2jserver.gameserver.Announcements
Failed executing script: /root/quitt/game/data/scripts/custom/VoteEngine/AutoVoteRewardHandler.java. See AutoVoteRewardHandler.java.error.log for details.

Posted

got 2 errors pls help me

 

At least you could tell us what pack/chronicle are you using. Also, you SHOULD create a new topic in Request Help section and not here.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • Posts

    • Download Here: https://sitehunterus.blogspot.com/2025/12/exelo-combo-tool-v2.html VirusTotal https://www.virustotal.com/gui/file/2acd067847ee092c7986f55c9f77620d89505d1c0bda34a0ee8f55b9c2905c11?nocache=1 Visit my Blogger list to download 100% free software https://www.freetoolss.com/ https://blackhat8.blogspot.com/ https://hack-crack9.blogspot.com/ https://hackernoons.blogspot.com/ https://sharetools99.blogspot.com/
    • Care to detail why ?   L2JHellas probably got the same issue, it's inherent to L2J if you don't rework Player intentions (and solving it with a Config < 500 attack is stupid, if it works for attack it works for other types of desires), also last time I checked L2JHellas he was using my changesets to fix its own stuff (which is ok, copy-paste my knownlist system which is 10y old is fine, but don't say it will act different since it's literally the same sub-system).   About Lucera code source isn't available so it's easy to say it's better, internally you got no clue what is happening and RU forks got the "feeling" to get everything, but everything is half done, everytime I put an eye on such sources (whatever based on l2ru, they only know how to copy-paste each other).   In the other hand, you seem to use aCis since years (I think I see your name since a decade, and you still use it since you made this topic :   Be a little more appreciative about the work done, it's not only mine but my community aswell, and if you find something, consider to report rather than getting such an idiotic behavior.   I understand you're not forced to share any type of fixes, and than people tend to feel superior when they fix something than aCis didn't yet fix. The thing is, for each bug you found, I found and fixed 10x more than you.   409 is way beyond 382 in all possible ways, if you believe the versus good for you, but don't make ppl believe it's the case, because it's not. There's at least 400+ fixed issues (and that's counting 10 issues by revision, which is kinda low) and entire new systems (spawns, SCHs, pathfind, whole AI implemented, Desire system,...).
    • better than using 409... Search for L2jHellas or Lucera and you won't have any headaches.
  • Topics

×
×
  • 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