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);
			}
	}

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

    • We are entering another season, the year 2026, which marks 20 years since the beginning of preparations for the first Chronicle server - Gracia Final.     The plans are the same as 20 years ago: to prepare a new generation of the game with the help of our edited game client, New Era.   There will be special new locations and dungeons for solo players and clans, clan quests and a clan shop, as well as special items and jewelry with attributes.     Enjoy the game at Dark Dragon             https://www.darkdragon.club/wp-content/uploads/2025/12/Dark_Dragon_login_New_Era.mp4    
    • Coming soon — New Year promotions across the entire SOCNET ecosystem We are preparing special offers, bonuses, and surprises across all our projects. Follow updates on our social media — you definitely don’t want to miss them. News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh
    • Coming soon — New Year promotions across the entire SOCNET ecosystem We are preparing special offers, bonuses, and surprises across all our projects. Follow updates on our social media — you definitely don’t want to miss them. News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh
    • We are looking for partners and account suppliers for cooperation We are open to partnerships with reliable account suppliers for the following services: ➡ Tinder ➡ Badoo ➡ Bumble ➡ Hinge ➡ Happn ➡ Meetic ➡ VK Dating ➡ LINE ➡ Snapchat ➡ Reddit ➡ LinkedIn ➡ Instagram ➡ Facebook ➡ Threads ➡ Google ADS ➡ E-mails ➡ WhatsApp ➡ Twitter We are considering long-term cooperation, stable volumes, and mutually beneficial terms. If you have any offers — we will be glad to discuss the details. Contact us using the details below. ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Hello Alisa, do you know where is the "auto target" when other enemy attack you?, is in dll but idk wich is the binary code
  • 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