(https://www.united-extreme.com/u3games/foro/proxy.php?request=http%3A%2F%2Fs8.postimg.org%2Foe5z8brmt%2Fimage.jpg&hash=2ab702c5ad813a34fa94d025e542d280288e0420)
(https://www.united-extreme.com/u3games/foro/proxy.php?request=http%3A%2F%2Fwww.l2jserver.com%2Fforum%2Fdownload%2Ffile.php%3Fid%3D5681&hash=4801859f03d965b686f4b8d3fbabade8c210dd5d)
Index: java/com/l2jserver/gameserver/GameServer.java
===================================================================
--- java/com/l2jserver/gameserver/GameServer.java (revision 10590)
+++ java/com/l2jserver/gameserver/GameServer.java (working copy)
@@ -135,6 +135,7 @@
import com.l2jserver.gameserver.scripting.L2ScriptEngineManager;
import com.l2jserver.gameserver.taskmanager.KnownListUpdateTaskManager;
import com.l2jserver.gameserver.taskmanager.TaskManager;
+import com.l2jserver.gui.Main;
import com.l2jserver.mmocore.SelectorConfig;
import com.l2jserver.mmocore.SelectorThread;
import com.l2jserver.status.Status;
@@ -151,7 +152,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;
}
@@ -440,6 +441,8 @@
printSection("UPnP");
UPnPService.getInstance();
+ Main info = new Main();
+ info.init();
}
public static void main(String[] args) throws Exception
Index: java/com/l2jserver/gui/Main.java
===================================================================
--- java/com/l2jserver/gui/Main.java (revision 0)
+++ java/com/l2jserver/gui/Main.java (revision 0)
@@ -0,0 +1,56 @@
+/*
+ * 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.gui;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+/**
+ * @author Micr0
+ */
+public class Main extends Application
+{
+ @Override
+ public void start(Stage primaryStage)
+ {
+ try
+ {
+ final Parent root = FXMLLoader.load(getClass().getResource("/com/l2jserver/gui/fxml/Main.fxml"));
+ final Scene scene = new Scene(root);
+ primaryStage.setScene(scene);
+ primaryStage.setMinWidth(321);
+ primaryStage.setMinHeight(234);
+ primaryStage.setResizable(false);
+ primaryStage.setTitle("L2JConsole Server Information");
+ primaryStage.show();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ launch(args);
+ }
+}
Index: java/com/l2jserver/gui/MainController.java
===================================================================
--- java/com/l2jserver/gui/MainController.java (revision 0)
+++ java/com/l2jserver/gui/MainController.java (revision 0)
@@ -0,0 +1,101 @@
+/*
+ * 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.gui;
+
+import java.net.URL;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.ResourceBundle;
+
+import javafx.animation.Animation;
+import javafx.animation.KeyFrame;
+import javafx.animation.Timeline;
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.scene.control.Label;
+import javafx.util.Duration;
+
+import com.l2jserver.Config;
+import com.l2jserver.L2DatabaseFactory;
+import com.l2jserver.gameserver.GameServer;
+import com.l2jserver.gameserver.model.L2World;
+
+/**
+ * @author Micr0
+ */
+public class MainController implements Initializable
+{
+
+ // Server Information
+ @FXML
+ private Label ServerName;
+ @FXML
+ private Label Revision;
+ @FXML
+ private Label Version;
+ @FXML
+ private Label IP;
+ @FXML
+ private Label Online;
+ @FXML
+ private Label OfflineTraders;
+ @FXML
+ private Label Account;
+
+ // Hardware Information
+ @FXML
+ private Label CPU;
+ @FXML
+ private Label RAM;
+ @FXML
+ private Label OS;
+
+ @Override
+ public void initialize(URL arg0, ResourceBundle arg1)
+ {
+ IP.setText("IP: FIXME");
+ ServerName.setText("Server Name: " + Config.GAMESERVER_HOSTNAME + "");
+ Revision.setText("Revision: 1");
+ Version.setText("Version: HighFive");
+
+ final Timeline UpdateTask = new Timeline(new KeyFrame(Duration.seconds(1), event ->
+ {
+ Online.setText("Online: " + L2World.getInstance().getAllPlayersCount());
+ long shops = L2World.getInstance().getPlayers().stream().filter(p -> (p.getClient() == null) || p.getClient().isDetached()).count();
+ OfflineTraders.setText("Offline Traders: " + shops);
+ RAM.setText("RAM: " + (Runtime.getRuntime().maxMemory() / 1024) + " MB " + "Usage: " + GameServer.getUsedMemoryMB() + " MB");
+ }));
+ UpdateTask.setCycleCount(Animation.INDEFINITE);
+ UpdateTask.play();
+
+ try (Connection con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) FROM accounts;"))
+ {
+ Account.setText("Accounts:" + String.valueOf(ps.getResultSet()));
+ }
+ catch (SQLException e)
+ {
+ // LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Could not check existing petname:" + e.getMessage(), e);
+ }
+
+ CPU.setText("CPU: " + System.getenv("PROCESSOR_IDENTIFIER"));
+ OS.setText("OS: " + System.getProperty("os.name"));
+ }
+}
Index: java/com/l2jserver/gui/fxml/Main.fxml
===================================================================
--- java/com/l2jserver/gui/fxml/Main.fxml (revision 0)
+++ java/com/l2jserver/gui/fxml/Main.fxml (revision 0)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?import javafx.scene.control.*?>
+<?import javafx.scene.effect.*?>
+<?import javafx.scene.image.*?>
+<?import javafx.scene.chart.*?>
+<?import javafx.scene.text.*?>
+<?import java.lang.*?>
+<?import javafx.scene.layout.*?>
+
+<Pane maxHeight="321.0" maxWidth="344.0" minHeight="321.0" minWidth="344.0" prefHeight="321.0" prefWidth="344.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.l2jserver.gui.MainController">
+ <children>
+ <ImageView fitHeight="234.0" fitWidth="344.0" layoutY="7.0" pickOnBounds="true" preserveRatio="true">
+ <image>
+ <Image url="@L2jlogo.png" />
+ </image>
+ <effect>
+ <Reflection />
+ </effect>
+ </ImageView>
+ <Label layoutX="58.0" layoutY="14.0" prefHeight="38.0" prefWidth="253.0" text="Server Information">
+ <font>
+ <Font name="System Bold" size="26.0" />
+ </font>
+ </Label>
+ <Label fx:id="ServerName" layoutX="137.0" layoutY="44.0" text="Server Name:">
+ <font>
+ <Font size="15.0" />
+ </font>
+ </Label>
+ <Label fx:id="Revision" layoutX="247.0" layoutY="299.0" text="Revision:" />
+ <Label fx:id="Version" layoutX="14.0" layoutY="299.0" text="Version:" />
+ <Label fx:id="IP" layoutX="134.0" layoutY="114.0" prefHeight="17.0" prefWidth="85.0" text="IP:" />
+ <Label fx:id="Online" layoutX="56.0" layoutY="138.0" text="Online:" />
+ <Label fx:id="OfflineTraders" layoutX="224.0" layoutY="138.0" text="Offline Traders:" />
+ <Label fx:id="Account" layoutX="137.0" layoutY="161.0" text="Accounts:" />
+ <Label layoutX="58.0" layoutY="191.0" text="Hardware Information">
+ <font>
+ <Font size="26.0" />
+ </font>
+ </Label>
+ <Label fx:id="CPU" layoutX="44.0" layoutY="229.0" text="CPU:" />
+ <Label fx:id="RAM" layoutX="42.0" layoutY="253.0" text="RAM:" />
+ <Label fx:id="OS" layoutX="42.0" layoutY="282.0" text="OS:" />
+ </children>
+</Pane>
l2jlogo
[attachment=0]L2jlogo.png[/attachment]
By iliqbg