Does some much needed cleanup, adds the Paper server type and fixes broken downloads
Some checks failed
KnarCraft/Minecraft-Server-Launcher/pipeline/head There was a failure building this commit
Some checks failed
KnarCraft/Minecraft-Server-Launcher/pipeline/head There was a failure building this commit
This commit is contained in:
@ -2,8 +2,10 @@ package net.knarcraft.minecraftserverlauncher.userinterface;
|
||||
|
||||
import net.knarcraft.minecraftserverlauncher.profile.Profile;
|
||||
import net.knarcraft.minecraftserverlauncher.server.Server;
|
||||
import net.knarcraft.minecraftserverlauncher.server.ServerType;
|
||||
import net.knarcraft.minecraftserverlauncher.server.servertypes.ServerType;
|
||||
import net.knarcraft.minecraftserverlauncher.server.ServerTypeHandler;
|
||||
|
||||
import javax.naming.ConfigurationException;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
@ -33,7 +35,7 @@ public class ServerTab implements ActionListener {
|
||||
* @param serverVersion The version of the server
|
||||
* @param maxRam The max usable ram for the server
|
||||
*/
|
||||
public void setData(String path, boolean enabled, String typeName, String serverVersion, String maxRam) {
|
||||
public void setData(String path, boolean enabled, String typeName, String serverVersion, String maxRam) throws ConfigurationException {
|
||||
this.directory.setText(path);
|
||||
this.chckbxEnabled.setSelected(enabled);
|
||||
this.serverTypes.setSelectedItem(typeName);
|
||||
@ -42,7 +44,7 @@ public class ServerTab implements ActionListener {
|
||||
this.maxRam.setSelectedItem(maxRam);
|
||||
}
|
||||
|
||||
public ServerTab(String name) {
|
||||
public ServerTab(String name) throws ConfigurationException {
|
||||
this.name = name;
|
||||
panel = new JPanel();
|
||||
Profile.getGUI().getPane().addTab(name, null, panel, null);
|
||||
@ -59,7 +61,7 @@ public class ServerTab implements ActionListener {
|
||||
sl_panel_3.putConstraint(SpringLayout.SOUTH, lblServerVersion, 26, SpringLayout.SOUTH, lblServerType);
|
||||
panel.add(lblServerVersion);
|
||||
|
||||
serverTypes = new JComboBox<>(ServerType.getTypeNames());
|
||||
serverTypes = new JComboBox<>(ServerTypeHandler.getTypeNames());
|
||||
sl_panel_3.putConstraint(SpringLayout.NORTH, serverTypes, 10, SpringLayout.NORTH, panel);
|
||||
sl_panel_3.putConstraint(SpringLayout.WEST, serverTypes, 5, SpringLayout.EAST, lblServerVersion);
|
||||
sl_panel_3.putConstraint(SpringLayout.EAST, serverTypes, 154, SpringLayout.WEST, serverTypes);
|
||||
@ -68,7 +70,7 @@ public class ServerTab implements ActionListener {
|
||||
panel.add(serverTypes);
|
||||
serverTypes.addActionListener(this);
|
||||
|
||||
serverVersions = new JComboBox<>(ServerType.getServerTypes().get(0).getVersions());
|
||||
serverVersions = new JComboBox<>(ServerTypeHandler.getServerTypes().get(0).getVersions());
|
||||
sl_panel_3.putConstraint(SpringLayout.NORTH, serverVersions, 6, SpringLayout.SOUTH, serverTypes);
|
||||
sl_panel_3.putConstraint(SpringLayout.EAST, serverVersions, 0, SpringLayout.EAST, serverTypes);
|
||||
sl_panel_3.putConstraint(SpringLayout.WEST, serverVersions, 6, SpringLayout.EAST, lblServerVersion);
|
||||
@ -183,7 +185,11 @@ public class ServerTab implements ActionListener {
|
||||
} else if (e.getSource() == btnBrowse) {
|
||||
browse();
|
||||
} else if (e.getSource() == serverTypes) {
|
||||
serverTypes();
|
||||
try {
|
||||
serverTypes();
|
||||
} catch (ConfigurationException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +220,7 @@ public class ServerTab implements ActionListener {
|
||||
/**
|
||||
* Updates the versions combo according to the value of the server type combo.
|
||||
*/
|
||||
private void serverTypes() {
|
||||
private void serverTypes() throws ConfigurationException {
|
||||
serverVersions.removeAllItems();
|
||||
String selectedserverTypes = null;
|
||||
Object selectedType = serverTypes.getSelectedItem();
|
||||
@ -227,7 +233,7 @@ public class ServerTab implements ActionListener {
|
||||
} else {
|
||||
serverVersions.setEditable(false);
|
||||
ServerType current = null;
|
||||
for (ServerType servertype : ServerType.getServerTypes()) {
|
||||
for (ServerType servertype : ServerTypeHandler.getServerTypes()) {
|
||||
if (servertype.getName().equals(selectedserverTypes)) {
|
||||
current = servertype;
|
||||
}
|
||||
|
Reference in New Issue
Block a user