Adds the not yet implemented server consoles

This commit is contained in:
Kristian Knarvik 2018-01-30 19:35:42 +01:00
parent 89f0962c2d
commit be32c7e3a1
5 changed files with 77 additions and 2 deletions

View File

@ -1,6 +1,6 @@
Vanilla;Latest,1.12,1.11.2,1.10.2,1.9.4,1.8.9,1.7.10,1.6.4,1.5.2,1.4.7,1.3.2,1.2.5;https://launchermeta.mojang.com/mc/game/version_manifest.json;"release":";";https://s3.amazonaws.com/Minecraft.Download/versions/;/minecraft_server. Vanilla;Latest,1.12,1.11.2,1.10.2,1.9.4,1.8.9,1.7.10,1.6.4,1.5.2,1.4.7,1.3.2,1.2.5;https://launchermeta.mojang.com/mc/game/version_manifest.json;"release":";";https://s3.amazonaws.com/Minecraft.Download/versions/;/minecraft_server.
Snapshot;Latest;https://launchermeta.mojang.com/mc/game/version_manifest.json;"snapshot":";";https://s3.amazonaws.com/Minecraft.Download/versions/;/minecraft_server. Snapshot;Latest;https://launchermeta.mojang.com/mc/game/version_manifest.json;"snapshot":";";https://s3.amazonaws.com/Minecraft.Download/versions/;/minecraft_server.
SpongeVanilla;1.11.2,1.10.2,1.8.9;https://dl-api.spongepowered.org/v1/org.spongepowered/spongevanilla/downloads?type=stable&minecraft=;"version":";",;https://repo.spongepowered.org/maven/org/spongepowered/spongevanilla/;/spongevanilla- SpongeVanilla;1.12.2,1.11.2,1.10.2,1.8.9;https://dl-api.spongepowered.org/v1/org.spongepowered/spongevanilla/downloads?type=stable&minecraft=;"version":";",;https://repo.spongepowered.org/maven/org/spongepowered/spongevanilla/;/spongevanilla-
Bungee;Latest;https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/;Artifacts of BungeeCord #; ;http://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar; Bungee;Latest;https://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/;Artifacts of BungeeCord #; ;http://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar;
Spigot;1.12.2,1.11.2,1.10.2,1.9.4,1.9,1.8.8,1.7.10,1.6.4,1.5.2,1.4.7;https://knarcraft.net/Api/Download/bungeeminecraftserverlauncher/jars/Spigot/ Spigot;1.12.2,1.11.2,1.10.2,1.9.4,1.9,1.8.8,1.7.10,1.6.4,1.5.2,1.4.7;https://knarcraft.net/Api/Download/bungeeminecraftserverlauncher/jars/Spigot/
MCPCplus;1.6.4,1.6.2,1.5.2,1.4.7;https://knarcraft.net/Api/Download/bungeeminecraftserverlauncher/jars/MCPC+/ MCPCplus;1.6.4,1.6.2,1.5.2,1.4.7;https://knarcraft.net/Api/Download/bungeeminecraftserverlauncher/jars/MCPC+/

Can't render this file because it contains an unexpected character in line 1 and column 154.

View File

@ -1,6 +1,7 @@
import net.knarcraft.serverlauncher.profile.Profile; import net.knarcraft.serverlauncher.profile.Profile;
import net.knarcraft.serverlauncher.server.ServerType; import net.knarcraft.serverlauncher.server.ServerType;
import net.knarcraft.serverlauncher.userinterface.GUI; import net.knarcraft.serverlauncher.userinterface.GUI;
import net.knarcraft.serverlauncher.userinterface.ServerConsoles;
import javax.naming.ConfigurationException; import javax.naming.ConfigurationException;
import java.awt.*; import java.awt.*;
@ -23,6 +24,7 @@ class Main {
try { try {
setup(); setup();
new GUI(); new GUI();
new ServerConsoles();
Profile.addProfile("Default"); Profile.addProfile("Default");
//TODO: replace with profiles loading generating a default profile if empty. //TODO: replace with profiles loading generating a default profile if empty.

View File

@ -0,0 +1,28 @@
package net.knarcraft.serverlauncher.userinterface;
import javax.swing.*;
import java.awt.*;
class Console {
private JTextField textInput;
private JTextArea textOutput;
void output(String text) {
this.textOutput.setText(text);
}
Console(JTabbedPane tab, String name) {
JPanel panel = new JPanel();
tab.addTab(name, null, panel, null);
panel.setLayout(new BorderLayout(0, 0));
textInput = new JTextField();
panel.add(textInput, BorderLayout.SOUTH);
textInput.setColumns(10);
textOutput = new JTextArea();
JScrollPane scroll = new JScrollPane(textOutput);
panel.add(scroll, BorderLayout.CENTER);
textOutput.setEditable(false);
}
}

View File

@ -15,6 +15,7 @@ import java.net.URISyntaxException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;
import java.util.Scanner; import java.util.Scanner;
import java.util.concurrent.Executors;
/** /**
* Generates a GUI * Generates a GUI
@ -54,6 +55,8 @@ public class GUI implements ActionListener {
private final ArrayList<ServerTab> serverTabs = new ArrayList<>(); private final ArrayList<ServerTab> serverTabs = new ArrayList<>();
//TODO: Update target server list with the list of servers when adding or removing a server.
/** /**
* Create the application. * Create the application.
*/ */
@ -379,6 +382,7 @@ public class GUI implements ActionListener {
panel_2.add(tabbedPane_1); panel_2.add(tabbedPane_1);
this.serversPane = tabbedPane_1; this.serversPane = tabbedPane_1;
tabbedPane_1.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
frame.setVisible(true); frame.setVisible(true);
} }
@ -422,7 +426,12 @@ public class GUI implements ActionListener {
goToURL("https://knarcraft.net/Bungeeminecraftserverlauncher/Story/"); goToURL("https://knarcraft.net/Bungeeminecraftserverlauncher/Story/");
} else if (e.getSource() == btnStartServer) { } else if (e.getSource() == btnStartServer) {
this.save(); this.save();
Server.startServers(); Executors.newSingleThreadExecutor().execute(new Runnable() {
@Override
public void run() {
Server.startServers();
}
});
} else if (e.getSource() == btnStopServer) { } else if (e.getSource() == btnStopServer) {
stop(); stop();
} else if (e.getSource() == addServer) { } else if (e.getSource() == addServer) {

View File

@ -0,0 +1,36 @@
package net.knarcraft.serverlauncher.userinterface;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import java.awt.BorderLayout;
public class ServerConsoles {
private static ServerConsoles serverConsoles;
private JFrame frame;
private JTabbedPane consolesTab;
public ServerConsoles() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
consolesTab = new JTabbedPane(JTabbedPane.TOP);
frame.getContentPane().add(consolesTab, BorderLayout.CENTER);
serverConsoles = this;
frame.setVisible(true);
}
public static ServerConsoles getGUI() {
return serverConsoles;
}
public void show() {
frame.setVisible(true);
}
public void addTab(String name) {
new Console(consolesTab, name);
}
}