Jump to content
  • 0

[HELP] IOException error


Question

Posted

Hello,

 

I've been getting an error and I have no idea how to get rid of it, if anyone can just tell me what is causing it...

 

I just want to know what the problem is, I'll try to fix it my self.

 

Ok then, this is my error:

 

Error on loading dimensional rift spawns: java.io.IOException
java.io.IOException
        at com.l2jmod.gameserver.instancemanager.DimensionalRiftManager.loadS
pawns(DimensionalRiftManager.java:149)
        at com.l2jmod.gameserver.L2GameServer.loadSpawns(L2GameServer.java:31
5)
        at com.l2jmod.gameserver.L2GameServer.load(L2GameServer.java:245)
        at com.ll2jmod.gameserver.L2GameServer.main(L2GameServer.java:584)

 

I just how someone will help me with any info, thanks.

8 answers to this question

Recommended Posts

  • 0
Posted

Thanks for your help.

 

This is the entire packet (P.S. the "bad" line is 128):

package com.l2jmod.gameserver.instancemanager;

import java.awt.Polygon;
import java.awt.Shape;
import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import javax.xml.parsers.DocumentBuilderFactory;

import javolution.util.FastList;
import javolution.util.FastMap;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

import com.l2jmod.Config;
import com.l2jmod.database.DatabaseFactory;
import com.l2jmod.gameserver.datatables.NpcTable;
import com.l2jmod.gameserver.datatables.SpawnTable;
import com.l2jmod.gameserver.model.L2ItemInstance;
import com.l2jmod.gameserver.model.L2Spawn;
import com.l2jmod.gameserver.model.actor.L2Npc;
import com.l2jmod.gameserver.model.actor.L2Player;
import com.l2jmod.gameserver.model.entity.DimensionalRift;
import com.l2jmod.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jmod.gameserver.templates.actor.L2NpcTemplate;
import com.l2jmod.tools.Rnd;

public class DimensionalRiftManager
{

private static Log _log = LogFactory.getLog(DimensionalRiftManager.class.getName());
private static DimensionalRiftManager _instance;
private final FastMap<Byte, FastMap<Byte, DimensionalRiftRoom>> _rooms = new FastMap<Byte, FastMap<Byte, DimensionalRiftRoom>>();
private final short DIMENSIONAL_FRAGMENT_ITEM_ID = 7079;

public static DimensionalRiftManager getInstance()
{
	if (_instance == null)
		_instance = new DimensionalRiftManager();

	return _instance;
}

public DimensionalRiftRoom getRoom(byte type, byte room)
{
	return _rooms.get(type) == null ? null : _rooms.get(type).get(room);
}

public void loadRooms()
{
	Connection con = null;

	try
	{
		con = DatabaseFactory.getInstance().getConnection();
		PreparedStatement s = con.prepareStatement("SELECT * FROM dimensional_rift");
		ResultSet rs = s.executeQuery();

		while (rs.next())
		{
			// 0 waiting room, 1 recruit, 2 soldier, 3 officer, 4 captain , 5 commander, 6 hero
			byte type = rs.getByte("type");
			byte room_id = rs.getByte("room_id");

			//coords related
			int xMin = rs.getInt("xMin");
			int xMax = rs.getInt("xMax");
			int yMin = rs.getInt("yMin");
			int yMax = rs.getInt("yMax");
			int z1 = rs.getInt("zMin");
			int z2 = rs.getInt("zMax");
			int xT = rs.getInt("xT");
			int yT = rs.getInt("yT");
			int zT = rs.getInt("zT");
			boolean isBossRoom = rs.getByte("boss") > 0;

			if (!_rooms.containsKey(type))
				_rooms.put(type, new FastMap<Byte, DimensionalRiftRoom>());

			_rooms.get(type).put(room_id, new DimensionalRiftRoom(type, room_id, xMin, xMax, yMin, yMax, z1, z2, xT, yT, zT, isBossRoom));
		}

		s.close();
		con.close();
	}
	catch (Exception e)
	{
		_log.warn("Can't load Dimension Rift zones. " + e);
	}
	finally
	{
		try
		{
			con.close();
		}
		catch (Exception e)
		{ /*do nothing */
		}
	}

	int typeSize = _rooms.keySet().size();
	int roomSize = 0;

	for (Byte b : _rooms.keySet())
		roomSize += _rooms.get(b).keySet().size();

	_log.info("DimensionalRiftManager: Loaded " + typeSize + " room types with " + roomSize + " rooms.");
}

