Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/java/Dev/Dungeon/DungeonManager.java b/java/Dev/Dungeon/DungeonManager.java
- index 7d251f4..f6b4a95 100644
- --- a/java/Dev/Dungeon/DungeonManager.java
- +++ b/java/Dev/Dungeon/DungeonManager.java
- @@ -32,6 +32,7 @@
- import net.sf.l2j.L2DatabaseFactory;
- import net.sf.l2j.gameserver.model.actor.Player;
- import net.sf.l2j.gameserver.model.location.Location;
- +import net.sf.l2j.gameserver.xmlfactory.XMLDocumentFactory;
- import org.w3c.dom.Document;
- import org.w3c.dom.NamedNodeMap;
- @@ -103,7 +104,6 @@
- return true;
- }
- - @SuppressWarnings("resource")
- private void load()
- {
- try
- diff --git a/java/Dev/Dungeon/XMLDocumentFactory.java b/java/Dev/Dungeon/XMLDocumentFactory.java
- deleted file mode 100644
- index 44c1a59..0000000
- --- a/java/Dev/Dungeon/XMLDocumentFactory.java
- +++ /dev/null
- @@ -1,72 +0,0 @@
- -package Dev.Dungeon;
- -
- -import java.io.File;
- -
- -import javax.xml.parsers.DocumentBuilder;
- -import javax.xml.parsers.DocumentBuilderFactory;
- -
- -import org.w3c.dom.Document;
- -
- -/**
- - * @author Forsaiken
- - */
- -public final class XMLDocumentFactory
- -{
- - public static final XMLDocumentFactory getInstance()
- - {
- - return SingletonHolder._instance;
- - }
- -
- - private final DocumentBuilder _builder;
- -
- - protected XMLDocumentFactory() throws Exception
- - {
- - try
- - {
- - final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- - factory.setValidating(false);
- - factory.setIgnoringComments(true);
- -
- - _builder = factory.newDocumentBuilder();
- - }
- - catch (Exception e)
- - {
- - throw new Exception("Failed initializing", e);
- - }
- - }
- -
- - public final Document loadDocument(final String filePath) throws Exception
- - {
- - return loadDocument(new File(filePath));
- - }
- -
- - public final Document loadDocument(final File file) throws Exception
- - {
- - if (!file.exists() || !file.isFile())
- - throw new Exception("File: " + file.getAbsolutePath() + " doesn't exist and/or is not a file.");
- -
- - return _builder.parse(file);
- - }
- -
- - public final Document newDocument()
- - {
- - return _builder.newDocument();
- - }
- -
- - private static class SingletonHolder
- - {
- - protected static final XMLDocumentFactory _instance;
- -
- - static
- - {
- - try
- - {
- - _instance = new XMLDocumentFactory();
- - }
- - catch (Exception e)
- - {
- - throw new ExceptionInInitializerError(e);
- - }
- - }
- - }
- -}
- \ No newline at end of file
- diff --git a/java/com/rouxy/phantom/XMLDocument.java b/java/com/rouxy/phantom/XMLDocument.java
- deleted file mode 100644
- index 9e155e7..0000000
- --- a/java/com/rouxy/phantom/XMLDocument.java
- +++ /dev/null
- @@ -1,84 +0,0 @@
- -package com.rouxy.phantom;
- -
- -
- -
- -import java.io.File;
- -
- -import javax.xml.parsers.DocumentBuilderFactory;
- -
- -
- -
- -import net.sf.l2j.gameserver.templates.StatsSet;
- -
- -import org.w3c.dom.Document;
- -import org.w3c.dom.NamedNodeMap;
- -import org.w3c.dom.Node;
- -
- -/**
- - * An XML document, relying on a static and single {@link DocumentBuilderFactory}.
- - */
- -public abstract class XMLDocument
- -{
- - protected static final CLogger LOGGER = new CLogger(XMLDocument.class.getName());
- -
- - private static final DocumentBuilderFactory BUILDER;
- - static
- - {
- - BUILDER = DocumentBuilderFactory.newInstance();
- - BUILDER.setValidating(false);
- - BUILDER.setIgnoringComments(true);
- - }
- -
- - abstract protected void load();
- -
- - abstract protected void parseDocument(Document doc, File f);
- -
- - public void loadDocument(String filePath)
- - {
- - loadDocument(new File(filePath));
- - }
- -
- - /**
- - * Parse an entire directory or file if found.
- - * @param file
- - */
- - public void loadDocument(File file)
- - {
- - if (!file.exists())
- - {
- - LOGGER.error("The following file or directory doesn't exist: {}.", file.getName());
- - return;
- - }
- -
- - if (file.isDirectory())
- - {
- - for (File f : file.listFiles())
- - loadDocument(f);
- - }
- - else if (file.isFile())
- - {
- - try
- - {
- - parseDocument(BUILDER.newDocumentBuilder().parse(file), file);
- - }
- - catch (Exception e)
- - {
- - LOGGER.error("Error loading XML file '{}'.", e, file.getName());
- - }
- - }
- - }
- -
- - /**
- - * This method parses the content of a NamedNodeMap and feed the given StatsSet.
- - * @param attrs : The NamedNodeMap to parse.
- - * @param set : The StatsSet to feed.
- - */
- - public static void parseAndFeed(NamedNodeMap attrs, StatsSet set)
- - {
- - for (int i = 0; i < attrs.getLength(); i++)
- - {
- - final Node attr = attrs.item(i);
- - set.set(attr.getNodeName(), attr.getNodeValue());
- - }
- - }
- -}
- diff --git a/java/net/sf/l2j/gameserver/GameServer.java b/java/net/sf/l2j/gameserver/GameServer.java
- index b9a1ef0..f0ac485 100644
- --- a/java/net/sf/l2j/gameserver/GameServer.java
- +++ b/java/net/sf/l2j/gameserver/GameServer.java
- @@ -175,9 +175,7 @@
- Config.loadGameServer();
- // Factories
- - XMLDocumentFactory.getInstance();
- L2DatabaseFactory.getInstance();
- - IconTable.getInstance();
- StringUtil.printSection("ThreadPool");
- ThreadPool.init();
- StringUtil.printSection("IdFactory");
- @@ -207,6 +205,8 @@
- SoulCrystalData.getInstance();
- AugmentationData.getInstance();
- CursedWeaponsManager.getInstance();
- + XMLDocumentFactory.getInstance();
- + IconTable.getInstance();
- StringUtil.printSection("Admins");
- AdminData.getInstance();
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement