Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Command Center

Iniciado por Swarlog, Ene 29, 2023, 04:00 PM

Tema anterior - Siguiente tema

Swarlog

Index: java/com/l2jserver/gameserver/GameServer.java
===================================================================
--- java/com/l2jserver/gameserver/GameServer.java (revision 10701)
+++ java/com/l2jserver/gameserver/GameServer.java (working copy)
@@ -26,6 +26,7 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.Calendar;
+import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import java.util.logging.LogManager;
 import java.util.logging.Logger;
@@ -35,6 +36,7 @@
 import com.l2jserver.Server;
 import com.l2jserver.UPnPService;
 import com.l2jserver.gameserver.cache.HtmCache;
+import com.l2jserver.gameserver.center.CommandGUI;
 import com.l2jserver.gameserver.data.sql.impl.AnnouncementsTable;
 import com.l2jserver.gameserver.data.sql.impl.CharNameTable;
 import com.l2jserver.gameserver.data.sql.impl.CharSummonTable;
@@ -151,7 +153,7 @@
  public static GameServer gameServer;
  public static final Calendar dateTimeServerStarted = Calendar.getInstance();
 
- public long getUsedMemoryMB()
+ public static long getUsedMemoryMB()
  {
  return (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1048576;
  }
@@ -171,6 +173,19 @@
  return _deadDetectThread;
  }
 
+ public static String getUptime()
+ {
+ long time = System.currentTimeMillis() - GameServer.dateTimeServerStarted.getTimeInMillis();
+
+ final long days = TimeUnit.MILLISECONDS.toDays(time);
+ time -= TimeUnit.DAYS.toMillis(days);
+ final long hours = TimeUnit.MILLISECONDS.toHours(time);
+ time -= TimeUnit.HOURS.toMillis(hours);
+ final long minutes = TimeUnit.MILLISECONDS.toMinutes(time);
+
+ return days + " Days , " + hours + " Hours , " + minutes + " Minutes";
+ }
+
  public GameServer() throws Exception
  {
  long serverLoadStart = System.currentTimeMillis();
@@ -440,6 +455,13 @@
 
  printSection("UPnP");
  UPnPService.getInstance();
+
+ printSection("Command Center");
+ CommandGUI center = new CommandGUI();
+ center.setVisible(true);
+ center.setResizable(false);
+ _log.info("Command Center successfully loaded!.");
+
  }
 
  public static void main(String[] args) throws Exception