  public void loadSpawns()
  {
    int countGood = 0; int countBad = 0;
    try
    {
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      factory.setValidating(false);
      factory.setIgnoringComments(true);

      File file = new File(Config.DATAPACK_ROOT + "/data/dimensionalRift.xml");
      if (!file.exists()) {
        throw new IOException();
      }
      Document doc = factory.newDocumentBuilder().parse(file);

      for (Node rift = doc.getFirstChild(); rift != null; rift = rift.getNextSibling())
      {
        if (!"rift".equalsIgnoreCase(rift.getNodeName()))
          continue;
        for (Node area = rift.getFirstChild(); area != null; area = area.getNextSibling())
        {
          if (!"area".equalsIgnoreCase(area.getNodeName()))
            continue;
          NamedNodeMap attrs = area.getAttributes();
          byte type = Byte.parseByte(attrs.getNamedItem("type").getNodeValue());

          for (Node room = area.getFirstChild(); room != null; room = room.getNextSibling())
          {
            if (!"room".equalsIgnoreCase(room.getNodeName()))
              continue;
            attrs = room.getAttributes();
            byte roomId = Byte.parseByte(attrs.getNamedItem("id").getNodeValue());

            for (Node spawn = room.getFirstChild(); spawn != null; spawn = spawn.getNextSibling())
            {
              if (!"spawn".equalsIgnoreCase(spawn.getNodeName()))
                continue;
              attrs = spawn.getAttributes();
              int mobId = Integer.parseInt(attrs.getNamedItem("mobId").getNodeValue());
              int delay = Integer.parseInt(attrs.getNamedItem("delay").getNodeValue());
              int count = Integer.parseInt(attrs.getNamedItem("count").getNodeValue());

              L2NpcTemplate template = NpcTable.getInstance().getTemplate(mobId);
              if (template == null) _log.warn("Template " + mobId + " not found!");
              if (!this._rooms.containsKey(Byte.valueOf(type))) _log.warn("Type " + type + " not found!");
              else if (!((FastMap)this._rooms.get(Byte.valueOf(type))).containsKey(Byte.valueOf(roomId))) _log.warn("Room " + roomId + " in Type " + type + " not found!");

              for (int i = 0; i < count; i++)
              {
                DimensionalRiftRoom riftRoom = (DimensionalRiftRoom)((FastMap)this._rooms.get(Byte.valueOf(type))).get(Byte.valueOf(roomId));
                int x = riftRoom.getRandomX();
                int y = riftRoom.getRandomY();
                int z = riftRoom.getTeleportCoords()[2];

                if ((template != null) && (this._rooms.containsKey(Byte.valueOf(type))) && (((FastMap)this._rooms.get(Byte.valueOf(type))).containsKey(Byte.valueOf(roomId))))
                {
                  L2Spawn spawnDat = new L2Spawn(template);
                  spawnDat.setAmount(1);
                  spawnDat.setLocx(x);
                  spawnDat.setLocy(y);
                  spawnDat.setLocz(z);
                  spawnDat.setHeading(-1);
                  spawnDat.setRespawnDelay(delay);
                  SpawnTable.getInstance().addNewSpawn(spawnDat, false);
                  ((DimensionalRiftRoom)((FastMap)this._rooms.get(Byte.valueOf(type))).get(Byte.valueOf(roomId))).getSpawns().add(spawnDat);
                  countGood++;
                }
                else
                {
                  countBad++;
                }
              }
            }

          }

        }

      }

    }
    catch (Exception e)
    {
      _log.warn("Error on loading dimensional rift spawns: " + e);
      e.printStackTrace();
    }
    _log.info("DimensionalRiftManager: Loaded " + countGood + " dimensional rift spawns, " + countBad + " errors.");
  }

public void reload()
{
	for (Byte b : _rooms.keySet())
	{
		for (int i : _rooms.get(b).keySet())
		{
			_rooms.get(b).get(i).getSpawns().clear();
		}
		_rooms.get(b).clear();
	}
	_rooms.clear();
	loadRooms();
	loadSpawns();
}

public boolean checkIfInRiftZone(int x, int y, int z, boolean ignorePeaceZone)
{
	if (ignorePeaceZone)
		return _rooms.get((byte) 0).get((byte) 1).checkIfInZone(x, y, z);
	else
		return _rooms.get((byte) 0).get((byte) 1).checkIfInZone(x, y, z) && !_rooms.get((byte) 0).get((byte) 0).checkIfInZone(x, y, z);
}

public boolean checkIfInPeaceZone(int x, int y, int z)
{
	return _rooms.get((byte) 0).get((byte) 0).checkIfInZone(x, y, z);
}

public void teleportToWaitingRoom(L2Player player)
{
	int[] coords = getRoom((byte) 0, (byte) 0).getTeleportCoords();
	player.teleToLocation(coords[0], coords[1], coords[2]);
}

public void start(L2Player player, byte type, L2Npc npc)
{
	boolean canPass = true;
	if (!player.isInParty())
	{
		showHtmlFile(player, "data/html/seven_signs/rift/NoParty.htm", npc);
		return;
	}

	if (player.getParty().getPartyLeaderOID() != player.getObjectId())
	{
		showHtmlFile(player, "data/html/seven_signs/rift/NotPartyLeader.htm", npc);
		return;
	}

	if (player.getParty().isInDimensionalRift())
	{
		handleCheat(player, npc);
		return;
	}

	if (player.getParty().getMemberCount() < Config.RIFT_MIN_PARTY_SIZE)
	{
		NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
		html.setFile("data/html/seven_signs/rift/SmallParty.htm");
		html.replace("%npc_name%", npc.getName());
		html.replace("%count%", new Integer(Config.RIFT_MIN_PARTY_SIZE).toString());
		player.sendPacket(html);
		return;
	}

	for (L2Player p : player.getParty().getPartyMembers())
		if (!checkIfInPeaceZone(p.getX(), p.getY(), p.getZ()))
			canPass = false;

	if (!canPass)
	{
		showHtmlFile(player, "data/html/seven_signs/rift/NotInWaitingRoom.htm", npc);
		return;
	}

	L2ItemInstance i;
	for (L2Player p : player.getParty().getPartyMembers())
	{
		i = p.getInventory().getItemByItemId(DIMENSIONAL_FRAGMENT_ITEM_ID);

		if (i == null)
		{
			canPass = false;
			break;
		}

		if (i.getCount() > 0)
			if (i.getCount() < getNeededItems(type))
				canPass = false;
	}

	if (!canPass)
	{
		NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
		html.setFile("data/html/seven_signs/rift/NoFragments.htm");
		html.replace("%npc_name%", npc.getName());
		html.replace("%count%", new Integer(getNeededItems(type)).toString());
		player.sendPacket(html);
		return;
	}

	for (L2Player p : player.getParty().getPartyMembers())
	{
		i = p.getInventory().getItemByItemId(DIMENSIONAL_FRAGMENT_ITEM_ID);
		p.destroyItem("RiftEntrance", i.getObjectId(), getNeededItems(type), null, false);
	}

	new DimensionalRift(player.getParty(), type, (byte) Rnd.get(1, 9));
}

public void killRift(DimensionalRift d)
{
	if (d.getTeleportTimerTask() != null)
		d.getTeleportTimerTask().cancel();
	d.setTeleportTimerTask(null);

	if (d.getTeleportTimer() != null)
		d.getTeleportTimer().cancel();
	d.setTeleportTimer(null);

	if (d.getSpawnTimerTask() != null)
		d.getSpawnTimerTask().cancel();
	d.setSpawnTimerTask(null);

	if (d.getSpawnTimer() != null)
		d.getSpawnTimer().cancel();
	d.setSpawnTimer(null);
}

public class DimensionalRiftRoom
{
	protected final byte _type;
	protected final byte _room;
	private final int _xMin;
	private final int _xMax;
	private final int _yMin;
	private final int _yMax;
	private final int _zMin;
	private final int _zMax;
	private final int[] _teleportCoords;
	private final Shape _s;
	private final boolean _isBossRoom;
	private final FastList<L2Spawn> _roomSpawns;
	protected final FastList<L2Npc> _roomMobs;

	public DimensionalRiftRoom(byte type, byte room, int xMin, int xMax, int yMin, int yMax, int zMin, int zMax, int xT, int yT, int zT, boolean isBossRoom)
	{
		_type = type;
		_room = room;
		_xMin = (xMin + 128);
		_xMax = (xMax - 128);
		_yMin = (yMin + 128);
		_yMax = (yMax - 128);
		_zMin = zMin;
		_zMax = zMax;
		_teleportCoords = new int[] { xT, yT, zT };
		_isBossRoom = isBossRoom;
		_roomSpawns = new FastList<L2Spawn>();
		_roomMobs = new FastList<L2Npc>();
		_s = new Polygon(new int[] { xMin, xMax, xMax, xMin }, new int[] { yMin, yMin, yMax, yMax }, 4);
	}

	public int getRandomX()
	{
		return Rnd.get(_xMin, _xMax);
	}

	public int getRandomY()
	{
		return Rnd.get(_yMin, _yMax);
	}

	public int[] getTeleportCoords()
	{
		return _teleportCoords;
	}

	public boolean checkIfInZone(int x, int y, int z)
	{
		return _s.contains(x, y) && z >= _zMin && z <= _zMax;
	}

	public boolean isBossRoom()
	{
		return _isBossRoom;
	}

