Changes based on Java 10 recommendations.

This commit is contained in:
MobiusDev
2018-08-05 19:38:51 +00:00
parent 29eb40b3fa
commit 7cbd09ae2e
94 changed files with 260 additions and 168 deletions

View File

@@ -715,7 +715,7 @@ public class MasterHandler
try try
{ {
final Object handler = c.newInstance(); final Object handler = c.getDeclaredConstructor().newInstance();
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet()) for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
{ {
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler)) if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))

View File

@@ -897,7 +897,7 @@ public class QuestMasterHandler
{ {
try try
{ {
quest.newInstance(); quest.getDeclaredConstructor().newInstance();
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -1 +1 @@
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g -server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g

View File

@@ -311,8 +311,8 @@ public class Gui
JScrollPane scrollPanel = new JScrollPane(txtrConsole); JScrollPane scrollPanel = new JScrollPane(txtrConsole);
scrollPanel.setBounds(0, 0, 800, 550); scrollPanel.setBounds(0, 0, 800, 550);
JLayeredPane layeredPanel = new JLayeredPane(); JLayeredPane layeredPanel = new JLayeredPane();
layeredPanel.add(scrollPanel, new Integer(0), 0); layeredPanel.add(scrollPanel, 0, 0);
layeredPanel.add(systemPanel, new Integer(1), 0); layeredPanel.add(systemPanel, 1, 0);
// Set frame. // Set frame.
JFrame frame = new JFrame("Mobius - GameServer"); JFrame frame = new JFrame("Mobius - GameServer");

View File

@@ -370,7 +370,7 @@ public class SchedulingPattern
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
for (int i = min; i <= max; i++) for (int i = min; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
return values; return values;
} }
@@ -393,7 +393,7 @@ public class SchedulingPattern
if (size == 1) if (size == 1)
{ {
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
values.add(new Integer(v1)); values.add(v1);
return values; return values;
} }
String v2Str = st.nextToken(); String v2Str = st.nextToken();
@@ -411,7 +411,7 @@ public class SchedulingPattern
{ {
for (int i = v1; i <= v2; i++) for (int i = v1; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else if (v1 > v2) else if (v1 > v2)
@@ -420,17 +420,17 @@ public class SchedulingPattern
int max = parser.getMaxValue(); int max = parser.getMaxValue();
for (int i = v1; i <= max; i++) for (int i = v1; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
for (int i = min; i <= v2; i++) for (int i = min; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else else
{ {
// v1 == v2 // v1 == v2
values.add(new Integer(v1)); values.add(v1);
} }
return values; return values;
} }

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherGS extends AbstractDBLauncher public class LauncherGS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/game/"; final String dir = "sql/game/";

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherLS extends AbstractDBLauncher public class LauncherLS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/login/"; final String dir = "sql/login/";

View File

@@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
{ {
Connection _con; Connection _con;
public DBInstallerConsole(String db, String dir) public DBInstallerConsole(String db, String dir) throws Exception
{ {
System.out.println("Welcome to L2J DataBase installer"); System.out.println("Welcome to L2J DataBase installer");
final Preferences prop = Preferences.userRoot(); final Preferences prop = Preferences.userRoot();
@@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
* @param pass the password * @param pass the password
* @param database the database name * @param database the database name
* @param mode the mode, c: Clean, u:update * @param mode the mode, c: Clean, u:update
* @throws Exception
*/ */
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
{ {
if ((database == null) || database.isEmpty()) if ((database == null) || database.isEmpty())
{ {

View File

@@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SpringLayout; import javax.swing.SpringLayout;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import com.l2jmobius.commons.util.SplashScreen; import com.l2jmobius.commons.util.SplashScreen;
import com.l2jmobius.tools.dbinstaller.RunTasks; import com.l2jmobius.tools.dbinstaller.RunTasks;
@@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
final int height = 220; final int height = 220;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);
@@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
final ActionListener connectListener = e -> final ActionListener connectListener = e ->
{ {
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false); MySqlConnect connector = null;
try
{
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
}
catch (Exception ex)
{
ex.printStackTrace();
}
if (connector.getConnection() != null) if ((connector != null) && (connector.getConnection() != null))
{ {
_prop.put("dbHost_" + _db, _dbHost.getText()); _prop.put("dbHost_" + _db, _dbHost.getText());
_prop.put("dbPort_" + _db, _dbPort.getText()); _prop.put("dbPort_" + _db, _dbPort.getText());

View File

@@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.WindowConstants;
import com.l2jmobius.tools.dbinstaller.DBOutputInterface; import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
@@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
final int height = 360; final int height = 360;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);

View File

@@ -31,11 +31,11 @@ public class MySqlConnect
{ {
Connection con = null; Connection con = null;
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
{ {
try (Formatter form = new Formatter()) try (Formatter form = new Formatter())
{ {
Class.forName("com.mysql.jdbc.Driver").newInstance(); Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString(); final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
con = DriverManager.getConnection(formattedText, user, password); con = DriverManager.getConnection(formattedText, user, password);

View File

@@ -717,7 +717,7 @@ public class MasterHandler
try try
{ {
final Object handler = c.newInstance(); final Object handler = c.getDeclaredConstructor().newInstance();
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet()) for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
{ {
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler)) if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))

View File

@@ -963,7 +963,7 @@ public class QuestMasterHandler
{ {
try try
{ {
quest.newInstance(); quest.getDeclaredConstructor().newInstance();
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -1 +1 @@
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g -server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g

View File

@@ -49,7 +49,6 @@ public class DailyMissionHandler
{ {
try try
{ {
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler(); ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
} }
catch (Exception e) catch (Exception e)

View File

@@ -311,8 +311,8 @@ public class Gui
JScrollPane scrollPanel = new JScrollPane(txtrConsole); JScrollPane scrollPanel = new JScrollPane(txtrConsole);
scrollPanel.setBounds(0, 0, 800, 550); scrollPanel.setBounds(0, 0, 800, 550);
JLayeredPane layeredPanel = new JLayeredPane(); JLayeredPane layeredPanel = new JLayeredPane();
layeredPanel.add(scrollPanel, new Integer(0), 0); layeredPanel.add(scrollPanel, 0, 0);
layeredPanel.add(systemPanel, new Integer(1), 0); layeredPanel.add(systemPanel, 1, 0);
// Set frame. // Set frame.
JFrame frame = new JFrame("Mobius - GameServer"); JFrame frame = new JFrame("Mobius - GameServer");

View File

@@ -370,7 +370,7 @@ public class SchedulingPattern
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
for (int i = min; i <= max; i++) for (int i = min; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
return values; return values;
} }
@@ -393,7 +393,7 @@ public class SchedulingPattern
if (size == 1) if (size == 1)
{ {
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
values.add(new Integer(v1)); values.add(v1);
return values; return values;
} }
String v2Str = st.nextToken(); String v2Str = st.nextToken();
@@ -411,7 +411,7 @@ public class SchedulingPattern
{ {
for (int i = v1; i <= v2; i++) for (int i = v1; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else if (v1 > v2) else if (v1 > v2)
@@ -420,17 +420,17 @@ public class SchedulingPattern
int max = parser.getMaxValue(); int max = parser.getMaxValue();
for (int i = v1; i <= max; i++) for (int i = v1; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
for (int i = min; i <= v2; i++) for (int i = min; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else else
{ {
// v1 == v2 // v1 == v2
values.add(new Integer(v1)); values.add(v1);
} }
return values; return values;
} }

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherGS extends AbstractDBLauncher public class LauncherGS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/game/"; final String dir = "sql/game/";

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherLS extends AbstractDBLauncher public class LauncherLS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/login/"; final String dir = "sql/login/";

View File

@@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
{ {
Connection _con; Connection _con;
public DBInstallerConsole(String db, String dir) public DBInstallerConsole(String db, String dir) throws Exception
{ {
System.out.println("Welcome to L2J DataBase installer"); System.out.println("Welcome to L2J DataBase installer");
final Preferences prop = Preferences.userRoot(); final Preferences prop = Preferences.userRoot();
@@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
* @param pass the password * @param pass the password
* @param database the database name * @param database the database name
* @param mode the mode, c: Clean, u:update * @param mode the mode, c: Clean, u:update
* @throws Exception
*/ */
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
{ {
if ((database == null) || database.isEmpty()) if ((database == null) || database.isEmpty())
{ {

View File

@@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SpringLayout; import javax.swing.SpringLayout;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import com.l2jmobius.commons.util.SplashScreen; import com.l2jmobius.commons.util.SplashScreen;
import com.l2jmobius.tools.dbinstaller.RunTasks; import com.l2jmobius.tools.dbinstaller.RunTasks;
@@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
final int height = 220; final int height = 220;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);
@@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
final ActionListener connectListener = e -> final ActionListener connectListener = e ->
{ {
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false); MySqlConnect connector = null;
try
{
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
}
catch (Exception ex)
{
ex.printStackTrace();
}
if (connector.getConnection() != null) if ((connector != null) && (connector.getConnection() != null))
{ {
_prop.put("dbHost_" + _db, _dbHost.getText()); _prop.put("dbHost_" + _db, _dbHost.getText());
_prop.put("dbPort_" + _db, _dbPort.getText()); _prop.put("dbPort_" + _db, _dbPort.getText());

View File

@@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.WindowConstants;
import com.l2jmobius.tools.dbinstaller.DBOutputInterface; import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
@@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
final int height = 360; final int height = 360;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);

View File

@@ -31,11 +31,11 @@ public class MySqlConnect
{ {
Connection con = null; Connection con = null;
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
{ {
try (Formatter form = new Formatter()) try (Formatter form = new Formatter())
{ {
Class.forName("com.mysql.jdbc.Driver").newInstance(); Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString(); final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
con = DriverManager.getConnection(formattedText, user, password); con = DriverManager.getConnection(formattedText, user, password);

View File

@@ -719,7 +719,7 @@ public class MasterHandler
try try
{ {
final Object handler = c.newInstance(); final Object handler = c.getDeclaredConstructor().newInstance();
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet()) for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
{ {
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler)) if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))

View File

@@ -893,7 +893,7 @@ public class QuestMasterHandler
{ {
try try
{ {
quest.newInstance(); quest.getDeclaredConstructor().newInstance();
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -1 +1 @@
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g -server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g

View File

@@ -49,7 +49,6 @@ public class DailyMissionHandler
{ {
try try
{ {
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler(); ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
} }
catch (Exception e) catch (Exception e)

View File

@@ -311,8 +311,8 @@ public class Gui
JScrollPane scrollPanel = new JScrollPane(txtrConsole); JScrollPane scrollPanel = new JScrollPane(txtrConsole);
scrollPanel.setBounds(0, 0, 800, 550); scrollPanel.setBounds(0, 0, 800, 550);
JLayeredPane layeredPanel = new JLayeredPane(); JLayeredPane layeredPanel = new JLayeredPane();
layeredPanel.add(scrollPanel, new Integer(0), 0); layeredPanel.add(scrollPanel, 0, 0);
layeredPanel.add(systemPanel, new Integer(1), 0); layeredPanel.add(systemPanel, 1, 0);
// Set frame. // Set frame.
JFrame frame = new JFrame("Mobius - GameServer"); JFrame frame = new JFrame("Mobius - GameServer");

View File

@@ -370,7 +370,7 @@ public class SchedulingPattern
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
for (int i = min; i <= max; i++) for (int i = min; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
return values; return values;
} }
@@ -393,7 +393,7 @@ public class SchedulingPattern
if (size == 1) if (size == 1)
{ {
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
values.add(new Integer(v1)); values.add(v1);
return values; return values;
} }
String v2Str = st.nextToken(); String v2Str = st.nextToken();
@@ -411,7 +411,7 @@ public class SchedulingPattern
{ {
for (int i = v1; i <= v2; i++) for (int i = v1; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else if (v1 > v2) else if (v1 > v2)
@@ -420,17 +420,17 @@ public class SchedulingPattern
int max = parser.getMaxValue(); int max = parser.getMaxValue();
for (int i = v1; i <= max; i++) for (int i = v1; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
for (int i = min; i <= v2; i++) for (int i = min; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else else
{ {
// v1 == v2 // v1 == v2
values.add(new Integer(v1)); values.add(v1);
} }
return values; return values;
} }

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherGS extends AbstractDBLauncher public class LauncherGS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/game/"; final String dir = "sql/game/";

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherLS extends AbstractDBLauncher public class LauncherLS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/login/"; final String dir = "sql/login/";

View File

@@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
{ {
Connection _con; Connection _con;
public DBInstallerConsole(String db, String dir) public DBInstallerConsole(String db, String dir) throws Exception
{ {
System.out.println("Welcome to L2J DataBase installer"); System.out.println("Welcome to L2J DataBase installer");
final Preferences prop = Preferences.userRoot(); final Preferences prop = Preferences.userRoot();
@@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
* @param pass the password * @param pass the password
* @param database the database name * @param database the database name
* @param mode the mode, c: Clean, u:update * @param mode the mode, c: Clean, u:update
* @throws Exception
*/ */
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
{ {
if ((database == null) || database.isEmpty()) if ((database == null) || database.isEmpty())
{ {

View File

@@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SpringLayout; import javax.swing.SpringLayout;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import com.l2jmobius.commons.util.SplashScreen; import com.l2jmobius.commons.util.SplashScreen;
import com.l2jmobius.tools.dbinstaller.RunTasks; import com.l2jmobius.tools.dbinstaller.RunTasks;
@@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
final int height = 220; final int height = 220;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);
@@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
final ActionListener connectListener = e -> final ActionListener connectListener = e ->
{ {
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false); MySqlConnect connector = null;
try
{
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
}
catch (Exception ex)
{
ex.printStackTrace();
}
if (connector.getConnection() != null) if ((connector != null) && (connector.getConnection() != null))
{ {
_prop.put("dbHost_" + _db, _dbHost.getText()); _prop.put("dbHost_" + _db, _dbHost.getText());
_prop.put("dbPort_" + _db, _dbPort.getText()); _prop.put("dbPort_" + _db, _dbPort.getText());

View File

@@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.WindowConstants;
import com.l2jmobius.tools.dbinstaller.DBOutputInterface; import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
@@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
final int height = 360; final int height = 360;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);

View File

@@ -31,11 +31,11 @@ public class MySqlConnect
{ {
Connection con = null; Connection con = null;
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
{ {
try (Formatter form = new Formatter()) try (Formatter form = new Formatter())
{ {
Class.forName("com.mysql.jdbc.Driver").newInstance(); Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString(); final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
con = DriverManager.getConnection(formattedText, user, password); con = DriverManager.getConnection(formattedText, user, password);

View File

@@ -719,7 +719,7 @@ public class MasterHandler
try try
{ {
final Object handler = c.newInstance(); final Object handler = c.getDeclaredConstructor().newInstance();
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet()) for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
{ {
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler)) if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))

View File

@@ -887,7 +887,7 @@ public class QuestMasterHandler
{ {
try try
{ {
quest.newInstance(); quest.getDeclaredConstructor().newInstance();
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -1 +1 @@
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g -server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g

View File

@@ -49,7 +49,6 @@ public class DailyMissionHandler
{ {
try try
{ {
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler(); ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
} }
catch (Exception e) catch (Exception e)

View File

@@ -311,8 +311,8 @@ public class Gui
JScrollPane scrollPanel = new JScrollPane(txtrConsole); JScrollPane scrollPanel = new JScrollPane(txtrConsole);
scrollPanel.setBounds(0, 0, 800, 550); scrollPanel.setBounds(0, 0, 800, 550);
JLayeredPane layeredPanel = new JLayeredPane(); JLayeredPane layeredPanel = new JLayeredPane();
layeredPanel.add(scrollPanel, new Integer(0), 0); layeredPanel.add(scrollPanel, 0, 0);
layeredPanel.add(systemPanel, new Integer(1), 0); layeredPanel.add(systemPanel, 1, 0);
// Set frame. // Set frame.
JFrame frame = new JFrame("Mobius - GameServer"); JFrame frame = new JFrame("Mobius - GameServer");

View File

@@ -370,7 +370,7 @@ public class SchedulingPattern
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
for (int i = min; i <= max; i++) for (int i = min; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
return values; return values;
} }
@@ -393,7 +393,7 @@ public class SchedulingPattern
if (size == 1) if (size == 1)
{ {
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
values.add(new Integer(v1)); values.add(v1);
return values; return values;
} }
String v2Str = st.nextToken(); String v2Str = st.nextToken();
@@ -411,7 +411,7 @@ public class SchedulingPattern
{ {
for (int i = v1; i <= v2; i++) for (int i = v1; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else if (v1 > v2) else if (v1 > v2)
@@ -420,17 +420,17 @@ public class SchedulingPattern
int max = parser.getMaxValue(); int max = parser.getMaxValue();
for (int i = v1; i <= max; i++) for (int i = v1; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
for (int i = min; i <= v2; i++) for (int i = min; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else else
{ {
// v1 == v2 // v1 == v2
values.add(new Integer(v1)); values.add(v1);
} }
return values; return values;
} }

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherGS extends AbstractDBLauncher public class LauncherGS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/game/"; final String dir = "sql/game/";

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherLS extends AbstractDBLauncher public class LauncherLS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/login/"; final String dir = "sql/login/";

View File

@@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
{ {
Connection _con; Connection _con;
public DBInstallerConsole(String db, String dir) public DBInstallerConsole(String db, String dir) throws Exception
{ {
System.out.println("Welcome to L2J DataBase installer"); System.out.println("Welcome to L2J DataBase installer");
final Preferences prop = Preferences.userRoot(); final Preferences prop = Preferences.userRoot();
@@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
* @param pass the password * @param pass the password
* @param database the database name * @param database the database name
* @param mode the mode, c: Clean, u:update * @param mode the mode, c: Clean, u:update
* @throws Exception
*/ */
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
{ {
if ((database == null) || database.isEmpty()) if ((database == null) || database.isEmpty())
{ {

View File

@@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SpringLayout; import javax.swing.SpringLayout;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import com.l2jmobius.commons.util.SplashScreen; import com.l2jmobius.commons.util.SplashScreen;
import com.l2jmobius.tools.dbinstaller.RunTasks; import com.l2jmobius.tools.dbinstaller.RunTasks;
@@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
final int height = 220; final int height = 220;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);
@@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
final ActionListener connectListener = e -> final ActionListener connectListener = e ->
{ {
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false); MySqlConnect connector = null;
try
{
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
}
catch (Exception ex)
{
ex.printStackTrace();
}
if (connector.getConnection() != null) if ((connector != null) && (connector.getConnection() != null))
{ {
_prop.put("dbHost_" + _db, _dbHost.getText()); _prop.put("dbHost_" + _db, _dbHost.getText());
_prop.put("dbPort_" + _db, _dbPort.getText()); _prop.put("dbPort_" + _db, _dbPort.getText());

View File

@@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.WindowConstants;
import com.l2jmobius.tools.dbinstaller.DBOutputInterface; import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
@@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
final int height = 360; final int height = 360;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);

View File

@@ -31,11 +31,11 @@ public class MySqlConnect
{ {
Connection con = null; Connection con = null;
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
{ {
try (Formatter form = new Formatter()) try (Formatter form = new Formatter())
{ {
Class.forName("com.mysql.jdbc.Driver").newInstance(); Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString(); final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
con = DriverManager.getConnection(formattedText, user, password); con = DriverManager.getConnection(formattedText, user, password);

View File

@@ -15,6 +15,14 @@ org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonN
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
@@ -114,6 +122,8 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0

View File

@@ -641,7 +641,7 @@ public class MasterHandler
try try
{ {
final Object handler = c.newInstance(); final Object handler = c.getDeclaredConstructor().newInstance();
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet()) for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
{ {
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler)) if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))

View File

@@ -1049,7 +1049,7 @@ public class QuestMasterHandler
{ {
try try
{ {
quest.newInstance(); quest.getDeclaredConstructor().newInstance();
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -1 +1 @@
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g -server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g

View File

@@ -311,8 +311,8 @@ public class Gui
JScrollPane scrollPanel = new JScrollPane(txtrConsole); JScrollPane scrollPanel = new JScrollPane(txtrConsole);
scrollPanel.setBounds(0, 0, 800, 550); scrollPanel.setBounds(0, 0, 800, 550);
JLayeredPane layeredPanel = new JLayeredPane(); JLayeredPane layeredPanel = new JLayeredPane();
layeredPanel.add(scrollPanel, new Integer(0), 0); layeredPanel.add(scrollPanel, 0, 0);
layeredPanel.add(systemPanel, new Integer(1), 0); layeredPanel.add(systemPanel, 1, 0);
// Set frame. // Set frame.
JFrame frame = new JFrame("Mobius - GameServer"); JFrame frame = new JFrame("Mobius - GameServer");

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherGS extends AbstractDBLauncher public class LauncherGS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobiush5"; final String defDatabase = "l2jmobiush5";
final String dir = "sql/game/"; final String dir = "sql/game/";

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherLS extends AbstractDBLauncher public class LauncherLS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobiush5"; final String defDatabase = "l2jmobiush5";
final String dir = "sql/login/"; final String dir = "sql/login/";

View File

@@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
{ {
Connection _con; Connection _con;
public DBInstallerConsole(String db, String dir) public DBInstallerConsole(String db, String dir) throws Exception
{ {
System.out.println("Welcome to L2J DataBase installer"); System.out.println("Welcome to L2J DataBase installer");
final Preferences prop = Preferences.userRoot(); final Preferences prop = Preferences.userRoot();
@@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
* @param pass the password * @param pass the password
* @param database the database name * @param database the database name
* @param mode the mode, c: Clean, u:update * @param mode the mode, c: Clean, u:update
* @throws Exception
*/ */
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
{ {
if ((database == null) || database.isEmpty()) if ((database == null) || database.isEmpty())
{ {

View File

@@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SpringLayout; import javax.swing.SpringLayout;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import com.l2jmobius.commons.util.SplashScreen; import com.l2jmobius.commons.util.SplashScreen;
import com.l2jmobius.tools.dbinstaller.RunTasks; import com.l2jmobius.tools.dbinstaller.RunTasks;
@@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
final int height = 220; final int height = 220;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);
@@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
final ActionListener connectListener = e -> final ActionListener connectListener = e ->
{ {
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false); MySqlConnect connector = null;
try
{
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
}
catch (Exception ex)
{
ex.printStackTrace();
}
if (connector.getConnection() != null) if ((connector != null) && (connector.getConnection() != null))
{ {
_prop.put("dbHost_" + _db, _dbHost.getText()); _prop.put("dbHost_" + _db, _dbHost.getText());
_prop.put("dbPort_" + _db, _dbPort.getText()); _prop.put("dbPort_" + _db, _dbPort.getText());

View File

@@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.WindowConstants;
import com.l2jmobius.tools.dbinstaller.DBOutputInterface; import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
@@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
final int height = 360; final int height = 360;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);

View File

@@ -31,11 +31,11 @@ public class MySqlConnect
{ {
Connection con = null; Connection con = null;
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
{ {
try (Formatter form = new Formatter()) try (Formatter form = new Formatter())
{ {
Class.forName("com.mysql.jdbc.Driver").newInstance(); Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString(); final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
con = DriverManager.getConnection(formattedText, user, password); con = DriverManager.getConnection(formattedText, user, password);

View File

@@ -719,7 +719,7 @@ public class MasterHandler
try try
{ {
final Object handler = c.newInstance(); final Object handler = c.getDeclaredConstructor().newInstance();
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet()) for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
{ {
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler)) if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))

View File

@@ -363,7 +363,7 @@ public class QuestMasterHandler
{ {
try try
{ {
quest.newInstance(); quest.getDeclaredConstructor().newInstance();
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -1 +1 @@
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g -server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g

View File

@@ -49,7 +49,6 @@ public class DailyMissionHandler
{ {
try try
{ {
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler(); ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
} }
catch (Exception e) catch (Exception e)

View File

@@ -299,8 +299,8 @@ public class Gui
JScrollPane scrollPanel = new JScrollPane(txtrConsole); JScrollPane scrollPanel = new JScrollPane(txtrConsole);
scrollPanel.setBounds(0, 0, 800, 550); scrollPanel.setBounds(0, 0, 800, 550);
JLayeredPane layeredPanel = new JLayeredPane(); JLayeredPane layeredPanel = new JLayeredPane();
layeredPanel.add(scrollPanel, new Integer(0), 0); layeredPanel.add(scrollPanel, 0, 0);
layeredPanel.add(systemPanel, new Integer(1), 0); layeredPanel.add(systemPanel, 1, 0);
// Set frame. // Set frame.
JFrame frame = new JFrame("Mobius - GameServer"); JFrame frame = new JFrame("Mobius - GameServer");

View File

@@ -370,7 +370,7 @@ public class SchedulingPattern
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
for (int i = min; i <= max; i++) for (int i = min; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
return values; return values;
} }
@@ -393,7 +393,7 @@ public class SchedulingPattern
if (size == 1) if (size == 1)
{ {
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
values.add(new Integer(v1)); values.add(v1);
return values; return values;
} }
String v2Str = st.nextToken(); String v2Str = st.nextToken();
@@ -411,7 +411,7 @@ public class SchedulingPattern
{ {
for (int i = v1; i <= v2; i++) for (int i = v1; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else if (v1 > v2) else if (v1 > v2)
@@ -420,17 +420,17 @@ public class SchedulingPattern
int max = parser.getMaxValue(); int max = parser.getMaxValue();
for (int i = v1; i <= max; i++) for (int i = v1; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
for (int i = min; i <= v2; i++) for (int i = min; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else else
{ {
// v1 == v2 // v1 == v2
values.add(new Integer(v1)); values.add(v1);
} }
return values; return values;
} }

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherGS extends AbstractDBLauncher public class LauncherGS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/game/"; final String dir = "sql/game/";

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherLS extends AbstractDBLauncher public class LauncherLS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/login/"; final String dir = "sql/login/";

View File

@@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
{ {
Connection _con; Connection _con;
public DBInstallerConsole(String db, String dir) public DBInstallerConsole(String db, String dir) throws Exception
{ {
System.out.println("Welcome to L2J DataBase installer"); System.out.println("Welcome to L2J DataBase installer");
final Preferences prop = Preferences.userRoot(); final Preferences prop = Preferences.userRoot();
@@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
* @param pass the password * @param pass the password
* @param database the database name * @param database the database name
* @param mode the mode, c: Clean, u:update * @param mode the mode, c: Clean, u:update
* @throws Exception
*/ */
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
{ {
if ((database == null) || database.isEmpty()) if ((database == null) || database.isEmpty())
{ {

View File

@@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SpringLayout; import javax.swing.SpringLayout;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import com.l2jmobius.commons.util.SplashScreen; import com.l2jmobius.commons.util.SplashScreen;
import com.l2jmobius.tools.dbinstaller.RunTasks; import com.l2jmobius.tools.dbinstaller.RunTasks;
@@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
final int height = 220; final int height = 220;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);
@@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
final ActionListener connectListener = e -> final ActionListener connectListener = e ->
{ {
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false); MySqlConnect connector = null;
try
{
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
}
catch (Exception ex)
{
ex.printStackTrace();
}
if (connector.getConnection() != null) if ((connector != null) && (connector.getConnection() != null))
{ {
_prop.put("dbHost_" + _db, _dbHost.getText()); _prop.put("dbHost_" + _db, _dbHost.getText());
_prop.put("dbPort_" + _db, _dbPort.getText()); _prop.put("dbPort_" + _db, _dbPort.getText());

View File

@@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.WindowConstants;
import com.l2jmobius.tools.dbinstaller.DBOutputInterface; import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
@@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
final int height = 360; final int height = 360;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);

View File

@@ -31,11 +31,11 @@ public class MySqlConnect
{ {
Connection con = null; Connection con = null;
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
{ {
try (Formatter form = new Formatter()) try (Formatter form = new Formatter())
{ {
Class.forName("com.mysql.jdbc.Driver").newInstance(); Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString(); final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
con = DriverManager.getConnection(formattedText, user, password); con = DriverManager.getConnection(formattedText, user, password);

View File

@@ -719,7 +719,7 @@ public class MasterHandler
try try
{ {
final Object handler = c.newInstance(); final Object handler = c.getDeclaredConstructor().newInstance();
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet()) for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
{ {
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler)) if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))

View File

@@ -357,7 +357,7 @@ public class QuestMasterHandler
{ {
try try
{ {
quest.newInstance(); quest.getDeclaredConstructor().newInstance();
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -1 +1 @@
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g -server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g

View File

@@ -49,7 +49,6 @@ public class DailyMissionHandler
{ {
try try
{ {
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler(); ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
} }
catch (Exception e) catch (Exception e)

View File

@@ -299,8 +299,8 @@ public class Gui
JScrollPane scrollPanel = new JScrollPane(txtrConsole); JScrollPane scrollPanel = new JScrollPane(txtrConsole);
scrollPanel.setBounds(0, 0, 800, 550); scrollPanel.setBounds(0, 0, 800, 550);
JLayeredPane layeredPanel = new JLayeredPane(); JLayeredPane layeredPanel = new JLayeredPane();
layeredPanel.add(scrollPanel, new Integer(0), 0); layeredPanel.add(scrollPanel, 0, 0);
layeredPanel.add(systemPanel, new Integer(1), 0); layeredPanel.add(systemPanel, 1, 0);
// Set frame. // Set frame.
JFrame frame = new JFrame("Mobius - GameServer"); JFrame frame = new JFrame("Mobius - GameServer");

View File

@@ -370,7 +370,7 @@ public class SchedulingPattern
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
for (int i = min; i <= max; i++) for (int i = min; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
return values; return values;
} }
@@ -393,7 +393,7 @@ public class SchedulingPattern
if (size == 1) if (size == 1)
{ {
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
values.add(new Integer(v1)); values.add(v1);
return values; return values;
} }
String v2Str = st.nextToken(); String v2Str = st.nextToken();
@@ -411,7 +411,7 @@ public class SchedulingPattern
{ {
for (int i = v1; i <= v2; i++) for (int i = v1; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else if (v1 > v2) else if (v1 > v2)
@@ -420,17 +420,17 @@ public class SchedulingPattern
int max = parser.getMaxValue(); int max = parser.getMaxValue();
for (int i = v1; i <= max; i++) for (int i = v1; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
for (int i = min; i <= v2; i++) for (int i = min; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else else
{ {
// v1 == v2 // v1 == v2
values.add(new Integer(v1)); values.add(v1);
} }
return values; return values;
} }

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherGS extends AbstractDBLauncher public class LauncherGS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/game/"; final String dir = "sql/game/";

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherLS extends AbstractDBLauncher public class LauncherLS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/login/"; final String dir = "sql/login/";

View File

@@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
{ {
Connection _con; Connection _con;
public DBInstallerConsole(String db, String dir) public DBInstallerConsole(String db, String dir) throws Exception
{ {
System.out.println("Welcome to L2J DataBase installer"); System.out.println("Welcome to L2J DataBase installer");
final Preferences prop = Preferences.userRoot(); final Preferences prop = Preferences.userRoot();
@@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
* @param pass the password * @param pass the password
* @param database the database name * @param database the database name
* @param mode the mode, c: Clean, u:update * @param mode the mode, c: Clean, u:update
* @throws Exception
*/ */
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
{ {
if ((database == null) || database.isEmpty()) if ((database == null) || database.isEmpty())
{ {

View File

@@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SpringLayout; import javax.swing.SpringLayout;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import com.l2jmobius.commons.util.SplashScreen; import com.l2jmobius.commons.util.SplashScreen;
import com.l2jmobius.tools.dbinstaller.RunTasks; import com.l2jmobius.tools.dbinstaller.RunTasks;
@@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
final int height = 220; final int height = 220;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);
@@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
final ActionListener connectListener = e -> final ActionListener connectListener = e ->
{ {
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false); MySqlConnect connector = null;
try
{
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
}
catch (Exception ex)
{
ex.printStackTrace();
}
if (connector.getConnection() != null) if ((connector != null) && (connector.getConnection() != null))
{ {
_prop.put("dbHost_" + _db, _dbHost.getText()); _prop.put("dbHost_" + _db, _dbHost.getText());
_prop.put("dbPort_" + _db, _dbPort.getText()); _prop.put("dbPort_" + _db, _dbPort.getText());

View File

@@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.WindowConstants;
import com.l2jmobius.tools.dbinstaller.DBOutputInterface; import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
@@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
final int height = 360; final int height = 360;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);

View File

@@ -31,11 +31,11 @@ public class MySqlConnect
{ {
Connection con = null; Connection con = null;
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
{ {
try (Formatter form = new Formatter()) try (Formatter form = new Formatter())
{ {
Class.forName("com.mysql.jdbc.Driver").newInstance(); Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString(); final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
con = DriverManager.getConnection(formattedText, user, password); con = DriverManager.getConnection(formattedText, user, password);

View File

@@ -719,7 +719,7 @@ public class MasterHandler
try try
{ {
final Object handler = c.newInstance(); final Object handler = c.getDeclaredConstructor().newInstance();
for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet()) for (Entry<IHandler<?, ?>, Method> entry : registerHandlerMethods.entrySet())
{ {
if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler)) if ((entry.getValue() != null) && entry.getValue().getParameterTypes()[0].isInstance(handler))

View File

@@ -357,7 +357,7 @@ public class QuestMasterHandler
{ {
try try
{ {
quest.newInstance(); quest.getDeclaredConstructor().newInstance();
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -1 +1 @@
-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g -server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g

View File

@@ -49,7 +49,6 @@ public class DailyMissionHandler
{ {
try try
{ {
ScriptEngineManager.getInstance().executeDailyMissionMasterHandler(); ScriptEngineManager.getInstance().executeDailyMissionMasterHandler();
} }
catch (Exception e) catch (Exception e)

View File

@@ -299,8 +299,8 @@ public class Gui
JScrollPane scrollPanel = new JScrollPane(txtrConsole); JScrollPane scrollPanel = new JScrollPane(txtrConsole);
scrollPanel.setBounds(0, 0, 800, 550); scrollPanel.setBounds(0, 0, 800, 550);
JLayeredPane layeredPanel = new JLayeredPane(); JLayeredPane layeredPanel = new JLayeredPane();
layeredPanel.add(scrollPanel, new Integer(0), 0); layeredPanel.add(scrollPanel, 0, 0);
layeredPanel.add(systemPanel, new Integer(1), 0); layeredPanel.add(systemPanel, 1, 0);
// Set frame. // Set frame.
JFrame frame = new JFrame("Mobius - GameServer"); JFrame frame = new JFrame("Mobius - GameServer");

View File

@@ -370,7 +370,7 @@ public class SchedulingPattern
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
for (int i = min; i <= max; i++) for (int i = min; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
return values; return values;
} }
@@ -393,7 +393,7 @@ public class SchedulingPattern
if (size == 1) if (size == 1)
{ {
ArrayList<Integer> values = new ArrayList<>(); ArrayList<Integer> values = new ArrayList<>();
values.add(new Integer(v1)); values.add(v1);
return values; return values;
} }
String v2Str = st.nextToken(); String v2Str = st.nextToken();
@@ -411,7 +411,7 @@ public class SchedulingPattern
{ {
for (int i = v1; i <= v2; i++) for (int i = v1; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else if (v1 > v2) else if (v1 > v2)
@@ -420,17 +420,17 @@ public class SchedulingPattern
int max = parser.getMaxValue(); int max = parser.getMaxValue();
for (int i = v1; i <= max; i++) for (int i = v1; i <= max; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
for (int i = min; i <= v2; i++) for (int i = min; i <= v2; i++)
{ {
values.add(new Integer(i)); values.add(i);
} }
} }
else else
{ {
// v1 == v2 // v1 == v2
values.add(new Integer(v1)); values.add(v1);
} }
return values; return values;
} }

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherGS extends AbstractDBLauncher public class LauncherGS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/game/"; final String dir = "sql/game/";

View File

@@ -29,7 +29,7 @@ import com.l2jmobius.tools.dbinstaller.gui.DBConfigGUI;
*/ */
public class LauncherLS extends AbstractDBLauncher public class LauncherLS extends AbstractDBLauncher
{ {
public static void main(String[] args) public static void main(String[] args) throws Exception
{ {
final String defDatabase = "l2jmobius"; final String defDatabase = "l2jmobius";
final String dir = "sql/login/"; final String dir = "sql/login/";

View File

@@ -32,7 +32,7 @@ public class DBInstallerConsole implements DBOutputInterface
{ {
Connection _con; Connection _con;
public DBInstallerConsole(String db, String dir) public DBInstallerConsole(String db, String dir) throws Exception
{ {
System.out.println("Welcome to L2J DataBase installer"); System.out.println("Welcome to L2J DataBase installer");
final Preferences prop = Preferences.userRoot(); final Preferences prop = Preferences.userRoot();
@@ -98,8 +98,9 @@ public class DBInstallerConsole implements DBOutputInterface
* @param pass the password * @param pass the password
* @param database the database name * @param database the database name
* @param mode the mode, c: Clean, u:update * @param mode the mode, c: Clean, u:update
* @throws Exception
*/ */
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
{ {
if ((database == null) || database.isEmpty()) if ((database == null) || database.isEmpty())
{ {

View File

@@ -33,6 +33,7 @@ import javax.swing.JPasswordField;
import javax.swing.JTextField; import javax.swing.JTextField;
import javax.swing.SpringLayout; import javax.swing.SpringLayout;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import com.l2jmobius.commons.util.SplashScreen; import com.l2jmobius.commons.util.SplashScreen;
import com.l2jmobius.tools.dbinstaller.RunTasks; import com.l2jmobius.tools.dbinstaller.RunTasks;
@@ -82,7 +83,7 @@ public class DBConfigGUI extends JFrame
final int height = 220; final int height = 220;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);
@@ -137,9 +138,17 @@ public class DBConfigGUI extends JFrame
final ActionListener connectListener = e -> final ActionListener connectListener = e ->
{ {
final MySqlConnect connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false); MySqlConnect connector = null;
try
{
connector = new MySqlConnect(_dbHost.getText(), _dbPort.getText(), _dbUser.getText(), new String(_dbPass.getPassword()), _dbDbse.getText(), false);
}
catch (Exception ex)
{
ex.printStackTrace();
}
if (connector.getConnection() != null) if ((connector != null) && (connector.getConnection() != null))
{ {
_prop.put("dbHost_" + _db, _dbHost.getText()); _prop.put("dbHost_" + _db, _dbHost.getText());
_prop.put("dbPort_" + _db, _dbPort.getText()); _prop.put("dbPort_" + _db, _dbPort.getText());

View File

@@ -30,6 +30,7 @@ import javax.swing.JOptionPane;
import javax.swing.JProgressBar; import javax.swing.JProgressBar;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.WindowConstants;
import com.l2jmobius.tools.dbinstaller.DBOutputInterface; import com.l2jmobius.tools.dbinstaller.DBOutputInterface;
@@ -62,7 +63,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
final int height = 360; final int height = 360;
final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize(); final Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height); setBounds((resolution.width - width) / 2, (resolution.height - height) / 2, width, height);
setResizable(false); setResizable(false);

View File

@@ -31,11 +31,11 @@ public class MySqlConnect
{ {
Connection con = null; Connection con = null;
public MySqlConnect(String host, String port, String user, String password, String db, boolean console) public MySqlConnect(String host, String port, String user, String password, String db, boolean console) throws Exception
{ {
try (Formatter form = new Formatter()) try (Formatter form = new Formatter())
{ {
Class.forName("com.mysql.jdbc.Driver").newInstance(); Class.forName("com.mysql.jdbc.Driver").getDeclaredConstructor().newInstance();
final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString(); final String formattedText = form.format("jdbc:mysql://%1$s:%2$s", host, port).toString();
con = DriverManager.getConnection(formattedText, user, password); con = DriverManager.getConnection(formattedText, user, password);