From 3bf91ea9152764b104a24f8d313cde2244ddf20b Mon Sep 17 00:00:00 2001 From: Szum123321 Date: Sat, 27 Nov 2021 19:54:35 +0100 Subject: [PATCH] 1.18 dep and name update --- build.gradle | 9 ++++++--- gradle.properties | 12 ++++++------ .../net/szum123321/textile_backup/TextileBackup.java | 2 +- .../net/szum123321/textile_backup/TextileLogger.java | 9 +++------ .../szum123321/textile_backup/core/Utilities.java | 7 ++++--- src/main/resources/fabric.mod.json | 2 +- 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/build.gradle b/build.gradle index 6ac9b2e..6e675ad 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.9-SNAPSHOT' + id 'fabric-loom' version '0.10-SNAPSHOT' id 'maven-publish' } @@ -23,6 +23,7 @@ repositories{ includeGroup "com.terraformersmc" } } + mavenCentral() } dependencies { @@ -47,8 +48,8 @@ dependencies { include "org.apache.commons:commons-compress:1.19" //LZMA support - modImplementation "org.tukaani:xz:1.8" - include "org.tukaani:xz:1.8" + modImplementation 'org.tukaani:xz:1.9' + include "org.tukaani:xz:1.9" //Gzip compression, parallel, GITHUB modImplementation "com.github.shevek:parallelgzip:${project.pgzip_commit_hash}" @@ -116,5 +117,7 @@ publishing { static def getMcMinor(ver) { String[] arr = ((String)ver).split("\\."); + if(arr.length < 2) return ver; + return (String)(arr[0] + "." + arr[1]); } diff --git a/gradle.properties b/gradle.properties index f1a6bf9..2ff09b8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,18 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G -minecraft_version=1.17.1 -yarn_mappings=1.17.1+build.32 -loader_version=0.11.6 +minecraft_version=1.18-rc3 +yarn_mappings=1.18-rc3+build.1 +loader_version=0.12.5 #Fabric api -fabric_version=0.37.0+1.17 +fabric_version=0.43.1+1.18 #Cloth Config -cloth_version=5.0.37 +cloth_version=6.0.42 #ModMenu -modmenu_version=2.0.4 +modmenu_version=3.0.0 #Lazy DFU for faster dev start lazydfu_version=0.1.2 diff --git a/src/main/java/net/szum123321/textile_backup/TextileBackup.java b/src/main/java/net/szum123321/textile_backup/TextileBackup.java index 7cabff7..d6818a6 100644 --- a/src/main/java/net/szum123321/textile_backup/TextileBackup.java +++ b/src/main/java/net/szum123321/textile_backup/TextileBackup.java @@ -86,7 +86,7 @@ public class TextileBackup implements ModInitializer { return ((config.get().playerWhitelist.contains(ctx.getEntityOrThrow().getEntityName()) || ctx.hasPermissionLevel(config.get().permissionLevel)) && !config.get().playerBlacklist.contains(ctx.getEntityOrThrow().getEntityName())) || - (ctx.getServer().isSinglePlayer() && + (ctx.getServer().isSingleplayer() && config.get().alwaysSingleplayerAllowed); } catch (Exception ignored) { //Command was called from server console. return true; diff --git a/src/main/java/net/szum123321/textile_backup/TextileLogger.java b/src/main/java/net/szum123321/textile_backup/TextileLogger.java index 9036e41..90c0a8e 100644 --- a/src/main/java/net/szum123321/textile_backup/TextileLogger.java +++ b/src/main/java/net/szum123321/textile_backup/TextileLogger.java @@ -93,12 +93,9 @@ public class TextileLogger { if(source != null && source.getEntity() instanceof PlayerEntity) { LiteralText text = new LiteralText(messageFactory.newMessage(msg, args).getFormattedMessage()); - if(level.intLevel() == Level.TRACE.intLevel()) - text.formatted(Formatting.GREEN); - else if(level.intLevel() <= Level.WARN.intLevel()) - text.formatted(Formatting.RED); - else - text.formatted(Formatting.WHITE); + if(level.intLevel() == Level.TRACE.intLevel()) text.formatted(Formatting.GREEN); + else if(level.intLevel() <= Level.WARN.intLevel()) text.formatted(Formatting.RED); + else text.formatted(Formatting.WHITE); source.sendFeedback(prefixText.shallowCopy().append(text), false); diff --git a/src/main/java/net/szum123321/textile_backup/core/Utilities.java b/src/main/java/net/szum123321/textile_backup/core/Utilities.java index effc491..be7c304 100644 --- a/src/main/java/net/szum123321/textile_backup/core/Utilities.java +++ b/src/main/java/net/szum123321/textile_backup/core/Utilities.java @@ -31,6 +31,7 @@ import net.szum123321.textile_backup.config.ConfigHelper; import net.szum123321.textile_backup.config.ConfigPOJO; import net.szum123321.textile_backup.Statics; import net.szum123321.textile_backup.mixin.MinecraftServerSessionAccessor; +import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; @@ -47,12 +48,11 @@ public class Utilities { private final static ConfigHelper config = ConfigHelper.INSTANCE; private final static TextileLogger log = new TextileLogger(TextileBackup.MOD_NAME); - public static void notifyPlayers(MinecraftServer server, UUID sender, String msg) { MutableText message = log.getPrefixText(); message.append(new LiteralText(msg).formatted(Formatting.WHITE)); - server.getPlayerManager().broadcastChatMessage( + server.getPlayerManager().broadcast( message, MessageType.SYSTEM, sender @@ -66,7 +66,8 @@ public class Utilities { public static File getWorldFolder(MinecraftServer server) { return ((MinecraftServerSessionAccessor)server) .getSession() - .getWorldDirectory(World.OVERWORLD); + .getWorldDirectory(World.OVERWORLD) + .toFile(); } public static File getBackupRootPath(String worldName) { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 7a78961..035ac64 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -39,7 +39,7 @@ "depends": { "fabricloader": ">=0.11", "fabric": "*", - "minecraft": "1.17.*", + "minecraft": "1.18.*", "cloth-config2": "*", "java": ">=16" },