Index: java/com/l2jserver/gameserver/center/CommandGUI.java
===================================================================
--- java/com/l2jserver/gameserver/center/CommandGUI.java (revision 0)
+++ java/com/l2jserver/gameserver/center/CommandGUI.java (revision 0)
@@ -0,0 +1,311 @@
+/*
+ * Copyright (C) 2004-2015 L2J Server
+ *
+ * This file is part of L2J Server.
+ *
+ * L2J Server is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.center;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.event.ActionListener;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.ScrollPaneConstants;
+import javax.swing.Timer;
+import javax.swing.border.EmptyBorder;
+
+import com.l2jserver.Config;
+import com.l2jserver.L2DatabaseFactory;
+import com.l2jserver.gameserver.GameServer;
+import com.l2jserver.gameserver.Shutdown;
+import com.l2jserver.gameserver.center.page.DlgRestart;
+import com.l2jserver.gameserver.center.page.DlgShutdown;
+import com.l2jserver.gameserver.center.page.SettingsPage;
+import com.l2jserver.gameserver.data.xml.impl.AdminData;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.tools.images.ImagesTable;
+
+/**
+ * @author micr0
+ */
+public class CommandGUI extends JFrame
+{
+ public static final Logger _log = Logger.getLogger(CommandGUI.class.getName());
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8572019066158235300L;
+ private final JPanel contentPane;
+ private L2World world;
+
+ /**
+ * Launch the application.
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ EventQueue.invokeLater(() ->
+ {
+ try
+ {
+ CommandGUI frame = new CommandGUI();
+ frame.setVisible(true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ });
+ }
+
+ String[] fileSizeUnits =
+ {
+ "bytes",
+ "KB",
+ "MB",
+ "GB",
+ "TB",
+ "PB",
+ "EB",
+ "ZB",
+ "YB"
+ };
+
+ public String calculate(double bytes)
+ {
+ String sizeToReturn = "";
+ int index = 0;
+ for (index = 0; index < fileSizeUnits.length; index++)
+ {
+ if (bytes < 1024)
+ {
+ break;
+ }
+ bytes = bytes / 1024;
+ }
+ sizeToReturn = String.valueOf(bytes) + " " + fileSizeUnits[index];
+ return sizeToReturn;
+ }
+
+ public int getAccountCount()
+ {
+ int count = 0;
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ Statement s = con.createStatement();
+ ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM characters GROUP BY account_name"))
+ {
+ while (rs.next())
+ {
+ count = rs.getInt(1);
+ }
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.SEVERE, "Error restoring CommandCenter.", e);
+ }
+ return count;
+ }
+
+ public int getCharacterCount()
+ {
+ int count = 0;
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ Statement s = con.createStatement();
+ ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM characters"))
+ {
+ while (rs.next())
+ {
+ count = rs.getInt(1);
+ }
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.SEVERE, "Error restoring CommandCenter.", e);
+ }
+ return count;
+ }
+
+ /**
+ * Create the frame.
+ */
+ public CommandGUI()
+ {
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ setBounds(100, 100, 834, 480);
+ setTitle("L2JServer Command Center - 1.1.0");
+ setIconImage(ImagesTable.getImage("l2j.png").getImage());
+ contentPane = new JPanel();
+ contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
+ contentPane.setLayout(new BorderLayout(0, 0));
+ setContentPane(contentPane);
+
+ JPanel panel = new JPanel();
+ panel.setBackground(Color.DARK_GRAY);
+ contentPane.add(panel, BorderLayout.CENTER);
+ panel.setLayout(null);
+
+ Icon RestartIcon = new ImageIcon("..\\images\\restart.png");
+ JButton btnNewButton = new JButton();
+ btnNewButton.addActionListener(arg0 ->
+ {
+ DlgRestart.main();
+ });
+ btnNewButton.setIcon(RestartIcon);
+ btnNewButton.setBounds(662, 79, 132, 42);
+ panel.add(btnNewButton);
+
+ Icon Shutdowns = new ImageIcon("..\\images\\shutdonw.png");
+ JButton btnNewButton_1 = new JButton(Shutdowns);
+ btnNewButton_1.addActionListener(e ->
+ {
+ DlgShutdown.main();
+ });
+ btnNewButton_1.setBounds(662, 134, 132, 42);
+ panel.add(btnNewButton_1);
+
+ Icon abort = new ImageIcon("..\\images\\abort.png");
+ JButton btnNewButton_2 = new JButton(abort);
+ btnNewButton_2.addActionListener(e ->
+ {
+ Shutdown.getInstance().telnetAbort("127.0.0.1");
+ _log.info("OK! - Shutdown/Restart Aborted.");
+ });
+ btnNewButton_2.setBounds(662, 189, 132, 42);
+ panel.add(btnNewButton_2);
+
+ Icon sett = new ImageIcon("..\\images\\settings.png");
+ JButton btnNewButton_3 = new JButton(sett);
+ btnNewButton_3.addActionListener(arg0 ->
+ {
+ SettingsPage page = new SettingsPage();
+ page.setVisible(true);
+
+ });
+ btnNewButton_3.setBounds(662, 246, 132, 42);
+ panel.add(btnNewButton_3);
+
+ JLabel lblNewLabel = new JLabel("Online: " + L2World.getInstance().getAllPlayersCount() + " / " + Config.MAXIMUM_ONLINE_USERS + " / " + L2World.getInstance().getPlayers().stream().filter(p -> (p.getClient() == null) || p.getClient().isDetached()).count());
+ lblNewLabel.setToolTipText("Real Time online Players / max online Players / offline Traders");
+ lblNewLabel.setForeground(Color.GREEN);
+ lblNewLabel.setBounds(96, 57, 144, 16);
+ final Timer online = new Timer(500, null);
+ ActionListener onlinee = e -> lblNewLabel.setText("Online: " + L2World.getInstance().getAllPlayersCount() + " / " + Config.MAXIMUM_ONLINE_USERS + " / " + L2World.getInstance().getPlayers().stream().filter(p -> (p.getClient() == null) || p.getClient().isDetached()).count());
+ online.addActionListener(onlinee);
+ online.start();
+ panel.add(lblNewLabel);
+
+ JLabel lblNewLabel_1 = new JLabel("Characters: " + Integer.valueOf(getCharacterCount()));
+ lblNewLabel_1.setForeground(Color.GREEN);
+ lblNewLabel_1.setBounds(501, 57, 125, 16);
+ final Timer character = new Timer(500, null);
+ ActionListener chars = e -> lblNewLabel_1.setText("Characters: " + Integer.valueOf(getCharacterCount()));
+ character.addActionListener(chars);
+ character.start();
+ panel.add(lblNewLabel_1);
+
+ JLabel lblAccounts = new JLabel("Accounts: " + Integer.valueOf(getAccountCount()));
+ lblAccounts.setForeground(Color.GREEN);
+ lblAccounts.setBounds(367, 57, 134, 16);
+ final Timer account = new Timer(500, null);
+ ActionListener acc = e -> lblAccounts.setText("Accounts: " + Integer.valueOf(getAccountCount()));
+ account.addActionListener(acc);
+ account.start();
+ panel.add(lblAccounts);
+
+ JLabel lblNewLabel_2 = new JLabel("Server Ram:");
+ lblNewLabel_2.setForeground(Color.GREEN);
+ lblNewLabel_2.setBounds(686, 318, 88, 16);
+ panel.add(lblNewLabel_2);
+
+ JLabel lblNewLabel_3 = new JLabel(calculate(Runtime.getRuntime().maxMemory()) + " / " + (((Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory()) + Runtime.getRuntime().freeMemory()) / 1048576) + " MB");
+ lblNewLabel_3.setForeground(Color.GREEN);
+ lblNewLabel_3.setBounds(662, 336, 132, 16);
+ final Timer ram = new Timer(500, null);
+ ActionListener rams = e -> lblNewLabel_3.setText(calculate(Runtime.getRuntime().maxMemory()) + " / " + (((Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory()) + Runtime.getRuntime().freeMemory()) / 1048576) + " MB");
+ ram.addActionListener(rams);
+ ram.start();
+ panel.add(lblNewLabel_3);
+
+ Icon setta = new ImageIcon("..\\images\\L2jlogo.png");
+ JLabel lblNewLabel_4 = new JLabel(setta);
+ lblNewLabel_4.setBounds(5, 7, 210, 66);
+ panel.add(lblNewLabel_4);
+
+ JLabel lblNewLabel_5 = new JLabel("Server UpTime: " + GameServer.getUptime());
+ lblNewLabel_5.setForeground(Color.GREEN);
+ lblNewLabel_5.setBounds(501, 13, 292, 16);
+ final Timer up = new Timer(500, null);
+ ActionListener times = e -> lblNewLabel_5.setText("Server UpTime: " + GameServer.getUptime());
+ up.addActionListener(times);
+ up.start();
+ panel.add(lblNewLabel_5);
+
+ JLabel lblNewLabel_6 = new JLabel("Online GM: " + AdminData.getInstance().getAllGms(true).size());
+ lblNewLabel_6.setForeground(Color.GREEN);
+ lblNewLabel_6.setBounds(243, 57, 112, 16);
+ final Timer onGM = new Timer(50, null);
+ ActionListener onGms = e -> lblNewLabel_6.setText("Online GM: " + AdminData.getInstance().getAllGms(true).size());
+ onGM.addActionListener(onGms);
+ onGM.start();
+ panel.add(lblNewLabel_6);
+
+ JPanel panel_1 = new JPanel();
+ panel_1.setBounds(15, 81, 611, 311);
+ panel.add(panel_1);
+ panel_1.setLayout(null);
+
+ JTextArea textArea = new JTextArea();
+ textArea.setFont(new Font("Monospaced", Font.PLAIN, 13));
+ textArea.setForeground(Color.GREEN);
+ textArea.setBackground(Color.BLACK);
+ textArea.setBounds(-77, -59, 611, 311);
+ if (world != null)
+ {
+ world.getPlayers().forEach(player ->
+ {
+ textArea.append("--> ID:" + player.getObjectId() + " Name:" + player.getName() + " Pvp: " + player.getPvpKills() + " Pk: " + player.getPkKills() + " Hp: " + player.getMaxHp() + "/" + player.getCurrentHp() + " Mp:" + player.getMaxMp() + "/" + player.getCurrentMp() + "  <-- \n");
+ });
+ }
+ else
+ {
+ textArea.append("Null world");
+ }
+
+ panel_1.add(textArea);
+ JScrollPane scrollPane = new JScrollPane(textArea);
+ scrollPane.setBounds(0, 1, 611, 311);
+ scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
+ scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ panel_1.add(scrollPane);
+ setLocationRelativeTo(null);
+
+ }
+}
Index: java/com/l2jserver/gameserver/center/page/DlgRestart.java
===================================================================
--- java/com/l2jserver/gameserver/center/page/DlgRestart.java (revision 0)
+++ java/com/l2jserver/gameserver/center/page/DlgRestart.java (revision 0)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2004-2015 L2J Server
+ *
+ * This file is part of L2J Server.
+ *
+ * L2J Server is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.center.page;
+
+import java.util.logging.Logger;
+
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import com.l2jserver.gameserver.Shutdown;
+
+/**
+ * @author micr0
+ */
+public class DlgRestart
+{
+ public static final Logger _log = Logger.getLogger(DlgRestart.class.getName());
+
+ /**
+ * @wbp.parser.entryPoint
+ */
+ public static void main()
+ {
+ Object[] options1 =
+ {
+ "Restart",
+ "Cancel"
+ };
+
+ JPanel panel = new JPanel();
+ panel.add(new JLabel("Restarting server after: "));
+ JTextField textField = new JTextField(10);
+ panel.add(textField);
+
+ int result = JOptionPane.showOptionDialog(null, panel, "Restart Server", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null);
+ if (result == JOptionPane.YES_OPTION)
+ {
+ try
+ {
+ Shutdown.getInstance().startTelnetShutdown("Command Center", Integer.valueOf(textField.getText()), true);
+ _log.info("Server Will Restart In " + Integer.valueOf(textField.getText()) + " Seconds!");
+ _log.info("Type \"abort\" To Abort Restart!");
+ }
+ catch (StringIndexOutOfBoundsException e1)
+ {
+ _log.info("Please Enter * amount of seconds to restart!");
+ }
+ catch (Exception NumberFormatException)
+ {
+ _log.info("Numbers Only!");
+ }
+ JOptionPane.showMessageDialog(null, "Server is restarting after: " + textField.getText() + " Seconds.!");
+ }
+ }
+
+}
Index: java/com/l2jserver/gameserver/center/page/DlgShutdown.java
===================================================================
--- java/com/l2jserver/gameserver/center/page/DlgShutdown.java (revision 0)
+++ java/com/l2jserver/gameserver/center/page/DlgShutdown.java (revision 0)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2004-2015 L2J Server
+ *
+ * This file is part of L2J Server.
+ *
+ * L2J Server is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.center.page;
+
+import java.util.logging.Logger;
+
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import com.l2jserver.gameserver.Shutdown;
+
+/**
+ * @author micr0
+ */
+public class DlgShutdown
+{
+ public static final Logger _log = Logger.getLogger(DlgShutdown.class.getName());
+
+ public static void main()
+ {
+ Object[] options1 =
+ {
+ "Shutdown",
+ "Cancel"
+ };
+
+ JPanel panel = new JPanel();
+ panel.add(new JLabel("Shutdown server after: "));
+ JTextField textField = new JTextField(10);
+ panel.add(textField);
+
+ int result = JOptionPane.showOptionDialog(null, panel, "Shutdown Server", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options1, null);
+ if (result == JOptionPane.YES_OPTION)
+ {
+ try
+ {
+ Shutdown.getInstance().startTelnetShutdown("Command Center", Integer.valueOf(textField.getText()), false);
+ _log.info("Server Will Shutdown In " + Integer.valueOf(textField.getText()) + " Seconds!");
+ _log.info("Type \"abort\" To abort shutdown!");
+ }
+ catch (StringIndexOutOfBoundsException e1)
+ {
+ _log.info("Please Enter * amount of seconds to restart!");
+ }
+ catch (Exception NumberFormatException)
+ {
+ _log.info("Numbers Only!");
+ }
+ JOptionPane.showMessageDialog(null, "Server is restarting after: " + textField.getText() + " Seconds.!");
+ }
+ }
+}
Index: java/com/l2jserver/gameserver/center/page/SettingsPage.java
===================================================================
--- java/com/l2jserver/gameserver/center/page/SettingsPage.java (revision 0)
+++ java/com/l2jserver/gameserver/center/page/SettingsPage.java (revision 0)
@@ -0,0 +1,1033 @@
+/*
+ * Copyright (C) 2004-2015 L2J Server
+ *
+ * This file is part of L2J Server.
+ *
+ * L2J Server is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J Server is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.center.page;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.io.File;
+import java.util.logging.Logger;
+
+import javax.script.ScriptException;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JSeparator;
+import javax.swing.JTextField;
+import javax.swing.WindowConstants;
+import javax.swing.border.EmptyBorder;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.cache.HtmCache;
+import com.l2jserver.gameserver.data.sql.impl.CharNameTable;
+import com.l2jserver.gameserver.data.sql.impl.CrestTable;
+import com.l2jserver.gameserver.data.sql.impl.TeleportLocationTable;
+import com.l2jserver.gameserver.data.xml.impl.AdminData;
+import com.l2jserver.gameserver.data.xml.impl.BuyListData;
+import com.l2jserver.gameserver.data.xml.impl.DoorData;
+import com.l2jserver.gameserver.data.xml.impl.EnchantItemData;
+import com.l2jserver.gameserver.data.xml.impl.EnchantItemGroupsData;
+import com.l2jserver.gameserver.data.xml.impl.MultisellData;
+import com.l2jserver.gameserver.data.xml.impl.NpcData;
+import com.l2jserver.gameserver.data.xml.impl.TransformData;
+import com.l2jserver.gameserver.datatables.ItemTable;
+import com.l2jserver.gameserver.datatables.SkillData;
+import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager;
+import com.l2jserver.gameserver.instancemanager.PunishmentManager;
+import com.l2jserver.gameserver.instancemanager.QuestManager;
+import com.l2jserver.gameserver.instancemanager.WalkingManager;
+import com.l2jserver.gameserver.instancemanager.ZoneManager;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.punishment.PunishmentAffect;
+import com.l2jserver.gameserver.model.punishment.PunishmentTask;
+import com.l2jserver.gameserver.model.punishment.PunishmentType;
+import com.l2jserver.gameserver.network.clientpackets.Say2;
+import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
+import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
+import com.l2jserver.gameserver.scripting.L2ScriptEngineManager;
+import com.l2jserver.gameserver.util.Broadcast;
+import com.l2jserver.tools.images.ImagesTable;
+
+/**
+ * @author micr0
+ */
+public class SettingsPage extends JFrame
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public static final Logger _log = Logger.getLogger(SettingsPage.class.getName());
+
+ public final JPanel contentPane;
+ public final JTextField KickText;
+ public final JTextField JailText;
+ public final JTextField BanText;
+ public final JTextField Jailtime;
+ public final JTextField UnJail_1;
+ public final JTextField BanTime;
+ public final JTextField UnBanText;
+ public final JTextField txtPlayerName;
+ public final JTextField txtMessage;
+ public final JTextField AnnounceText;
+ public final JTextField toallText;
+ public final JTextField txtKickmessage;
+ public final JTextField JailMessage;
+ public final JTextField BanMessage;
+ public final JTextField UnJailMessage;
+
+ /**
+ * Launch the application.
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ EventQueue.invokeLater(() ->
+ {
+ try
+ {
+ SettingsPage frame = new SettingsPage();
+ frame.setVisible(true);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ });
+ }
+
+ /**
+ * Create the frame.
+ */
+ public SettingsPage()
+ {
+ setTitle("Settigs Panel");
+ setIconImage(ImagesTable.getImage("l2j.png").getImage());
+ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ setBounds(100, 100, 603, 537);
+ contentPane = new JPanel();
+ contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
+ contentPane.setLayout(new BorderLayout(0, 0));
+ setContentPane(contentPane);
+
+ JPanel panel = new JPanel();
+ panel.setBackground(Color.DARK_GRAY);
+ contentPane.add(panel, BorderLayout.CENTER);
+ panel.setLayout(null);
+
+ JLabel lblNewLabel = new JLabel("Admin Panel");
+ lblNewLabel.setForeground(Color.WHITE);
+ lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 21));
+ lblNewLabel.setBounds(214, 13, 130, 37);
+ panel.add(lblNewLabel);
+
+ JSeparator separator = new JSeparator();
+ separator.setBounds(0, 63, 575, 2);
+ panel.add(separator);
+
+ txtKickmessage = new JTextField();
+ txtKickmessage.setText("You are kicked by gm");
+ txtKickmessage.setBounds(229, 78, 334, 22);
+ panel.add(txtKickmessage);
+ txtKickmessage.setColumns(10);
+
+ KickText = new JTextField();
+ KickText.setText("Name");
+ KickText.setBounds(119, 78, 98, 22);
+ panel.add(KickText);
+ KickText.setColumns(10);
+
+ JButton Kick = new JButton("Kick");
+ Kick.addActionListener(e ->
+ {
+ String name = KickText.getText();
+ L2PcInstance player = L2World.getInstance().getPlayer(name);
+ if (player != null)
+ {
+ player.sendMessage(txtKickmessage.getText());
+ player.logout();
+ _log.info("Player " + name + " Kicked!!");
+ }
+ else
+ {
+ _log.info("Player not found!!" + KickText.getText());
+ }
+ });
+ Kick.setBounds(10, 78, 97, 25);
+ panel.add(Kick);
+
+ JailText = new JTextField();
+ JailText.setText("Name");
+ JailText.setBounds(119, 114, 98, 22);
+ panel.add(JailText);
+ JailText.setColumns(10);
+
+ JailMessage = new JTextField();
+ JailMessage.setText("Contact to the GM For more Info Thanks!.");
+ JailMessage.setBounds(305, 114, 258, 22);
+ panel.add(JailMessage);
+ JailMessage.setColumns(10);
+
+ Jailtime = new JTextField();
+ Jailtime.setText("Time");
+ Jailtime.setBounds(229, 114, 58, 22);
+ panel.add(Jailtime);
+ Jailtime.setColumns(10);
+
+ JButton Jail = new JButton("Jail");
+ Jail.addActionListener(e ->
+ {
+
+ int charId = CharNameTable.getInstance().getIdByName(JailText.getText());
+ if (charId > 0)
+ {
+ long expirationTime = Integer.valueOf(Jailtime.getText()) > 0 ? System.currentTimeMillis() + (Integer.valueOf(Jailtime.getText()) * 60 * 1000) : -1;
+ PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, expirationTime, JailMessage.getText(), "Administrator"));
+ _log.info("Character " + JailText.getText() + " jailed for " + (Integer.valueOf(Jailtime.getText()) > 0 ? Integer.valueOf(Jailtime.getText()) + " minutes." : "ever!"));
+ }
+ else
+ {
+ _log.info("Character with name: " + JailText.getText() + " was not found!");
+ }
+ });
+ Jail.setBounds(10, 113, 97, 25);
+ panel.add(Jail);
+
+ BanText = new JTextField();
+ BanText.setText("Name");
+ BanText.setBounds(119, 151, 98, 22);
+ panel.add(BanText);
+ BanText.setColumns(10);
+
+ BanMessage = new JTextField();
+ BanMessage.setText("Contact to the GM For more Info Thanks!.");
+ BanMessage.setBounds(305, 149, 258, 22);
+ panel.add(BanMessage);
+ BanMessage.setColumns(10);
+
+ BanTime = new JTextField();
+ BanTime.setText("Time");
+ BanTime.setBounds(229, 149, 58, 22);
+ panel.add(BanTime);
+ BanTime.setColumns(10);
+
+ JButton BanBtn = new JButton("Ban");
+ BanBtn.addActionListener(e ->
+ {
+ int charId = CharNameTable.getInstance().getIdByName(BanText.getText());
+ if (charId > 0)
+ {
+ PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.BAN, Integer.valueOf(BanTime.getText()), BanMessage.getText(), "Administrator"));
+ }
+ else
+ {
+ _log.info("Character : " + BanText.getText() + " was not found!");
+ }
+
+ });
+ BanBtn.setBounds(10, 148, 97, 25);
+ panel.add(BanBtn);
+
+ UnJailMessage = new JTextField();
+ UnJailMessage.setText("next time be more careful Thanks!.");
+ UnJailMessage.setBounds(229, 184, 334, 22);
+ panel.add(UnJailMessage);
+ UnJailMessage.setColumns(10);
+
+ UnJail_1 = new JTextField();
+ UnJail_1.setText("Name");
+ UnJail_1.setBounds(119, 184, 97, 22);
+ panel.add(UnJail_1);
+ UnJail_1.setColumns(10);
+
+ JButton UnJail = new JButton("UnJail");
+ UnJail.addActionListener(e ->
+ {
+ int charId = CharNameTable.getInstance().getIdByName(UnJail_1.getText());
+ L2PcInstance player = L2World.getInstance().getPlayer(UnJail_1.getText());
+ if (charId > 0)
+ {
+ PunishmentManager.getInstance().stopPunishment(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL);
+ player.sendMessage(UnJailMessage.getText());
+ _log.info("Character " + UnJail_1.getText() + " have been unjailed");
+ }
+ else
+ {
+ _log.info("Character with name: " + UnJail_1.getText() + " was not found!");
+ }
+ });
+ UnJail.setBounds(10, 183, 97, 25);
+ panel.add(UnJail);
+
+ UnBanText = new JTextField();
+ UnBanText.setText("Name");
+ UnBanText.setBounds(119, 222, 98, 22);
+ panel.add(UnBanText);
+ UnBanText.setColumns(10);
+
+ JButton UnbanBtn = new JButton("UnBan");
+ UnbanBtn.addActionListener(e ->
+ {
+ int charId = CharNameTable.getInstance().getIdByName(UnBanText.getText());
+ if (charId > 0)
+ {
+ PunishmentManager.getInstance().stopPunishment(charId, PunishmentAffect.CHARACTER, PunishmentType.BAN);
+ }
+ else
+ {
+ _log.info("Character : " + UnBanText.getText() + " was not found!");
+ }
+ });
+ UnbanBtn.setBounds(10, 219, 97, 25);
+ panel.add(UnbanBtn);
+
+ final JComboBox<String> Box2 = new JComboBox<>();
+ Box2.addItem("All");
+ Box2.addItem("Shout");
+ Box2.addItem("Tell");
+ Box2.addItem("Party");
+ Box2.addItem("Clan");
+ Box2.addItem("GM");
+ Box2.addItem("PetitionPlayer");
+ Box2.addItem("PetitionGM");
+ Box2.addItem("Trade");
+ Box2.addItem("Alliance");
+ Box2.addItem("Boat");
+ Box2.addItem("Friend");
+ Box2.addItem("Msn");
+ Box2.addItem("PartyRoom");
+ Box2.addItem("PartyRoomCmd");
+ Box2.addItem("PartyRoomAll");
+ Box2.addItem("HeroVoice");
+ Box2.addItem("BattlefieLd");
+ Box2.addItem("MpccRoom");
+ Box2.addItem("NpcAll");
+ Box2.addItem("Npcshout");
+ Box2.setBounds(436, 306, 127, 22);
+ panel.add(Box2);
+
+ txtPlayerName = new JTextField();
+ txtPlayerName.setText("Name");
+ txtPlayerName.setBounds(119, 306, 98, 22);
+ panel.add(txtPlayerName);
+ txtPlayerName.setColumns(10);
+
+ txtMessage = new JTextField();
+ txtMessage.setText("Message");
+ txtMessage.setBounds(226, 306, 198, 22);
+ panel.add(txtMessage);
+ txtMessage.setColumns(10);
+
+ JButton PlayerMsgBtn = new JButton("Send");
+ PlayerMsgBtn.addActionListener(e ->
+ {
+ String PlayerMsg = (String) Box2.getSelectedItem();
+ switch (PlayerMsg)
+ {
+ case "All":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.ALL, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "Shout":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.SHOUT, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "Tell":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.TELL, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "Party":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.PARTY, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "Clan":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.CLAN, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "GM":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.GM, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "PetitionPlayer":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.PETITION_PLAYER, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "PetitionGM":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.PETITION_GM, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "Trade":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.TRADE, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "Alliance":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.ALLIANCE, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "Boat":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.BOAT, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "Friend":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.L2FRIEND, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "Msn":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.MSNCHAT, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "PartyRoom":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.PARTYMATCH_ROOM, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "PartyRoomCmd":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "PartyRoomAll":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.PARTYROOM_ALL, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "HeroVoice":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.HERO_VOICE, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "BattlefieLd":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.BATTLEFIELD, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "MpccRoom":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.MPCC_ROOM, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "NpcAll":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.NPC_ALL, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+ case "NpcShout":
+ try
+ {
+ L2PcInstance reciever = L2World.getInstance().getPlayer(txtPlayerName.getText());
+ CreatureSay cs = new CreatureSay(0, Say2.NPC_SHOUT, "Command Center", txtMessage.getText());
+ if (reciever != null)
+ {
+ reciever.sendPacket(cs);
+ _log.info("Command Center ->" + txtPlayerName.getText() + ": " + txtMessage.getText());
+ _log.info("Message Sent!");
+ }
+ else
+ {
+ _log.info("Unable To Find Username: " + txtPlayerName.getText());
+ }
+ }
+ catch (StringIndexOutOfBoundsException e3)
+ {
+ _log.info("Please Enter Some Text!");
+ }
+ break;
+
+ }
+ });
+ PlayerMsgBtn.setBounds(10, 305, 97, 25);
+ panel.add(PlayerMsgBtn);
+
+ JSeparator separator_1 = new JSeparator();
+ separator_1.setBounds(0, 257, 575, 2);
+ panel.add(separator_1);
+
+ final JComboBox<String> Box = new JComboBox<>();
+ Box.addItem("Normal_Announce");
+ Box.addItem("Critical_Announce");
+ Box.setBounds(436, 367, 127, 22);
+ panel.add(Box);
+
+ AnnounceText = new JTextField();
+ AnnounceText.setText("Text");
+ AnnounceText.setBounds(119, 367, 305, 22);
+ panel.add(AnnounceText);
+ AnnounceText.setColumns(10);
+
+ JButton AnnounceBtn = new JButton("Send");
+ AnnounceBtn.addActionListener(arg0 ->
+ {
+ String announce = (String) Box.getSelectedItem();
+ switch (announce)
+ {
+ case "Normal_Announce":
+ try
+ {
+ Broadcast.toAllOnlinePlayers(AnnounceText.getText());
+ _log.info("Announcement Sent!");
+ }
+ catch (StringIndexOutOfBoundsException e2)
+ {
+ _log.info("Please Enter Some Text To Announce!");
+ }
+ break;
+ case "Critical_Announce":
+ try
+ {
+ Broadcast.toAllOnlinePlayers(AnnounceText.getText(), true);
+ _log.info("Announcement Sent!");
+ }
+ catch (StringIndexOutOfBoundsException e2)
+ {
+ _log.info("Please Enter Some Text To Announce!");
+ }
+ break;
+ }
+
+ });
+ AnnounceBtn.setBounds(10, 366, 97, 25);
+ panel.add(AnnounceBtn);
+
+ toallText = new JTextField();
+ toallText.setText("To all online Players on Screen");
+ toallText.setBounds(116, 430, 308, 22);
+ panel.add(toallText);
+ toallText.setColumns(10);
+
+ final JComboBox<String> comboBox = new JComboBox<>();
+ comboBox.addItem("TOP_LEFT");
+ comboBox.addItem("TOP_CENTER");
+ comboBox.addItem("TOP_RIGHT");
+ comboBox.addItem("MIDDLE_LEFT");
+ comboBox.addItem("MIDDLE_CENTER");
+ comboBox.addItem("MIDDLE_RIGHT");
+ comboBox.addItem("BOTTOM_CENTER");
+ comboBox.addItem("BOTTOM_RIGHT");
+ comboBox.setBounds(436, 430, 127, 22);
+ panel.add(comboBox);
+
+ JButton toAllonScreen = new JButton("Send");
+ toAllonScreen.addActionListener(arg0 ->
+ {
+ String screen = (String) comboBox.getSelectedItem();
+ switch (screen)
+ {
+ case "TOP_LEFT":
+ Broadcast.toAllOnlinePlayers(new ExShowScreenMessage(toallText.getText(), ExShowScreenMessage.TOP_LEFT, 10000));
+ break;
+ case "TOP_CENTER":
+ Broadcast.toAllOnlinePlayers(new ExShowScreenMessage(toallText.getText(), ExShowScreenMessage.TOP_CENTER, 10000));
+ break;
+ case "TOP_RIGHT":
+ Broadcast.toAllOnlinePlayers(new ExShowScreenMessage(toallText.getText(), ExShowScreenMessage.TOP_RIGHT, 10000));
+ break;
+ case "MIDDLE_LEFT":
+ Broadcast.toAllOnlinePlayers(new ExShowScreenMessage(toallText.getText(), ExShowScreenMessage.MIDDLE_LEFT, 10000));
+ break;
+ case "MIDDLE_CENTER":
+ Broadcast.toAllOnlinePlayers(new ExShowScreenMessage(toallText.getText(), ExShowScreenMessage.MIDDLE_CENTER, 10000));
+ break;
+ case "MIDDLE_RIGHT":
+ Broadcast.toAllOnlinePlayers(new ExShowScreenMessage(toallText.getText(), ExShowScreenMessage.MIDDLE_RIGHT, 10000));
+ break;
+ case "BOTTOM_CENTER":
+ Broadcast.toAllOnlinePlayers(new ExShowScreenMessage(toallText.getText(), ExShowScreenMessage.BOTTOM_CENTER, 10000));
+ break;
+ case "BOTTOM_RIGHT":
+ Broadcast.toAllOnlinePlayers(new ExShowScreenMessage(toallText.getText(), ExShowScreenMessage.BOTTOM_RIGHT, 10000));
+ break;
+ }
+ });
+ toAllonScreen.setBounds(10, 429, 97, 25);
+ panel.add(toAllonScreen);
+
+ final JComboBox<String> rebox = new JComboBox<>();
+ rebox.addItem("config");
+ rebox.addItem("access");
+ rebox.addItem("npc");
+ rebox.addItem("quest");
+ rebox.addItem("walker");
+ rebox.addItem("html");
+ rebox.addItem("multisell");
+ rebox.addItem("buylist");
+ rebox.addItem("teleport");
+ rebox.addItem("skill");
+ rebox.addItem("item");
+ rebox.addItem("door");
+ rebox.addItem("zone");
+ rebox.addItem("cursed");
+ rebox.addItem("crest");
+ rebox.addItem("effect");
+ rebox.addItem("handler");
+ rebox.addItem("enchant");
+ rebox.addItem("transform");
+ rebox.setBounds(258, 219, 149, 22);
+ panel.add(rebox);
+
+ JButton Reload = new JButton("Reload");
+ Reload.addActionListener(e ->
+ {
+ int response = JOptionPane.showConfirmDialog(null, "WARNING: There are several known issues regarding this feature.\n Reloading server data during runtime is STRONGLY NOT RECOMMENDED for live servers,\n just for developing environments.", "Warning", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
+ if (response == JOptionPane.YES_OPTION)
+ {
+ String reload = (String) rebox.getSelectedItem();
+ switch (reload)
+ {
+ case "config":
+ Config.load();
+ break;
+ case "access":
+ AdminData.getInstance().load();
+ break;
+ case "npc":
+ NpcData.getInstance().load();
+ break;
+ case "quest":
+ QuestManager.getInstance().reloadAllScripts();
+ break;
+ case "walker":
+ WalkingManager.getInstance().load();
+ break;
+ case "html":
+ HtmCache.getInstance().reload();
+ break;
+ case "multisell":
+ MultisellData.getInstance().load();
+ break;
+ case "buylist":
+ BuyListData.getInstance().load();
+ break;
+ case "teleport":
+ TeleportLocationTable.getInstance().reloadAll();
+ break;
+ case "skill":
+ SkillData.getInstance().reload();
+ break;
+ case "item":
+ ItemTable.getInstance().reload();
+ break;
+ case "door":
+ DoorData.getInstance().load();
+ break;
+ case "zone":
+ ZoneManager.getInstance().reload();
+ break;
+ case "cursed":
+ CursedWeaponsManager.getInstance().reload();
+ break;
+ case "crest":
+ CrestTable.getInstance().load();
+ break;
+ case "effect":
+ final File file = new File(L2ScriptEngineManager.SCRIPT_FOLDER, "handlers/EffectMasterHandler.java");
+ try
+ {
+ L2ScriptEngineManager.getInstance().executeScript(file);
+ }
+ catch (ScriptException e2)
+ {
+ L2ScriptEngineManager.getInstance().reportScriptFileError(file, e2);
+ _log.info("Error Reloading Effect" + e2);
+ }
+ break;
+ case "handler":
+ final File file1 = new File(L2ScriptEngineManager.SCRIPT_FOLDER, "handlers/MasterHandler.java");
+ try
+ {
+ L2ScriptEngineManager.getInstance().executeScript(file1);
+ }
+ catch (ScriptException e1)
+ {
+ L2ScriptEngineManager.getInstance().reportScriptFileError(file1, e1);
+ _log.info("Error Reloading Effect" + e1);
+ }
+ break;
+ case "enchant":
+ EnchantItemGroupsData.getInstance().load();
+ EnchantItemData.getInstance().load();
+ break;
+ case "transform":
+ TransformData.getInstance().load();
+ break;
+
+ }
+ }
+ });
+ Reload.setBounds(436, 219, 97, 25);
+ panel.add(Reload);
+
+ JLabel lblNewLabel_1 = new JLabel("Show Screen Message");
+ lblNewLabel_1.setForeground(Color.WHITE);
+ lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 16));
+ lblNewLabel_1.setBounds(214, 402, 167, 25);
+ panel.add(lblNewLabel_1);
+
+ JLabel lblNewLabel_3 = new JLabel("Message to Player");
+ lblNewLabel_3.setForeground(Color.WHITE);
+ lblNewLabel_3.setFont(new Font("Tahoma", Font.PLAIN, 16));
+ lblNewLabel_3.setBounds(214, 283, 130, 16);
+ panel.add(lblNewLabel_3);
+
+ JLabel lblNewLabel_2 = new JLabel("Announce Message");
+ lblNewLabel_2.setForeground(Color.WHITE);
+ lblNewLabel_2.setFont(new Font("Tahoma", Font.PLAIN, 16));
+ lblNewLabel_2.setBounds(214, 341, 153, 22);
+ panel.add(lblNewLabel_2);
+
+ }
+}
Index: java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java
===================================================================
--- java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java (revision 10701)
+++ java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java (working copy)
@@ -75,6 +75,28 @@
  }
 
  /**
+ * Display a String on the screen for a given time.
+ * @param text the text to display
+ * @param position
+ * @param time the display time
+ */
+ public ExShowScreenMessage(String text, int position, int time)
+ {
+ _type = 2;
+ _sysMessageId = -1;
+ _unk1 = 0;
+ _unk2 = 0;
+ _unk3 = 0;
+ _fade = false;
+ _position = position;
+ _text = text;
+ _time = time;
+ _size = 0;
+ _effect = false;
+ _npcString = -1;
+ }
+
+ /**
  * Display a NPC String on the screen for a given position and time.
  * @param npcString the NPC String Id
  * @param position the position on the screen