Skip to content

Commit d113444

Browse files
committed
Version 6.0.0
1 parent 0ef25a1 commit d113444

37 files changed

+258
-153
lines changed

AdminTools/build/built-jar.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Wed, 04 Nov 2020 14:55:59 +0100
1+
#Sat, 07 Nov 2020 02:24:44 +0100
22

33

44
C\:\\Users\\lukak\\Documents\\NetBeansProjects\\AdminTools=
Binary file not shown.
Binary file not shown.

AdminTools/build/classes/app/admintools/gui/RconWindow.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<AnchorPane id="AnchorPane" fx:id="rootPane" prefHeight="650.0" prefWidth="973.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="app.admintools.gui.RconWindowController">
1515
<!---<stylesheets>
16-
<URL value="@../../../Assets/Themes/Default/style.css" />
16+
<URL value="@../../../Assets/themes/Default/style.css" />
1717
</stylesheets>-->
1818
<children>
1919
<AnchorPane fx:id="rconPane" layoutX="71.0" prefHeight="593.0" prefWidth="902.0" styleClass="rconPane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="71.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
Binary file not shown.
Binary file not shown.
Binary file not shown.

AdminTools/build/classes/app/admintools/gui/SettingsWindow.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<AnchorPane id="AnchorPane" fx:id="rootPane" onKeyPressed="#onKeyPressed" prefHeight="650.0" prefWidth="973.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="app.admintools.gui.SettingsWindowController">
1616
<!---<stylesheets>
17-
<URL value="@../../../Assets/Themes/Default/style.css" />
17+
<URL value="@../../../Assets/themes/Default/style.css" />
1818
</stylesheets>-->
1919
<children>
2020
<AnchorPane layoutX="71.0" prefHeight="593.0" prefWidth="902.0" styleClass="pane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="71.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
Binary file not shown.

AdminTools/build/classes/app/admintools/gui/StatusWindow.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<AnchorPane id="AnchorPane" fx:id="rootPane" prefHeight="650.0" prefWidth="973.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="app.admintools.gui.StatusWindowController">
1616
<!---<stylesheets>
17-
<URL value="@../../../Assets/Themes/Default/style.css" />
17+
<URL value="@../../../Assets/themes/Default/style.css" />
1818
</stylesheets>-->
1919
<children>
2020
<AnchorPane layoutX="71.0" prefHeight="593.0" prefWidth="902.0" styleClass="settingsPane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="71.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

AdminTools/dist/AdminTools-6-0-0.zip

2.32 MB
Binary file not shown.

AdminTools/nbproject/private/private.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
44
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
55
<group>
6-
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/Assets/Themes/Aqua/style.css</file>
76
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/app/admintools/util/Utill.java</file>
7+
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/app/admintools/gui/StatusWindowController.java</file>
88
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/app/admintools/gui/RconWindowController.java</file>
9-
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/app/admintools/RconClient.java</file>
10-
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/Assets/Themes/Default/style.css</file>
9+
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/app/admintools/gui/theme/ThemeReader.java</file>
1110
<file>file:/C:/Users/lukak/Documents/NetBeansProjects/AdminTools/src/app/admintools/gui/HomeWindowController.java</file>
1211
</group>
1312
</open-files>

AdminTools/nbproject/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ javadoc.splitindex=true
6969
javadoc.use=true
7070
javadoc.version=false
7171
javadoc.windowtitle=
72-
javafx.application.implementation.version=5.3.0
72+
javafx.application.implementation.version=6.0.0
7373
javafx.binarycss=false
7474
javafx.classpath.extension=\
7575
${java.home}/lib/javaws.jar:\

AdminTools/src/app/admintools/RconClient.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void start(Stage stage) throws Exception {
6868
root = FXMLLoader.load(getClass().getResource("/app/admintools/gui/HomeWindow.fxml"));
6969

7070
//Set selected theme css
71-
root.getStylesheets().add("file:Assets/Themes/" + d.getSelectedTheme() + "/style.css");
71+
root.getStylesheets().add("file:Assets/themes/" + d.getSelectedTheme() + "/style.css");
7272

7373
Scene scene = new Scene(root);
7474

@@ -86,8 +86,10 @@ public void start(Stage stage) throws Exception {
8686
cr.command(TellrawFormatter.assembleLogoutTellraw(d.getMessageUsername()));
8787
}
8888
cr.disconnect();
89-
} catch (IOException | AuthenticationException | NullPointerException ex) {
89+
} catch (IOException | AuthenticationException ex) {
9090
AtLogger.logException(ex);
91+
} catch (NullPointerException ex) {
92+
//Its normal for it to trow a null pointer exception on exit if no connection is avalable
9193
}
9294
Platform.exit();
9395
System.exit(0);

