Jump to content
  • 0

Java.util.nosuchelementexception


Question

Posted (edited)

hey, what could be wrong with this code? I'm using acis 330rev

private static void sendReport(String event, L2PcInstance player, String command)
	{
		StringTokenizer st = new StringTokenizer(command);
			st.nextToken();

			String message = "";
			String _type = null;
			L2GameClient info = player.getClient().getConnection().getClient();
			
			try
			{
				_type = st.nextToken();
				while (st.hasMoreTokens())
				{
					message = message + st.nextToken() + " ";
				}
				
				if (message.equals(""))
				{
					player.sendMessage("Message box cannot be empty.");
					return;
				}
				
				String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss").format(Calendar.getInstance().getTime());
				String fname = "data/Reports/" + player.getName() + " "+timeStamp+".txt";
				File file = new File(fname);
				boolean exist = file.createNewFile();
				
				if (!exist)
				{
					return;
				}
				
				FileWriter fstream = new FileWriter(fname);
				BufferedWriter out = new BufferedWriter(fstream);
				out.write("Character Info: " + info + "\r\nBug Type: " + _type + "\r\nMessage: " + message);
				player.sendMessage("Report successfully sent. Staff will check it soon, thank you!");
				
				for (L2PcInstance allgms : L2World.getAllGMs())
				{
					allgms.sendMessage(player.getName() + " has sent a report. Type: " + _type);
				}
				
				out.close();
			}
			catch (Exception e)
			{
				L2Character._log.warning("could not send report: " + e);
			}
	}

I get this error when sending the report, however this worked fine on 320rev: java.util.NoSuchElementException

 

Please help me :/

Edited by lsj14

3 answers to this question

Recommended Posts

  • 0
Posted

probably a wrong bypass string with less than required parameters sent from the npc as "command" , this would fix the problem. source: http://javarevisited.blogspot.com/2012/02/how-to-solve-javautilnosuchelementexcep.html
 

private static void sendReport(String event, L2PcInstance player, String command)
	{
		StringTokenizer st = new StringTokenizer(command);
                       if(st.hasMoreTokens())
			st.nextToken();

			String message = "";
			String _type = null;
			L2GameClient info = player.getClient().getConnection().getClient();
			
			try
			{
                               if(st.hasMoreTokens())
				_type = st.nextToken();
				while (st.hasMoreTokens())
				{
					message = message + st.nextToken() + " ";
				}
				
				if (message.equals(""))
				{
					player.sendMessage("Message box cannot be empty.");
					return;
				}
				
				String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss").format(Calendar.getInstance().getTime());
				String fname = "data/Reports/" + player.getName() + " "+timeStamp+".txt";
				File file = new File(fname);
				boolean exist = file.createNewFile();
				
				if (!exist)
				{
					return;
				}
				
				FileWriter fstream = new FileWriter(fname);
				BufferedWriter out = new BufferedWriter(fstream);
				out.write("Character Info: " + info + "\r\nBug Type: " + _type + "\r\nMessage: " + message);
				player.sendMessage("Report successfully sent. Staff will check it soon, thank you!");
				
				for (L2PcInstance allgms : L2World.getAllGMs())
				{
					allgms.sendMessage(player.getName() + " has sent a report. Type: " + _type);
				}
				
				out.close();
			}
			catch (Exception e)
			{
				L2Character._log.warning("could not send report: " + e);
			}
	}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • 🚀 MoMoProxy Static Residential Proxies For Sale!     🔹 Stable, secure & high-anonymity 🔹 >10Mbps speed, <10ms latency 🔹 99.99% uptime & static IPs 🔹 Unlimited traffic & connections 🌍 30M+ clean residential IPs ✅ Whitelist & user/pass auth 💳 Flexible plans (7/30/90 days) 💰 From $3/IP (Pay-per-IP) 🔥 Perfect for: ✔️ Ad verification ✔️ E-commerce/social media ✔️ Data scraping ✔️ Anti-detect browsers 🆓 Start free trial today! 🔗 [Insert Link] #Proxy #ResidentialProxies #WebScraping #DigitalMarketing   1/ Why Choose MoMoProxy? ✅ Global ISP network (30M+ IPs) ✅ Dedicated dashboard for easy management ✅ 24/7 stable operation ✅ HTTP(S)/SOCKS5 support 2/ Use Cases: 📊 Ad fraud detection 🛒 Sneaker copping & e-com 📱 Social media automation 🌐 Travel aggregation & more! 3/ Get Started in 4 Steps: A. Pick MoMoProxy B. Grab your IP credentials C. Configure your tool D. Enjoy unlimited sessions!   https://momoproxy.com/static-residential-proxies https://momoproxy.com/static-residential-proxies https://momoproxy.com/static-residential-proxies    
    • ➡ Discount for your purchase: MAY2025 (10% discount) ➡ Our Online Shop: https://socnet.store  ➡ Our SMM-Boosting Panel: https://socnet.pro  ➡ Telegram Shop Bot: https://socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
    • ➡ Discount for your purchase: MAY2025 (10% discount) ➡ Our Online Shop: https://socnet.store  ➡ Our SMM-Boosting Panel: https://socnet.pro  ➡ Telegram Shop Bot: https://socnet.shop  ➡ Telegram Support: https://t.me/solomon_bog  ➡ Telegram Channel: https://t.me/accsforyou_shop  ➡ Discord Support: @AllSocialNetworksShop  ➡ Discord Server: https://discord.gg/y9AStFFsrh  ➡ WhatsApp Support: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n  ➡ Email Support: solomonbog@socnet.store 
    • Special offer until end of the month, don't lose it. 250  include datapack and patch latest.
    • We are certainly not an ambulance, but we will definitely cure you of blacklists and empty pockets. Live freely with SX! Each of you will receive a trial version of SX to familiarize yourself with the product, all you have to do is post in this thread
  • Topics

×
×
  • Create New...