Configuration for dark themed GUI.
This commit is contained in:
parent
04042485eb
commit
8de4d585c3
@ -142,6 +142,23 @@ UrgentPacketThreadCoreSize = 40
|
||||
ThreadsForLoading = False
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Dead Lock Detector (separate thread for detecting deadlocks)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -54,6 +54,23 @@ Password =
|
||||
MaximumDbConnections = 5
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Automatic Database Backup Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -96,11 +96,11 @@ public class Config
|
||||
private static final String GENERAL_CONFIG_FILE = "./config/General.ini";
|
||||
private static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
|
||||
private static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
|
||||
private static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
public static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
private static final String NPC_CONFIG_FILE = "./config/NPC.ini";
|
||||
private static final String PVP_CONFIG_FILE = "./config/PVP.ini";
|
||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
public static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||
@ -444,6 +444,8 @@ public class Config
|
||||
public static int INSTANT_THREAD_POOL_COUNT;
|
||||
public static int IO_PACKET_THREAD_CORE_SIZE;
|
||||
public static boolean THREADS_FOR_LOADING;
|
||||
public static boolean ENABLE_GUI;
|
||||
public static boolean DARK_THEME;
|
||||
public static boolean DEADLOCK_DETECTOR;
|
||||
public static int DEADLOCK_CHECK_INTERVAL;
|
||||
public static boolean RESTART_ON_DEADLOCK;
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class DarkTheme
|
||||
{
|
||||
public static void activate()
|
||||
{
|
||||
// Modify existing white Nimbus look and feel to dark.
|
||||
UIManager.put("control", new Color(128, 128, 128));
|
||||
UIManager.put("info", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusBase", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusAlertYellow", new Color(248, 187, 0));
|
||||
UIManager.put("nimbusDisabledText", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusFocus", Color.DARK_GRAY); // new Color(115, 164, 209)
|
||||
UIManager.put("nimbusGreen", new Color(176, 179, 50));
|
||||
UIManager.put("nimbusInfoBlue", Color.DARK_GRAY); // new Color(66, 139, 221)
|
||||
UIManager.put("nimbusLightBackground", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusOrange", new Color(191, 98, 4));
|
||||
UIManager.put("nimbusRed", new Color(169, 46, 34));
|
||||
UIManager.put("nimbusSelectedText", new Color(255, 255, 255));
|
||||
UIManager.put("nimbusSelectionBackground", new Color(104, 93, 156));
|
||||
UIManager.put("text", new Color(230, 230, 230));
|
||||
|
||||
// Set look and feel.
|
||||
try
|
||||
{
|
||||
UIManager.setLookAndFeel(new NimbusLookAndFeel());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* 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 org.l2jmobius.commons.util;
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
@ -14,7 +14,7 @@
|
||||
* 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 org.l2jmobius.commons.util;
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
@ -34,6 +34,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.DeadLockDetector;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.BotReportTable;
|
||||
import org.l2jmobius.gameserver.data.EventDroplist;
|
||||
@ -181,8 +182,11 @@ public class GameServer
|
||||
final long serverLoadStart = Chronos.currentTimeMillis();
|
||||
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.SERVER_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("GameServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -45,8 +45,9 @@ import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.gameserver.Shutdown;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
@ -86,6 +87,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -335,7 +341,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(layeredPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -47,7 +47,11 @@ public class SystemPanel extends JPanel
|
||||
|
||||
public SystemPanel()
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
if (!Config.DARK_THEME)
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
}
|
||||
|
||||
setBounds(500, 20, 284, 140);
|
||||
setBorder(new LineBorder(new Color(0, 0, 0), 1, false));
|
||||
setOpaque(true);
|
||||
|
@ -33,6 +33,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseBackup;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.network.loginserverpackets.game.ServerStatus;
|
||||
import org.l2jmobius.loginserver.network.ClientNetworkManager;
|
||||
import org.l2jmobius.loginserver.ui.Gui;
|
||||
@ -63,8 +64,11 @@ public class LoginServer
|
||||
private LoginServer() throws Exception
|
||||
{
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.LOGIN_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("LoginServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -43,8 +43,10 @@ import javax.swing.JTextArea;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.loginserver.GameServerTable;
|
||||
import org.l2jmobius.loginserver.GameServerTable.GameServerInfo;
|
||||
import org.l2jmobius.loginserver.LoginController;
|
||||
@ -75,6 +77,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -243,7 +250,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(scrollPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -36,7 +36,7 @@ import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
import org.l2jmobius.tools.dbinstaller.util.mysql.MySqlConnect;
|
||||
import org.l2jmobius.tools.dbinstaller.util.swing.SpringUtilities;
|
||||
|
@ -142,6 +142,23 @@ UrgentPacketThreadCoreSize = 40
|
||||
ThreadsForLoading = False
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Dead Lock Detector (separate thread for detecting deadlocks)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -54,6 +54,23 @@ Password =
|
||||
MaximumDbConnections = 5
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Automatic Database Backup Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -97,11 +97,11 @@ public class Config
|
||||
private static final String GENERAL_CONFIG_FILE = "./config/General.ini";
|
||||
private static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
|
||||
private static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
|
||||
private static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
public static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
private static final String NPC_CONFIG_FILE = "./config/NPC.ini";
|
||||
private static final String PVP_CONFIG_FILE = "./config/PVP.ini";
|
||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
public static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||
@ -451,6 +451,8 @@ public class Config
|
||||
public static int INSTANT_THREAD_POOL_COUNT;
|
||||
public static int IO_PACKET_THREAD_CORE_SIZE;
|
||||
public static boolean THREADS_FOR_LOADING;
|
||||
public static boolean ENABLE_GUI;
|
||||
public static boolean DARK_THEME;
|
||||
public static boolean DEADLOCK_DETECTOR;
|
||||
public static int DEADLOCK_CHECK_INTERVAL;
|
||||
public static boolean RESTART_ON_DEADLOCK;
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class DarkTheme
|
||||
{
|
||||
public static void activate()
|
||||
{
|
||||
// Modify existing white Nimbus look and feel to dark.
|
||||
UIManager.put("control", new Color(128, 128, 128));
|
||||
UIManager.put("info", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusBase", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusAlertYellow", new Color(248, 187, 0));
|
||||
UIManager.put("nimbusDisabledText", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusFocus", Color.DARK_GRAY); // new Color(115, 164, 209)
|
||||
UIManager.put("nimbusGreen", new Color(176, 179, 50));
|
||||
UIManager.put("nimbusInfoBlue", Color.DARK_GRAY); // new Color(66, 139, 221)
|
||||
UIManager.put("nimbusLightBackground", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusOrange", new Color(191, 98, 4));
|
||||
UIManager.put("nimbusRed", new Color(169, 46, 34));
|
||||
UIManager.put("nimbusSelectedText", new Color(255, 255, 255));
|
||||
UIManager.put("nimbusSelectionBackground", new Color(104, 93, 156));
|
||||
UIManager.put("text", new Color(230, 230, 230));
|
||||
|
||||
// Set look and feel.
|
||||
try
|
||||
{
|
||||
UIManager.setLookAndFeel(new NimbusLookAndFeel());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* 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 org.l2jmobius.commons.util;
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
@ -14,7 +14,7 @@
|
||||
* 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 org.l2jmobius.commons.util;
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
@ -34,6 +34,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.DeadLockDetector;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.BotReportTable;
|
||||
import org.l2jmobius.gameserver.data.EventDroplist;
|
||||
@ -185,8 +186,11 @@ public class GameServer
|
||||
final long serverLoadStart = Chronos.currentTimeMillis();
|
||||
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.SERVER_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("GameServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -45,8 +45,9 @@ import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.gameserver.Shutdown;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
@ -86,6 +87,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -335,7 +341,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(layeredPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -47,7 +47,11 @@ public class SystemPanel extends JPanel
|
||||
|
||||
public SystemPanel()
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
if (!Config.DARK_THEME)
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
}
|
||||
|
||||
setBounds(500, 20, 284, 140);
|
||||
setBorder(new LineBorder(new Color(0, 0, 0), 1, false));
|
||||
setOpaque(true);
|
||||
|
@ -33,6 +33,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseBackup;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.network.loginserverpackets.game.ServerStatus;
|
||||
import org.l2jmobius.loginserver.network.ClientNetworkManager;
|
||||
import org.l2jmobius.loginserver.ui.Gui;
|
||||
@ -63,8 +64,11 @@ public class LoginServer
|
||||
private LoginServer() throws Exception
|
||||
{
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.LOGIN_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("LoginServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -43,8 +43,10 @@ import javax.swing.JTextArea;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.loginserver.GameServerTable;
|
||||
import org.l2jmobius.loginserver.GameServerTable.GameServerInfo;
|
||||
import org.l2jmobius.loginserver.LoginController;
|
||||
@ -75,6 +77,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -243,7 +250,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(scrollPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -36,7 +36,7 @@ import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
import org.l2jmobius.tools.dbinstaller.util.mysql.MySqlConnect;
|
||||
import org.l2jmobius.tools.dbinstaller.util.swing.SpringUtilities;
|
||||
|
@ -142,6 +142,23 @@ UrgentPacketThreadCoreSize = 40
|
||||
ThreadsForLoading = False
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Dead Lock Detector (separate thread for detecting deadlocks)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -54,6 +54,23 @@ Password =
|
||||
MaximumDbConnections = 5
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Automatic Database Backup Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -97,11 +97,11 @@ public class Config
|
||||
private static final String GENERAL_CONFIG_FILE = "./config/General.ini";
|
||||
private static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
|
||||
private static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
|
||||
private static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
public static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
private static final String NPC_CONFIG_FILE = "./config/NPC.ini";
|
||||
private static final String PVP_CONFIG_FILE = "./config/PVP.ini";
|
||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
public static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||
@ -451,6 +451,8 @@ public class Config
|
||||
public static int INSTANT_THREAD_POOL_COUNT;
|
||||
public static int IO_PACKET_THREAD_CORE_SIZE;
|
||||
public static boolean THREADS_FOR_LOADING;
|
||||
public static boolean ENABLE_GUI;
|
||||
public static boolean DARK_THEME;
|
||||
public static boolean DEADLOCK_DETECTOR;
|
||||
public static int DEADLOCK_CHECK_INTERVAL;
|
||||
public static boolean RESTART_ON_DEADLOCK;
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class DarkTheme
|
||||
{
|
||||
public static void activate()
|
||||
{
|
||||
// Modify existing white Nimbus look and feel to dark.
|
||||
UIManager.put("control", new Color(128, 128, 128));
|
||||
UIManager.put("info", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusBase", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusAlertYellow", new Color(248, 187, 0));
|
||||
UIManager.put("nimbusDisabledText", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusFocus", Color.DARK_GRAY); // new Color(115, 164, 209)
|
||||
UIManager.put("nimbusGreen", new Color(176, 179, 50));
|
||||
UIManager.put("nimbusInfoBlue", Color.DARK_GRAY); // new Color(66, 139, 221)
|
||||
UIManager.put("nimbusLightBackground", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusOrange", new Color(191, 98, 4));
|
||||
UIManager.put("nimbusRed", new Color(169, 46, 34));
|
||||
UIManager.put("nimbusSelectedText", new Color(255, 255, 255));
|
||||
UIManager.put("nimbusSelectionBackground", new Color(104, 93, 156));
|
||||
UIManager.put("text", new Color(230, 230, 230));
|
||||
|
||||
// Set look and feel.
|
||||
try
|
||||
{
|
||||
UIManager.setLookAndFeel(new NimbusLookAndFeel());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* 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 org.l2jmobius.commons.util;
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
@ -14,7 +14,7 @@
|
||||
* 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 org.l2jmobius.commons.util;
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
@ -34,6 +34,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.DeadLockDetector;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.BotReportTable;
|
||||
import org.l2jmobius.gameserver.data.EventDroplist;
|
||||
@ -185,8 +186,11 @@ public class GameServer
|
||||
final long serverLoadStart = Chronos.currentTimeMillis();
|
||||
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.SERVER_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("GameServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -45,8 +45,9 @@ import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.gameserver.Shutdown;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
@ -86,6 +87,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -335,7 +341,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(layeredPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -47,7 +47,11 @@ public class SystemPanel extends JPanel
|
||||
|
||||
public SystemPanel()
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
if (!Config.DARK_THEME)
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
}
|
||||
|
||||
setBounds(500, 20, 284, 140);
|
||||
setBorder(new LineBorder(new Color(0, 0, 0), 1, false));
|
||||
setOpaque(true);
|
||||
|
@ -33,6 +33,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseBackup;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.network.loginserverpackets.game.ServerStatus;
|
||||
import org.l2jmobius.loginserver.network.ClientNetworkManager;
|
||||
import org.l2jmobius.loginserver.ui.Gui;
|
||||
@ -63,8 +64,11 @@ public class LoginServer
|
||||
private LoginServer() throws Exception
|
||||
{
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.LOGIN_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("LoginServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -43,8 +43,10 @@ import javax.swing.JTextArea;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.loginserver.GameServerTable;
|
||||
import org.l2jmobius.loginserver.GameServerTable.GameServerInfo;
|
||||
import org.l2jmobius.loginserver.LoginController;
|
||||
@ -75,6 +77,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -243,7 +250,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(scrollPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -36,7 +36,7 @@ import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
import org.l2jmobius.tools.dbinstaller.util.mysql.MySqlConnect;
|
||||
import org.l2jmobius.tools.dbinstaller.util.swing.SpringUtilities;
|
||||
|
@ -142,6 +142,23 @@ UrgentPacketThreadCoreSize = 40
|
||||
ThreadsForLoading = False
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Dead Lock Detector (separate thread for detecting deadlocks)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -54,6 +54,23 @@ Password =
|
||||
MaximumDbConnections = 5
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Automatic Database Backup Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -97,11 +97,11 @@ public class Config
|
||||
private static final String GENERAL_CONFIG_FILE = "./config/General.ini";
|
||||
private static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
|
||||
private static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
|
||||
private static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
public static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
private static final String NPC_CONFIG_FILE = "./config/NPC.ini";
|
||||
private static final String PVP_CONFIG_FILE = "./config/PVP.ini";
|
||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
public static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||
@ -445,6 +445,8 @@ public class Config
|
||||
public static int INSTANT_THREAD_POOL_COUNT;
|
||||
public static int IO_PACKET_THREAD_CORE_SIZE;
|
||||
public static boolean THREADS_FOR_LOADING;
|
||||
public static boolean ENABLE_GUI;
|
||||
public static boolean DARK_THEME;
|
||||
public static boolean DEADLOCK_DETECTOR;
|
||||
public static int DEADLOCK_CHECK_INTERVAL;
|
||||
public static boolean RESTART_ON_DEADLOCK;
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class DarkTheme
|
||||
{
|
||||
public static void activate()
|
||||
{
|
||||
// Modify existing white Nimbus look and feel to dark.
|
||||
UIManager.put("control", new Color(128, 128, 128));
|
||||
UIManager.put("info", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusBase", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusAlertYellow", new Color(248, 187, 0));
|
||||
UIManager.put("nimbusDisabledText", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusFocus", Color.DARK_GRAY); // new Color(115, 164, 209)
|
||||
UIManager.put("nimbusGreen", new Color(176, 179, 50));
|
||||
UIManager.put("nimbusInfoBlue", Color.DARK_GRAY); // new Color(66, 139, 221)
|
||||
UIManager.put("nimbusLightBackground", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusOrange", new Color(191, 98, 4));
|
||||
UIManager.put("nimbusRed", new Color(169, 46, 34));
|
||||
UIManager.put("nimbusSelectedText", new Color(255, 255, 255));
|
||||
UIManager.put("nimbusSelectionBackground", new Color(104, 93, 156));
|
||||
UIManager.put("text", new Color(230, 230, 230));
|
||||
|
||||
// Set look and feel.
|
||||
try
|
||||
{
|
||||
UIManager.setLookAndFeel(new NimbusLookAndFeel());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* 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 org.l2jmobius.commons.util;
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
@ -14,7 +14,7 @@
|
||||
* 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 org.l2jmobius.commons.util;
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
@ -34,6 +34,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.DeadLockDetector;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.BotReportTable;
|
||||
import org.l2jmobius.gameserver.data.EventDroplist;
|
||||
@ -185,8 +186,11 @@ public class GameServer
|
||||
final long serverLoadStart = Chronos.currentTimeMillis();
|
||||
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.SERVER_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("GameServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -45,8 +45,9 @@ import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.gameserver.Shutdown;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
@ -86,6 +87,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -335,7 +341,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(layeredPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -47,7 +47,11 @@ public class SystemPanel extends JPanel
|
||||
|
||||
public SystemPanel()
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
if (!Config.DARK_THEME)
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
}
|
||||
|
||||
setBounds(500, 20, 284, 140);
|
||||
setBorder(new LineBorder(new Color(0, 0, 0), 1, false));
|
||||
setOpaque(true);
|
||||
|
@ -33,6 +33,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseBackup;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.network.loginserverpackets.game.ServerStatus;
|
||||
import org.l2jmobius.loginserver.network.ClientNetworkManager;
|
||||
import org.l2jmobius.loginserver.ui.Gui;
|
||||
@ -63,8 +64,11 @@ public class LoginServer
|
||||
private LoginServer() throws Exception
|
||||
{
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.LOGIN_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("LoginServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -43,8 +43,10 @@ import javax.swing.JTextArea;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.loginserver.GameServerTable;
|
||||
import org.l2jmobius.loginserver.GameServerTable.GameServerInfo;
|
||||
import org.l2jmobius.loginserver.LoginController;
|
||||
@ -75,6 +77,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -243,7 +250,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(scrollPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -36,7 +36,7 @@ import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
import org.l2jmobius.tools.dbinstaller.util.mysql.MySqlConnect;
|
||||
import org.l2jmobius.tools.dbinstaller.util.swing.SpringUtilities;
|
||||
|
@ -142,6 +142,23 @@ UrgentPacketThreadCoreSize = 40
|
||||
ThreadsForLoading = False
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Dead Lock Detector (separate thread for detecting deadlocks)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -54,6 +54,23 @@ Password =
|
||||
MaximumDbConnections = 5
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Automatic Database Backup Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -98,11 +98,11 @@ public class Config
|
||||
private static final String GENERAL_CONFIG_FILE = "./config/General.ini";
|
||||
private static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
|
||||
private static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
|
||||
private static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
public static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
private static final String NPC_CONFIG_FILE = "./config/NPC.ini";
|
||||
private static final String PVP_CONFIG_FILE = "./config/PVP.ini";
|
||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
public static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||
@ -440,6 +440,8 @@ public class Config
|
||||
public static int INSTANT_THREAD_POOL_COUNT;
|
||||
public static int IO_PACKET_THREAD_CORE_SIZE;
|
||||
public static boolean THREADS_FOR_LOADING;
|
||||
public static boolean ENABLE_GUI;
|
||||
public static boolean DARK_THEME;
|
||||
public static boolean DEADLOCK_DETECTOR;
|
||||
public static int DEADLOCK_CHECK_INTERVAL;
|
||||
public static boolean RESTART_ON_DEADLOCK;
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class DarkTheme
|
||||
{
|
||||
public static void activate()
|
||||
{
|
||||
// Modify existing white Nimbus look and feel to dark.
|
||||
UIManager.put("control", new Color(128, 128, 128));
|
||||
UIManager.put("info", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusBase", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusAlertYellow", new Color(248, 187, 0));
|
||||
UIManager.put("nimbusDisabledText", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusFocus", Color.DARK_GRAY); // new Color(115, 164, 209)
|
||||
UIManager.put("nimbusGreen", new Color(176, 179, 50));
|
||||
UIManager.put("nimbusInfoBlue", Color.DARK_GRAY); // new Color(66, 139, 221)
|
||||
UIManager.put("nimbusLightBackground", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusOrange", new Color(191, 98, 4));
|
||||
UIManager.put("nimbusRed", new Color(169, 46, 34));
|
||||
UIManager.put("nimbusSelectedText", new Color(255, 255, 255));
|
||||
UIManager.put("nimbusSelectionBackground", new Color(104, 93, 156));
|
||||
UIManager.put("text", new Color(230, 230, 230));
|
||||
|
||||
// Set look and feel.
|
||||
try
|
||||
{
|
||||
UIManager.setLookAndFeel(new NimbusLookAndFeel());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.Element;
|
||||
|
||||
/*
|
||||
* A class to control the maximum number of lines to be stored in a Document
|
||||
*
|
||||
* Excess lines can be removed from the start or end of the Document
|
||||
* depending on your requirement.
|
||||
*
|
||||
* a) if you append text to the Document, then you would want to remove lines
|
||||
* from the start.
|
||||
* b) if you insert text at the beginning of the Document, then you would
|
||||
* want to remove lines from the end.
|
||||
*/
|
||||
public class LimitLinesDocumentListener implements DocumentListener
|
||||
{
|
||||
private int _maximumLines;
|
||||
private final boolean _isRemoveFromStart;
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start of the Document.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines)
|
||||
{
|
||||
this(maximumLines, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start or end of the Document, depending on the boolean value specified.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines, boolean isRemoveFromStart)
|
||||
{
|
||||
setLimitLines(maximumLines);
|
||||
_isRemoveFromStart = isRemoveFromStart;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public int getLimitLines()
|
||||
{
|
||||
return _maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public void setLimitLines(int maximumLines)
|
||||
{
|
||||
if (maximumLines < 1)
|
||||
{
|
||||
final String message = "Maximum lines must be greater than 0";
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
|
||||
_maximumLines = maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle insertion of new text into the Document.
|
||||
*/
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e)
|
||||
{
|
||||
// Changes to the Document can not be done within the listener so we need to add the processing to the end of the EDT.
|
||||
SwingUtilities.invokeLater(() -> removeLines(e));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the Document when necessary.
|
||||
*/
|
||||
private void removeLines(DocumentEvent e)
|
||||
{
|
||||
// The root Element of the Document will tell us the total number of line in the Document.
|
||||
final Document document = e.getDocument();
|
||||
final Element root = document.getDefaultRootElement();
|
||||
|
||||
while (root.getElementCount() > _maximumLines)
|
||||
{
|
||||
if (_isRemoveFromStart)
|
||||
{
|
||||
removeFromStart(document, root);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeFromEnd(document, root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the start of the Document
|
||||
*/
|
||||
private void removeFromStart(Document document, Element root)
|
||||
{
|
||||
final Element line = root.getElement(0);
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(0, end);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the end of the Document
|
||||
*/
|
||||
private void removeFromEnd(Document document, Element root)
|
||||
{
|
||||
// We use start minus 1 to make sure we remove the newline character of the previous line.
|
||||
|
||||
final Element line = root.getElement(root.getElementCount() - 1);
|
||||
final int start = line.getStartOffset();
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(start - 1, end - start);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Toolkit;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JWindow;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class SplashScreen extends JWindow
|
||||
{
|
||||
Image image;
|
||||
|
||||
/**
|
||||
* @param path of image file
|
||||
* @param time in milliseconds
|
||||
* @param parent frame to set visible after time ends
|
||||
*/
|
||||
public SplashScreen(String path, long time, JFrame parent)
|
||||
{
|
||||
setBackground(new Color(0, 255, 0, 0)); // Transparency.
|
||||
image = Toolkit.getDefaultToolkit().getImage(path);
|
||||
final ImageIcon imageIcon = new ImageIcon(image);
|
||||
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
|
||||
setLocationRelativeTo(null);
|
||||
setAlwaysOnTop(true);
|
||||
setVisible(true);
|
||||
|
||||
new Timer().schedule(new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
setVisible(false);
|
||||
if (parent != null)
|
||||
{
|
||||
// Make parent visible.
|
||||
parent.setVisible(true);
|
||||
// Focus parent window.
|
||||
parent.toFront();
|
||||
parent.setState(Frame.ICONIFIED);
|
||||
parent.setState(Frame.NORMAL);
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
}, imageIcon.getIconWidth() > 0 ? time : 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
g.drawImage(image, 0, 0, null);
|
||||
}
|
||||
}
|
@ -1,163 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.util;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.Element;
|
||||
|
||||
/*
|
||||
* A class to control the maximum number of lines to be stored in a Document
|
||||
*
|
||||
* Excess lines can be removed from the start or end of the Document
|
||||
* depending on your requirement.
|
||||
*
|
||||
* a) if you append text to the Document, then you would want to remove lines
|
||||
* from the start.
|
||||
* b) if you insert text at the beginning of the Document, then you would
|
||||
* want to remove lines from the end.
|
||||
*/
|
||||
public class LimitLinesDocumentListener implements DocumentListener
|
||||
{
|
||||
private int _maximumLines;
|
||||
private final boolean _isRemoveFromStart;
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start of the Document.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines)
|
||||
{
|
||||
this(maximumLines, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start or end of the Document, depending on the boolean value specified.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines, boolean isRemoveFromStart)
|
||||
{
|
||||
setLimitLines(maximumLines);
|
||||
_isRemoveFromStart = isRemoveFromStart;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public int getLimitLines()
|
||||
{
|
||||
return _maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public void setLimitLines(int maximumLines)
|
||||
{
|
||||
if (maximumLines < 1)
|
||||
{
|
||||
final String message = "Maximum lines must be greater than 0";
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
|
||||
_maximumLines = maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle insertion of new text into the Document.
|
||||
*/
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e)
|
||||
{
|
||||
// Changes to the Document can not be done within the listener so we need to add the processing to the end of the EDT.
|
||||
SwingUtilities.invokeLater(() -> removeLines(e));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the Document when necessary.
|
||||
*/
|
||||
private void removeLines(DocumentEvent e)
|
||||
{
|
||||
// The root Element of the Document will tell us the total number of line in the Document.
|
||||
final Document document = e.getDocument();
|
||||
final Element root = document.getDefaultRootElement();
|
||||
|
||||
while (root.getElementCount() > _maximumLines)
|
||||
{
|
||||
if (_isRemoveFromStart)
|
||||
{
|
||||
removeFromStart(document, root);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeFromEnd(document, root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the start of the Document
|
||||
*/
|
||||
private void removeFromStart(Document document, Element root)
|
||||
{
|
||||
final Element line = root.getElement(0);
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(0, end);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the end of the Document
|
||||
*/
|
||||
private void removeFromEnd(Document document, Element root)
|
||||
{
|
||||
// We use start minus 1 to make sure we remove the newline character of the previous line.
|
||||
|
||||
final Element line = root.getElement(root.getElementCount() - 1);
|
||||
final int start = line.getStartOffset();
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(start - 1, end - start);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.util;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Toolkit;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JWindow;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class SplashScreen extends JWindow
|
||||
{
|
||||
Image image;
|
||||
|
||||
/**
|
||||
* @param path of image file
|
||||
* @param time in milliseconds
|
||||
* @param parent frame to set visible after time ends
|
||||
*/
|
||||
public SplashScreen(String path, long time, JFrame parent)
|
||||
{
|
||||
setBackground(new Color(0, 255, 0, 0)); // Transparency.
|
||||
image = Toolkit.getDefaultToolkit().getImage(path);
|
||||
final ImageIcon imageIcon = new ImageIcon(image);
|
||||
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
|
||||
setLocationRelativeTo(null);
|
||||
setAlwaysOnTop(true);
|
||||
setVisible(true);
|
||||
|
||||
new Timer().schedule(new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
setVisible(false);
|
||||
if (parent != null)
|
||||
{
|
||||
// Make parent visible.
|
||||
parent.setVisible(true);
|
||||
// Focus parent window.
|
||||
parent.toFront();
|
||||
parent.setState(Frame.ICONIFIED);
|
||||
parent.setState(Frame.NORMAL);
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
}, imageIcon.getIconWidth() > 0 ? time : 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
g.drawImage(image, 0, 0, null);
|
||||
}
|
||||
}
|
@ -34,6 +34,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.DeadLockDetector;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.BotReportTable;
|
||||
import org.l2jmobius.gameserver.data.EventDroplist;
|
||||
@ -187,8 +188,11 @@ public class GameServer
|
||||
final long serverLoadStart = Chronos.currentTimeMillis();
|
||||
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.SERVER_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("GameServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -45,8 +45,9 @@ import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.gameserver.Shutdown;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
@ -86,6 +87,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -335,7 +341,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(layeredPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -47,7 +47,11 @@ public class SystemPanel extends JPanel
|
||||
|
||||
public SystemPanel()
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
if (!Config.DARK_THEME)
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
}
|
||||
|
||||
setBounds(500, 20, 284, 140);
|
||||
setBorder(new LineBorder(new Color(0, 0, 0), 1, false));
|
||||
setOpaque(true);
|
||||
|
@ -33,6 +33,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseBackup;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.network.loginserverpackets.game.ServerStatus;
|
||||
import org.l2jmobius.loginserver.network.ClientNetworkManager;
|
||||
import org.l2jmobius.loginserver.ui.Gui;
|
||||
@ -63,8 +64,11 @@ public class LoginServer
|
||||
private LoginServer() throws Exception
|
||||
{
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.LOGIN_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("LoginServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -43,8 +43,10 @@ import javax.swing.JTextArea;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.loginserver.GameServerTable;
|
||||
import org.l2jmobius.loginserver.GameServerTable.GameServerInfo;
|
||||
import org.l2jmobius.loginserver.LoginController;
|
||||
@ -75,6 +77,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -243,7 +250,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(scrollPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -36,7 +36,7 @@ import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
import org.l2jmobius.tools.dbinstaller.util.mysql.MySqlConnect;
|
||||
import org.l2jmobius.tools.dbinstaller.util.swing.SpringUtilities;
|
||||
|
@ -142,6 +142,23 @@ UrgentPacketThreadCoreSize = 40
|
||||
ThreadsForLoading = False
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Dead Lock Detector (separate thread for detecting deadlocks)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -54,6 +54,23 @@ Password =
|
||||
MaximumDbConnections = 5
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Automatic Database Backup Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -98,11 +98,11 @@ public class Config
|
||||
private static final String GENERAL_CONFIG_FILE = "./config/General.ini";
|
||||
private static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
|
||||
private static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
|
||||
private static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
public static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
private static final String NPC_CONFIG_FILE = "./config/NPC.ini";
|
||||
private static final String PVP_CONFIG_FILE = "./config/PVP.ini";
|
||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
public static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||
@ -440,6 +440,8 @@ public class Config
|
||||
public static int INSTANT_THREAD_POOL_COUNT;
|
||||
public static int IO_PACKET_THREAD_CORE_SIZE;
|
||||
public static boolean THREADS_FOR_LOADING;
|
||||
public static boolean ENABLE_GUI;
|
||||
public static boolean DARK_THEME;
|
||||
public static boolean DEADLOCK_DETECTOR;
|
||||
public static int DEADLOCK_CHECK_INTERVAL;
|
||||
public static boolean RESTART_ON_DEADLOCK;
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class DarkTheme
|
||||
{
|
||||
public static void activate()
|
||||
{
|
||||
// Modify existing white Nimbus look and feel to dark.
|
||||
UIManager.put("control", new Color(128, 128, 128));
|
||||
UIManager.put("info", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusBase", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusAlertYellow", new Color(248, 187, 0));
|
||||
UIManager.put("nimbusDisabledText", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusFocus", Color.DARK_GRAY); // new Color(115, 164, 209)
|
||||
UIManager.put("nimbusGreen", new Color(176, 179, 50));
|
||||
UIManager.put("nimbusInfoBlue", Color.DARK_GRAY); // new Color(66, 139, 221)
|
||||
UIManager.put("nimbusLightBackground", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusOrange", new Color(191, 98, 4));
|
||||
UIManager.put("nimbusRed", new Color(169, 46, 34));
|
||||
UIManager.put("nimbusSelectedText", new Color(255, 255, 255));
|
||||
UIManager.put("nimbusSelectionBackground", new Color(104, 93, 156));
|
||||
UIManager.put("text", new Color(230, 230, 230));
|
||||
|
||||
// Set look and feel.
|
||||
try
|
||||
{
|
||||
UIManager.setLookAndFeel(new NimbusLookAndFeel());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.Element;
|
||||
|
||||
/*
|
||||
* A class to control the maximum number of lines to be stored in a Document
|
||||
*
|
||||
* Excess lines can be removed from the start or end of the Document
|
||||
* depending on your requirement.
|
||||
*
|
||||
* a) if you append text to the Document, then you would want to remove lines
|
||||
* from the start.
|
||||
* b) if you insert text at the beginning of the Document, then you would
|
||||
* want to remove lines from the end.
|
||||
*/
|
||||
public class LimitLinesDocumentListener implements DocumentListener
|
||||
{
|
||||
private int _maximumLines;
|
||||
private final boolean _isRemoveFromStart;
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start of the Document.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines)
|
||||
{
|
||||
this(maximumLines, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start or end of the Document, depending on the boolean value specified.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines, boolean isRemoveFromStart)
|
||||
{
|
||||
setLimitLines(maximumLines);
|
||||
_isRemoveFromStart = isRemoveFromStart;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public int getLimitLines()
|
||||
{
|
||||
return _maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public void setLimitLines(int maximumLines)
|
||||
{
|
||||
if (maximumLines < 1)
|
||||
{
|
||||
final String message = "Maximum lines must be greater than 0";
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
|
||||
_maximumLines = maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle insertion of new text into the Document.
|
||||
*/
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e)
|
||||
{
|
||||
// Changes to the Document can not be done within the listener so we need to add the processing to the end of the EDT.
|
||||
SwingUtilities.invokeLater(() -> removeLines(e));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the Document when necessary.
|
||||
*/
|
||||
private void removeLines(DocumentEvent e)
|
||||
{
|
||||
// The root Element of the Document will tell us the total number of line in the Document.
|
||||
final Document document = e.getDocument();
|
||||
final Element root = document.getDefaultRootElement();
|
||||
|
||||
while (root.getElementCount() > _maximumLines)
|
||||
{
|
||||
if (_isRemoveFromStart)
|
||||
{
|
||||
removeFromStart(document, root);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeFromEnd(document, root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the start of the Document
|
||||
*/
|
||||
private void removeFromStart(Document document, Element root)
|
||||
{
|
||||
final Element line = root.getElement(0);
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(0, end);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the end of the Document
|
||||
*/
|
||||
private void removeFromEnd(Document document, Element root)
|
||||
{
|
||||
// We use start minus 1 to make sure we remove the newline character of the previous line.
|
||||
|
||||
final Element line = root.getElement(root.getElementCount() - 1);
|
||||
final int start = line.getStartOffset();
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(start - 1, end - start);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Toolkit;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JWindow;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class SplashScreen extends JWindow
|
||||
{
|
||||
Image image;
|
||||
|
||||
/**
|
||||
* @param path of image file
|
||||
* @param time in milliseconds
|
||||
* @param parent frame to set visible after time ends
|
||||
*/
|
||||
public SplashScreen(String path, long time, JFrame parent)
|
||||
{
|
||||
setBackground(new Color(0, 255, 0, 0)); // Transparency.
|
||||
image = Toolkit.getDefaultToolkit().getImage(path);
|
||||
final ImageIcon imageIcon = new ImageIcon(image);
|
||||
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
|
||||
setLocationRelativeTo(null);
|
||||
setAlwaysOnTop(true);
|
||||
setVisible(true);
|
||||
|
||||
new Timer().schedule(new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
setVisible(false);
|
||||
if (parent != null)
|
||||
{
|
||||
// Make parent visible.
|
||||
parent.setVisible(true);
|
||||
// Focus parent window.
|
||||
parent.toFront();
|
||||
parent.setState(Frame.ICONIFIED);
|
||||
parent.setState(Frame.NORMAL);
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
}, imageIcon.getIconWidth() > 0 ? time : 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
g.drawImage(image, 0, 0, null);
|
||||
}
|
||||
}
|
@ -1,163 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.util;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.Element;
|
||||
|
||||
/*
|
||||
* A class to control the maximum number of lines to be stored in a Document
|
||||
*
|
||||
* Excess lines can be removed from the start or end of the Document
|
||||
* depending on your requirement.
|
||||
*
|
||||
* a) if you append text to the Document, then you would want to remove lines
|
||||
* from the start.
|
||||
* b) if you insert text at the beginning of the Document, then you would
|
||||
* want to remove lines from the end.
|
||||
*/
|
||||
public class LimitLinesDocumentListener implements DocumentListener
|
||||
{
|
||||
private int _maximumLines;
|
||||
private final boolean _isRemoveFromStart;
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start of the Document.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines)
|
||||
{
|
||||
this(maximumLines, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start or end of the Document, depending on the boolean value specified.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines, boolean isRemoveFromStart)
|
||||
{
|
||||
setLimitLines(maximumLines);
|
||||
_isRemoveFromStart = isRemoveFromStart;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public int getLimitLines()
|
||||
{
|
||||
return _maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public void setLimitLines(int maximumLines)
|
||||
{
|
||||
if (maximumLines < 1)
|
||||
{
|
||||
final String message = "Maximum lines must be greater than 0";
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
|
||||
_maximumLines = maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle insertion of new text into the Document.
|
||||
*/
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e)
|
||||
{
|
||||
// Changes to the Document can not be done within the listener so we need to add the processing to the end of the EDT.
|
||||
SwingUtilities.invokeLater(() -> removeLines(e));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the Document when necessary.
|
||||
*/
|
||||
private void removeLines(DocumentEvent e)
|
||||
{
|
||||
// The root Element of the Document will tell us the total number of line in the Document.
|
||||
final Document document = e.getDocument();
|
||||
final Element root = document.getDefaultRootElement();
|
||||
|
||||
while (root.getElementCount() > _maximumLines)
|
||||
{
|
||||
if (_isRemoveFromStart)
|
||||
{
|
||||
removeFromStart(document, root);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeFromEnd(document, root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the start of the Document
|
||||
*/
|
||||
private void removeFromStart(Document document, Element root)
|
||||
{
|
||||
final Element line = root.getElement(0);
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(0, end);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the end of the Document
|
||||
*/
|
||||
private void removeFromEnd(Document document, Element root)
|
||||
{
|
||||
// We use start minus 1 to make sure we remove the newline character of the previous line.
|
||||
|
||||
final Element line = root.getElement(root.getElementCount() - 1);
|
||||
final int start = line.getStartOffset();
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(start - 1, end - start);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.util;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Toolkit;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JWindow;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class SplashScreen extends JWindow
|
||||
{
|
||||
Image image;
|
||||
|
||||
/**
|
||||
* @param path of image file
|
||||
* @param time in milliseconds
|
||||
* @param parent frame to set visible after time ends
|
||||
*/
|
||||
public SplashScreen(String path, long time, JFrame parent)
|
||||
{
|
||||
setBackground(new Color(0, 255, 0, 0)); // Transparency.
|
||||
image = Toolkit.getDefaultToolkit().getImage(path);
|
||||
final ImageIcon imageIcon = new ImageIcon(image);
|
||||
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
|
||||
setLocationRelativeTo(null);
|
||||
setAlwaysOnTop(true);
|
||||
setVisible(true);
|
||||
|
||||
new Timer().schedule(new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
setVisible(false);
|
||||
if (parent != null)
|
||||
{
|
||||
// Make parent visible.
|
||||
parent.setVisible(true);
|
||||
// Focus parent window.
|
||||
parent.toFront();
|
||||
parent.setState(Frame.ICONIFIED);
|
||||
parent.setState(Frame.NORMAL);
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
}, imageIcon.getIconWidth() > 0 ? time : 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
g.drawImage(image, 0, 0, null);
|
||||
}
|
||||
}
|
@ -34,6 +34,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.DeadLockDetector;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.BotReportTable;
|
||||
import org.l2jmobius.gameserver.data.EventDroplist;
|
||||
@ -187,8 +188,11 @@ public class GameServer
|
||||
final long serverLoadStart = Chronos.currentTimeMillis();
|
||||
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.SERVER_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("GameServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -45,8 +45,9 @@ import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.gameserver.Shutdown;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
@ -86,6 +87,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -335,7 +341,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(layeredPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -47,7 +47,11 @@ public class SystemPanel extends JPanel
|
||||
|
||||
public SystemPanel()
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
if (!Config.DARK_THEME)
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
}
|
||||
|
||||
setBounds(500, 20, 284, 140);
|
||||
setBorder(new LineBorder(new Color(0, 0, 0), 1, false));
|
||||
setOpaque(true);
|
||||
|
@ -33,6 +33,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseBackup;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.network.loginserverpackets.game.ServerStatus;
|
||||
import org.l2jmobius.loginserver.network.ClientNetworkManager;
|
||||
import org.l2jmobius.loginserver.ui.Gui;
|
||||
@ -63,8 +64,11 @@ public class LoginServer
|
||||
private LoginServer() throws Exception
|
||||
{
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.LOGIN_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("LoginServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -43,8 +43,10 @@ import javax.swing.JTextArea;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.loginserver.GameServerTable;
|
||||
import org.l2jmobius.loginserver.GameServerTable.GameServerInfo;
|
||||
import org.l2jmobius.loginserver.LoginController;
|
||||
@ -75,6 +77,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -243,7 +250,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(scrollPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -36,7 +36,7 @@ import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
import org.l2jmobius.tools.dbinstaller.util.mysql.MySqlConnect;
|
||||
import org.l2jmobius.tools.dbinstaller.util.swing.SpringUtilities;
|
||||
|
@ -142,6 +142,23 @@ UrgentPacketThreadCoreSize = 40
|
||||
ThreadsForLoading = False
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Dead Lock Detector (separate thread for detecting deadlocks)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -54,6 +54,23 @@ Password =
|
||||
MaximumDbConnections = 5
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Automatic Database Backup Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -98,11 +98,11 @@ public class Config
|
||||
private static final String GENERAL_CONFIG_FILE = "./config/General.ini";
|
||||
private static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
|
||||
private static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
|
||||
private static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
public static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
private static final String NPC_CONFIG_FILE = "./config/NPC.ini";
|
||||
private static final String PVP_CONFIG_FILE = "./config/PVP.ini";
|
||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
public static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||
@ -441,6 +441,8 @@ public class Config
|
||||
public static int INSTANT_THREAD_POOL_COUNT;
|
||||
public static int IO_PACKET_THREAD_CORE_SIZE;
|
||||
public static boolean THREADS_FOR_LOADING;
|
||||
public static boolean ENABLE_GUI;
|
||||
public static boolean DARK_THEME;
|
||||
public static boolean DEADLOCK_DETECTOR;
|
||||
public static int DEADLOCK_CHECK_INTERVAL;
|
||||
public static boolean RESTART_ON_DEADLOCK;
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class DarkTheme
|
||||
{
|
||||
public static void activate()
|
||||
{
|
||||
// Modify existing white Nimbus look and feel to dark.
|
||||
UIManager.put("control", new Color(128, 128, 128));
|
||||
UIManager.put("info", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusBase", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusAlertYellow", new Color(248, 187, 0));
|
||||
UIManager.put("nimbusDisabledText", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusFocus", Color.DARK_GRAY); // new Color(115, 164, 209)
|
||||
UIManager.put("nimbusGreen", new Color(176, 179, 50));
|
||||
UIManager.put("nimbusInfoBlue", Color.DARK_GRAY); // new Color(66, 139, 221)
|
||||
UIManager.put("nimbusLightBackground", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusOrange", new Color(191, 98, 4));
|
||||
UIManager.put("nimbusRed", new Color(169, 46, 34));
|
||||
UIManager.put("nimbusSelectedText", new Color(255, 255, 255));
|
||||
UIManager.put("nimbusSelectionBackground", new Color(104, 93, 156));
|
||||
UIManager.put("text", new Color(230, 230, 230));
|
||||
|
||||
// Set look and feel.
|
||||
try
|
||||
{
|
||||
UIManager.setLookAndFeel(new NimbusLookAndFeel());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.Element;
|
||||
|
||||
/*
|
||||
* A class to control the maximum number of lines to be stored in a Document
|
||||
*
|
||||
* Excess lines can be removed from the start or end of the Document
|
||||
* depending on your requirement.
|
||||
*
|
||||
* a) if you append text to the Document, then you would want to remove lines
|
||||
* from the start.
|
||||
* b) if you insert text at the beginning of the Document, then you would
|
||||
* want to remove lines from the end.
|
||||
*/
|
||||
public class LimitLinesDocumentListener implements DocumentListener
|
||||
{
|
||||
private int _maximumLines;
|
||||
private final boolean _isRemoveFromStart;
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start of the Document.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines)
|
||||
{
|
||||
this(maximumLines, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start or end of the Document, depending on the boolean value specified.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines, boolean isRemoveFromStart)
|
||||
{
|
||||
setLimitLines(maximumLines);
|
||||
_isRemoveFromStart = isRemoveFromStart;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public int getLimitLines()
|
||||
{
|
||||
return _maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public void setLimitLines(int maximumLines)
|
||||
{
|
||||
if (maximumLines < 1)
|
||||
{
|
||||
final String message = "Maximum lines must be greater than 0";
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
|
||||
_maximumLines = maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle insertion of new text into the Document.
|
||||
*/
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e)
|
||||
{
|
||||
// Changes to the Document can not be done within the listener so we need to add the processing to the end of the EDT.
|
||||
SwingUtilities.invokeLater(() -> removeLines(e));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the Document when necessary.
|
||||
*/
|
||||
private void removeLines(DocumentEvent e)
|
||||
{
|
||||
// The root Element of the Document will tell us the total number of line in the Document.
|
||||
final Document document = e.getDocument();
|
||||
final Element root = document.getDefaultRootElement();
|
||||
|
||||
while (root.getElementCount() > _maximumLines)
|
||||
{
|
||||
if (_isRemoveFromStart)
|
||||
{
|
||||
removeFromStart(document, root);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeFromEnd(document, root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the start of the Document
|
||||
*/
|
||||
private void removeFromStart(Document document, Element root)
|
||||
{
|
||||
final Element line = root.getElement(0);
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(0, end);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the end of the Document
|
||||
*/
|
||||
private void removeFromEnd(Document document, Element root)
|
||||
{
|
||||
// We use start minus 1 to make sure we remove the newline character of the previous line.
|
||||
|
||||
final Element line = root.getElement(root.getElementCount() - 1);
|
||||
final int start = line.getStartOffset();
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(start - 1, end - start);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Toolkit;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JWindow;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class SplashScreen extends JWindow
|
||||
{
|
||||
Image image;
|
||||
|
||||
/**
|
||||
* @param path of image file
|
||||
* @param time in milliseconds
|
||||
* @param parent frame to set visible after time ends
|
||||
*/
|
||||
public SplashScreen(String path, long time, JFrame parent)
|
||||
{
|
||||
setBackground(new Color(0, 255, 0, 0)); // Transparency.
|
||||
image = Toolkit.getDefaultToolkit().getImage(path);
|
||||
final ImageIcon imageIcon = new ImageIcon(image);
|
||||
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
|
||||
setLocationRelativeTo(null);
|
||||
setAlwaysOnTop(true);
|
||||
setVisible(true);
|
||||
|
||||
new Timer().schedule(new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
setVisible(false);
|
||||
if (parent != null)
|
||||
{
|
||||
// Make parent visible.
|
||||
parent.setVisible(true);
|
||||
// Focus parent window.
|
||||
parent.toFront();
|
||||
parent.setState(Frame.ICONIFIED);
|
||||
parent.setState(Frame.NORMAL);
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
}, imageIcon.getIconWidth() > 0 ? time : 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
g.drawImage(image, 0, 0, null);
|
||||
}
|
||||
}
|
@ -1,163 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.util;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.Element;
|
||||
|
||||
/*
|
||||
* A class to control the maximum number of lines to be stored in a Document
|
||||
*
|
||||
* Excess lines can be removed from the start or end of the Document
|
||||
* depending on your requirement.
|
||||
*
|
||||
* a) if you append text to the Document, then you would want to remove lines
|
||||
* from the start.
|
||||
* b) if you insert text at the beginning of the Document, then you would
|
||||
* want to remove lines from the end.
|
||||
*/
|
||||
public class LimitLinesDocumentListener implements DocumentListener
|
||||
{
|
||||
private int _maximumLines;
|
||||
private final boolean _isRemoveFromStart;
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start of the Document.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines)
|
||||
{
|
||||
this(maximumLines, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start or end of the Document, depending on the boolean value specified.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines, boolean isRemoveFromStart)
|
||||
{
|
||||
setLimitLines(maximumLines);
|
||||
_isRemoveFromStart = isRemoveFromStart;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public int getLimitLines()
|
||||
{
|
||||
return _maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public void setLimitLines(int maximumLines)
|
||||
{
|
||||
if (maximumLines < 1)
|
||||
{
|
||||
final String message = "Maximum lines must be greater than 0";
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
|
||||
_maximumLines = maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle insertion of new text into the Document.
|
||||
*/
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e)
|
||||
{
|
||||
// Changes to the Document can not be done within the listener so we need to add the processing to the end of the EDT.
|
||||
SwingUtilities.invokeLater(() -> removeLines(e));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the Document when necessary.
|
||||
*/
|
||||
private void removeLines(DocumentEvent e)
|
||||
{
|
||||
// The root Element of the Document will tell us the total number of line in the Document.
|
||||
final Document document = e.getDocument();
|
||||
final Element root = document.getDefaultRootElement();
|
||||
|
||||
while (root.getElementCount() > _maximumLines)
|
||||
{
|
||||
if (_isRemoveFromStart)
|
||||
{
|
||||
removeFromStart(document, root);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeFromEnd(document, root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the start of the Document
|
||||
*/
|
||||
private void removeFromStart(Document document, Element root)
|
||||
{
|
||||
final Element line = root.getElement(0);
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(0, end);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the end of the Document
|
||||
*/
|
||||
private void removeFromEnd(Document document, Element root)
|
||||
{
|
||||
// We use start minus 1 to make sure we remove the newline character of the previous line.
|
||||
|
||||
final Element line = root.getElement(root.getElementCount() - 1);
|
||||
final int start = line.getStartOffset();
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(start - 1, end - start);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.util;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Toolkit;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JWindow;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class SplashScreen extends JWindow
|
||||
{
|
||||
Image image;
|
||||
|
||||
/**
|
||||
* @param path of image file
|
||||
* @param time in milliseconds
|
||||
* @param parent frame to set visible after time ends
|
||||
*/
|
||||
public SplashScreen(String path, long time, JFrame parent)
|
||||
{
|
||||
setBackground(new Color(0, 255, 0, 0)); // Transparency.
|
||||
image = Toolkit.getDefaultToolkit().getImage(path);
|
||||
final ImageIcon imageIcon = new ImageIcon(image);
|
||||
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
|
||||
setLocationRelativeTo(null);
|
||||
setAlwaysOnTop(true);
|
||||
setVisible(true);
|
||||
|
||||
new Timer().schedule(new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
setVisible(false);
|
||||
if (parent != null)
|
||||
{
|
||||
// Make parent visible.
|
||||
parent.setVisible(true);
|
||||
// Focus parent window.
|
||||
parent.toFront();
|
||||
parent.setState(Frame.ICONIFIED);
|
||||
parent.setState(Frame.NORMAL);
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
}, imageIcon.getIconWidth() > 0 ? time : 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
g.drawImage(image, 0, 0, null);
|
||||
}
|
||||
}
|
@ -34,6 +34,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.DeadLockDetector;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.BotReportTable;
|
||||
import org.l2jmobius.gameserver.data.EventDroplist;
|
||||
@ -188,8 +189,11 @@ public class GameServer
|
||||
final long serverLoadStart = Chronos.currentTimeMillis();
|
||||
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.SERVER_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("GameServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -45,8 +45,9 @@ import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.gameserver.Shutdown;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
@ -86,6 +87,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -335,7 +341,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(layeredPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -47,7 +47,11 @@ public class SystemPanel extends JPanel
|
||||
|
||||
public SystemPanel()
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
if (!Config.DARK_THEME)
|
||||
{
|
||||
setBackground(Color.WHITE);
|
||||
}
|
||||
|
||||
setBounds(500, 20, 284, 140);
|
||||
setBorder(new LineBorder(new Color(0, 0, 0), 1, false));
|
||||
setOpaque(true);
|
||||
|
@ -33,6 +33,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseBackup;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.network.loginserverpackets.game.ServerStatus;
|
||||
import org.l2jmobius.loginserver.network.ClientNetworkManager;
|
||||
import org.l2jmobius.loginserver.ui.Gui;
|
||||
@ -63,8 +64,11 @@ public class LoginServer
|
||||
private LoginServer() throws Exception
|
||||
{
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.LOGIN_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("LoginServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -43,8 +43,10 @@ import javax.swing.JTextArea;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.loginserver.GameServerTable;
|
||||
import org.l2jmobius.loginserver.GameServerTable.GameServerInfo;
|
||||
import org.l2jmobius.loginserver.LoginController;
|
||||
@ -75,6 +77,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -243,7 +250,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(scrollPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
@ -36,7 +36,7 @@ import javax.swing.SpringLayout;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.tools.dbinstaller.RunTasks;
|
||||
import org.l2jmobius.tools.dbinstaller.util.mysql.MySqlConnect;
|
||||
import org.l2jmobius.tools.dbinstaller.util.swing.SpringUtilities;
|
||||
|
@ -142,6 +142,23 @@ UrgentPacketThreadCoreSize = 40
|
||||
ThreadsForLoading = False
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Dead Lock Detector (separate thread for detecting deadlocks)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -54,6 +54,23 @@ Password =
|
||||
MaximumDbConnections = 5
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Look and feel
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Enable L2jMobius GUI when OS supports it.
|
||||
# Provides access to admin commands without the need to be online.
|
||||
# Warning! Do not disable if you use Gameserver.exe
|
||||
# because server will run in the background!
|
||||
# Default: True
|
||||
EnableGUI = True
|
||||
|
||||
# Dark theme.
|
||||
# Use a dark version of the Nimbus theme.
|
||||
# Default: True
|
||||
DarkTheme = True
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Automatic Database Backup Settings
|
||||
# ---------------------------------------------------------------------------
|
||||
|
@ -98,11 +98,11 @@ public class Config
|
||||
private static final String GENERAL_CONFIG_FILE = "./config/General.ini";
|
||||
private static final String GRACIASEEDS_CONFIG_FILE = "./config/GraciaSeeds.ini";
|
||||
private static final String GRANDBOSS_CONFIG_FILE = "./config/GrandBoss.ini";
|
||||
private static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
public static final String LOGIN_CONFIG_FILE = "./config/LoginServer.ini";
|
||||
private static final String NPC_CONFIG_FILE = "./config/NPC.ini";
|
||||
private static final String PVP_CONFIG_FILE = "./config/PVP.ini";
|
||||
private static final String RATES_CONFIG_FILE = "./config/Rates.ini";
|
||||
private static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
public static final String SERVER_CONFIG_FILE = "./config/Server.ini";
|
||||
private static final String TELNET_CONFIG_FILE = "./config/Telnet.ini";
|
||||
private static final String TRAINING_CAMP_CONFIG_FILE = "./config/TrainingCamp.ini";
|
||||
private static final String CHAT_FILTER_FILE = "./config/chatfilter.txt";
|
||||
@ -440,6 +440,8 @@ public class Config
|
||||
public static int INSTANT_THREAD_POOL_COUNT;
|
||||
public static int IO_PACKET_THREAD_CORE_SIZE;
|
||||
public static boolean THREADS_FOR_LOADING;
|
||||
public static boolean ENABLE_GUI;
|
||||
public static boolean DARK_THEME;
|
||||
public static boolean DEADLOCK_DETECTOR;
|
||||
public static int DEADLOCK_CHECK_INTERVAL;
|
||||
public static boolean RESTART_ON_DEADLOCK;
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.nimbus.NimbusLookAndFeel;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class DarkTheme
|
||||
{
|
||||
public static void activate()
|
||||
{
|
||||
// Modify existing white Nimbus look and feel to dark.
|
||||
UIManager.put("control", new Color(128, 128, 128));
|
||||
UIManager.put("info", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusBase", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusAlertYellow", new Color(248, 187, 0));
|
||||
UIManager.put("nimbusDisabledText", new Color(128, 128, 128));
|
||||
UIManager.put("nimbusFocus", Color.DARK_GRAY); // new Color(115, 164, 209)
|
||||
UIManager.put("nimbusGreen", new Color(176, 179, 50));
|
||||
UIManager.put("nimbusInfoBlue", Color.DARK_GRAY); // new Color(66, 139, 221)
|
||||
UIManager.put("nimbusLightBackground", Color.DARK_GRAY); // new Color(18, 30, 49)
|
||||
UIManager.put("nimbusOrange", new Color(191, 98, 4));
|
||||
UIManager.put("nimbusRed", new Color(169, 46, 34));
|
||||
UIManager.put("nimbusSelectedText", new Color(255, 255, 255));
|
||||
UIManager.put("nimbusSelectionBackground", new Color(104, 93, 156));
|
||||
UIManager.put("text", new Color(230, 230, 230));
|
||||
|
||||
// Set look and feel.
|
||||
try
|
||||
{
|
||||
UIManager.setLookAndFeel(new NimbusLookAndFeel());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.Element;
|
||||
|
||||
/*
|
||||
* A class to control the maximum number of lines to be stored in a Document
|
||||
*
|
||||
* Excess lines can be removed from the start or end of the Document
|
||||
* depending on your requirement.
|
||||
*
|
||||
* a) if you append text to the Document, then you would want to remove lines
|
||||
* from the start.
|
||||
* b) if you insert text at the beginning of the Document, then you would
|
||||
* want to remove lines from the end.
|
||||
*/
|
||||
public class LimitLinesDocumentListener implements DocumentListener
|
||||
{
|
||||
private int _maximumLines;
|
||||
private final boolean _isRemoveFromStart;
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start of the Document.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines)
|
||||
{
|
||||
this(maximumLines, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start or end of the Document, depending on the boolean value specified.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines, boolean isRemoveFromStart)
|
||||
{
|
||||
setLimitLines(maximumLines);
|
||||
_isRemoveFromStart = isRemoveFromStart;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public int getLimitLines()
|
||||
{
|
||||
return _maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public void setLimitLines(int maximumLines)
|
||||
{
|
||||
if (maximumLines < 1)
|
||||
{
|
||||
final String message = "Maximum lines must be greater than 0";
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
|
||||
_maximumLines = maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle insertion of new text into the Document.
|
||||
*/
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e)
|
||||
{
|
||||
// Changes to the Document can not be done within the listener so we need to add the processing to the end of the EDT.
|
||||
SwingUtilities.invokeLater(() -> removeLines(e));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the Document when necessary.
|
||||
*/
|
||||
private void removeLines(DocumentEvent e)
|
||||
{
|
||||
// The root Element of the Document will tell us the total number of line in the Document.
|
||||
final Document document = e.getDocument();
|
||||
final Element root = document.getDefaultRootElement();
|
||||
|
||||
while (root.getElementCount() > _maximumLines)
|
||||
{
|
||||
if (_isRemoveFromStart)
|
||||
{
|
||||
removeFromStart(document, root);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeFromEnd(document, root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the start of the Document
|
||||
*/
|
||||
private void removeFromStart(Document document, Element root)
|
||||
{
|
||||
final Element line = root.getElement(0);
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(0, end);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the end of the Document
|
||||
*/
|
||||
private void removeFromEnd(Document document, Element root)
|
||||
{
|
||||
// We use start minus 1 to make sure we remove the newline character of the previous line.
|
||||
|
||||
final Element line = root.getElement(root.getElementCount() - 1);
|
||||
final int start = line.getStartOffset();
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(start - 1, end - start);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Toolkit;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JWindow;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class SplashScreen extends JWindow
|
||||
{
|
||||
Image image;
|
||||
|
||||
/**
|
||||
* @param path of image file
|
||||
* @param time in milliseconds
|
||||
* @param parent frame to set visible after time ends
|
||||
*/
|
||||
public SplashScreen(String path, long time, JFrame parent)
|
||||
{
|
||||
setBackground(new Color(0, 255, 0, 0)); // Transparency.
|
||||
image = Toolkit.getDefaultToolkit().getImage(path);
|
||||
final ImageIcon imageIcon = new ImageIcon(image);
|
||||
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
|
||||
setLocationRelativeTo(null);
|
||||
setAlwaysOnTop(true);
|
||||
setVisible(true);
|
||||
|
||||
new Timer().schedule(new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
setVisible(false);
|
||||
if (parent != null)
|
||||
{
|
||||
// Make parent visible.
|
||||
parent.setVisible(true);
|
||||
// Focus parent window.
|
||||
parent.toFront();
|
||||
parent.setState(Frame.ICONIFIED);
|
||||
parent.setState(Frame.NORMAL);
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
}, imageIcon.getIconWidth() > 0 ? time : 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
g.drawImage(image, 0, 0, null);
|
||||
}
|
||||
}
|
@ -1,163 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.util;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
import javax.swing.text.Element;
|
||||
|
||||
/*
|
||||
* A class to control the maximum number of lines to be stored in a Document
|
||||
*
|
||||
* Excess lines can be removed from the start or end of the Document
|
||||
* depending on your requirement.
|
||||
*
|
||||
* a) if you append text to the Document, then you would want to remove lines
|
||||
* from the start.
|
||||
* b) if you insert text at the beginning of the Document, then you would
|
||||
* want to remove lines from the end.
|
||||
*/
|
||||
public class LimitLinesDocumentListener implements DocumentListener
|
||||
{
|
||||
private int _maximumLines;
|
||||
private final boolean _isRemoveFromStart;
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start of the Document.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines)
|
||||
{
|
||||
this(maximumLines, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Specify the number of lines to be stored in the Document. Extra lines will be removed from the start or end of the Document, depending on the boolean value specified.
|
||||
*/
|
||||
public LimitLinesDocumentListener(int maximumLines, boolean isRemoveFromStart)
|
||||
{
|
||||
setLimitLines(maximumLines);
|
||||
_isRemoveFromStart = isRemoveFromStart;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public int getLimitLines()
|
||||
{
|
||||
return _maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the maximum number of lines to be stored in the Document.
|
||||
*/
|
||||
public void setLimitLines(int maximumLines)
|
||||
{
|
||||
if (maximumLines < 1)
|
||||
{
|
||||
final String message = "Maximum lines must be greater than 0";
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
|
||||
_maximumLines = maximumLines;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle insertion of new text into the Document.
|
||||
*/
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e)
|
||||
{
|
||||
// Changes to the Document can not be done within the listener so we need to add the processing to the end of the EDT.
|
||||
SwingUtilities.invokeLater(() -> removeLines(e));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the Document when necessary.
|
||||
*/
|
||||
private void removeLines(DocumentEvent e)
|
||||
{
|
||||
// The root Element of the Document will tell us the total number of line in the Document.
|
||||
final Document document = e.getDocument();
|
||||
final Element root = document.getDefaultRootElement();
|
||||
|
||||
while (root.getElementCount() > _maximumLines)
|
||||
{
|
||||
if (_isRemoveFromStart)
|
||||
{
|
||||
removeFromStart(document, root);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeFromEnd(document, root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the start of the Document
|
||||
*/
|
||||
private void removeFromStart(Document document, Element root)
|
||||
{
|
||||
final Element line = root.getElement(0);
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(0, end);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove lines from the end of the Document
|
||||
*/
|
||||
private void removeFromEnd(Document document, Element root)
|
||||
{
|
||||
// We use start minus 1 to make sure we remove the newline character of the previous line.
|
||||
|
||||
final Element line = root.getElement(root.getElementCount() - 1);
|
||||
final int start = line.getStartOffset();
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
document.remove(start - 1, end - start);
|
||||
}
|
||||
catch (BadLocationException ble)
|
||||
{
|
||||
System.out.println(ble);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.commons.util;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Toolkit;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JWindow;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class SplashScreen extends JWindow
|
||||
{
|
||||
Image image;
|
||||
|
||||
/**
|
||||
* @param path of image file
|
||||
* @param time in milliseconds
|
||||
* @param parent frame to set visible after time ends
|
||||
*/
|
||||
public SplashScreen(String path, long time, JFrame parent)
|
||||
{
|
||||
setBackground(new Color(0, 255, 0, 0)); // Transparency.
|
||||
image = Toolkit.getDefaultToolkit().getImage(path);
|
||||
final ImageIcon imageIcon = new ImageIcon(image);
|
||||
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
|
||||
setLocationRelativeTo(null);
|
||||
setAlwaysOnTop(true);
|
||||
setVisible(true);
|
||||
|
||||
new Timer().schedule(new TimerTask()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
setVisible(false);
|
||||
if (parent != null)
|
||||
{
|
||||
// Make parent visible.
|
||||
parent.setVisible(true);
|
||||
// Focus parent window.
|
||||
parent.toFront();
|
||||
parent.setState(Frame.ICONIFIED);
|
||||
parent.setState(Frame.NORMAL);
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
}, imageIcon.getIconWidth() > 0 ? time : 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
g.drawImage(image, 0, 0, null);
|
||||
}
|
||||
}
|
@ -34,6 +34,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.enums.ServerMode;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.DeadLockDetector;
|
||||
import org.l2jmobius.commons.util.PropertiesParser;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.BotReportTable;
|
||||
import org.l2jmobius.gameserver.data.EventDroplist;
|
||||
@ -191,8 +192,11 @@ public class GameServer
|
||||
final long serverLoadStart = Chronos.currentTimeMillis();
|
||||
|
||||
// GUI
|
||||
if (!GraphicsEnvironment.isHeadless())
|
||||
final PropertiesParser serverSettings = new PropertiesParser(Config.SERVER_CONFIG_FILE);
|
||||
Config.ENABLE_GUI = serverSettings.getBoolean("EnableGUI", true);
|
||||
if (Config.ENABLE_GUI && !GraphicsEnvironment.isHeadless())
|
||||
{
|
||||
Config.DARK_THEME = serverSettings.getBoolean("DarkTheme", true);
|
||||
System.out.println("GameServer: Running in GUI mode.");
|
||||
new Gui();
|
||||
}
|
||||
|
@ -45,8 +45,9 @@ import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.util.SplashScreen;
|
||||
import org.l2jmobius.commons.ui.DarkTheme;
|
||||
import org.l2jmobius.commons.ui.LimitLinesDocumentListener;
|
||||
import org.l2jmobius.commons.ui.SplashScreen;
|
||||
import org.l2jmobius.gameserver.Shutdown;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
@ -86,6 +87,11 @@ public class Gui
|
||||
|
||||
public Gui()
|
||||
{
|
||||
if (Config.DARK_THEME)
|
||||
{
|
||||
DarkTheme.activate();
|
||||
}
|
||||
|
||||
// Initialize console.
|
||||
txtrConsole = new JTextArea();
|
||||
txtrConsole.setEditable(false);
|
||||
@ -335,7 +341,7 @@ public class Gui
|
||||
frame.setJMenuBar(menuBar);
|
||||
frame.setIconImages(icons);
|
||||
frame.add(layeredPanel, BorderLayout.CENTER);
|
||||
frame.getContentPane().setPreferredSize(new Dimension(800, 550));
|
||||
frame.getContentPane().setPreferredSize(new Dimension(Config.DARK_THEME ? 815 : 800, 550));
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user