Jump to content
  • 0

Hello Got A Problem With A Code Can Anyone Help?


Question

4 answers to this question

Recommended Posts

  • 0
Posted (edited)

post the user.java here if you can and mark the line that the code is inserted 

red lines

 

 

 

  1. package handlers.voicedcommandhandlers;
  2.  
  3. import com.l2jserver.Config;
  4. import com.l2jserver.gameserver.GameTimeController;
  5. import com.l2jserver.gameserver.cache.HtmCache;
  6. import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
  7. import com.l2jserver.gameserver.model.L2World;
  8. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  9. import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
  10. import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
  11.  
  12. /**
  13.  * @author NeverMore
  14.  */
  15.  
  16. public class User implements IVoicedCommandHandler
  17. {
  18.        public static final String[] VOICED_COMMANDS = { "user" , "user1", "user2", "user3" };
  19.       
  20.        @Override
  21.        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
  22.        {
  23.                   if (Config.SHOW_USER)
  24.           {
  25.                           if(command.equalsIgnoreCase("user"))
  26.                           {
  27.                                   User.showUserPage(activeChar, "user.htm");
  28.                           }      
  29.                   if(command.equalsIgnoreCase("user1"))
  30.                           {
  31.                                   User.showUserPage(activeChar, "user1.htm");
  32.                           }  
  33.                   if(command.equalsIgnoreCase("user2"))
  34.                           {
  35.                                   User.showUserPage(activeChar, "user2.htm");
  36.                           }
  37.                   if(command.equalsIgnoreCase("user3"))
  38.                           {
  39.                                   User.showUserPage(activeChar, "user3.htm");
  40.                           }
  41.           }
  42.                   else
  43.                   {
  44.                                        activeChar.sendMessage("This command is disabled");
  45.                                        ExShowScreenMessage message1 = new ExShowScreenMessage("This command is disabled by admin!", 4000);
  46.                                        activeChar.sendPacket(message1);
  47.                                        return false;
  48.                   }    
  49.                        return false;      
  50.        }        
  51.       
  52.        public static String getServerRunTime()
  53.        {
  54.           int timeSeconds = (GameTimeController.getGameTicks() - 36000) / 10;
  55.           String timeResult = "";
  56.           if (timeSeconds >= 86400)
  57.                   timeResult = Integer.toString(timeSeconds / 86400) + " Days " + Integer.toString((timeSeconds % 86400) / 3600) + "hours";
  58.           else
  59.                   timeResult = Integer.toString(timeSeconds / 3600) + " Hours " + Integer.toString((timeSeconds % 3600) / 60) + "mins";
  60.           return timeResult;
  61.        }
  62.             
  63.        public static String getRealOnline()
  64.        {
  65.           int counter = 0;
  66.           for (L2PcInstance onlinePlayer : L2World.getInstance().getAllPlayersArray())
  67.           {
  68.                   if (onlinePlayer.isOnline() && (onlinePlayer.getClient() != null && !onlinePlayer.getClient().isDetached()))
  69.                   {
  70.                           counter++;
  71.                   }
  72.           }
  73.           String realOnline = "<tr><td fixwidth=11></td><td FIXWIDTH=280>Players Active</td><td FIXWIDTH=470><font color=FF6600>" + counter + "</font></td></tr>" + "<tr><td fixwidth=11></td><td FIXWIDTH=280>Players Shops</td><td FIXWIDTH=470><font color=FF6600>" + (L2World.getInstance().getAllPlayersCount() - counter) + "</font></td></tr>";
  74.           return realOnline;
  75.        }
  76.       
  77.        public static void showUserPage(L2PcInstance targetChar, String filename)
  78.        {
  79.           String content = HtmCache.getInstance().getHtmForce(targetChar.getHtmlPrefix(), "data/html/userpanel/" + filename);
  80.           NpcHtmlMessage UserPanelReply = new NpcHtmlMessage(5);
  81.           UserPanelReply.setHtml(content);
  82.           UserPanelReply.replace("%online%", String.valueOf(L2World.getInstance().getAllPlayers().size()));
  83.           UserPanelReply.replace("%name%", String.valueOf(targetChar.getName()));
  84.           UserPanelReply.replace("%serveronline%", getRealOnline());
  85.           UserPanelReply.replace("%servercapacity%", Integer.toString(Config.MAXIMUM_ONLINE_USERS));
  86.           UserPanelReply.replace("%serverruntime%", getServerRunTime());
  87.           UserPanelReply.replace("%playernumber%", String.valueOf(L2World.getInstance().getAllPlayers().size()));
  88.                   if (!Config.ENABLE_SPECIAL_EFFECT)
  89.                   {
  90.                        UserPanelReply.replace("%effect%", "Disabled");
  91.                   }
  92.                   else if (L2PcInstance._isoneffect == true)
  93.                   {
  94.                           UserPanelReply.replace("%effect%", "ON");
  95.                   }
  96.                   else  
  97.                   {
  98.                           UserPanelReply.replace("%effect%", "OFF");
  99.                   }
  100.                   if (!Config.ENABLE_PM_REFUSAL)
  101.                   {
  102.                           UserPanelReply.replace("%pm%", "Disabled");
  103.                   }
  104.                   else if (L2PcInstance._ispmrefusal == true)
  105.                   {
  106.                           UserPanelReply.replace("%pm%", "ON");
  107.                   }
  108.                   else
  109.                   {
  110.                           UserPanelReply.replace("%pm%", "OFF");
  111.                   }
  112.                   if (!Config.ENABLE_TRADE_REFUSAL)
  113.                   {
  114.                           UserPanelReply.replace("%trade%", "Disabled");
  115.                   }
  116.                   else if (L2PcInstance._istraderefusal == true)
  117.                   {
  118.                           UserPanelReply.replace("%trade%", "ON");
  119.                   }
  120.                   else
  121.                   {
  122.                           UserPanelReply.replace("%trade%", "OFF");
  123.                   }
  124.                   if (!Config.ENABLE_EXP_REFUSAL)
  125.                   {
  126.                        UserPanelReply.replace("%exp%", "Disabled");
  127.                   }
  128.                   else if (L2PcInstance._isexpsprefusal == true)
  129.                   {
  130.                        UserPanelReply.replace("%exp%", "ON");
  131.                   }
  132.                   else
  133.                   {
  134.                        UserPanelReply.replace("%exp%", "OFF");
  135.                   }
  136.                   if (!Config.ENABLE_SPECIAL_EFFECT)
  137.                   {
  138.                           UserPanelReply.replace("%effect%", "Disabled");
  139.                   }
  140.                   else if (L2PcInstance._isoneffect == true)
  141.                   {
  142.                           UserPanelReply.replace("%effect%", "ON");
  143.                   }
  144.                   else  
  145.                   {
  146.                           UserPanelReply.replace("%effect%", "OFF");
  147.                   }               
  148.                   targetChar.sendPacket(UserPanelReply);
  149.         }
  150.  
  151.       
  152.        @Override
  153.        public String[] getVoicedCommandList()
  154.        {
  155.                return VOICED_COMMANDS;
  156.        }
  157. }

     

     

     

     

     

    RED LINE

