Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
196 views
in Technique[技术] by (71.8m points)

ERROR Scripts: No such method / java.lang.NoSuchMethodException

Тhe error:

[22:19:14] ERROR Scripts: No such method services.FakeHero.list()! java.lang.NoSuchMethodException: No such accessible method: list() on object: services.FakeHero at org.apache.commons.lang3.reflect.MethodUtils.invokeMethod(MethodUtils.java:129) at l2f.gameserver.scripts.Scripts.callScripts(Scripts.java:360) at l2f.gameserver.scripts.Scripts.callScripts(Scripts.java:296) at l2f.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:94) at l2f.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:49) at l2f.commons.net.nio.impl.MMOExecutableQueue.run(MMOExecutableQueue.java:39) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

The code:

public class FakeHero extends Functions{

    private final int[] ITEM = Config.SERVICES_HERO_SELL_ITEM;
    private final int[] PRICE = Config.SERVICES_HERO_SELL_PRICE;
    private final int[] DAY = Config.SERVICES_HERO_SELL_DAY;
    

    public void list(String[] arg)
    {
        final Player player = getSelf();
        if (player == null)
            return;
        
        if (!Config.SERVICES_HERO_SELL_ENABLED)
        {
            player.sendMessage("This service is turned off.");
            return;
        }
        NpcHtmlMessage html = null;
        if ((!player.isHero()) && (!player.isFakeHero()))
        {
            html = new NpcHtmlMessage(5).setFile("scripts/services/FakeHero/index.htm");
            String template = HtmCache.getInstance().getNotNull("scripts/services/FakeHero/template.htm", player);
            String block = "";
            String list = "";
            
            int page = arg[0].length() > 0 ? Integer.parseInt(arg[0]) : 1;
            int counter = 0;
            for (int i = (page - 1) * 6; i < DAY.length; i++)
            {
                block = template;
                block = block.replace("{bypass}", "bypass -h scripts_services.FakeHero:buy " + i);
                block = block.replace("{info}", DAY[i] + " " + Util.declension(DAY[i], DeclensionKey.DAYS));
                block = block.replace("{cost}", new CustomMessage("<font color=00ff00>Cost</font>: {0}").addString(Util.formatPay(player, PRICE[i], ITEM[i])).toString());
                list = list + block;
                
                counter++;
                if (counter >= 6)
                {
                    break;
                }
            }
            double count = Math.ceil(DAY.length / 6.0D);
            int inline = 1;
            String navigation = "";
            for (int i = 1; i <= count; i++)
            {
                if (i == page)
                {
                    navigation = navigation + "<td width=25 align=center valign=top><button value="[" + i + "]" action="bypass -h scripts_services.FakeHero:list " + i + "" width=32 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>";
                }
                else
                {
                    navigation = navigation + "<td width=25 align=center valign=top><button value="" + i + "" action="bypass -h scripts_services.FakeHero:list " + i + "" width=32 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>";
                }
                if (inline % 7 == 0)
                {
                    navigation = navigation + "</tr><tr>";
                }
                inline++;
            }
            if (inline == 2)
            {
                navigation = "<td width=30 align=center valign=top>...</td>";
            }
            html.replace("%list%", list);
            html.replace("%navigation%", navigation);
        }
        else
        {
            html = new NpcHtmlMessage(5).setFile("scripts/services/FakeHero/already.htm");
            player.sendMessage(new CustomMessage("You are already a hero."));
        }
        player.sendPacket(html);
    }
    
    public void buy(String[] arg)
    {
        final Player player = getSelf();
        if (player == null)
            return;
        
        if (!Config.SERVICES_HERO_SELL_ENABLED)
        {
            player.sendMessage("This service is turned off.");
            return;
        }
        if (arg[0].isEmpty())
        {
            return;
        }
        int i = Integer.parseInt(arg[0]);
        if (i > Config.SERVICES_HERO_SELL_DAY.length)
        {
            player.sendMessage("Error.");
            return;
        }
        if ((player.isHero()) || (player.isFakeHero()))
        {
            player.sendMessage("You are already a hero.");
            return;
        }
        if (Util.getPay(player, ITEM[i], PRICE[i], true))
        {
            long day = Util.addDay(DAY[i]);
            long time = System.currentTimeMillis() + day;
            try
            {
                player.setVar("hasFakeHero", 1, time);
                player.sendChanges();
                player.broadcastCharInfo();
                if (Config.SERVICES_HERO_SELL_SKILL)
                {
                    Hero.addSkills(player);
                }
                player.broadcastPacket(new SocialAction(player.getObjectId(), SocialAction.GIVE_HERO));
                player.sendMessage(new CustomMessage("Congratulations!").addNumber(DAY[i]).addString(Util.declension(DAY[i], DeclensionKey.DAYS)));
            }
            catch (Exception e)
            {
                player.sendMessage(new CustomMessage("Error."));
            }
        }
    }
}

I call the function here:

                                                                <table width=247 height=42>
                                                                    <tr>
                                                                        <td width=243 align=center valign=center>
                                                                            <table width=241 height=39>
                                                                                <tr>
                                                                                    <td width=40 align=right valign=top>
                                                                                        <table cellspacing=0 cellpadding=0 width=32 height=32 background=icon.pvp_point_i00>
                                                                                            <tr>
                                                                                                <td width=32 height=32 align=center valign=top>
                                                                                                    <img src=icon.panel_2 width=32 height=32>
                                                                                                </td>
                                                                                            </tr>
                                                                                        </table>
                                                                                    </td>
                                                                                    <td width=150 valign=center>
                                                                                        <font color=FF6600>15,000 Fame Points</font>
                                                                                        <br1>
                                                                                        <font color=669900>Cost:</font> 15 Donator Coin
                                                                                    </td>
                                                                                    <td width=47 valign=center align=center>
                                                                                        <button value=BUY action="bypass -h scripts_services.Donations:buy_fame" width=45 height=32 back=L2UI_CT1.ListCTRL_DF_Title_Down fore=L2UI_CT1.ListCTRL_DF_Title />
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                                <table width=247 height=42 bgcolor=111111>
                                                                    <tr>
                                                                        <td width=243 align=center valign=center>
                                                                            <table width=241 height=39>
                                                                                <tr>
                                                                                    <td width=40 align=right valign=top>
                                                                                        <table cellspacing=0 cellpadding=0 width=32 height=32 background=icon.skill1323>
                                                                                            <tr>
                                                                                                <td width=32 height=32 align=center valign=top>
                                                                                                    <img src=icon.panel_2 width=32 height=32>
                                                                                                </td>
                                                                                            </tr>
                                                                                        </table>
                                                                                    </td>
                                                                                    <td width=150 valign=center>
                                                                                        <font color=FF6600>Nobless</font>
                                                                                        <br1>
                                                                                        <font color=669900>Cost:</font> 10 Donator Coin
                                                                                    </td>
                                                                                    <td width=47 valign=center align=center>
                                                                             

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...