Skip to content

Commit

Permalink
v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeOnuke committed Jul 24, 2020
1 parent 9649b04 commit 0326738
Show file tree
Hide file tree
Showing 30 changed files with 663 additions and 103 deletions.
2 changes: 1 addition & 1 deletion AdminTools/build/built-jar.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Sun, 19 Jul 2020 17:51:38 +0200
#Fri, 24 Jul 2020 15:15:01 +0200


C\:\\Users\\lukak\\Documents\\NetBeansProjects\\AdminTools=
Binary file modified AdminTools/build/classes/rconclient/RconClient.class
Binary file not shown.
64 changes: 64 additions & 0 deletions AdminTools/build/classes/rconclient/gui/LoginWindow.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.ProgressBar?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.effect.DropShadow?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.paint.LinearGradient?>
<?import javafx.scene.paint.Stop?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>

<AnchorPane id="AnchorPane" fx:id="rootPane" prefHeight="593.0" prefWidth="973.0" styleClass="imageBackground" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.251" fx:controller="rconclient.gui.LoginWindowController">
<stylesheets>
<URL value="@Style.css" />
</stylesheets>
<children>
<AnchorPane prefHeight="71.0" prefWidth="973.0" styleClass="settingsTitlePane" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Text layoutX="14.0" layoutY="51.0" strokeType="OUTSIDE" strokeWidth="0.0" styleClass="title" text="Login" />
</children>
<effect>
<DropShadow color="#00000081" />
</effect>
</AnchorPane>
<StackPane layoutX="6.0" layoutY="71.0" prefHeight="522.0" prefWidth="973.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="71.0">
<children>
<AnchorPane fx:id="loginPane" maxHeight="-Infinity" maxWidth="-Infinity" opacity="0.9" prefHeight="290.0" prefWidth="441.0" styleClass="loginCenter" StackPane.alignment="CENTER">
<children>
<Label layoutX="15.0" layoutY="87.0" styleClass="text" text="IP : " AnchorPane.leftAnchor="15.0" AnchorPane.topAnchor="87.0" />
<TextField fx:id="ip" layoutX="87.0" layoutY="83.0" prefHeight="29.0" prefWidth="245.0" styleClass="rconTextField" AnchorPane.leftAnchor="87.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="83.0" />
<Label layoutX="15.0" layoutY="137.0" styleClass="text" text="Port : " AnchorPane.leftAnchor="15.0" AnchorPane.topAnchor="137.0" />
<TextField fx:id="port" layoutX="87.0" layoutY="133.0" prefHeight="29.0" prefWidth="245.0" styleClass="rconTextField" AnchorPane.leftAnchor="87.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="133.0" />
<Label layoutX="15.0" layoutY="187.0" styleClass="text" text="Password : " AnchorPane.leftAnchor="15.0" AnchorPane.topAnchor="187.0" />
<PasswordField fx:id="password" layoutX="87.0" layoutY="183.0" prefHeight="29.0" prefWidth="245.0" styleClass="rconTextField" AnchorPane.leftAnchor="87.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="183.0" />
<Label fx:id="loginButton" layoutX="299.0" layoutY="488.0" onMouseClicked="#login" styleClass="labelButton" text="Log in" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="14.0" />
<Text layoutX="104.0" layoutY="56.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Admin Tools">
<fill>
<LinearGradient endX="1.0" endY="1.0" startY="1.0">
<stops>
<Stop color="#38ff00" />
<Stop color="#0095ff" offset="1.0" />
</stops>
</LinearGradient>
</fill>
<font>
<Font size="39.0" />
</font>
</Text>
<ProgressBar fx:id="loginProgress" layoutX="16.0" layoutY="252.0" prefHeight="20.0" prefWidth="357.0" progress="0.0" />
<Label fx:id="loginInfo" layoutX="18.0" layoutY="229.0" styleClass="text" />
</children>
<StackPane.margin>
<Insets bottom="50.0" left="50.0" right="50.0" top="50.0" />
</StackPane.margin>
</AnchorPane>
</children>
</StackPane>
</children>
</AnchorPane>
Binary file not shown.
Binary file modified AdminTools/build/classes/rconclient/gui/RconWindowController.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
19 changes: 19 additions & 0 deletions AdminTools/build/classes/rconclient/gui/Style.css
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,23 @@
.list-cell:even{
-fx-background-color : #575757;
-fx-text-fill: white;
}