Edited by Olymps

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

    • There is a ready-made option and the possibility to work according to "Wishlist"
    • Contact me, Discord: xbaus
    • WTB GRACIA FINAL INTERFACE
    • Dear partners! At the moment we are in great need of the following positions: — Snapchat old and new accounts | With snapscores | Geo: Europe/USA | Full access via email/phone number — Reddit old (brute or hacked origin, self-registered) accounts with post and comment karma from 100 to 100,000+ | Full email access included — LinkedIn old accounts with real connections | Geo: Europe/USA | Full email access + active 2FA password — Instagram old accounts (2010–2023) | Full email access (possibly with active 2FA password) — Facebook old accounts (2010–2023) | Full email access (possibly with active 2FA password) | With friends or without friends | Geo: Europe/USA/Asia — Threads accounts | Full email access (possibly with active 2FA password) — TikTok/Facebook/Google ADS Agency advertising accounts — Email accounts: mail.ru, yahoo.com, gazeta.pl, gmx.ch / gmx.de / gmx.net (BUT NOT gmx.com) — Google ADS Manual Farm accounts (verified via email and phone number) | GEO: USA/Europe, mostly USA. — WhatsApp OLD Accounts — Twitter accounts with followers and posts (old accounts) Contact us via the details below. We will be glad to cooperate! We are also ready to consider other partnership and collaboration options. Active links to our projects: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. SMM Panel: Go to – promotion of your social media accounts. Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • 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