Browse Source

Removing Configuration Editor GUI from L2J Server

Adding data files to Login Server (does not require L2J DataPack
anymore).
Zoey76 6 years ago
parent
commit
540ca2a8d6

+ 1 - 25
build.gradle

@@ -47,7 +47,6 @@ def generalManifest = manifest {
 jar {
 	archiveName = 'l2jserver.jar'
 	exclude('**/loginserver/**')
-	exclude('**/gsregistering/**')
 	manifest {
 		from(generalManifest)
 		attributes('Main-Class': 'com.l2jserver.gameserver.GameServer')
@@ -57,36 +56,14 @@ jar {
 task loginJar(type: Jar, dependsOn: classes) {
 	from(sourceSets.main.output)
 	archiveName = 'l2jlogin.jar'
-	exclude('**/gameserver/**')
 	manifest {
 		from(generalManifest)
 		attributes('Main-Class': 'com.l2jserver.loginserver.L2LoginServer')
 	}
 }
 
-task configuratorJar(type: Jar, dependsOn: classes) {
-	from(sourceSets.main.output)
-	archiveName = 'L2J_Configurator.jar'
-	include('**/configurator/**')
-	include('**/i18n/**')
-	include('**/images/**')
-	exclude('**/gameserver/**')
-	exclude('**/gsregistering/**')
-	exclude('**/log/**')
-	exclude('**/loginserver/**')
-	exclude('**/status/**')
-	exclude('**/util/**')
-	exclude('**/Config/**')
-	exclude('**/ConnectionFactory/**')
-	exclude('**/Server/**')
-	manifest {
-		from(generalManifest)
-		attributes('Main-Class': 'com.l2jserver.tools.configurator.ConfigUserInterface')
-	}
-}
-
 artifacts {
-	archives loginJar, configuratorJar
+	archives loginJar
 }
 
 task zip(type: Zip, dependsOn: build) {
@@ -98,7 +75,6 @@ task zip(type: Zip, dependsOn: build) {
 	}
 	into('game') {
 		from(jar)
-		from(configuratorJar)
 	}
 	into('login') {
 		from(loginJar)

BIN
dist/images/disk.png


BIN
dist/images/help.png


BIN
dist/images/l2j.png


BIN
dist/images/l2jserverlogo.png


+ 0 - 23
dist/languages/configurator/Configurator.properties

@@ -1,23 +0,0 @@
-language = English
-toolName = Server Configuration Tool
-
-success = Configuration saved successfully
-error = Error
-errorReading = Error reading
-errorSaving = Error saving
-reason = Reason:
-yes = Yes
-no = No
-
-fileMenu = File
-exitItem = Exit
-helpMenu = Help
-aboutItem = About
-
-save = Save
-cancel = Cancel
-
-credits = © 2008-2009 L2J Team. All rights reserved.
-langText = Language: English
-icons = Icons by http://www.famfamfam.com
-translation = Translation: L2J Team

+ 4 - 0
dist/login/data/mail/MailList.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MailList.xsd">
+	<mail id="SATempBan" file="html/SecAuthTempBan.htm" subject="Your account has been temporarily suspended" />
+</list>

+ 16 - 0
dist/login/data/mail/MailList.xsd

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema">
+	<element name="list">
+		<complexType>
+			<sequence minOccurs="1" maxOccurs="1">
+				<element name="mail" minOccurs="1" maxOccurs="1">
+					<complexType>
+						<attribute name="file" type="token" use="required" />
+						<attribute name="id" type="token" use="required" />
+						<attribute name="subject" type="normalizedString" use="required" />
+					</complexType>
+				</element>
+			</sequence>
+		</complexType>
+	</element>
+</schema>

+ 15 - 0
dist/login/data/mail/html/SecAuthTempBan.htm

@@ -0,0 +1,15 @@
+Greetings,<br>
+<br>
+We have temporally suspended your account:<br>
+<br>
+Account Name: %accountname%<br>
+Reason: Typed wrong character password %var1% times in row from ip %var0%.<br>
+Consequences: Your account has been temporaly suspended for %var2% minutes.<br>
+<br>
+If you've lost your your character password, you can recover them by <a href="%var3%">clicking here</a>.<br>
+<br>
+If you have any question, <a href="mailto:%servermail%">click here</a> to send an email to the administrator.<br>
+Regards,<br>
+%servername% Game Master Team<br>
+<br>
+<p align="center">Powered By: <a href="http://www.l2jserver.com/">L2J Server</a></p>

+ 130 - 0
dist/login/data/servername.xml

@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<servers_list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="servername.xsd">
+	<server id="1" name="Bartz" />
+	<server id="2" name="Sieghardt" />
+	<server id="3" name="Kain" />
+	<server id="4" name="Lionna" />
+	<server id="5" name="Erica" />
+	<server id="6" name="Gustin" />
+	<server id="7" name="Devianne" />
+	<server id="8" name="Hindemith" />
+	<server id="9" name="Teon (EURO)" />
+	<server id="10" name="Franz (EURO)" />
+	<server id="11" name="Luna (EURO)" />
+	<server id="12" name="Sayha" />
+	<server id="13" name="Aria" />
+	<server id="14" name="Phoenix" />
+	<server id="15" name="Chronos" />
+	<server id="16" name="Naia (EURO)" />
+	<server id="17" name="Elhwynna" />
+	<server id="18" name="Ellikia" />
+	<server id="19" name="Shikken" />
+	<server id="20" name="Scryde" />
+	<server id="21" name="Frikios" />
+	<server id="22" name="Ophylia" />
+	<server id="23" name="Shakdun" />
+	<server id="24" name="Tarziph" />
+	<server id="25" name="Aria" />
+	<server id="26" name="Esenn" />
+	<server id="27" name="Elcardia" />
+	<server id="28" name="Yiana" />
+	<server id="29" name="Seresin" />
+	<server id="30" name="Tarkai" />
+	<server id="31" name="Khadia" />
+	<server id="32" name="Roien" />
+	<server id="33" name="Kallint (Non-PvP)" />
+	<server id="34" name="Baium" />
+	<server id="35" name="Kamael" />
+	<server id="36" name="Beleth" />
+	<server id="37" name="Anakim" />
+	<server id="38" name="Lilith" />
+	<server id="39" name="Thifiel" />
+	<server id="40" name="Lithra" />
+	<server id="41" name="Lockirin" />
+	<server id="42" name="Kakai" />
+	<server id="43" name="Cadmus" />
+	<server id="44" name="Athebaldt" />
+	<server id="45" name="Blackbird" />
+	<server id="46" name="Ramsheart" />
+	<server id="47" name="Esthus" />
+	<server id="48" name="Vasper" />
+	<server id="49" name="Lancer" />
+	<server id="50" name="Ashton" />
+	<server id="51" name="Waytrel" />
+	<server id="52" name="Waltner" />
+	<server id="53" name="Tahnford" />
+	<server id="54" name="Hunter" />
+	<server id="55" name="Dewell" />
+	<server id="56" name="Rodemaye" />
+	<server id="57" name="Ken Rauhel" />
+	<server id="58" name="Ken Abigail" />
+	<server id="59" name="Ken Orwen" />
+	<server id="60" name="Van Holter" />
+	<server id="61" name="Desperion" />
+	<server id="62" name="Einhovant" />
+	<server id="63" name="Shunaiman" />
+	<server id="64" name="Faris" />
+	<server id="65" name="Tor" />
+	<server id="66" name="Carneiar" />
+	<server id="67" name="Dwyllios" />
+	<server id="68" name="Baium" />
+	<server id="69" name="Hallate" />
+	<server id="70" name="Zaken" />
+	<server id="71" name="Core" />
+	<server id="72" name="72" />
+	<server id="73" name="73" />
+	<server id="74" name="74" />
+	<server id="75" name="75" />
+	<server id="76" name="76" />
+	<server id="77" name="77" />
+	<server id="78" name="78" />
+	<server id="79" name="79" />
+	<server id="80" name="80" />
+	<server id="81" name="81" />
+	<server id="82" name="82" />
+	<server id="83" name="83" />
+	<server id="84" name="84" />
+	<server id="85" name="85" />
+	<server id="86" name="86" />
+	<server id="87" name="87" />
+	<server id="88" name="88" />
+	<server id="89" name="89" />
+	<server id="90" name="90" />
+	<server id="91" name="91" />
+	<server id="92" name="92" />
+	<server id="93" name="93" />
+	<server id="94" name="94" />
+	<server id="95" name="95" />
+	<server id="96" name="96" />
+	<server id="97" name="97" />
+	<server id="98" name="98" />
+	<server id="99" name="99" />
+	<server id="100" name="100" />
+	<server id="101" name="101" />
+	<server id="102" name="102" />
+	<server id="103" name="103" />
+	<server id="104" name="104" />
+	<server id="105" name="105" />
+	<server id="106" name="106" />
+	<server id="107" name="107" />
+	<server id="108" name="108" />
+	<server id="109" name="109" />
+	<server id="110" name="110" />
+	<server id="111" name="111" />
+	<server id="112" name="112" />
+	<server id="113" name="113" />
+	<server id="114" name="114" />
+	<server id="115" name="115" />
+	<server id="116" name="116" />
+	<server id="117" name="117" />
+	<server id="118" name="118" />
+	<server id="119" name="119" />
+	<server id="120" name="120" />
+	<server id="121" name="121" />
+	<server id="122" name="122" />
+	<server id="123" name="123" />
+	<server id="124" name="124" />
+	<server id="125" name="125" />
+	<server id="126" name="126" />
+	<server id="127" name="???" />
+</servers_list>

+ 22 - 0
dist/login/data/servername.xsd

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+	<xs:element name="servers_list">
+		<xs:complexType>
+			<xs:sequence minOccurs="1" maxOccurs="1">
+				<xs:element name="server" minOccurs="127" maxOccurs="127">
+					<xs:complexType>
+						<xs:attribute name="id" use="required">
+							<xs:simpleType>
+								<xs:restriction base="xs:integer">
+									<xs:minInclusive value="1" />
+									<xs:maxInclusive value="127" />
+								</xs:restriction>
+							</xs:simpleType>
+						</xs:attribute>
+						<xs:attribute name="name" type="xs:normalizedString" use="required" />
+					</xs:complexType>
+				</xs:element>
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>

+ 0 - 762
src/main/java/com/l2jserver/tools/configurator/ConfigUserInterface.java

@@ -1,762 +0,0 @@
-/*
- * Copyright © 2004-2019 L2J Server
- * 
- * This file is part of L2J Server.
- * 
- * L2J Server 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.
- * 
- * L2J Server 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.l2jserver.tools.configurator;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.LineNumberReader;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.net.Inet4Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.NoSuchElementException;
-import java.util.ResourceBundle;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JTextArea;
-import javax.swing.JToolBar;
-import javax.swing.SwingConstants;
-import javax.swing.SwingUtilities;
-import javax.swing.ToolTipManager;
-import javax.swing.UIManager;
-import javax.swing.WindowConstants;
-
-import com.l2jserver.tools.configurator.ConfigUserInterface.ConfigFile.ConfigComment;
-import com.l2jserver.tools.configurator.ConfigUserInterface.ConfigFile.ConfigProperty;
-import com.l2jserver.tools.i18n.LanguageControl;
-import com.l2jserver.tools.images.ImagesTable;
-
-/**
- * @author KenM
- */
-public class ConfigUserInterface extends JFrame implements ActionListener
-{
-	private static final long serialVersionUID = 2609592249095305857L;
-	
-	public static final String EOL = System.getProperty("line.separator");
-	
-	private final JTabbedPane _tabPane = new JTabbedPane();
-	
-	private List<ConfigFile> _configs = new ArrayList<>();
-	
-	private ResourceBundle _bundle;
-	
-	public static void main(String[] args)
-	{
-		try
-		{
-			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-		}
-		catch (Exception e)
-		{
-			// couldn't care less
-		}
-		
-		final ResourceBundle bundle = ResourceBundle.getBundle("configurator.Configurator", Locale.getDefault(), LanguageControl.INSTANCE);
-		
-		SwingUtilities.invokeLater(() ->
-		{
-			ConfigUserInterface cui = new ConfigUserInterface(bundle);
-			cui.setVisible(true);
-		});
-	}
-	
-	public ConfigUserInterface(ResourceBundle bundle)
-	{
-		setBundle(bundle);
-		setTitle(bundle.getString("toolName"));
-		setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
-		this.setSize(750, 500);
-		setLayout(new GridBagLayout());
-		
-		setDefaultLookAndFeelDecorated(true);
-		setIconImage(ImagesTable.getImage("l2j.png").getImage());
-		
-		GridBagConstraints cons = new GridBagConstraints();
-		cons.fill = GridBagConstraints.HORIZONTAL;
-		cons.gridx = 0;
-		cons.gridy = 0;
-		cons.weighty = 0;
-		cons.weightx = 1;
-		
-		JMenuBar menubar = new JMenuBar();
-		
-		JMenu fileMenu = new JMenu(bundle.getString("fileMenu"));
-		JMenu helpMenu = new JMenu(bundle.getString("helpMenu"));
-		
-		JMenuItem exitItem = new JMenuItem(bundle.getString("exitItem"));
-		exitItem.setActionCommand("exit");
-		exitItem.addActionListener(this);
-		fileMenu.add(exitItem);
-		
-		JMenuItem aboutItem = new JMenuItem(bundle.getString("aboutItem"));
-		aboutItem.setActionCommand("about");
-		aboutItem.addActionListener(this);
-		helpMenu.add(aboutItem);
-		
-		menubar.add(fileMenu);
-		menubar.add(helpMenu);
-		
-		setJMenuBar(menubar);
-		
-		JToolBar toolBar = new JToolBar();
-		toolBar.setFloatable(false);
-		toolBar.setRollover(true);
-		toolBar.add(createToolButton("disk.png", bundle.getString("save"), "save"));
-		this.add(toolBar, cons);
-		
-		cons.gridy++;
-		cons.fill = GridBagConstraints.BOTH;
-		cons.weighty = 1;
-		loadConfigs();
-		buildInterface();
-		this.add(_tabPane, cons);
-	}
-	
-	private JButton createToolButton(String image, String text, String action)
-	{
-		JButton button = new JButton(text, ImagesTable.getImage(image));
-		button.setActionCommand(action);
-		button.addActionListener(this);
-		return button;
-	}
-	
-	private void buildInterface()
-	{
-		ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);
-		ToolTipManager.sharedInstance().setInitialDelay(0);
-		ToolTipManager.sharedInstance().setReshowDelay(0);
-		
-		GridBagConstraints cons = new GridBagConstraints();
-		cons.fill = GridBagConstraints.NONE;
-		cons.anchor = GridBagConstraints.FIRST_LINE_START;
-		cons.insets = new Insets(2, 2, 2, 2);
-		for (ConfigFile cf : getConfigs())
-		{
-			JPanel panel = new JPanel()
-			{
-				private static final long serialVersionUID = -323928678804839054L;
-				
-				@Override
-				public void scrollRectToVisible(Rectangle r)
-				{
-				}
-			};
-			panel.setLayout(new GridBagLayout());
-			
-			cons.gridy = 0;
-			cons.weighty = 0;
-			for (ConfigComment cc : cf.getConfigProperties())
-			{
-				if (!(cc instanceof ConfigProperty))
-				{
-					continue;
-				}
-				
-				ConfigProperty cp = (ConfigProperty) cc;
-				cons.gridx = 0;
-				
-				JLabel keyLabel = new JLabel(cp.getDisplayName() + ':', ImagesTable.getImage("help.png"), SwingConstants.LEFT);
-				String comments = "<b>" + cp.getName() + ":</b><br>" + cp.getComments();
-				comments = comments.replace(EOL, "<br>");
-				comments = "<html>" + comments + "</html>";
-				keyLabel.setToolTipText(comments);
-				cons.weightx = 0;
-				panel.add(keyLabel, cons);
-				cons.gridx++;
-				
-				JComponent valueComponent = cp.getValueComponent();
-				valueComponent.setToolTipText(comments);
-				cons.weightx = 1;
-				panel.add(valueComponent, cons);
-				cons.gridx++;
-				cons.gridy++;
-			}
-			cons.gridy++;
-			cons.weighty = 1;
-			panel.add(new JLabel(), cons); // filler
-			_tabPane.addTab(cf.getName(), new JScrollPane(panel));
-		}
-	}
-	
-	private void loadConfigs()
-	{
-		final File configsDir = new File("config");
-		final File[] files = configsDir.listFiles();
-		if (files == null)
-		{
-			JOptionPane.showMessageDialog(ConfigUserInterface.this, getBundle().getString("errorReading") + "config", getBundle().getString("error"), JOptionPane.ERROR_MESSAGE);
-			return;
-		}
-		
-		for (File file : files)
-		{
-			if (file.getName().endsWith(".properties") && file.isFile() && file.canWrite())
-			{
-				try
-				{
-					parsePropertiesFile(file);
-				}
-				catch (IOException e)
-				{
-					JOptionPane.showMessageDialog(ConfigUserInterface.this, getBundle().getString("errorReading") + file.getName(), getBundle().getString("error"), JOptionPane.ERROR_MESSAGE);
-					System.exit(3);
-				}
-			}
-		}
-	}
-	
-	/**
-	 * @param file
-	 * @throws IOException
-	 */
-	private void parsePropertiesFile(File file) throws IOException
-	{
-		try (FileInputStream fis = new FileInputStream(file);
-			InputStreamReader isr = new InputStreamReader(fis);
-			LineNumberReader lnr = new LineNumberReader(isr))
-		{
-			String line;
-			StringBuilder commentBuffer = new StringBuilder();
-			ConfigFile cf = new ConfigFile(file);
-			while ((line = lnr.readLine()) != null)
-			{
-				line = line.trim();
-				if (line.isEmpty())
-				{
-					// blank line, reset comments
-					if (commentBuffer.length() > 0)
-					{
-						cf.addConfigComment(commentBuffer.toString());
-					}
-					commentBuffer.setLength(0);
-				}
-				else if (line.charAt(0) == '#')
-				{
-					if (commentBuffer.length() > 0)
-					{
-						commentBuffer.append(EOL);
-					}
-					commentBuffer.append(line.substring(1));
-				}
-				else if (line.indexOf('=') >= 0)
-				{
-					String[] kv = line.split("=", 2);
-					String key = kv[0].trim();
-					StringBuilder value = new StringBuilder();
-					if (kv.length > 1)
-					{
-						value.append(kv[1].trim());
-					}
-					
-					if (line.indexOf('\\') >= 0)
-					{
-						while (((line = lnr.readLine()) != null) && (line.indexOf('\\') >= 0))
-						{
-							value.append(EOL + line);
-						}
-						value.append(EOL + line);
-					}
-					
-					String comments = commentBuffer.toString();
-					commentBuffer.setLength(0); // reset
-					
-					cf.addConfigProperty(key, parseValue(value.toString()), comments);
-				}
-			}
-			getConfigs().add(cf);
-		}
-	}
-	
-	/**
-	 * @param value
-	 * @return
-	 */
-	private Object parseValue(String value)
-	{
-		if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("true"))
-		{
-			return Boolean.parseBoolean(value);
-		}
-		
-		/*
-		 * try { double parseDouble = Double.parseDouble(value); return parseDouble; } catch (NumberFormatException e) { // not a double, ignore }
-		 */
-		
-		// localhost -> 127.0.0.1
-		if (value.equals("localhost"))
-		{
-			value = "127.0.0.1";
-		}
-		
-		String[] parts = value.split("\\.");
-		if (parts.length == 4)
-		{
-			boolean ok = true;
-			for (int i = 0; (i < 4) && ok; i++)
-			{
-				try
-				{
-					int parseInt = Integer.parseInt(parts[i]);
-					if ((parseInt < 0) || (parseInt > 255))
-					{
-						ok = false;
-					}
-				}
-				catch (NumberFormatException e)
-				{
-					ok = false;
-				}
-			}
-			
-			if (ok)
-			{
-				try
-				{
-					InetAddress address = InetAddress.getByName(value);
-					return address;
-				}
-				catch (UnknownHostException e)
-				{
-					// ignore
-				}
-			}
-		}
-		
-		return value;
-	}
-	
-	static class ConfigFile
-	{
-		private final File _file;
-		private String _name;
-		private final List<ConfigComment> _configs = new ArrayList<>();
-		
-		public ConfigFile(File file)
-		{
-			_file = file;
-			int lastIndex = file.getName().lastIndexOf('.');
-			setName(file.getName().substring(0, lastIndex));
-		}
-		
-		public void addConfigProperty(String name, Object value, ValueType type, String comments)
-		{
-			_configs.add(new ConfigProperty(name, value, type, comments));
-		}
-		
-		public void addConfigComment(String comment)
-		{
-			_configs.add(new ConfigComment(comment));
-		}
-		
-		public void addConfigProperty(String name, Object value, String comments)
-		{
-			this.addConfigProperty(name, value, ValueType.firstTypeMatch(value), comments);
-		}
-		
-		public List<ConfigComment> getConfigProperties()
-		{
-			return _configs;
-		}
-		
-		/**
-		 * @param name The name to set.
-		 */
-		public void setName(String name)
-		{
-			_name = name;
-		}
-		
-		/**
-		 * @return Returns the name.
-		 */
-		public String getName()
-		{
-			return _name;
-		}
-		
-		public void save() throws IOException
-		{
-			try (FileOutputStream fos = new FileOutputStream(_file);
-				OutputStreamWriter osw = new OutputStreamWriter(fos);
-				BufferedWriter bufWriter = new BufferedWriter(osw))
-			{
-				for (ConfigComment cc : _configs)
-				{
-					cc.save(bufWriter);
-				}
-			}
-		}
-		
-		class ConfigComment
-		{
-			
-			private String _comments;
-			
-			/**
-			 * @param comments
-			 */
-			public ConfigComment(String comments)
-			{
-				_comments = comments;
-			}
-			
-			/**
-			 * @return Returns the comments.
-			 */
-			public String getComments()
-			{
-				return _comments;
-			}
-			
-			/**
-			 * @param comments The comments to set.
-			 */
-			public void setComments(String comments)
-			{
-				_comments = comments;
-			}
-			
-			public void save(Writer writer) throws IOException
-			{
-				StringBuilder sb = new StringBuilder();
-				sb.append('#');
-				sb.append(getComments().replace(EOL, EOL + "#"));
-				sb.append(EOL + EOL);
-				writer.write(sb.toString());
-			}
-		}
-		
-		class ConfigProperty extends ConfigComment
-		{
-			private String _propname;
-			private Object _value;
-			private ValueType _type;
-			private JComponent _component;
-			
-			/**
-			 * @param name
-			 * @param value
-			 * @param type
-			 * @param comments
-			 */
-			public ConfigProperty(String name, Object value, ValueType type, String comments)
-			{
-				super(comments);
-				if (!type.getType().isAssignableFrom(value.getClass()))
-				{
-					throw new IllegalArgumentException("Value Instance Type doesn't match the type argument.");
-				}
-				_propname = name;
-				_type = type;
-				_value = value;
-			}
-			
-			/**
-			 * @return Returns the name.
-			 */
-			public String getName()
-			{
-				return _propname;
-			}
-			
-			/**
-			 * @return Returns the name.
-			 */
-			public String getDisplayName()
-			{
-				return unCamelize(_propname);
-			}
-			
-			/**
-			 * @param name The name to set.
-			 */
-			public void setName(String name)
-			{
-				_propname = name;
-			}
-			
-			/**
-			 * @return Returns the value.
-			 */
-			public Object getValue()
-			{
-				return _value;
-			}
-			
-			/**
-			 * @param value The value to set.
-			 */
-			public void setValue(String value)
-			{
-				_value = value;
-			}
-			
-			/**
-			 * @return Returns the type.
-			 */
-			public ValueType getType()
-			{
-				return _type;
-			}
-			
-			/**
-			 * @param type The type to set.
-			 */
-			public void setType(ValueType type)
-			{
-				_type = type;
-			}
-			
-			public JComponent getValueComponent()
-			{
-				if (_component == null)
-				{
-					_component = createValueComponent();
-				}
-				return _component;
-			}
-			
-			public JComponent createValueComponent()
-			{
-				switch (getType())
-				{
-					case BOOLEAN:
-						boolean bool = (Boolean) getValue();
-						JCheckBox checkBox = new JCheckBox();
-						checkBox.setSelected(bool);
-						return checkBox;
-					case IPv4:
-						return new JIPTextField((Inet4Address) getValue());
-					case DOUBLE:
-					case INTEGER:
-					case STRING:
-					default:
-						String val = getValue().toString();
-						JTextArea textArea = new JTextArea(val);
-						textArea.setFont(UIManager.getFont("TextField.font"));
-						int rows = 1;
-						for (int i = 0; i < val.length(); i++)
-						{
-							if (val.charAt(i) == '\\')
-							{
-								rows++;
-							}
-						}
-						textArea.setRows(rows);
-						textArea.setColumns(Math.max(val.length() / rows, 20));
-						return textArea;
-				}
-			}
-			
-			@Override
-			public void save(Writer writer) throws IOException
-			{
-				String value;
-				if (getValueComponent() instanceof JCheckBox)
-				{
-					value = Boolean.toString(((JCheckBox) getValueComponent()).isSelected());
-					value = value.substring(0, 1).toUpperCase() + value.substring(1);
-				}
-				else if (getValueComponent() instanceof JIPTextField)
-				{
-					value = ((JIPTextField) getValueComponent()).getText();
-				}
-				else if (getValueComponent() instanceof JTextArea)
-				{
-					value = ((JTextArea) getValueComponent()).getText();
-				}
-				else
-				{
-					throw new IllegalStateException("Unhandled component value");
-				}
-				
-				StringBuilder sb = new StringBuilder();
-				sb.append('#');
-				sb.append(getComments().replace(EOL, EOL + "#"));
-				sb.append(EOL);
-				sb.append(getName());
-				sb.append(" = ");
-				sb.append(value);
-				sb.append(EOL);
-				sb.append(EOL);
-				writer.write(sb.toString());
-			}
-		}
-	}
-	
-	public static enum ValueType
-	{
-		BOOLEAN(Boolean.class),
-		DOUBLE(Double.class),
-		INTEGER(Integer.class),
-		IPv4(Inet4Address.class),
-		STRING(String.class);
-		
-		private final Class<?> _type;
-		
-		private ValueType(Class<?> type)
-		{
-			_type = type;
-		}
-		
-		/**
-		 * @return Returns the type.
-		 */
-		public Class<?> getType()
-		{
-			return _type;
-		}
-		
-		public static ValueType firstTypeMatch(Object value)
-		{
-			for (ValueType vt : ValueType.values())
-			{
-				if (vt.getType() == value.getClass())
-				{
-					return vt;
-				}
-			}
-			throw new NoSuchElementException("No match for: " + value.getClass().getName());
-		}
-	}
-	
-	@Override
-	public void actionPerformed(ActionEvent e)
-	{
-		String cmd = e.getActionCommand();
-		
-		StringBuilder errors = new StringBuilder();
-		
-		if (cmd.equals("save"))
-		{
-			for (ConfigFile cf : ConfigUserInterface.this.getConfigs())
-			{
-				try
-				{
-					cf.save();
-				}
-				catch (Exception e1)
-				{
-					e1.printStackTrace();
-					errors.append(getBundle().getString("errorSaving") + cf.getName() + ".properties. " + getBundle().getString("reason") + e1.getLocalizedMessage() + EOL);
-				}
-			}
-			if (errors.length() == 0)
-			{
-				JOptionPane.showMessageDialog(ConfigUserInterface.this, getBundle().getString("success"), "OK", JOptionPane.INFORMATION_MESSAGE);
-			}
-			else
-			{
-				JOptionPane.showMessageDialog(ConfigUserInterface.this, errors, getBundle().getString("error"), JOptionPane.ERROR_MESSAGE);
-				System.exit(2);
-			}
-		}
-		else if (cmd.equals("exit"))
-		{
-			System.exit(0);
-		}
-		else if (cmd.equals("about"))
-		{
-			JOptionPane.showMessageDialog(ConfigUserInterface.this, getBundle().getString("credits") + EOL + "http://www.l2jserver.com" + EOL + EOL + getBundle().getString("icons") + EOL + EOL + getBundle().getString("langText") + EOL
-				+ getBundle().getString("translation"), getBundle().getString("aboutItem"), JOptionPane.INFORMATION_MESSAGE, ImagesTable.getImage("l2jserverlogo.png"));
-		}
-	}
-	
-	/**
-	 * @param configs The configuration to set.
-	 */
-	public void setConfigs(List<ConfigFile> configs)
-	{
-		_configs = configs;
-	}
-	
-	/**
-	 * @return Returns the configuration.
-	 */
-	public List<ConfigFile> getConfigs()
-	{
-		return _configs;
-	}
-	
-	/**
-	 * @param keyName
-	 * @return Returns the configuration setting name in a human readable form.
-	 */
-	public static String unCamelize(final String keyName)
-	{
-		Pattern p = Pattern.compile("\\p{Lu}");
-		Matcher m = p.matcher(keyName);
-		StringBuffer sb = new StringBuffer();
-		int last = 0;
-		while (m.find())
-		{
-			if (m.start() != (last + 1))
-			{
-				m.appendReplacement(sb, " " + m.group());
-			}
-			last = m.start();
-		}
-		m.appendTail(sb);
-		return sb.toString().trim();
-	}
-	
-	/**
-	 * @param bundle The bundle to set.
-	 */
-	public void setBundle(ResourceBundle bundle)
-	{
-		_bundle = bundle;
-	}
-	
-	/**
-	 * @return Returns the bundle.
-	 */
-	public ResourceBundle getBundle()
-	{
-		return _bundle;
-	}
-}

+ 0 - 328
src/main/java/com/l2jserver/tools/configurator/JIPTextField.java

@@ -1,328 +0,0 @@
-/*
- * Copyright © 2004-2019 L2J Server
- * 
- * This file is part of L2J Server.
- * 
- * L2J Server 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.
- * 
- * L2J Server 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.l2jserver.tools.configurator;
-
-import java.awt.Component;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.Toolkit;
-import java.awt.event.ActionListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.net.Inet4Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.PlainDocument;
-
-/**
- * @author KenM
- */
-public class JIPTextField extends JPanel implements FocusListener
-{
-	/**
-	 * Comment for <code>serialVersionUID</code>
-	 */
-	private static final long serialVersionUID = 1L;
-	private JTextField[] _textFields;
-	private List<FocusListener> _focusListeners;
-	
-	public JIPTextField(String textIp)
-	{
-		super.addFocusListener(this);
-		
-		initIPTextField(textIp);
-		
-		for (JTextField _textField : _textFields)
-		{
-			_textField.addFocusListener(this);
-		}
-	}
-	
-	public JIPTextField()
-	{
-		this("...");
-	}
-	
-	/**
-	 * @param value
-	 */
-	public JIPTextField(Inet4Address value)
-	{
-		this(value.getHostAddress());
-	}
-	
-	private void initIPTextField(String textIp)
-	{
-		final ActionListener nextfocusaction = evt -> ((Component) evt.getSource()).transferFocus();
-		
-		setLayout(new GridBagLayout());
-		_textFields = new JTextField[4];
-		
-		GridBagConstraints cons = new GridBagConstraints();
-		cons.anchor = GridBagConstraints.PAGE_START;
-		cons.fill = GridBagConstraints.HORIZONTAL;
-		cons.insets = new Insets(1, 1, 1, 1);
-		cons.gridx = 0;
-		cons.gridy = 0;
-		
-		MaxLengthDocument previous = null;
-		String[] parts = textIp.split("\\.");
-		for (int i = 0; i < 4; i++)
-		{
-			String str = parts[i];
-			if (i > 0)
-			{
-				JLabel dot = new JLabel(".");
-				cons.weightx = 0;
-				add(dot, cons);
-				cons.gridx++;
-			}
-			MaxLengthDocument maxDoc = new MaxLengthDocument(3);
-			_textFields[i] = new JTextField(maxDoc, str, 3);
-			if (previous != null)
-			{
-				previous.setNext(_textFields[i]);
-			}
-			previous = maxDoc;
-			// ic.weightx = 1;
-			add(_textFields[i], cons);
-			_textFields[i].addActionListener(nextfocusaction);
-			cons.gridx++;
-		}
-	}
-	
-	@Override
-	public void addFocusListener(FocusListener fl)
-	{
-		if (_focusListeners == null)
-		{
-			_focusListeners = new LinkedList<>();
-		}
-		
-		if ((fl != null) && !_focusListeners.contains(fl))
-		{
-			_focusListeners.add(fl);
-		}
-	}
-	
-	@Override
-	public void removeFocusListener(FocusListener fl)
-	{
-		if (_focusListeners != null)
-		{
-			_focusListeners.remove(fl);
-		}
-	}
-	
-	public String getText()
-	{
-		StringBuilder str = new StringBuilder();
-		for (int i = 0; i < 4; i++)
-		{
-			if (_textFields[i].getText().length() == 0)
-			{
-				str.append('0');
-			}
-			else
-			{
-				str.append(_textFields[i].getText());
-			}
-			
-			if (i < 3)
-			{
-				str.append('.');
-			}
-		}
-		return str.toString();
-	}
-	
-	public void setText(String str)
-	{
-		try
-		{
-			// make sure string is not null; throw a NullPointerException otherwise
-			str.length();
-			
-			InetAddress ip = InetAddress.getByName(str);
-			byte b[] = ip.getAddress();
-			for (int i = 0; i < 4; i++)
-			{
-				// byte always have a sign in Java, IP addresses aren't
-				if (b[i] >= 0)
-				{
-					_textFields[i].setText(Byte.toString(b[i]));
-				}
-				else
-				{
-					_textFields[i].setText(Integer.toString(b[i] + 256));
-				}
-			}
-			return;
-		}
-		catch (UnknownHostException ex)
-		{
-		}
-		catch (NullPointerException npe)
-		{
-		}
-		for (int i = 0; i < 4; i++)
-		{
-			_textFields[i].setText("");
-		}
-	}
-	
-	@Override
-	public void setEnabled(boolean enabled)
-	{
-		for (JTextField _textField : _textFields)
-		{
-			if (_textField != null)
-			{
-				_textField.setEnabled(enabled);
-			}
-		}
-	}
-	
-	public boolean isEmpty()
-	{
-		for (int i = 0; i < 4; i++)
-		{
-			if (!_textFields[i].getText().isEmpty())
-			{
-				return false;
-			}
-		}
-		return true;
-	}
-	
-	public boolean isCorrect()
-	{
-		for (int i = 0; i < 4; i++)
-		{
-			if (_textFields[i].getText().length() == 0)
-			{
-				return false;
-			}
-		}
-		return true;
-	}
-	
-	@Override
-	public void focusGained(FocusEvent event)
-	{
-		if (_focusListeners != null)
-		{
-			for (FocusListener fl : _focusListeners)
-			{
-				fl.focusGained(event);
-			}
-		}
-	}
-	
-	@Override
-	public void focusLost(FocusEvent event)
-	{
-		if (isCorrect() || isEmpty())
-		{
-			if (_focusListeners != null)
-			{
-				for (FocusListener fl : _focusListeners)
-				{
-					fl.focusLost(event);
-				}
-			}
-		}
-	}
-	
-	public class MaxLengthDocument extends PlainDocument
-	{
-		
-		/**
-		 * Comment for <code>serialVersionUID</code>
-		 */
-		private static final long serialVersionUID = 1L;
-		
-		private final int _max;
-		private JTextField _next;
-		
-		public MaxLengthDocument(int maxLength)
-		{
-			this(maxLength, null);
-		}
-		
-		public MaxLengthDocument(int maxLength, JTextField next)
-		{
-			_max = maxLength;
-			setNext(next);
-		}
-		
-		@Override
-		public void insertString(int offset, String str, AttributeSet a) throws BadLocationException
-		{
-			if ((getLength() + str.length()) > _max)
-			{
-				if (getNext() != null)
-				{
-					if (getNext().getText().length() > 0)
-					{
-						getNext().select(0, getNext().getText().length());
-					}
-					else
-					{
-						getNext().getDocument().insertString(0, str, a);
-					}
-					getNext().requestFocusInWindow();
-				}
-				else
-				{
-					Toolkit.getDefaultToolkit().beep();
-				}
-			}
-			else
-			{
-				super.insertString(offset, str, a);
-			}
-		}
-		
-		/**
-		 * @param next The next to set.
-		 */
-		public void setNext(JTextField next)
-		{
-			_next = next;
-		}
-		
-		/**
-		 * @return Returns the next.
-		 */
-		public JTextField getNext()
-		{
-			return _next;
-		}
-	}
-}

+ 0 - 68
src/main/java/com/l2jserver/tools/i18n/LanguageControl.java

@@ -1,68 +0,0 @@
-/*
- * Copyright © 2004-2019 L2J Server
- * 
- * This file is part of L2J Server.
- * 
- * L2J Server 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.
- * 
- * L2J Server 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.l2jserver.tools.i18n;
-
-import java.io.BufferedInputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Locale;
-import java.util.PropertyResourceBundle;
-import java.util.ResourceBundle;
-import java.util.ResourceBundle.Control;
-
-/**
- * @author KenM
- */
-public class LanguageControl extends Control
-{
-	public static final String LANGUAGES_DIRECTORY = "../languages/";
-	
-	public static final LanguageControl INSTANCE = new LanguageControl();
-	
-	/**
-	 * prevent instancing, allows sub-classing
-	 */
-	protected LanguageControl()
-	{
-		
-	}
-	
-	@Override
-	public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IOException
-	{
-		if ((baseName == null) || (locale == null) || (format == null) || (loader == null))
-		{
-			throw new NullPointerException();
-		}
-		ResourceBundle bundle = null;
-		if (format.equals("java.properties"))
-		{
-			format = "properties";
-			String bundleName = toBundleName(baseName, locale);
-			String resourceName = LANGUAGES_DIRECTORY + toResourceName(bundleName, format);
-			
-			try (FileInputStream fis = new FileInputStream(resourceName);
-				BufferedInputStream bis = new BufferedInputStream(fis))
-			{
-				bundle = new PropertyResourceBundle(bis);
-			}
-		}
-		return bundle;
-	}
-}

+ 0 - 45
src/main/java/com/l2jserver/tools/images/ImagesTable.java

@@ -1,45 +0,0 @@
-/*
- * Copyright © 2004-2019 L2J Server
- * 
- * This file is part of L2J Server.
- * 
- * L2J Server 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.
- * 
- * L2J Server 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.l2jserver.tools.images;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.swing.ImageIcon;
-
-/**
- * Usage of this class causes images to be loaded and kept in memory, and therefore should only be used by helper applications.<br>
- * Some icons from famfamfam (http://www.famfamfam.com/) credit *MUST* be given.
- * @author KenM
- */
-public class ImagesTable
-{
-	private static final Map<String, ImageIcon> IMAGES = new HashMap<>();
-	
-	public static final String IMAGES_DIRECTORY = "../images/";
-	
-	public static ImageIcon getImage(String name)
-	{
-		if (!IMAGES.containsKey(name))
-		{
-			IMAGES.put(name, new ImageIcon(IMAGES_DIRECTORY + name));
-		}
-		return IMAGES.get(name);
-	}
-}