Updated IXmlReader to match newer branches.

This commit is contained in:
MobiusDev
2018-04-03 18:15:04 +00:00
parent 9f35fd7fe6
commit 81d82a90ac
54 changed files with 1050 additions and 830 deletions

View File

@@ -16,6 +16,7 @@
*/ */
package ai.npc.ForgeOfTheGods; package ai.npc.ForgeOfTheGods;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
@@ -26,7 +27,7 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.geoengine.GeoEngine;
import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.L2Spawn;
@@ -38,7 +39,7 @@ import com.l2jmobius.gameserver.model.actor.L2Npc;
* Tar Beetle zone spawn * Tar Beetle zone spawn
* @author malyelfik * @author malyelfik
*/ */
public class TarBeetleSpawn implements IXmlReader public class TarBeetleSpawn implements IGameXmlReader
{ {
private final List<SpawnZone> zones = new ArrayList<>(); private final List<SpawnZone> zones = new ArrayList<>();
private ScheduledFuture<?> spawnTask; private ScheduledFuture<?> spawnTask;
@@ -61,7 +62,7 @@ public class TarBeetleSpawn implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
int i = 0; int i = 0;
for (Node d = doc.getFirstChild(); d != null; d = d.getNextSibling()) for (Node d = doc.getFirstChild(); d != null; d = d.getNextSibling())
@@ -97,11 +98,11 @@ public class TarBeetleSpawn implements IXmlReader
final Zone bannedZone = new Zone(); final Zone bannedZone = new Zone();
final int bMinZ = parseInteger(attrs, "minZ"); final int bMinZ = parseInteger(attrs, "minZ");
final int bMaxZ = parseInteger(attrs, "maxZ"); final int bMaxZ = parseInteger(attrs, "maxZ");
for (Node f = c.getFirstChild(); f != null; f = f.getNextSibling()) for (Node h = c.getFirstChild(); h != null; h = h.getNextSibling())
{ {
if (f.getNodeName().equals("point")) if (h.getNodeName().equals("point"))
{ {
attrs = f.getAttributes(); attrs = h.getAttributes();
final int x = parseInteger(attrs, "x"); final int x = parseInteger(attrs, "x");
final int y = parseInteger(attrs, "y"); final int y = parseInteger(attrs, "y");
bannedZone.add(x, y, bMinZ, bMaxZ, 0); bannedZone.add(x, y, bMinZ, bMaxZ, 0);

View File

@@ -16,6 +16,7 @@
*/ */
package ai.npc.NpcBuffers; package ai.npc.NpcBuffers;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -26,13 +27,13 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
/** /**
* @author UnAfraid * @author UnAfraid
*/ */
public class NpcBuffersData implements IXmlReader public class NpcBuffersData implements IGameXmlReader
{ {
private final Map<Integer, NpcBufferData> _npcBuffers = new HashMap<>(); private final Map<Integer, NpcBufferData> _npcBuffers = new HashMap<>();
@@ -49,7 +50,7 @@ public class NpcBuffersData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
StatsSet set; StatsSet set;
Node attr; Node attr;

View File

@@ -16,6 +16,7 @@
*/ */
package hellbound; package hellbound;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -23,13 +24,13 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
/** /**
* Point data parser. * Point data parser.
* @author Zoey76 * @author Zoey76
*/ */
public final class HellboundPointData implements IXmlReader public final class HellboundPointData implements IGameXmlReader
{ {
private final Map<Integer, int[]> _pointsInfo = new HashMap<>(); private final Map<Integer, int[]> _pointsInfo = new HashMap<>();
@@ -47,7 +48,7 @@ public final class HellboundPointData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package hellbound; package hellbound;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -25,7 +26,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.datatables.SpawnTable; import com.l2jmobius.gameserver.datatables.SpawnTable;
import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.L2Spawn;
import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.Location;
@@ -34,7 +35,7 @@ import com.l2jmobius.gameserver.model.Location;
* Hellbound Spawns parser. * Hellbound Spawns parser.
* @author Zoey76 * @author Zoey76
*/ */
public final class HellboundSpawns implements IXmlReader public final class HellboundSpawns implements IGameXmlReader
{ {
private final List<L2Spawn> _spawns = new ArrayList<>(); private final List<L2Spawn> _spawns = new ArrayList<>();
private final Map<Integer, int[]> _spawnLevels = new HashMap<>(); private final Map<Integer, int[]> _spawnLevels = new HashMap<>();
@@ -54,7 +55,7 @@ public final class HellboundSpawns implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node node = doc.getFirstChild(); node != null; node = node.getNextSibling()) for (Node node = doc.getFirstChild(); node != null; node = node.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package instances.FinalEmperialTomb; package instances.FinalEmperialTomb;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -31,7 +32,7 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.geoengine.GeoEngine;
@@ -74,7 +75,7 @@ import instances.AbstractInstance;
* Use proper zone spawn system. * Use proper zone spawn system.
* @author Gigiikun * @author Gigiikun
*/ */
public final class FinalEmperialTomb extends AbstractInstance implements IXmlReader public final class FinalEmperialTomb extends AbstractInstance implements IGameXmlReader
{ {
protected class FETWorld extends InstanceWorld protected class FETWorld extends InstanceWorld
{ {
@@ -258,7 +259,7 @@ public final class FinalEmperialTomb extends AbstractInstance implements IXmlRea
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
final Node first = doc.getFirstChild(); final Node first = doc.getFirstChild();
if ((first != null) && "list".equalsIgnoreCase(first.getNodeName())) if ((first != null) && "list".equalsIgnoreCase(first.getNodeName()))

View File

@@ -2813,7 +2813,7 @@
<node X="145760" Y="-47633" /> <node X="145760" Y="-47633" />
<node X="145415" Y="-47471" /> <node X="145415" Y="-47471" />
</zone> </zone>
<zone name="no_bookmark_rune_slow_1" type="ConditionZone" shape="NPoly" minZ="509" maxZ="09"> <zone name="no_bookmark_rune_slow_1" type="ConditionZone" shape="NPoly" minZ="509" maxZ="9">
<stat name="NoBookmark" val="true" /> <stat name="NoBookmark" val="true" />
<node X="13785" Y="-47663" /> <node X="13785" Y="-47663" />
<node X="14046" Y="-47854" /> <node X="14046" Y="-47854" />
@@ -2827,7 +2827,7 @@
<node X="14052" Y="-50447" /> <node X="14052" Y="-50447" />
<node X="13788" Y="-50647" /> <node X="13788" Y="-50647" />
</zone> </zone>
<zone name="no_bookmark_rune_damage_1" type="ConditionZone" shape="NPoly" minZ="509" maxZ="09"> <zone name="no_bookmark_rune_damage_1" type="ConditionZone" shape="NPoly" minZ="509" maxZ="9">
<stat name="NoBookmark" val="true" /> <stat name="NoBookmark" val="true" />
<node X="13785" Y="-47663" /> <node X="13785" Y="-47663" />
<node X="14046" Y="-47854" /> <node X="14046" Y="-47854" />

View File

@@ -52,9 +52,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.commons.util.PropertiesParser; import com.l2jmobius.commons.util.PropertiesParser;
import com.l2jmobius.gameserver.GameServer;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType; import com.l2jmobius.gameserver.enums.IllegalActionPunishmentType;
import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.Location;
@@ -3299,7 +3298,7 @@ public final class Config
return result; return result;
} }
private static class IPConfigData implements IXmlReader private static class IPConfigData implements IGameXmlReader
{ {
private static final List<String> _subnets = new ArrayList<>(5); private static final List<String> _subnets = new ArrayList<>(5);
private static final List<String> _hosts = new ArrayList<>(5); private static final List<String> _hosts = new ArrayList<>(5);
@@ -3312,22 +3311,22 @@ public final class Config
@Override @Override
public void load() public void load()
{ {
GameServer.printSection("Network Configuration"); final File f = new File(IPCONFIG_FILE);
if ((new File(IPCONFIG_FILE)).exists()) if (f.exists())
{ {
LOGGER.log(Level.INFO, "Using existing ipconfig.xml."); LOGGER.info("Network Config: ipconfig.xml exists using manual configuration...");
parseFile(new File(IPCONFIG_FILE)); parseFile(new File(IPCONFIG_FILE));
} }
else else
// Auto configuration... // Auto configuration...
{ {
LOGGER.log(Level.INFO, "Using automatic network configuration."); LOGGER.info("Network Config: ipconfig.xml doesn't exists using automatic configuration...");
autoIpConfig(); autoIpConfig();
} }
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
NamedNodeMap attrs; NamedNodeMap attrs;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
@@ -3344,7 +3343,7 @@ public final class Config
if (_hosts.size() != _subnets.size()) if (_hosts.size() != _subnets.size())
{ {
LOGGER.log(Level.WARNING, "Failed to Load " + IPCONFIG_FILE + " File - subnets does not match server addresses."); LOGGER.warning("Failed to Load " + IPCONFIG_FILE + " File - subnets does not match server addresses.");
} }
} }
} }
@@ -3352,7 +3351,7 @@ public final class Config
final Node att = n.getAttributes().getNamedItem("address"); final Node att = n.getAttributes().getNamedItem("address");
if (att == null) if (att == null)
{ {
LOGGER.log(Level.WARNING, "Failed to load " + IPCONFIG_FILE + " file - default server address is missing."); LOGGER.warning("Failed to load " + IPCONFIG_FILE + " file - default server address is missing.");
_hosts.add("127.0.0.1"); _hosts.add("127.0.0.1");
} }
else else
@@ -3417,7 +3416,7 @@ public final class Config
{ {
_subnets.add(subnet); _subnets.add(subnet);
_hosts.add(hostAddress); _hosts.add(hostAddress);
LOGGER.log(Level.INFO, "Adding new subnet: " + subnet + " address: " + hostAddress); LOGGER.info("Network Config: Adding new subnet: " + subnet + " address: " + hostAddress);
} }
} }
} }
@@ -3425,23 +3424,31 @@ public final class Config
// External host and subnet // External host and subnet
_hosts.add(externalIp); _hosts.add(externalIp);
_subnets.add("0.0.0.0/0"); _subnets.add("0.0.0.0/0");
LOGGER.log(Level.INFO, "Adding new subnet: 0.0.0.0/0 address: " + externalIp); LOGGER.info("Network Config: Adding new subnet: 0.0.0.0/0 address: " + externalIp);
} }
catch (SocketException e) catch (SocketException e)
{ {
LOGGER.log(Level.INFO, "Configuration failed please manually configure ipconfig.xml", e); LOGGER.log(Level.INFO, "Network Config: Configuration failed please configure manually using ipconfig.xml", e);
System.exit(0); System.exit(0);
} }
} }
protected List<String> getSubnets() protected List<String> getSubnets()
{ {
return _subnets.isEmpty() ? Arrays.asList("0.0.0.0/0") : _subnets; if (_subnets.isEmpty())
{
return Arrays.asList("0.0.0.0/0");
}
return _subnets;
} }
protected List<String> getHosts() protected List<String> getHosts()
{ {
return _hosts.isEmpty() ? Arrays.asList("127.0.0.1") : _hosts; if (_hosts.isEmpty())
{
return Arrays.asList("127.0.0.1");
}
return _hosts;
} }
} }
} }

View File

@@ -0,0 +1,118 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.commons.util;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.holders.MinionHolder;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
/**
* Interface for XML parsers.
* @author Zoey76
*/
public interface IGameXmlReader extends IXmlReader
{
/**
* Wrapper for {@link #parseFile(File)} method.
* @param path the relative path to the datapack root of the XML file to parse.
*/
default void parseDatapackFile(String path)
{
parseFile(new File(Config.DATAPACK_ROOT, path));
}
/**
* Wrapper for {@link #parseDirectory(File, boolean)}.
* @param path the path to the directory where the XML files are
* @param recursive parses all sub folders if there is
* @return {@code false} if it fails to find the directory, {@code true} otherwise
*/
default boolean parseDatapackDirectory(String path, boolean recursive)
{
return parseDirectory(new File(Config.DATAPACK_ROOT, path), recursive);
}
/**
* @param n
* @return a map of parameters
*/
default Map<String, Object> parseParameters(Node n)
{
final Map<String, Object> parameters = new HashMap<>();
for (Node parameters_node = n.getFirstChild(); parameters_node != null; parameters_node = parameters_node.getNextSibling())
{
NamedNodeMap attrs = parameters_node.getAttributes();
switch (parameters_node.getNodeName().toLowerCase())
{
case "param":
{
parameters.put(parseString(attrs, "name"), parseString(attrs, "value"));
break;
}
case "skill":
{
parameters.put(parseString(attrs, "name"), new SkillHolder(parseInteger(attrs, "id"), parseInteger(attrs, "level")));
break;
}
case "location":
{
parameters.put(parseString(attrs, "name"), new Location(parseInteger(attrs, "x"), parseInteger(attrs, "y"), parseInteger(attrs, "z"), parseInteger(attrs, "heading", 0)));
break;
}
case "minions":
{
final List<MinionHolder> minions = new ArrayList<>(1);
for (Node minions_node = parameters_node.getFirstChild(); minions_node != null; minions_node = minions_node.getNextSibling())
{
if (minions_node.getNodeName().equalsIgnoreCase("npc"))
{
attrs = minions_node.getAttributes();
minions.add(new MinionHolder(parseInteger(attrs, "id"), parseInteger(attrs, "count"), parseInteger(attrs, "respawnTime"), parseInteger(attrs, "weightPoint")));
}
}
if (!minions.isEmpty())
{
parameters.put(parseString(parameters_node.getAttributes(), "name"), minions);
}
break;
}
}
}
return parameters;
}
default Location parseLocation(Node n)
{
final NamedNodeMap attrs = n.getAttributes();
final int x = parseInteger(attrs, "x");
final int y = parseInteger(attrs, "y");
final int z = parseInteger(attrs, "z");
final int heading = parseInteger(attrs, "heading", 0);
return new Location(x, y, z, heading);
}
}

View File

@@ -18,6 +18,11 @@ package com.l2jmobius.commons.util;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
@@ -26,10 +31,10 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.ErrorHandler; import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXParseException; import org.xml.sax.SAXParseException;
import com.l2jmobius.Config;
import com.l2jmobius.commons.util.file.filter.XMLFilter; import com.l2jmobius.commons.util.file.filter.XMLFilter;
/** /**
@@ -39,6 +44,7 @@ import com.l2jmobius.commons.util.file.filter.XMLFilter;
public interface IXmlReader public interface IXmlReader
{ {
Logger LOGGER = Logger.getLogger(IXmlReader.class.getName()); Logger LOGGER = Logger.getLogger(IXmlReader.class.getName());
String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
/** The default file filter, ".xml" files only. */ /** The default file filter, ".xml" files only. */
@@ -50,15 +56,6 @@ public interface IXmlReader
*/ */
void load(); void load();
/**
* Wrapper for {@link #parseFile(File)} method.
* @param path the relative path to the datapack root of the XML file to parse.
*/
default void parseDatapackFile(String path)
{
parseFile(new File(Config.DATAPACK_ROOT, path));
}
/** /**
* Parses a single XML file.<br> * Parses a single XML file.<br>
* If the file was successfully parsed, call {@link #parseDocument(Document, File)} for the parsed document.<br> * If the file was successfully parsed, call {@link #parseDocument(Document, File)} for the parsed document.<br>
@@ -69,14 +66,14 @@ public interface IXmlReader
{ {
if (!getCurrentFileFilter().accept(f)) if (!getCurrentFileFilter().accept(f))
{ {
LOGGER.warning(getClass().getSimpleName() + ": Could not parse " + f.getName() + " is not a file or it doesn't exist!"); LOGGER.warning("Could not parse " + f.getName() + " is not a file or it doesn't exist!");
return; return;
} }
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true); dbf.setNamespaceAware(true);
dbf.setValidating(true); dbf.setValidating(isValidating());
dbf.setIgnoringComments(true); dbf.setIgnoringComments(isIgnoringComments());
try try
{ {
dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
@@ -86,16 +83,34 @@ public interface IXmlReader
} }
catch (SAXParseException e) catch (SAXParseException e)
{ {
LOGGER.warning(getClass().getSimpleName() + ": Could not parse file " + f.getName() + " at line " + e.getLineNumber() + ", column " + e.getColumnNumber() + ": " + e.getMessage()); LOGGER.log(Level.WARNING, "Could not parse file: " + f.getName() + " at line: " + e.getLineNumber() + ", column: " + e.getColumnNumber() + " :", e);
return; return;
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.warning(getClass().getSimpleName() + ": Could not parse file " + f.getName() + ": " + e.getMessage()); LOGGER.log(Level.WARNING, "Could not parse file: " + f.getName(), e);
return; return;
} }
} }
/**
* Checks if XML validation is enabled.
* @return {@code true} if its enabled, {@code false} otherwise
*/
default boolean isValidating()
{
return true;
}
/**
* Checks if XML comments are ignored.
* @return {@code true} if its comments are ignored, {@code false} otherwise
*/
default boolean isIgnoringComments()
{
return true;
}
/** /**
* Wrapper for {@link #parseDirectory(File, boolean)}. * Wrapper for {@link #parseDirectory(File, boolean)}.
* @param file the path to the directory where the XML files are. * @param file the path to the directory where the XML files are.
@@ -106,27 +121,6 @@ public interface IXmlReader
return parseDirectory(file, false); return parseDirectory(file, false);
} }
/**
* Wrapper for {@link #parseDirectory(File, boolean)}.
* @param path the path to the directory where the XML files are.
* @return {@code false} if it fails to find the directory, {@code true} otherwise.
*/
default boolean parseDirectory(String path)
{
return parseDirectory(new File(path), false);
}
/**
* Wrapper for {@link #parseDirectory(File, boolean)}.
* @param path the path to the directory where the XML files are.
* @param recursive parses all sub folders if there is.
* @return {@code false} if it fails to find the directory, {@code true} otherwise.
*/
default boolean parseDirectory(String path, boolean recursive)
{
return parseDirectory(new File(path), recursive);
}
/** /**
* Loads all XML files from {@code path} and calls {@link #parseFile(File)} for each one of them. * Loads all XML files from {@code path} and calls {@link #parseFile(File)} for each one of them.
* @param dir the directory object to scan. * @param dir the directory object to scan.
@@ -137,14 +131,12 @@ public interface IXmlReader
{ {
if (!dir.exists()) if (!dir.exists())
{ {
LOGGER.warning(getClass().getSimpleName() + ": Folder " + dir.getAbsolutePath() + " doesn't exist!"); LOGGER.warning("Folder " + dir.getAbsolutePath() + " doesn't exist!");
return false; return false;
} }
final File[] files = dir.listFiles(); final File[] listOfFiles = dir.listFiles();
if (files != null) for (File f : listOfFiles)
{
for (File f : files)
{ {
if (recursive && f.isDirectory()) if (recursive && f.isDirectory())
{ {
@@ -155,41 +147,16 @@ public interface IXmlReader
parseFile(f); parseFile(f);
} }
} }
}
return true; return true;
} }
/**
* Wrapper for {@link #parseDirectory(File, boolean)}.
* @param path the path to the directory where the XML files are
* @param recursive parses all sub folders if there is
* @return {@code false} if it fails to find the directory, {@code true} otherwise
*/
default boolean parseDatapackDirectory(String path, boolean recursive)
{
return parseDirectory(new File(Config.DATAPACK_ROOT, path), recursive);
}
/** /**
* Abstract method that when implemented will parse the current document.<br> * Abstract method that when implemented will parse the current document.<br>
* Is expected to be call from {@link #parseFile(File)}. * Is expected to be call from {@link #parseFile(File)}.
* @param doc the current document to parse * @param doc the current document to parse
* @param f the current file * @param f the current file
*/ */
default void parseDocument(Document doc, File f) void parseDocument(Document doc, File f);
{
parseDocument(doc);
}
/**
* Abstract method that when implemented will parse the current document.<br>
* Is expected to be call from {@link #parseFile(File)}.
* @param doc the current document to parse
*/
default void parseDocument(Document doc)
{
LOGGER.severe("Parser not implemented!");
}
/** /**
* Parses a boolean value. * Parses a boolean value.
@@ -243,7 +210,7 @@ public interface IXmlReader
*/ */
default Byte parseByte(Node node, Byte defaultValue) default Byte parseByte(Node node, Byte defaultValue)
{ {
return node != null ? Byte.valueOf(node.getNodeValue()) : defaultValue; return node != null ? Byte.decode(node.getNodeValue()) : defaultValue;
} }
/** /**
@@ -287,7 +254,7 @@ public interface IXmlReader
*/ */
default Short parseShort(Node node, Short defaultValue) default Short parseShort(Node node, Short defaultValue)
{ {
return node != null ? Short.valueOf(node.getNodeValue()) : defaultValue; return node != null ? Short.decode(node.getNodeValue()) : defaultValue;
} }
/** /**
@@ -331,7 +298,7 @@ public interface IXmlReader
*/ */
default int parseInt(Node node, Integer defaultValue) default int parseInt(Node node, Integer defaultValue)
{ {
return node != null ? Integer.parseInt(node.getNodeValue()) : defaultValue; return node != null ? Integer.decode(node.getNodeValue()) : defaultValue;
} }
/** /**
@@ -352,7 +319,7 @@ public interface IXmlReader
*/ */
default Integer parseInteger(Node node, Integer defaultValue) default Integer parseInteger(Node node, Integer defaultValue)
{ {
return node != null ? Integer.valueOf(node.getNodeValue()) : defaultValue; return node != null ? Integer.decode(node.getNodeValue()) : defaultValue;
} }
/** /**
@@ -396,7 +363,7 @@ public interface IXmlReader
*/ */
default Long parseLong(Node node, Long defaultValue) default Long parseLong(Node node, Long defaultValue)
{ {
return node != null ? Long.valueOf(node.getNodeValue()) : defaultValue; return node != null ? Long.decode(node.getNodeValue()) : defaultValue;
} }
/** /**
@@ -629,6 +596,80 @@ public interface IXmlReader
return parseEnum(attrs.getNamedItem(name), clazz, defaultValue); return parseEnum(attrs.getNamedItem(name), clazz, defaultValue);
} }
/**
* @param node
* @return parses all attributes to a Map
*/
default Map<String, Object> parseAttributes(Node node)
{
final NamedNodeMap attrs = node.getAttributes();
final Map<String, Object> map = new LinkedHashMap<>();
for (int i = 0; i < attrs.getLength(); i++)
{
final Node att = attrs.item(i);
map.put(att.getNodeName(), att.getNodeValue());
}
return map;
}
/**
* Executes action for each child of node
* @param node
* @param action
*/
default void forEach(Node node, Consumer<Node> action)
{
forEach(node, a -> true, action);
}
/**
* Executes action for each child that matches nodeName
* @param node
* @param nodeName
* @param action
*/
default void forEach(Node node, String nodeName, Consumer<Node> action)
{
forEach(node, innerNode -> nodeName.equalsIgnoreCase(innerNode.getNodeName()), action);
}
/**
* Executes action for each child of node if matches the filter specified
* @param node
* @param filter
* @param action
*/
default void forEach(Node node, Predicate<Node> filter, Consumer<Node> action)
{
final NodeList list = node.getChildNodes();
for (int i = 0; i < list.getLength(); i++)
{
final Node targetNode = list.item(i);
if (filter.test(targetNode))
{
action.accept(targetNode);
}
}
}
/**
* @param node
* @return {@code true} if the node is an element type, {@code false} otherwise
*/
static boolean isNode(Node node)
{
return node.getNodeType() == Node.ELEMENT_NODE;
}
/**
* @param node
* @return {@code true} if the node is an element type, {@code false} otherwise
*/
static boolean isText(Node node)
{
return node.getNodeType() == Node.TEXT_NODE;
}
/** /**
* Gets the current file filter. * Gets the current file filter.
* @return the current file filter * @return the current file filter
@@ -642,7 +683,7 @@ public interface IXmlReader
* Simple XML error handler. * Simple XML error handler.
* @author Zoey76 * @author Zoey76
*/ */
static class XMLErrorHandler implements ErrorHandler class XMLErrorHandler implements ErrorHandler
{ {
@Override @Override
public void warning(SAXParseException e) throws SAXParseException public void warning(SAXParseException e) throws SAXParseException

View File

@@ -45,8 +45,8 @@ import java.util.logging.Logger;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.network.BaseSendablePacket; import com.l2jmobius.commons.network.BaseSendablePacket;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.commons.util.crypt.NewCrypt; import com.l2jmobius.commons.util.crypt.NewCrypt;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -28,7 +29,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.L2AccessLevel; import com.l2jmobius.gameserver.model.L2AccessLevel;
import com.l2jmobius.gameserver.model.L2AdminCommandAccessRight; import com.l2jmobius.gameserver.model.L2AdminCommandAccessRight;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
@@ -41,7 +42,7 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
* Loads administrator access levels and commands. * Loads administrator access levels and commands.
* @author UnAfraid * @author UnAfraid
*/ */
public final class AdminData implements IXmlReader public final class AdminData implements IGameXmlReader
{ {
private final Map<Integer, L2AccessLevel> _accessLevels = new HashMap<>(); private final Map<Integer, L2AccessLevel> _accessLevels = new HashMap<>();
private final Map<String, L2AdminCommandAccessRight> _adminCommandAccessRights = new HashMap<>(); private final Map<String, L2AdminCommandAccessRight> _adminCommandAccessRights = new HashMap<>();
@@ -65,7 +66,7 @@ public final class AdminData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
NamedNodeMap attrs; NamedNodeMap attrs;
Node attr; Node attr;

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -23,7 +24,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.L2ArmorSet; import com.l2jmobius.gameserver.model.L2ArmorSet;
import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.holders.SkillHolder;
@@ -31,7 +32,7 @@ import com.l2jmobius.gameserver.model.holders.SkillHolder;
* Loads armor set bonuses. * Loads armor set bonuses.
* @author godson, Luno, UnAfraid * @author godson, Luno, UnAfraid
*/ */
public final class ArmorSetsData implements IXmlReader public final class ArmorSetsData implements IGameXmlReader
{ {
private final Map<Integer, L2ArmorSet> _armorSets = new HashMap<>(); private final Map<Integer, L2ArmorSet> _armorSets = new HashMap<>();
@@ -52,7 +53,7 @@ public final class ArmorSetsData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -32,7 +32,7 @@ import org.w3c.dom.Node;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.commons.util.file.filter.NumericNameFilter; import com.l2jmobius.commons.util.file.filter.NumericNameFilter;
import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.model.buylist.L2BuyList; import com.l2jmobius.gameserver.model.buylist.L2BuyList;
@@ -43,7 +43,7 @@ import com.l2jmobius.gameserver.model.items.L2Item;
* Loads buy lists for NPCs. * Loads buy lists for NPCs.
* @author NosBit * @author NosBit
*/ */
public final class BuyListData implements IXmlReader public final class BuyListData implements IGameXmlReader
{ {
private static final Logger LOGGER = Logger.getLogger(BuyListData.class.getName()); private static final Logger LOGGER = Logger.getLogger(BuyListData.class.getName());

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
@@ -27,14 +28,14 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.CategoryType;
/** /**
* Loads the category data with Class or NPC IDs. * Loads the category data with Class or NPC IDs.
* @author NosBit, xban1x * @author NosBit, xban1x
*/ */
public final class CategoryData implements IXmlReader public final class CategoryData implements IGameXmlReader
{ {
private static final Logger LOGGER = Logger.getLogger(CategoryData.class.getName()); private static final Logger LOGGER = Logger.getLogger(CategoryData.class.getName());
@@ -54,7 +55,7 @@ public final class CategoryData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node node = doc.getFirstChild(); node != null; node = node.getNextSibling()) for (Node node = doc.getFirstChild(); node != null; node = node.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -23,7 +24,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.base.ClassId; import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.base.ClassInfo; import com.l2jmobius.gameserver.model.base.ClassInfo;
@@ -31,7 +32,7 @@ import com.l2jmobius.gameserver.model.base.ClassInfo;
* Loads the the list of classes and it's info. * Loads the the list of classes and it's info.
* @author Zoey76 * @author Zoey76
*/ */
public final class ClassListData implements IXmlReader public final class ClassListData implements IGameXmlReader
{ {
private final Map<ClassId, ClassInfo> _classData = new HashMap<>(); private final Map<ClassId, ClassInfo> _classData = new HashMap<>();
@@ -52,7 +53,7 @@ public final class ClassListData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@@ -28,7 +29,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.instancemanager.InstanceManager; import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.instancemanager.MapRegionManager; import com.l2jmobius.gameserver.instancemanager.MapRegionManager;
import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.Location;
@@ -40,7 +41,7 @@ import com.l2jmobius.gameserver.model.actor.templates.L2DoorTemplate;
* Loads doors. * Loads doors.
* @author JIV, GodKratos, UnAfraid * @author JIV, GodKratos, UnAfraid
*/ */
public class DoorData implements IXmlReader public class DoorData implements IGameXmlReader
{ {
private static final Map<String, Set<Integer>> _groups = new HashMap<>(); private static final Map<String, Set<Integer>> _groups = new HashMap<>();
private final Map<Integer, L2DoorInstance> _doors = new HashMap<>(); private final Map<Integer, L2DoorInstance> _doors = new HashMap<>();
@@ -62,7 +63,7 @@ public class DoorData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node a = doc.getFirstChild(); a != null; a = a.getNextSibling()) for (Node a = doc.getFirstChild(); a != null; a = a.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
@@ -24,7 +25,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.items.enchant.EnchantScroll; import com.l2jmobius.gameserver.model.items.enchant.EnchantScroll;
import com.l2jmobius.gameserver.model.items.enchant.EnchantSupportItem; import com.l2jmobius.gameserver.model.items.enchant.EnchantSupportItem;
@@ -34,7 +35,7 @@ import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
* Loads item enchant data. * Loads item enchant data.
* @author UnAfraid * @author UnAfraid
*/ */
public class EnchantItemData implements IXmlReader public class EnchantItemData implements IGameXmlReader
{ {
private final Map<Integer, EnchantScroll> _scrolls = new HashMap<>(); private final Map<Integer, EnchantScroll> _scrolls = new HashMap<>();
private final Map<Integer, EnchantSupportItem> _supports = new HashMap<>(); private final Map<Integer, EnchantSupportItem> _supports = new HashMap<>();
@@ -58,7 +59,7 @@ public class EnchantItemData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
StatsSet set; StatsSet set;
Node att; Node att;

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
@@ -24,7 +25,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.model.holders.RangeChanceHolder; import com.l2jmobius.gameserver.model.holders.RangeChanceHolder;
import com.l2jmobius.gameserver.model.items.L2Item; import com.l2jmobius.gameserver.model.items.L2Item;
@@ -36,7 +37,7 @@ import com.l2jmobius.gameserver.util.Util;
/** /**
* @author UnAfraid * @author UnAfraid
*/ */
public final class EnchantItemGroupsData implements IXmlReader public final class EnchantItemGroupsData implements IGameXmlReader
{ {
private final Map<String, EnchantItemGroup> _itemGroups = new HashMap<>(); private final Map<String, EnchantItemGroup> _itemGroups = new HashMap<>();
private final Map<Integer, EnchantScrollGroup> _scrollGroups = new HashMap<>(); private final Map<Integer, EnchantScrollGroup> _scrollGroups = new HashMap<>();
@@ -57,7 +58,7 @@ public final class EnchantItemGroupsData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.EnumMap; import java.util.EnumMap;
@@ -25,7 +26,7 @@ import java.util.Map;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.StatFunction; import com.l2jmobius.gameserver.enums.StatFunction;
import com.l2jmobius.gameserver.model.items.L2Item; import com.l2jmobius.gameserver.model.items.L2Item;
@@ -38,7 +39,7 @@ import com.l2jmobius.gameserver.model.stats.functions.FuncTemplate;
* This class holds the Enchant HP Bonus Data. * This class holds the Enchant HP Bonus Data.
* @author MrPoke, Zoey76 * @author MrPoke, Zoey76
*/ */
public class EnchantItemHPBonusData implements IXmlReader public class EnchantItemHPBonusData implements IGameXmlReader
{ {
private final Map<CrystalType, List<Integer>> _armorHPBonuses = new EnumMap<>(CrystalType.class); private final Map<CrystalType, List<Integer>> _armorHPBonuses = new EnumMap<>(CrystalType.class);
@@ -53,7 +54,7 @@ public class EnchantItemHPBonusData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
@@ -23,7 +24,7 @@ import java.util.logging.Level;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.options.EnchantOptions; import com.l2jmobius.gameserver.model.options.EnchantOptions;
import com.l2jmobius.gameserver.util.Util; import com.l2jmobius.gameserver.util.Util;
@@ -31,7 +32,7 @@ import com.l2jmobius.gameserver.util.Util;
/** /**
* @author UnAfraid * @author UnAfraid
*/ */
public class EnchantItemOptionsData implements IXmlReader public class EnchantItemOptionsData implements IGameXmlReader
{ {
private final Map<Integer, Map<Integer, EnchantOptions>> _data = new HashMap<>(); private final Map<Integer, Map<Integer, EnchantOptions>> _data = new HashMap<>();
@@ -48,7 +49,7 @@ public class EnchantItemOptionsData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
int counter = 0; int counter = 0;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
@@ -25,7 +26,7 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.L2EnchantSkillGroup; import com.l2jmobius.gameserver.model.L2EnchantSkillGroup;
import com.l2jmobius.gameserver.model.L2EnchantSkillGroup.EnchantSkillHolder; import com.l2jmobius.gameserver.model.L2EnchantSkillGroup.EnchantSkillHolder;
import com.l2jmobius.gameserver.model.L2EnchantSkillLearn; import com.l2jmobius.gameserver.model.L2EnchantSkillLearn;
@@ -37,7 +38,7 @@ import com.l2jmobius.gameserver.model.skills.Skill;
* This class holds the Enchant Groups information. * This class holds the Enchant Groups information.
* @author Micr0 * @author Micr0
*/ */
public class EnchantSkillGroupsData implements IXmlReader public class EnchantSkillGroupsData implements IGameXmlReader
{ {
public static final int NORMAL_ENCHANT_COST_MULTIPLIER = Config.NORMAL_ENCHANT_COST_MULTIPLIER; public static final int NORMAL_ENCHANT_COST_MULTIPLIER = Config.NORMAL_ENCHANT_COST_MULTIPLIER;
public static final int SAFE_ENCHANT_COST_MULTIPLIER = Config.SAFE_ENCHANT_COST_MULTIPLIER; public static final int SAFE_ENCHANT_COST_MULTIPLIER = Config.SAFE_ENCHANT_COST_MULTIPLIER;
@@ -73,7 +74,7 @@ public class EnchantSkillGroupsData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -23,13 +24,13 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
/** /**
* This class holds the Experience points for each level for players and pets. * This class holds the Experience points for each level for players and pets.
* @author mrTJO * @author mrTJO
*/ */
public final class ExperienceData implements IXmlReader public final class ExperienceData implements IGameXmlReader
{ {
private final Map<Integer, Long> _expTable = new HashMap<>(); private final Map<Integer, Long> _expTable = new HashMap<>();
@@ -55,7 +56,7 @@ public final class ExperienceData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
final Node table = doc.getFirstChild(); final Node table = doc.getFirstChild();
final NamedNodeMap tableAttr = table.getAttributes(); final NamedNodeMap tableAttr = table.getAttributes();

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -25,7 +26,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.fishing.L2Fish; import com.l2jmobius.gameserver.model.fishing.L2Fish;
@@ -33,7 +34,7 @@ import com.l2jmobius.gameserver.model.fishing.L2Fish;
* This class holds the Fish information. * This class holds the Fish information.
* @author nonom * @author nonom
*/ */
public final class FishData implements IXmlReader public final class FishData implements IGameXmlReader
{ {
private final Map<Integer, L2Fish> _fishNormal = new HashMap<>(); private final Map<Integer, L2Fish> _fishNormal = new HashMap<>();
private final Map<Integer, L2Fish> _fishEasy = new HashMap<>(); private final Map<Integer, L2Fish> _fishEasy = new HashMap<>();
@@ -58,7 +59,7 @@ public final class FishData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -23,7 +24,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.fishing.L2FishingMonster; import com.l2jmobius.gameserver.model.fishing.L2FishingMonster;
@@ -31,7 +32,7 @@ import com.l2jmobius.gameserver.model.fishing.L2FishingMonster;
* This class holds the Fishing Monsters information. * This class holds the Fishing Monsters information.
* @author nonom * @author nonom
*/ */
public final class FishingMonstersData implements IXmlReader public final class FishingMonstersData implements IGameXmlReader
{ {
private final Map<Integer, L2FishingMonster> _fishingMonstersData = new HashMap<>(); private final Map<Integer, L2FishingMonster> _fishingMonstersData = new HashMap<>();
@@ -52,7 +53,7 @@ public final class FishingMonstersData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -23,7 +24,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.fishing.L2FishingRod; import com.l2jmobius.gameserver.model.fishing.L2FishingRod;
@@ -31,7 +32,7 @@ import com.l2jmobius.gameserver.model.fishing.L2FishingRod;
* This class holds the Fishing Rods information. * This class holds the Fishing Rods information.
* @author nonom * @author nonom
*/ */
public final class FishingRodsData implements IXmlReader public final class FishingRodsData implements IGameXmlReader
{ {
private final Map<Integer, L2FishingRod> _fishingRods = new HashMap<>(); private final Map<Integer, L2FishingRod> _fishingRods = new HashMap<>();
@@ -52,7 +53,7 @@ public final class FishingRodsData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -25,7 +26,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.base.ClassId; import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.items.L2Henna; import com.l2jmobius.gameserver.model.items.L2Henna;
@@ -37,7 +38,7 @@ import com.l2jmobius.gameserver.model.items.L2Henna;
* Allowed classes to wear each henna. * Allowed classes to wear each henna.
* @author Zoey76 * @author Zoey76
*/ */
public final class HennaData implements IXmlReader public final class HennaData implements IGameXmlReader
{ {
private final Map<Integer, L2Henna> _hennaList = new HashMap<>(); private final Map<Integer, L2Henna> _hennaList = new HashMap<>();
@@ -58,7 +59,7 @@ public final class HennaData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,11 +16,13 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.GameTimeController; import com.l2jmobius.gameserver.GameTimeController;
import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Character;
@@ -28,7 +30,7 @@ import com.l2jmobius.gameserver.model.actor.L2Character;
* This class load, holds and calculates the hit condition bonuses. * This class load, holds and calculates the hit condition bonuses.
* @author Nik * @author Nik
*/ */
public final class HitConditionBonusData implements IXmlReader public final class HitConditionBonusData implements IGameXmlReader
{ {
private int frontBonus = 0; private int frontBonus = 0;
private int sideBonus = 0; private int sideBonus = 0;
@@ -55,7 +57,7 @@ public final class HitConditionBonusData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node d = doc.getFirstChild().getFirstChild(); d != null; d = d.getNextSibling()) for (Node d = doc.getFirstChild().getFirstChild(); d != null; d = d.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -26,7 +27,7 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.base.ClassId; import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.items.PcItemTemplate; import com.l2jmobius.gameserver.model.items.PcItemTemplate;
@@ -36,7 +37,7 @@ import com.l2jmobius.gameserver.model.items.PcItemTemplate;
* What items get each newly created character and if this item is equipped upon creation (<b>Requires the item to be equippable</b>). * What items get each newly created character and if this item is equipped upon creation (<b>Requires the item to be equippable</b>).
* @author Zoey76 * @author Zoey76
*/ */
public final class InitialEquipmentData implements IXmlReader public final class InitialEquipmentData implements IGameXmlReader
{ {
private final Map<ClassId, List<PcItemTemplate>> _initialEquipmentList = new HashMap<>(); private final Map<ClassId, List<PcItemTemplate>> _initialEquipmentList = new HashMap<>();
private static final String NORMAL = "data/stats/initialEquipment.xml"; private static final String NORMAL = "data/stats/initialEquipment.xml";
@@ -59,7 +60,7 @@ public final class InitialEquipmentData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -25,7 +26,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.enums.MacroType; import com.l2jmobius.gameserver.enums.MacroType;
import com.l2jmobius.gameserver.enums.ShortcutType; import com.l2jmobius.gameserver.enums.ShortcutType;
import com.l2jmobius.gameserver.model.Macro; import com.l2jmobius.gameserver.model.Macro;
@@ -41,7 +42,7 @@ import com.l2jmobius.gameserver.network.serverpackets.ShortCutRegister;
* What shortcuts get each newly created character. * What shortcuts get each newly created character.
* @author Zoey76 * @author Zoey76
*/ */
public final class InitialShortcutData implements IXmlReader public final class InitialShortcutData implements IGameXmlReader
{ {
private final Map<ClassId, List<Shortcut>> _initialShortcutData = new HashMap<>(); private final Map<ClassId, List<Shortcut>> _initialShortcutData = new HashMap<>();
private final List<Shortcut> _initialGlobalShortcutList = new ArrayList<>(); private final List<Shortcut> _initialGlobalShortcutList = new ArrayList<>();
@@ -69,7 +70,7 @@ public final class InitialShortcutData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -26,14 +27,14 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.ItemMallProduct; import com.l2jmobius.gameserver.model.ItemMallProduct;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
/** /**
* @author Mobius * @author Mobius
*/ */
public class ItemMallData implements IXmlReader public class ItemMallData implements IGameXmlReader
{ {
private static final Logger _log = Logger.getLogger(ItemMallData.class.getName()); private static final Logger _log = Logger.getLogger(ItemMallData.class.getName());
private final Map<Integer, ItemMallProduct> _mallList = new HashMap<>(); private final Map<Integer, ItemMallProduct> _mallList = new HashMap<>();
@@ -57,7 +58,7 @@ public class ItemMallData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
NamedNodeMap attrs; NamedNodeMap attrs;
Node att; Node att;

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
@@ -24,12 +25,12 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
/** /**
* @author UnAfraid * @author UnAfraid
*/ */
public class KarmaData implements IXmlReader public class KarmaData implements IGameXmlReader
{ {
private final Map<Integer, Double> _karmaTable = new HashMap<>(); private final Map<Integer, Double> _karmaTable = new HashMap<>();
@@ -47,7 +48,7 @@ public class KarmaData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -29,7 +29,7 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.commons.util.file.filter.NumericNameFilter; import com.l2jmobius.commons.util.file.filter.NumericNameFilter;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.L2Npc;
@@ -45,7 +45,7 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.UserInfo; import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
import com.l2jmobius.gameserver.util.Util; import com.l2jmobius.gameserver.util.Util;
public final class MultisellData implements IXmlReader public final class MultisellData implements IGameXmlReader
{ {
private final Map<Integer, ListContainer> _entries = new HashMap<>(); private final Map<Integer, ListContainer> _entries = new HashMap<>();

View File

@@ -34,7 +34,7 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.AISkillScope; import com.l2jmobius.gameserver.enums.AISkillScope;
@@ -53,7 +53,7 @@ import com.l2jmobius.gameserver.util.Util;
* NPC data parser. * NPC data parser.
* @author NosBit * @author NosBit
*/ */
public class NpcData implements IXmlReader public class NpcData implements IGameXmlReader
{ {
private final Map<Integer, L2NpcTemplate> _npcs = new ConcurrentHashMap<>(); private final Map<Integer, L2NpcTemplate> _npcs = new ConcurrentHashMap<>();
private final Map<String, Integer> _clans = new ConcurrentHashMap<>(); private final Map<String, Integer> _clans = new ConcurrentHashMap<>();
@@ -790,7 +790,7 @@ public class NpcData implements IXmlReader
* Once Spawn System gets reworked delete this class<br> * Once Spawn System gets reworked delete this class<br>
* @author Zealar * @author Zealar
*/ */
private final class MinionData implements IXmlReader private final class MinionData implements IGameXmlReader
{ {
public final Map<Integer, List<MinionHolder>> _tempMinions = new HashMap<>(); public final Map<Integer, List<MinionHolder>> _tempMinions = new HashMap<>();
@@ -808,7 +808,7 @@ public class NpcData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node node = doc.getFirstChild(); node != null; node = node.getNextSibling()) for (Node node = doc.getFirstChild(); node != null; node = node.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
@@ -24,7 +25,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.options.Options; import com.l2jmobius.gameserver.model.options.Options;
import com.l2jmobius.gameserver.model.options.OptionsSkillHolder; import com.l2jmobius.gameserver.model.options.OptionsSkillHolder;
@@ -36,7 +37,7 @@ import com.l2jmobius.gameserver.model.stats.functions.FuncTemplate;
* Item Option data. * Item Option data.
* @author UnAfraid * @author UnAfraid
*/ */
public class OptionData implements IXmlReader public class OptionData implements IGameXmlReader
{ {
private final Map<Integer, Options> _optionData = new HashMap<>(); private final Map<Integer, Options> _optionData = new HashMap<>();
@@ -54,7 +55,7 @@ public class OptionData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -23,7 +24,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.enums.MountType; import com.l2jmobius.gameserver.enums.MountType;
import com.l2jmobius.gameserver.model.L2PetData; import com.l2jmobius.gameserver.model.L2PetData;
import com.l2jmobius.gameserver.model.L2PetLevelData; import com.l2jmobius.gameserver.model.L2PetLevelData;
@@ -34,7 +35,7 @@ import com.l2jmobius.gameserver.model.StatsSet;
* TODO: load and use all pet parameters. * TODO: load and use all pet parameters.
* @author Zoey76 (rework) * @author Zoey76 (rework)
*/ */
public final class PetDataTable implements IXmlReader public final class PetDataTable implements IGameXmlReader
{ {
private final Map<Integer, L2PetData> _pets = new HashMap<>(); private final Map<Integer, L2PetData> _pets = new HashMap<>();
@@ -55,7 +56,7 @@ public final class PetDataTable implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
NamedNodeMap attrs; NamedNodeMap attrs;
for (Node d = doc.getFirstChild().getFirstChild(); d != null; d = d.getNextSibling()) for (Node d = doc.getFirstChild().getFirstChild(); d != null; d = d.getNextSibling())

View File

@@ -27,7 +27,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.model.actor.L2Summon; import com.l2jmobius.gameserver.model.actor.L2Summon;
import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.holders.SkillHolder;
@@ -35,7 +35,7 @@ import com.l2jmobius.gameserver.model.holders.SkillHolder;
/** /**
* @author Mobius * @author Mobius
*/ */
public class PetSkillData implements IXmlReader public class PetSkillData implements IGameXmlReader
{ {
private static Logger LOGGER = Logger.getLogger(PetSkillData.class.getName()); private static Logger LOGGER = Logger.getLogger(PetSkillData.class.getName());
private final Map<Integer, Map<Long, SkillHolder>> _skillTrees = new HashMap<>(); private final Map<Integer, Map<Long, SkillHolder>> _skillTrees = new HashMap<>();

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -26,7 +27,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.templates.L2PcTemplate; import com.l2jmobius.gameserver.model.actor.templates.L2PcTemplate;
@@ -36,7 +37,7 @@ import com.l2jmobius.gameserver.model.base.ClassId;
* Loads player's base stats. * Loads player's base stats.
* @author Forsaiken, Zoey76, GKR * @author Forsaiken, Zoey76, GKR
*/ */
public final class PlayerTemplateData implements IXmlReader public final class PlayerTemplateData implements IGameXmlReader
{ {
private static final Logger LOGGER = Logger.getLogger(PlayerTemplateData.class.getName()); private static final Logger LOGGER = Logger.getLogger(PlayerTemplateData.class.getName());
@@ -59,7 +60,7 @@ public final class PlayerTemplateData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
NamedNodeMap attrs; NamedNodeMap attrs;
int classId = 0; int classId = 0;

View File

@@ -16,19 +16,20 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
/** /**
* This class holds the Player Xp Percent Lost Data for each level for players. * This class holds the Player Xp Percent Lost Data for each level for players.
* @author Zealar * @author Zealar
*/ */
public final class PlayerXpPercentLostData implements IXmlReader public final class PlayerXpPercentLostData implements IGameXmlReader
{ {
private final int _maxlevel = ExperienceData.getInstance().getMaxLevel(); private final int _maxlevel = ExperienceData.getInstance().getMaxLevel();
private final double[] _playerXpPercentLost = new double[_maxlevel + 1]; private final double[] _playerXpPercentLost = new double[_maxlevel + 1];
@@ -46,7 +47,7 @@ public final class PlayerXpPercentLostData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -25,7 +26,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.L2RecipeInstance; import com.l2jmobius.gameserver.model.L2RecipeInstance;
import com.l2jmobius.gameserver.model.L2RecipeList; import com.l2jmobius.gameserver.model.L2RecipeList;
import com.l2jmobius.gameserver.model.L2RecipeStatInstance; import com.l2jmobius.gameserver.model.L2RecipeStatInstance;
@@ -36,7 +37,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
* The Class RecipeData. * The Class RecipeData.
* @author Zoey76 * @author Zoey76
*/ */
public class RecipeData implements IXmlReader public class RecipeData implements IGameXmlReader
{ {
private final Map<Integer, L2RecipeList> _recipes = new HashMap<>(); private final Map<Integer, L2RecipeList> _recipes = new HashMap<>();
@@ -57,7 +58,7 @@ public class RecipeData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
// TODO: Cleanup checks enforced by XSD. // TODO: Cleanup checks enforced by XSD.
final List<L2RecipeInstance> recipePartList = new ArrayList<>(); final List<L2RecipeInstance> recipePartList = new ArrayList<>();

View File

@@ -24,13 +24,13 @@ import java.util.logging.Level;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
/** /**
* Secondary Auth data. * Secondary Auth data.
* @author NosBit * @author NosBit
*/ */
public class SecondaryAuthData implements IXmlReader public class SecondaryAuthData implements IGameXmlReader
{ {
private final Set<String> _forbiddenPasswords = new HashSet<>(); private final Set<String> _forbiddenPasswords = new HashSet<>();
private boolean _enabled = false; private boolean _enabled = false;
@@ -52,7 +52,7 @@ public class SecondaryAuthData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
try try
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
@@ -25,7 +26,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.SiegeScheduleDate; import com.l2jmobius.gameserver.model.SiegeScheduleDate;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.util.Util; import com.l2jmobius.gameserver.util.Util;
@@ -33,7 +34,7 @@ import com.l2jmobius.gameserver.util.Util;
/** /**
* @author UnAfraid * @author UnAfraid
*/ */
public class SiegeScheduleData implements IXmlReader public class SiegeScheduleData implements IGameXmlReader
{ {
private final List<SiegeScheduleDate> _scheduleData = new ArrayList<>(); private final List<SiegeScheduleDate> _scheduleData = new ArrayList<>();
@@ -56,7 +57,7 @@ public class SiegeScheduleData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -24,14 +25,14 @@ import java.util.Map;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.base.ClassId; import com.l2jmobius.gameserver.model.base.ClassId;
/** /**
* Holds all skill learn data for all NPCs. * Holds all skill learn data for all NPCs.
* @author xban1x * @author xban1x
*/ */
public final class SkillLearnData implements IXmlReader public final class SkillLearnData implements IGameXmlReader
{ {
private final Map<Integer, List<ClassId>> _skillLearn = new HashMap<>(); private final Map<Integer, List<ClassId>> _skillLearn = new HashMap<>();
@@ -49,7 +50,7 @@ public final class SkillLearnData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node node = doc.getFirstChild(); node != null; node = node.getNextSibling()) for (Node node = doc.getFirstChild(); node != null; node = node.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@@ -32,7 +33,7 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.datatables.SkillData; import com.l2jmobius.gameserver.datatables.SkillData;
import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Clan;
@@ -72,7 +73,7 @@ import com.l2jmobius.gameserver.model.skills.Skill;
* For XML schema please refer to skillTrees.xsd in datapack in xsd folder and for parameters documentation refer to documentation.txt in skillTrees folder.<br> * For XML schema please refer to skillTrees.xsd in datapack in xsd folder and for parameters documentation refer to documentation.txt in skillTrees folder.<br>
* @author Zoey76 * @author Zoey76
*/ */
public final class SkillTreesData implements IXmlReader public final class SkillTreesData implements IGameXmlReader
{ {
// ClassId, Map of Skill Hash Code, L2SkillLearn // ClassId, Map of Skill Hash Code, L2SkillLearn
private final Map<ClassId, Map<Integer, L2SkillLearn>> _classSkillTrees = new LinkedHashMap<>(); private final Map<ClassId, Map<Integer, L2SkillLearn>> _classSkillTrees = new LinkedHashMap<>();
@@ -142,7 +143,7 @@ public final class SkillTreesData implements IXmlReader
* Parse a skill tree file and store it into the correct skill tree. * Parse a skill tree file and store it into the correct skill tree.
*/ */
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
int cId = -1; int cId = -1;
ClassId classId = null; ClassId classId = null;

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -24,7 +25,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2StaticObjectInstance; import com.l2jmobius.gameserver.model.actor.instance.L2StaticObjectInstance;
import com.l2jmobius.gameserver.model.actor.templates.L2CharTemplate; import com.l2jmobius.gameserver.model.actor.templates.L2CharTemplate;
@@ -33,7 +34,7 @@ import com.l2jmobius.gameserver.model.actor.templates.L2CharTemplate;
* This class loads and holds all static object data. * This class loads and holds all static object data.
* @author UnAfraid * @author UnAfraid
*/ */
public final class StaticObjectData implements IXmlReader public final class StaticObjectData implements IGameXmlReader
{ {
private final Map<Integer, L2StaticObjectInstance> _staticObjects = new HashMap<>(); private final Map<Integer, L2StaticObjectInstance> _staticObjects = new HashMap<>();
@@ -54,7 +55,7 @@ public final class StaticObjectData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
@@ -24,7 +25,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.transform.Transform; import com.l2jmobius.gameserver.model.actor.transform.Transform;
@@ -38,7 +39,7 @@ import com.l2jmobius.gameserver.network.serverpackets.ExBasicActionList;
/** /**
* @author UnAfraid * @author UnAfraid
*/ */
public final class TransformData implements IXmlReader public final class TransformData implements IGameXmlReader
{ {
private final Map<Integer, Transform> _transformData = new HashMap<>(); private final Map<Integer, Transform> _transformData = new HashMap<>();
@@ -56,7 +57,7 @@ public final class TransformData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.data.xml.impl; package com.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -25,14 +26,14 @@ import java.util.logging.Logger;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.ActionKey; import com.l2jmobius.gameserver.model.ActionKey;
/** /**
* UI Data parser. * UI Data parser.
* @author Zoey76 * @author Zoey76
*/ */
public class UIData implements IXmlReader public class UIData implements IGameXmlReader
{ {
private static final Logger LOGGER = Logger.getLogger(UIData.class.getName()); private static final Logger LOGGER = Logger.getLogger(UIData.class.getName());
@@ -54,7 +55,7 @@ public class UIData implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.datatables; package com.l2jmobius.gameserver.datatables;
import java.io.File;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@@ -35,7 +36,7 @@ import org.w3c.dom.Node;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.data.xml.impl.NpcData; import com.l2jmobius.gameserver.data.xml.impl.NpcData;
import com.l2jmobius.gameserver.instancemanager.DayNightSpawnManager; import com.l2jmobius.gameserver.instancemanager.DayNightSpawnManager;
import com.l2jmobius.gameserver.instancemanager.ZoneManager; import com.l2jmobius.gameserver.instancemanager.ZoneManager;
@@ -47,7 +48,7 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
* Spawn data retriever. * Spawn data retriever.
* @author Zoey76 * @author Zoey76
*/ */
public final class SpawnTable implements IXmlReader public final class SpawnTable implements IGameXmlReader
{ {
private static final Logger LOGGER = Logger.getLogger(SpawnTable.class.getName()); private static final Logger LOGGER = Logger.getLogger(SpawnTable.class.getName());
// SQL // SQL
@@ -105,7 +106,7 @@ public final class SpawnTable implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
NamedNodeMap attrs; NamedNodeMap attrs;
for (Node list = doc.getFirstChild(); list != null; list = list.getNextSibling()) for (Node list = doc.getFirstChild(); list != null; list = list.getNextSibling())

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.instancemanager; package com.l2jmobius.gameserver.instancemanager;
import java.io.File;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@@ -37,7 +38,7 @@ import org.w3c.dom.Node;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.enums.ManorMode; import com.l2jmobius.gameserver.enums.ManorMode;
import com.l2jmobius.gameserver.model.CropProcure; import com.l2jmobius.gameserver.model.CropProcure;
@@ -55,7 +56,7 @@ import com.l2jmobius.gameserver.network.SystemMessageId;
* Castle manor system. * Castle manor system.
* @author malyelfik * @author malyelfik
*/ */
public final class CastleManorManager implements IXmlReader, IStorable public final class CastleManorManager implements IGameXmlReader, IStorable
{ {
// SQL queries // SQL queries
private static final String INSERT_PRODUCT = "INSERT INTO castle_manor_production VALUES (?, ?, ?, ?, ?, ?)"; private static final String INSERT_PRODUCT = "INSERT INTO castle_manor_production VALUES (?, ?, ?, ?, ?, ?)";
@@ -119,7 +120,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
} }
@Override @Override
public final void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
StatsSet set; StatsSet set;
NamedNodeMap attrs; NamedNodeMap attrs;

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.instancemanager; package com.l2jmobius.gameserver.instancemanager;
import java.io.File;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@@ -28,7 +29,7 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.entity.Instance; import com.l2jmobius.gameserver.model.entity.Instance;
import com.l2jmobius.gameserver.model.instancezone.InstanceWorld; import com.l2jmobius.gameserver.model.instancezone.InstanceWorld;
@@ -36,7 +37,7 @@ import com.l2jmobius.gameserver.model.instancezone.InstanceWorld;
/** /**
* @author evill33t, GodKratos * @author evill33t, GodKratos
*/ */
public final class InstanceManager implements IXmlReader public final class InstanceManager implements IGameXmlReader
{ {
private static final Map<Integer, Instance> INSTANCES = new ConcurrentHashMap<>(); private static final Map<Integer, Instance> INSTANCES = new ConcurrentHashMap<>();
private final Map<Integer, InstanceWorld> _instanceWorlds = new ConcurrentHashMap<>(); private final Map<Integer, InstanceWorld> _instanceWorlds = new ConcurrentHashMap<>();
@@ -198,7 +199,7 @@ public final class InstanceManager implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{ {

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.instancemanager; package com.l2jmobius.gameserver.instancemanager;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -24,7 +25,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.SevenSigns; import com.l2jmobius.gameserver.SevenSigns;
import com.l2jmobius.gameserver.model.L2MapRegion; import com.l2jmobius.gameserver.model.L2MapRegion;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
@@ -46,7 +47,7 @@ import com.l2jmobius.gameserver.model.zone.type.L2RespawnZone;
* Map Region Manager. * Map Region Manager.
* @author Nyaran * @author Nyaran
*/ */
public final class MapRegionManager implements IXmlReader public final class MapRegionManager implements IGameXmlReader
{ {
private static final Map<String, L2MapRegion> _regions = new HashMap<>(); private static final Map<String, L2MapRegion> _regions = new HashMap<>();
private static final String defaultRespawn = "talking_island_town"; private static final String defaultRespawn = "talking_island_town";
@@ -65,7 +66,7 @@ public final class MapRegionManager implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
NamedNodeMap attrs; NamedNodeMap attrs;
String name; String name;

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.gameserver.instancemanager; package com.l2jmobius.gameserver.instancemanager;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -26,7 +27,7 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.instancemanager.tasks.StartMovingTask; import com.l2jmobius.gameserver.instancemanager.tasks.StartMovingTask;
@@ -46,7 +47,7 @@ import com.l2jmobius.gameserver.network.NpcStringId;
* This class manages walking monsters. * This class manages walking monsters.
* @author GKR * @author GKR
*/ */
public final class WalkingManager implements IXmlReader public final class WalkingManager implements IGameXmlReader
{ {
// Repeat style: // Repeat style:
// -1 - no repeat // -1 - no repeat
@@ -77,7 +78,7 @@ public final class WalkingManager implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
for (Node d = doc.getFirstChild().getFirstChild(); d != null; d = d.getNextSibling()) for (Node d = doc.getFirstChild().getFirstChild(); d != null; d = d.getNextSibling())
{ {

View File

@@ -29,7 +29,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import com.l2jmobius.commons.util.IXmlReader; import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.L2WorldRegion; import com.l2jmobius.gameserver.model.L2WorldRegion;
@@ -51,7 +51,7 @@ import com.l2jmobius.gameserver.model.zone.type.NpcSpawnTerritory;
* This class manages the zones * This class manages the zones
* @author durgus * @author durgus
*/ */
public final class ZoneManager implements IXmlReader public final class ZoneManager implements IGameXmlReader
{ {
private static final Map<String, AbstractZoneSettings> _settings = new HashMap<>(); private static final Map<String, AbstractZoneSettings> _settings = new HashMap<>();

View File

@@ -34,8 +34,8 @@ import java.util.logging.Level;
import com.l2jmobius.Config; import com.l2jmobius.Config;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.commons.util.CommonUtil; import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.gameserver.cache.HtmCache; import com.l2jmobius.gameserver.cache.HtmCache;
import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.datatables.ItemTable;
import com.l2jmobius.gameserver.enums.CategoryType; import com.l2jmobius.gameserver.enums.CategoryType;

View File

@@ -16,6 +16,7 @@
*/ */
package com.l2jmobius.loginserver; package com.l2jmobius.loginserver;
import java.io.File;
import java.math.BigInteger; import java.math.BigInteger;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
@@ -29,13 +30,14 @@ import java.sql.Statement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.commons.util.IGameXmlReader;
import com.l2jmobius.commons.util.IPSubnet; import com.l2jmobius.commons.util.IPSubnet;
import com.l2jmobius.commons.util.IXmlReader;
import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.commons.util.Rnd;
import com.l2jmobius.loginserver.network.gameserverpackets.ServerStatus; import com.l2jmobius.loginserver.network.gameserverpackets.ServerStatus;
@@ -43,8 +45,10 @@ import com.l2jmobius.loginserver.network.gameserverpackets.ServerStatus;
* The Class GameServerTable loads the game server names and initialize the game server tables. * The Class GameServerTable loads the game server names and initialize the game server tables.
* @author KenM, Zoey76 * @author KenM, Zoey76
*/ */
public final class GameServerTable implements IXmlReader public final class GameServerTable implements IGameXmlReader
{ {
private static final Logger LOGGER = Logger.getLogger(GameServerTable.class.getName());
// Server Names // Server Names
private static final Map<Integer, String> SERVER_NAMES = new HashMap<>(); private static final Map<Integer, String> SERVER_NAMES = new HashMap<>();
// Game Server Table // Game Server Table
@@ -76,7 +80,7 @@ public final class GameServerTable implements IXmlReader
} }
@Override @Override
public void parseDocument(Document doc) public void parseDocument(Document doc, File f)
{ {
final NodeList servers = doc.getElementsByTagName("server"); final NodeList servers = doc.getElementsByTagName("server");
for (int s = 0; s < servers.getLength(); s++) for (int s = 0; s < servers.getLength(); s++)
@@ -277,7 +281,11 @@ public final class GameServerTable implements IXmlReader
*/ */
private String hexToString(byte[] hex) private String hexToString(byte[] hex)
{ {
return hex == null ? "null" : new BigInteger(hex).toString(16); if (hex == null)
{
return "null";
}
return new BigInteger(hex).toString(16);
} }
/** /**
@@ -454,7 +462,11 @@ public final class GameServerTable implements IXmlReader
*/ */
public int getCurrentPlayerCount() public int getCurrentPlayerCount()
{ {
return _gst == null ? 0 : _gst.getPlayerCount(); if (_gst == null)
{
return 0;
}
return _gst.getPlayerCount();
} }
/** /**