	public FastList<L2Spawn> getSpawns()
	{
		return _roomSpawns;
	}

	public void spawn()
	{
		for (L2Spawn spawn : _roomSpawns)
		{
			spawn.doSpawn();
			spawn.startRespawn();
		}
	}

	public void unspawn()
	{
		for (L2Spawn spawn : _roomSpawns)
		{
			spawn.stopRespawn();
			if (spawn.getLastSpawn() != null)
				spawn.getLastSpawn().deleteMe();
		}
	}
}

private int getNeededItems(byte type)
{
	switch (type)
	{
		case 1:
			return Config.RIFT_ENTER_COST_RECRUIT;
		case 2:
			return Config.RIFT_ENTER_COST_SOLDIER;
		case 3:
			return Config.RIFT_ENTER_COST_OFFICER;
		case 4:
			return Config.RIFT_ENTER_COST_CAPTAIN;
		case 5:
			return Config.RIFT_ENTER_COST_COMMANDER;
		case 6:
			return Config.RIFT_ENTER_COST_HERO;
		default:
			return 999999;
	}
}

public void showHtmlFile(L2Player player, String file, L2Npc npc)
{
	NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
	html.setFile(file);
	html.replace("%npc_name%", npc.getName());
	player.sendPacket(html);
}

public void handleCheat(L2Player player, L2Npc npc)
{
	showHtmlFile(player, "data/html/seven_signs/rift/Cheater.htm", npc);
	if (!player.isGM())
	{
		_log.warn("Player " + player.getName() + "(" + player.getObjectId() + ") was cheating in dimension rift area!");
		player.getGuard().handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " tried to cheat in dimensional rift.", Config.DEFAULT_PUNISH);
	}
}
}

  • 0
Posted

Akken stop saying bs :P.

 

1 - it's not an NPE, it's an IOException error.

2 - it's not Archid, it's l2jmod.

 

----

 

About problem you got at line 128 as the topic creator said :

 

     File file = new File(Config.DATAPACK_ROOT + "/data/dimensionalRift.xml");

     if (!file.exists()) {

       throw new IOException();

     }

 

The second line means if the "file" doesn't exists, then throw an error. If you refer to the first line you got the name of the file, "dimensionalRift.xml"

 

To correct, you have to add the file to the good location : data/dimensionalRift.xml, so to the root of data folder.

 

To be simple you miss a file in your datapack named dimensionalRift.xml, and the gameserver doesn't like it and says to you "Hehehe, you miss a file noob ! I powned your ass !". Add the file and it will be fine.

  • 0
Posted

l2jmod is based on the standard archid  i see same errors same shits.... so i solved it like this :D

 

But yes you are right... seems i am 0 skilled

  • 0
Posted

l2jmod is based on the standard archid  i see same errors same shits.... so i solved it like this :D

 

But yes you are right... seems i am 0 skilled

 

Think before you say. Lol.