.leftSidePane{
-fx-background-color: #3d3d3d;
-fx-border-color: #5c5c5c;
-fx-border-width: 0px 1px 0px 0px;
}

.imageBackground{
-fx-background-image: url(/rconclient/image/background.png);
-fx-background-size: cover;
}

.loginCenter{
-fx-background-color: #3d3d3d;
-fx-border-color: #5c5c5c;
-fx-border-width: 1px;
-fx-border-radius: 10px;
-fx-background-radius: 10px;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file modified AdminTools/build/classes/rconclient/util/CustomRcon.class
Binary file not shown.
Binary file modified AdminTools/build/classes/rconclient/util/Data.class
Binary file not shown.
Binary file modified AdminTools/build/classes/rconclient/util/Utill.class
Binary file not shown.
Binary file modified AdminTools/build/classes/rconclient/util/WindowLoader.class
Binary file not shown.
6 changes: 4 additions & 2 deletions AdminTools/nbproject/private/private.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/rconclient/util/Data.java</file>
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/rconclient/RconClient.java</file>
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/rconclient/gui/RconWindowController.java</file>
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/rconclient/textprocessing/Markup.java</file>
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/rconclient/util/WindowLoader.java</file>
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/rconclient/gui/LoginWindowController.java</file>
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/rconclient/gui/SettingsWindowController.java</file>
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/rconclient/gui/StatusWindowController.java</file>
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/rconclient/util/Utill.java</file>
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/rconclient/util/CustomRcon.java</file>
</group>
</open-files>
</project-private>
8 changes: 7 additions & 1 deletion AdminTools/src/rconclient/RconClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package rconclient;

import java.io.File;
import java.io.IOException;
import java.net.SocketException;
import javafx.application.Application;
Expand Down Expand Up @@ -28,7 +29,12 @@ public class RconClient extends Application {
@Override
public void start(Stage stage) throws Exception {

Parent root = FXMLLoader.load(getClass().getResource("/rconclient/gui/RconWindow.fxml"));
Parent root;
if(new File("rconclient.properties").exists()){
root = FXMLLoader.load(getClass().getResource("/rconclient/gui/RconWindow.fxml"));
}else{
root = FXMLLoader.load(getClass().getResource("/rconclient/gui/LoginWindow.fxml"));
}

Scene scene = new Scene(root);

Expand Down
64 changes: 64 additions & 0 deletions AdminTools/src/rconclient/gui/LoginWindow.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.ProgressBar?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.effect.DropShadow?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.paint.LinearGradient?>
<?import javafx.scene.paint.Stop?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>

<AnchorPane id="AnchorPane" fx:id="rootPane" prefHeight="593.0" prefWidth="973.0" styleClass="imageBackground" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.251" fx:controller="rconclient.gui.LoginWindowController">
<stylesheets>
<URL value="@Style.css" />
</stylesheets>
<children>
<AnchorPane prefHeight="71.0" prefWidth="973.0" styleClass="settingsTitlePane" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Text layoutX="14.0" layoutY="51.0" strokeType="OUTSIDE" strokeWidth="0.0" styleClass="title" text="Login" />
</children>
<effect>
<DropShadow color="#00000081" />
</effect>
</AnchorPane>
<StackPane layoutX="6.0" layoutY="71.0" prefHeight="522.0" prefWidth="973.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="71.0">
<children>
<AnchorPane fx:id="loginPane" maxHeight="-Infinity" maxWidth="-Infinity" opacity="0.9" prefHeight="290.0" prefWidth="441.0" styleClass="loginCenter" StackPane.alignment="CENTER">
<children>
<Label layoutX="15.0" layoutY="87.0" styleClass="text" text="IP : " AnchorPane.leftAnchor="15.0" AnchorPane.topAnchor="87.0" />
<TextField fx:id="ip" layoutX="87.0" layoutY="83.0" prefHeight="29.0" prefWidth="245.0" styleClass="rconTextField" AnchorPane.leftAnchor="87.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="83.0" />
<Label layoutX="15.0" layoutY="137.0" styleClass="text" text="Port : " AnchorPane.leftAnchor="15.0" AnchorPane.topAnchor="137.0" />
<TextField fx:id="port" layoutX="87.0" layoutY="133.0" prefHeight="29.0" prefWidth="245.0" styleClass="rconTextField" AnchorPane.leftAnchor="87.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="133.0" />
<Label layoutX="15.0" layoutY="187.0" styleClass="text" text="Password : " AnchorPane.leftAnchor="15.0" AnchorPane.topAnchor="187.0" />
<PasswordField fx:id="password" layoutX="87.0" layoutY="183.0" prefHeight="29.0" prefWidth="245.0" styleClass="rconTextField" AnchorPane.leftAnchor="87.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="183.0" />
<Label fx:id="loginButton" layoutX="299.0" layoutY="488.0" onMouseClicked="#login" styleClass="labelButton" text="Log in" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="14.0" />
<Text layoutX="104.0" layoutY="56.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Admin Tools">
<fill>
<LinearGradient endX="1.0" endY="1.0" startY="1.0">
<stops>
<Stop color="#38ff00" />
<Stop color="#0095ff" offset="1.0" />
</stops>
</LinearGradient>
</fill>
<font>
<Font size="39.0" />
</font>
</Text>
<ProgressBar fx:id="loginProgress" layoutX="16.0" layoutY="252.0" prefHeight="20.0" prefWidth="357.0" progress="0.0" />
<Label fx:id="loginInfo" layoutX="18.0" layoutY="229.0" styleClass="text" />
</children>
<StackPane.margin>
<Insets bottom="50.0" left="50.0" right="50.0" top="50.0" />
</StackPane.margin>
</AnchorPane>
</children>
</StackPane>
</children>
</AnchorPane>
144 changes: 144 additions & 0 deletions AdminTools/src/rconclient/gui/LoginWindowController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rconclient.gui;

import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Random;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import net.kronos.rkon.core.ex.AuthenticationException;
import rconclient.util.CustomRcon;
import rconclient.util.Data;
import rconclient.util.WindowLoader;
import simplefxdialog.Dialog;
import simplefxdialog.img.DialogImage;

/**
* FXML Controller class
*
* @author lukak
*/
public class LoginWindowController implements Initializable {

@FXML
private AnchorPane rootPane;
@FXML
private TextField ip;
@FXML
private TextField port;
@FXML
private PasswordField password;
@FXML
private Label loginButton;
@FXML
private ProgressBar loginProgress;
@FXML
private Label loginInfo;
@FXML
private AnchorPane loginPane;

/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}

@FXML
private void login() {
Thread loginThread = new Thread(() -> {
Platform.runLater(() -> {
loginPane.setDisable(true);
loginProgress.setProgress(ProgressBar.INDETERMINATE_PROGRESS);
loginInfo.setText("Starting up");
});

try {
Thread.sleep(new Random().nextInt(200));
} catch (InterruptedException ex) {

}

Platform.runLater(() -> {
loginInfo.setText("Connecting and autentificating");
});

boolean connected = true;
try {
CustomRcon rcon = CustomRcon.getInstance(ip.getText(), Integer.valueOf(port.getText()), password.getText().getBytes());
} catch (IOException ex) {
connected = false;
Platform.runLater(() -> {
loginProgress.setProgress(0);
loginInfo.setText("");
Dialog.okDialog(DialogImage.error, "Connnection Error", "Couldnt connect to server.\n Probably an incorect IP.");
ip.setText("");
});
} catch (AuthenticationException ex) {
connected = false;
Platform.runLater(() -> {
loginProgress.setProgress(0);
loginInfo.setText("");
Dialog.okDialog(DialogImage.error, "Connnection Error", "Couldnt authenticate with server. \nIncorrect password.");
password.setText("");
});
} catch (NumberFormatException ex) {
connected = false;
Platform.runLater(() -> {
loginProgress.setProgress(0);
loginInfo.setText("");
Dialog.okDialog(DialogImage.error, "Conversion error", "Port you specified is not a valid integer");
port.setText("");
});
} catch (Exception ex) {
connected = false;
Platform.runLater(() -> {
loginProgress.setProgress(0);
loginInfo.setText("");
Dialog.okDialog(DialogImage.error, "Error", "General exception\n" + ex.getMessage());
});
}

loginPane.setDisable(false);

if (connected) {
Data.rconTextData = null;

//Write to credentials
ArrayList<String> props = Data.credentialsDefaults;

props.set(0, ip.getText()); //set ip
props.set(1, port.getText()); //set port
props.set(2, password.getText()); //set password
try {
Data.writeCredentials(props);
} catch (IOException ex) {

}
Data.refresh();

Platform.runLater(() -> {
loginInfo.setText("Login successful");
loginProgress.setProgress(0);
WindowLoader.loadRcon(rootPane);
});
}
});
loginThread.start();
}
}
Loading

0 comments on commit 0326738

Please sign in to comment.