AdminTools/src/app/admintools/gui/HomeWindowController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ private void addNew() {
112112
AtLogger.logException(ex);
113113
}
114114
}
115+
115116
isWizardOpen.set(false);
116117
}
117118
}

AdminTools/src/app/admintools/gui/RconWindow.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<AnchorPane id="AnchorPane" fx:id="rootPane" prefHeight="650.0" prefWidth="973.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="app.admintools.gui.RconWindowController">
1515
<!---<stylesheets>
16-
<URL value="@../../../Assets/Themes/Default/style.css" />
16+
<URL value="@../../../Assets/themes/Default/style.css" />
1717
</stylesheets>-->
1818
<children>
1919
<AnchorPane fx:id="rconPane" layoutX="71.0" prefHeight="593.0" prefWidth="902.0" styleClass="rconPane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="71.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">

AdminTools/src/app/admintools/gui/RconWindowController.java

Lines changed: 123 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
import com.google.gson.JsonObject;
3636
import com.lukeonuke.simplefxdialog.Dialog;
3737
import com.lukeonuke.simplefxdialog.img.DialogImage;
38+
import java.io.File;
39+
import java.util.Arrays;
40+
import java.util.Scanner;
3841

3942
/**
4043
*
@@ -113,7 +116,7 @@ public void changed(ObservableValue<? extends Worker.State> observable, Worker.S
113116
if (!updateStats.get("draft").getAsBoolean()) {
114117
if (!updateStats.get("tag_name").getAsString().equals("v" + this.getClass().getPackage().getImplementationVersion())) {
115118
write("§a[AVCS] §4Newer version found §9" + updateStats.get("tag_name").getAsString() + "\n §f" + updateStats.get("name").getAsString() + "\n Get it from github: §ahttps://get.admintools.app/");
116-
119+
117120
isUpToDate = false;
118121
}
119122
}
@@ -166,6 +169,7 @@ public void changed(ObservableValue<? extends Worker.State> observable, Worker.S
166169

167170
Data d = Data.getInstance();
168171
write("§bConnecting to " + d.getSelectedCredentials().getIP() + ":" + d.getSelectedCredentials().getPort());
172+
AtLogger.log(Level.INFO, "Connecting to server");
169173
try {
170174
CustomRcon cr = CustomRcon.getInstance();
171175
//write connected message if its enabled
@@ -238,6 +242,11 @@ public void refresh() {
238242
});
239243
}
240244

245+
/**
246+
* 1-st layer interpreter command send
247+
*
248+
* @param command the command to be sent
249+
*/
241250
private void sendCommand(String command) {
242251
CustomRcon cRcon;
243252
try {
@@ -248,66 +257,77 @@ private void sendCommand(String command) {
248257
//Internal command interpreter
249258
boolean isRightToSend = true; //Boolean that is checked when sending commands to server
250259

251-
switch (command) {
252-
//Stop command
253-
case "stop":
254-
if (Dialog.okCancelDialog(DialogImage.WARNING, "Are you sure?", "Do you realy want to stop the server?"
255-
+ System.lineSeparator()
256-
+ "By pressing on you will be issuing a stop command to the server")) {
257-
258-
isRightToSend = false;
259-
write("§bStopping the server and exiting in 2 (two) seconds");
260-
cRcon.command("stop");
261-
sendButton.disableProperty().set(true);
262-
rconSend.disableProperty().set(true);
263-
Thread t = new Thread(() -> {
264-
try {
265-
Thread.sleep(2000);
266-
} catch (InterruptedException ex) {
267-
AtLogger.logException(ex);
268-
}
269-
Utill.exit(0);
270-
});
271-
t.start();
272-
}
273-
break;
274-
//Help command
275-
case "!help":
276-
isRightToSend = false;
277-
write("§bAdmin Tools internal command interpreter help: " + System.lineSeparator()
278-
+ "\t!help - Help command" + System.lineSeparator()
279-
+ "\t!clear - Clear the console" + System.lineSeparator()
280-
+ "\t!exit - Exit the program and close the rcon connection" + System.lineSeparator());
281-
break;
282-
//Clear command - clears the console
283-
case "!clear":
284-
isRightToSend = false;
285-
Data.rconTextData.clear();
286-
write("§bCleared console");
287-
break;
288-
//Clear command - clears the console
289-
case "!login":
290-
isRightToSend = false;
291-
Data.rconTextData.clear();
292-
WindowLoader.loadHome(rootPane);
293-
break;
260+
ArrayList<String> splitCommand = new ArrayList<>(Arrays.asList(command.trim().split("\\s+")));
261+
262+
if (command.equals("stop")) {
263+
if (Dialog.okCancelDialog(DialogImage.WARNING, "Are you sure?", "Do you realy want to stop the server?"
264+
+ System.lineSeparator()
265+
+ "By pressing on you will be issuing a stop command to the server")) {
294266

295-
//Exit command - exits the program
296-
case "!exit":
297267
isRightToSend = false;
268+
write("§bStopping the server and exiting in 2 (two) seconds");
269+
cRcon.command("stop");
270+
sendButton.disableProperty().set(true);
271+
rconSend.disableProperty().set(true);
272+
Thread t = new Thread(() -> {
273+
try {
274+
Thread.sleep(2000);
275+
} catch (InterruptedException ex) {
276+
AtLogger.logException(ex);
277+
}
278+
Utill.exit(0);
279+
});
280+
t.start();
298281

299-
write("§bClosing connection and exiting...");
282+
}
283+
} else if (command.equals("!help")) {
284+
isRightToSend = false;
285+
write("§bAdmin Tools internal command interpreter help: " + System.lineSeparator()
286+
+ "\t!help - Help command" + System.lineSeparator()
287+
+ "\t!clear - Clear the console" + System.lineSeparator()
288+
+ "\t!exit - Exit the program and close the rcon connection" + System.lineSeparator());
289+
} else if (command.equals("!clear")) {
290+
isRightToSend = false;
291+
Data.rconTextData.clear();
292+
write("§bCleared console");
293+
} else if (command.equals("!exit")) {
294+
isRightToSend = false;
295+
296+
write("§bClosing connection and exiting...");
297+
298+
Utill.exit(commandHistoryDeviation);
299+
} else if (splitCommand.get(0).equals("!if")) {
300+
isRightToSend = false;
301+
if (logicalOperations(splitCommand.get(1))) {
302+
splitCommand.remove(0);
303+
splitCommand.remove(0);
304+
/*
305+
*Send the command that is after the if instruction ex. &if yes==yes <command>
306+
*Send it this way so that it allows for nested if-s
307+
*/
308+
sendCommand(Utill.removeArrrayFormatting(splitCommand.toString()));
309+
}
310+
//Print statement
311+
} else if (splitCommand.get(0).equals("!print")) {
312+
isRightToSend = false;
313+
splitCommand.remove(0);
314+
write(Utill.removeArrrayFormatting(splitCommand.toString())); //Send the text after the print instruction
300315

301-
cRcon.disconnect();
302-
System.exit(0);
303-
break;
304-
default:
305-
break;
316+
}
317+
318+
for (int i = 0; i < listScripts().size(); i++) {
319+
if (command.startsWith("@" + Utill.stripExtension(listScripts().get(i)))) {
320+
isRightToSend = false;
321+
ArrayList<String> args = new ArrayList<>(Arrays.asList(command.split("[ ]")));
322+
args.remove(0);
323+
executeScript(getScript(listScripts().get(i)), args);
324+
}
306325
}
307326

308327
if (isRightToSend) {
309328
//Send and recive recsponce
310329
write(cRcon.command(command));
330+
AtLogger.log(Level.INFO, "Command sent to server : " + command);
311331
}
312332
}
313333
} catch (IOException | AuthenticationException ex) {
@@ -341,4 +361,55 @@ private void loadStatus() {
341361
private void loadHome() {
342362
WindowLoader.loadHome(rootPane);
343363
}
364+
365+
public static ArrayList<String> listScripts() {
366+
ArrayList<String> themeDir = new ArrayList<String>(); //Netbeans takes a shite than complaians
367+
File[] themes = new File("Assets/scripts/").listFiles(); //Get a array of all files in the script folder
368+
for (File theme : themes) { //Go through them all
369+
if (theme.isFile()) {
370+
themeDir.add(theme.getName()); //Add its name to the returning arraylist if its a directory
371+
}
372+
}
373+
return themeDir;
374+
}
375+
376+
public static String getScript(String scriptName) {
377+
return "Assets/scripts/" + scriptName;
378+
}
379+
380+
private void executeScript(String scriptPath, ArrayList<String> args) throws FileNotFoundException {
381+
// pass the path to the file as a parameter
382+
File file = new File(scriptPath);
383+
Scanner sc = new Scanner(file);
384+
385+
write("┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉");
386+
387+
while (sc.hasNextLine()) {
388+
String instruction = sc.nextLine();
389+
if (instruction != null) {
390+
for (int i = 0; i < args.size(); i++) {
391+
instruction = instruction.replace("arg" + i, args.get(i));
392+
}
393+
394+
if (instruction.startsWith("#")) {
395+
//Comment
396+
} else if (instruction.startsWith("@")) {
397+
//Call to new script, ignored
398+
399+
} else {
400+
//Minecraft command, or 1-st layer interpreter command
401+
sendCommand(instruction);
402+
}
403+
}
404+
}
405+
}
406+
407+
public static boolean logicalOperations(String operation) {
408+
if (operation.contains("==")) {
409+
return operation.split("==")[0].equals(operation.split("==")[1]); //Return true if the bit before the == is equal to the bit after the ==
410+
} else if (operation.contains("!=")) {
411+
return !operation.split("!=")[0].equals(operation.split("!=")[1]); //Return true if the bit before the != is not equal to the bit after the !=
412+
}
413+
return false;
414+
}
344415
}

AdminTools/src/app/admintools/gui/SettingsWindow.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<AnchorPane id="AnchorPane" fx:id="rootPane" onKeyPressed="#onKeyPressed" prefHeight="650.0" prefWidth="973.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="app.admintools.gui.SettingsWindowController">
1616
<!---<stylesheets>
17-
<URL value="@../../../Assets/Themes/Default/style.css" />
17+
<URL value="@../../../Assets/themes/Default/style.css" />
1818
</stylesheets>-->
1919
<children>
2020
<AnchorPane layoutX="71.0" prefHeight="593.0" prefWidth="902.0" styleClass="pane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="71.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">

AdminTools/src/app/admintools/gui/SettingsWindowController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private void apply() {
114114

115115
//Actualy have to refresh the theme
116116
//And refresh the Data singleton
117-
rootPane.getStylesheets().add("file:Assets/Themes/" + Data.refresh().getSelectedTheme() + "/style.css");
117+
rootPane.getStylesheets().add("file:Assets/themes/" + Data.refresh().getSelectedTheme() + "/style.css");
118118
}
119119

120120
@FXML

AdminTools/src/app/admintools/gui/StatusWindow.fxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<AnchorPane id="AnchorPane" fx:id="rootPane" prefHeight="650.0" prefWidth="973.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="app.admintools.gui.StatusWindowController">
1616
<!---<stylesheets>
17-
<URL value="@../../../Assets/Themes/Default/style.css" />
17+
<URL value="@../../../Assets/themes/Default/style.css" />
1818
</stylesheets>-->
1919
<children>
2020
<AnchorPane layoutX="71.0" prefHeight="593.0" prefWidth="902.0" styleClass="settingsPane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="71.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">

AdminTools/src/app/admintools/gui/StatusWindowController.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ private void tickApi() {
152152
} catch (InterruptedException ex) {
153153
AtLogger.logException(ex);
154154
}
155-
System.out.println(Data.isOnStatusWindow);
156155
tickApi();
157156
}
158157
});
@@ -181,16 +180,18 @@ private void mcStatusRefresh() {
181180

182181
//Set player list
183182
Platform.runLater(() -> {
184-
try {
185-
if (sOnlinePlayers.getItems() != null) {
186-
sOnlinePlayers.getItems().clear();
183+
if (data.getPlayers().getSample() != null) {
184+
try {
185+
if (sOnlinePlayers.getItems() != null) {
186+
sOnlinePlayers.getItems().clear();
187+
}
188+
for (int i = 0; i < data.getPlayers().getSample().size(); i++) {
189+
sOnlinePlayers.getItems().add(data.getPlayers().getSample().get(i).getName());
190+
}
191+
192+
} catch (Exception e) {
193+
AtLogger.logException(e);
187194
}
188-
for (int i = 0; i < data.getPlayers().getSample().size(); i++) {
189-
sOnlinePlayers.getItems().add(data.getPlayers().getSample().get(i).getName());
190-
}
191-
192-
} catch (Exception e) {
193-
AtLogger.logException(e);
194195
}
195196
});
196197

AdminTools/src/app/admintools/gui/credentials/credwizard/CredWizard.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public static Credentials showCredWizard(Credentials credentials) {
176176

177177
//Create window
178178
Scene scene = new Scene(ap);
179-
scene.getStylesheets().add("file:Assets/Themes/" + Data.getInstance().getSelectedTheme() + "/style.css"); //Themes
179+
scene.getStylesheets().add("file:Assets/themes/" + Data.getInstance().getSelectedTheme() + "/style.css"); //Themes
180180
Stage stage = new Stage();
181181
stage.setScene(scene);
182182
stage.setAlwaysOnTop(true);

0 commit comments

Comments
 (0)