Guest
This topic is now closed to further replies.
  • Posts

    • Server mid rate craft PvP   CLIENTE INTERLUDE Website server Discord olympus x25 &nbsp;server 🇧🇷🇦🇷🇨🇱🇬🇷🇲🇽🇵🇪🇸🇰🇪🇸🇺🇾 Server mid rate craft PvP 🔱CLIENTE INTERLUDE🔱 🔅xpx25 🔅Sp x25 🔅Adena x15 🔅Droop x2 🔅Spoil x2 🔅Raidboss xp x2 🔅Raidboss sp x2 🔅Raidboss droop x1 🔅All Rate quest reward  x1 ⚠️All Quest drop reward. x1 🔅Manor x 3 🔅Seal stone x1 🛡️🗡️INFO GRADO S🗡️🛡️ ⚠️Inicia desabilitado drop/spoil/quest. 🔱PROFESIONES/SUBCLASS🔱 🛡️1st profession - 50medal 🛡️2nd profession - 500 medal 🛡️3rd profession - 1k medal +30kk adena 🛡️Sub class - Quest. No necesita matar raids. ⚙️Configuraciones⚙️ 🛡️Gmshop  grade - B. 🛡️Grade A-S Craft - yes x1 chance 🛡️Globlal teleport - yes 🛡️Buffer 1hora. 🛡️Buffer slot 24(+4divine)+12 dances-song 🛡️Auto learn skils - yes 🛡️Autoloot - yes 🛡️Mana potion recarga 1000 ,9segundos delay. 🛡️Champions system:     ▫️lvl 30 - 76     ▫️chance respawn 0.5%.     ▫️adena x20 🛡️Max lvl party 14 lvl. 🛡️Festive sweeper on. 🛡️Max client pc 2. 🛡️Raid boss respawn retail. 🛡️Nobleza quest - yes. 🛡️Barakiel respawn 6 horas + -30 min. 🛡️Olimpiada duracion 14 dias. 🛡️Olimpiada de 18:00 a 00:00 🛡️Safe enchant +3 🛡️Normal enchant scroll 50% ⚠️+11-16 chance 30% 🛡️Bleesed enchant scroll 55% ⚠️+11-16 chance 35% 🛡️Rate dinamico x1 lvl 77-80   🛡️🗡️CLANES INFO🗡️🛡️ 🔅Crear clan min. level 20 🔅Max Alianzas 1 🔅Duracion penalidades clan / alianzas 8 horas. 🔅Cambio de lider 24 horas. 🛡️⚔️ ASEDIOS ⚔️🛡️ 🔅Cada 2 semanas. 🔅Proteccion hwid 1 pc. 🔅Clanes registrados. acceden a zona de asedio. 🔅Castillo asediable Aden. 🔅Reward 1000 FA 🔅Horario 16:00 GMT-3 🎊PACK DE INICIO🎊 🔅Start set - armor\weapon no grade. 🔅Level 20  - 5 shadow cuppon grado D 🔅Level 40 - 5 shadow cuppon grado C 🔅Free Autofarm 24 horas. 💰 INFO PREMIUM 💰 🔅Free autofarm. 🔅xp x30 🔅sp x30 🔅adena x17 🔅drop x4 🔅spoil x4 🔅enchant +2% 🔅seal stone x1 🔅Altb Gk-Gmshop/buffe ⚔️ RAID  BOSS INFO ⚔️ 🔅Raid boss 70 ++ respawn 5 días despues. 🔅Raid boss 75 ++ respawn 15 días despues 🔅Drop LETTER L2DAY para tradear en GMshop. ⚔️ INFO SEVEN SING ⚔️ 🔅Inicio del drop Seal stones dia 5 de iniciado el server. 🎊 EPIC RAID INFO 🎊 🔅Queen Ant (lvl 40)respawn Lunes a Viernes 22:00 GMT-3 drop chance 30%. 🔅Core (lvl 80)respawn Martes-miercoles 20:20 GMT-3 drop chance 100%. 🔅Orfen (lvl 80)respawn Martes-miercoles 21:00 GMT-3 drop chance 100%. 🔅Zaken (lvl 80)respawn Jueves 23:00 GMT-3 drop chance 100%. 🔅Frintezza (lvl 80)respawn Viernes 23:00 GMT-3 drop chance 100%. 🔅Baium (lvl 80)respawn Sabado 22:00 GMT-3 drop chance 100%. 🔅Valakas (lvl 80)respawn Domingo 20:00 GMT-3 drop chance 100%. 🔅Antharas (lvl 80)respawn Domingo 22:00 GMT-3 drop chance 100%.
    • The server is running in l2house.com.ar with C4 mode and in L2Tekila within the same login you can also test it in C5, if you want me to raise another chronicle to test, just let me know.
    • video nice song TopGear  gaming 1990    ....  
    • I have a system where Accounts are saved on login screen for fast login. I am playing a server where this feature is not on the logic screen. How I can try to add this feature to the system? I don't know what files I would have to touch.   Thanks!!
  • Topics

×
×
  • Create New...