From dff4dd4e65a28e1372e46031761907e03ae58bc3 Mon Sep 17 00:00:00 2001 From: unnatural <93143883+unnaturalistic@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:24:44 +0330 Subject: [PATCH 1/4] A simple file manager --- src/main/java/net/buj/rml/util/FileMan.java | 51 +++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/main/java/net/buj/rml/util/FileMan.java diff --git a/src/main/java/net/buj/rml/util/FileMan.java b/src/main/java/net/buj/rml/util/FileMan.java new file mode 100644 index 0000000..4bdc772 --- /dev/null +++ b/src/main/java/net/buj/rml/util/FileMan.java @@ -0,0 +1,51 @@ +package net.buj.rml.util; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +public class FileMan { + /** + * checks if a file/folder exists + * @param path + * @return exist boolean + */ + public boolean Exists(String path) { + File f = new File(path); + if (f.exists()) return true; + else return false; + } + + /** + * creates a dir + * @param path + * @return success boolean + */ + public boolean CreateDir(String path) { + File f = new File(path); + return f.mkdir(); + } + + /** + * creates a file + * @param path + * @return success boolean + * @throws IOException + */ + public boolean CreateFile(String path) throws IOException { + File f = new File(path); + return f.createNewFile(); + } + + /** + * writes to a file + * @param path + * @param text + * @throws IOException + */ + public void writetoFile(String path, String text) throws IOException { + FileWriter fwrite = new FileWriter(path); + fwrite.write(text); + fwrite.close(); + } +} From 6aa831015b2a613887c5acccd2ea572e8ef6c521 Mon Sep 17 00:00:00 2001 From: unnatural <93143883+unnaturalistic@users.noreply.github.com> Date: Tue, 3 Oct 2023 16:03:52 +0330 Subject: [PATCH 2/4] removed useless if --- src/main/java/net/buj/rml/util/FileMan.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/net/buj/rml/util/FileMan.java b/src/main/java/net/buj/rml/util/FileMan.java index 4bdc772..201f9de 100644 --- a/src/main/java/net/buj/rml/util/FileMan.java +++ b/src/main/java/net/buj/rml/util/FileMan.java @@ -12,8 +12,7 @@ public class FileMan { */ public boolean Exists(String path) { File f = new File(path); - if (f.exists()) return true; - else return false; + return f.exists(); } /** From c0640fa6fa61045cb0112aca66624a44657479b9 Mon Sep 17 00:00:00 2001 From: unnatural <93143883+unnaturalistic@users.noreply.github.com> Date: Thu, 5 Oct 2023 18:10:44 +0330 Subject: [PATCH 3/4] Delete FileMan.java --- src/main/java/net/buj/rml/util/FileMan.java | 50 --------------------- 1 file changed, 50 deletions(-) delete mode 100644 src/main/java/net/buj/rml/util/FileMan.java diff --git a/src/main/java/net/buj/rml/util/FileMan.java b/src/main/java/net/buj/rml/util/FileMan.java deleted file mode 100644 index 201f9de..0000000 --- a/src/main/java/net/buj/rml/util/FileMan.java +++ /dev/null @@ -1,50 +0,0 @@ -package net.buj.rml.util; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - -public class FileMan { - /** - * checks if a file/folder exists - * @param path - * @return exist boolean - */ - public boolean Exists(String path) { - File f = new File(path); - return f.exists(); - } - - /** - * creates a dir - * @param path - * @return success boolean - */ - public boolean CreateDir(String path) { - File f = new File(path); - return f.mkdir(); - } - - /** - * creates a file - * @param path - * @return success boolean - * @throws IOException - */ - public boolean CreateFile(String path) throws IOException { - File f = new File(path); - return f.createNewFile(); - } - - /** - * writes to a file - * @param path - * @param text - * @throws IOException - */ - public void writetoFile(String path, String text) throws IOException { - FileWriter fwrite = new FileWriter(path); - fwrite.write(text); - fwrite.close(); - } -} From 37e92426942020504280554d7cb73abb65f451ad Mon Sep 17 00:00:00 2001 From: unnatural <93143883+unnaturalistic@users.noreply.github.com> Date: Thu, 5 Oct 2023 18:14:38 +0330 Subject: [PATCH 4/4] Update World.java --- src/main/java/net/buj/rml/world/World.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/net/buj/rml/world/World.java b/src/main/java/net/buj/rml/world/World.java index 4ad7266..4a6978f 100644 --- a/src/main/java/net/buj/rml/world/World.java +++ b/src/main/java/net/buj/rml/world/World.java @@ -1,4 +1,9 @@ package net.buj.rml.world; public class World { + public static boolean multiplayerWorld; + + public boolean isMultiplayer() { + return multiplayerWorld; + } }