Jump to content
  • 0

oti nane problhma java


Question

Posted

exw auto to kommati code.

 

package custom.Gatekeeper;

import com.l2jserver.gameserver.custom.FTS;
import com.l2jserver.gameserver.instancemanager.TownManager;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;

public class Gatekeeper extends Quest
{

private static final int id = 444;

@Override
public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
	int i = 1;
	if (event.equalsIgnoreCase("1"))
	{
		NpcHtmlMessage htm = new NpcHtmlMessage(npc.getObjectId());
		String filler = "<html><title>Gatekeeper</title><body><br>Select a town to teleport:<br>";
		while(i<21)
		{
			if(FTS.isAvailable(i))

 

public static boolean isAvailable(int town)
{
	int id = 0;
--------->for(L2Character t : TownManager.getTown(town).getCharactersInside().values())
	{
		if (t instanceof L2PcInstance)		
		{
			id++;
		}
	}
	return id < 20;
}

 

einai apo quest script p ekana sto datapack.

kai to allo apo to class FTS.

me leei gia nullpointer exception ekei pou exw belos.

Kai eida oti epistrefei thn timh null to TownManager.getTown(town) anti gia polh.

Alla apo mesa apo to class otan xrhsimopoiw to isAvailable(integer) den exw problhma.

Mporeite na mou peite ti la8os kanw?

3 answers to this question

Recommended Posts

  • 0
Posted

ebala try/catch exception e, alla den me boi8a se kati.

Apla 8elw se mia lista ola ta town zones....

 

 

 

 

EDIT: Po eperna kai to getTown(18) pou den iparxei.......

alla twra exw neo prob apo to html.....8a to steilw se ligo

  • 0
Posted

To town id puo dineis stin sinartisi den antistoixei se kapio town. Otan prospatheis na pareis tin lsita apo ta objects mias town pou einai null exeis null pointer exception.

 

That pareis prota tin town na deis an einai null.

 

if(TownManager.getTown(town)==null)

return null;

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.



×
×
  • Create New...