summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle6
-rw-r--r--gradle.properties8
-rw-r--r--gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java3
-rw-r--r--src/main/java/com/keuin/kbackupfabric/backup/BackupFilesystemUtil.java2
-rw-r--r--src/main/java/com/keuin/kbackupfabric/backup/suggestion/BackupNameSuggestionProvider.java2
-rw-r--r--src/main/java/com/keuin/kbackupfabric/notification/DistinctNotifiable.java3
-rw-r--r--src/main/java/com/keuin/kbackupfabric/notification/NotificationManager.java4
-rw-r--r--src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java18
-rw-r--r--src/main/java/com/keuin/kbackupfabric/util/cow/FileCowCopier.java1
-rw-r--r--src/main/java/me/lucko/fabric/api/permissions/v0/PermissionCheckEvent.java2
-rw-r--r--src/main/java/me/lucko/fabric/api/permissions/v0/Permissions.java2
-rw-r--r--src/main/resources/fabric.mod.json2
13 files changed, 29 insertions, 26 deletions
diff --git a/build.gradle b/build.gradle
index 67b3e86..e9b4207 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,10 +1,10 @@
plugins {
- id 'fabric-loom' version '1.0-SNAPSHOT'
+ id 'fabric-loom' version '1.5-SNAPSHOT'
id 'maven-publish'
}
-sourceCompatibility = JavaVersion.VERSION_1_8
-targetCompatibility = JavaVersion.VERSION_1_8
+sourceCompatibility = JavaVersion.VERSION_16
+targetCompatibility = JavaVersion.VERSION_16
archivesBaseName = project.archives_base_name
version = project.mod_version + "_mc" + project.minecraft_version
diff --git a/gradle.properties b/gradle.properties
index 81cb9b8..987722f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,13 +2,13 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
-minecraft_version=1.14.4
-yarn_mappings=1.14.4+build.18
-loader_version=0.14.12
+minecraft_version=1.16.4
+yarn_mappings=1.16.4+build.9
+loader_version=0.15.6
# Mod Properties
mod_version=1.7.0
maven_group=com.keuin.kbackupfabric
archives_base_name=kbackup-fabric
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
-fabric_version=0.28.5+1.14
+fabric_version=0.42.0+1.16
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index ffed3a2..db9a6b8 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
index 362abb8..c9910c1 100644
--- a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
+++ b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
@@ -14,6 +14,7 @@ import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.dedicated.MinecraftDedicatedServer;
import java.io.File;
import java.io.FileInputStream;
@@ -51,7 +52,7 @@ public final class KBPluginEvents implements ModInitializer {
// Check if we have just recovered from a previous backup. If so, print message.
try {
- File levelDirectory = new File(server.getRunDirectory(), server.getLevelName());
+ File levelDirectory = new File(server.getRunDirectory(), ((MinecraftDedicatedServer) server).getLevelName());
File metadataFile = new File(levelDirectory, BackupMetadata.metadataFileName);
if (metadataFile.exists()) {
// Metadata exists. Deserialize.
diff --git a/src/main/java/com/keuin/kbackupfabric/backup/BackupFilesystemUtil.java b/src/main/java/com/keuin/kbackupfabric/backup/BackupFilesystemUtil.java
index 519951a..ab7c1b1 100644
--- a/src/main/java/com/keuin/kbackupfabric/backup/BackupFilesystemUtil.java
+++ b/src/main/java/com/keuin/kbackupfabric/backup/BackupFilesystemUtil.java
@@ -42,7 +42,7 @@ public final class BackupFilesystemUtil {
public static String getLevelPath(MinecraftServer server) throws IOException {
if (!(server instanceof MinecraftDedicatedServer))
throw new IllegalStateException("This plugin is server-side only.");
- String path = (new File(server.getRunDirectory().getCanonicalPath(), server.getLevelName())).getAbsolutePath();
+ String path = (new File(server.getRunDirectory().getCanonicalPath(), ((MinecraftDedicatedServer) server).getLevelName())).getAbsolutePath();
Logger.getLogger("getLevelPath").info(String.format("Level path: %s", path));
assert (new File(path)).exists();
return path;
diff --git a/src/main/java/com/keuin/kbackupfabric/backup/suggestion/BackupNameSuggestionProvider.java b/src/main/java/com/keuin/kbackupfabric/backup/suggestion/BackupNameSuggestionProvider.java
index fa38979..df8fc1b 100644
--- a/src/main/java/com/keuin/kbackupfabric/backup/suggestion/BackupNameSuggestionProvider.java
+++ b/src/main/java/com/keuin/kbackupfabric/backup/suggestion/BackupNameSuggestionProvider.java
@@ -1,7 +1,7 @@
package com.keuin.kbackupfabric.backup.suggestion;
import com.mojang.brigadier.suggestion.SuggestionProvider;
-import net.minecraft.server.command.CommandSource;
+import net.minecraft.command.CommandSource;
import net.minecraft.server.command.ServerCommandSource;
import java.io.File;
diff --git a/src/main/java/com/keuin/kbackupfabric/notification/DistinctNotifiable.java b/src/main/java/com/keuin/kbackupfabric/notification/DistinctNotifiable.java
index 8eef15b..a830c8b 100644
--- a/src/main/java/com/keuin/kbackupfabric/notification/DistinctNotifiable.java
+++ b/src/main/java/com/keuin/kbackupfabric/notification/DistinctNotifiable.java
@@ -1,6 +1,5 @@
package com.keuin.kbackupfabric.notification;
-import net.minecraft.network.MessageType;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
@@ -33,7 +32,7 @@ public interface DistinctNotifiable {
@Override
public void notify(Text text) {
- serverPlayerEntity.sendMessage(text);
+ serverPlayerEntity.sendMessage(text, false);
}
@Override
diff --git a/src/main/java/com/keuin/kbackupfabric/notification/NotificationManager.java b/src/main/java/com/keuin/kbackupfabric/notification/NotificationManager.java
index 5536a1a..92c119b 100644
--- a/src/main/java/com/keuin/kbackupfabric/notification/NotificationManager.java
+++ b/src/main/java/com/keuin/kbackupfabric/notification/NotificationManager.java
@@ -38,9 +38,9 @@ public class NotificationManager {
BackupMetadata backup = MetadataHolder.getMetadata();
notifiable.notify(
new LiteralText("The world has been restored to backup ")
- .append(new LiteralText("[" + backup.getBackupName() + "]").setStyle(new Style().setColor(Formatting.GREEN)))
+ .append(new LiteralText("[" + backup.getBackupName() + "]").setStyle(Style.EMPTY.withColor(Formatting.GREEN)))
.append(new LiteralText(" (created at "))
- .append(new LiteralText("[" + DateUtil.fromEpochMillis(backup.getBackupTime()) + "]").setStyle(new Style().setColor(Formatting.GREEN)))
+ .append(new LiteralText("[" + DateUtil.fromEpochMillis(backup.getBackupTime()) + "]").setStyle(Style.EMPTY.withColor(Formatting.GREEN)))
.append(new LiteralText(")"))
);
}
diff --git a/src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java b/src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java
index 34b548a..25334bc 100644
--- a/src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java
+++ b/src/main/java/com/keuin/kbackupfabric/util/PrintUtil.java
@@ -1,6 +1,7 @@
package com.keuin.kbackupfabric.util;
import com.mojang.brigadier.context.CommandContext;
+import net.minecraft.network.MessageType;
import net.minecraft.server.PlayerManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.LiteralText;
@@ -12,6 +13,7 @@ import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
+import java.util.UUID;
public final class PrintUtil {
@@ -19,11 +21,11 @@ public final class PrintUtil {
private static final Object syncMessage = new Object();
private static final Object syncBroadcast = new Object();
- private static final Style broadcastStyle = new Style().setColor(Formatting.AQUA);
- private static final Style infoStyle = new Style().setColor(Formatting.WHITE);
- private static final Style stressStyle = new Style().setColor(Formatting.AQUA);
- private static final Style warnStyle = new Style().setColor(Formatting.YELLOW);
- private static final Style errorStyle = new Style().setColor(Formatting.DARK_RED);
+ private static final Style broadcastStyle = Style.EMPTY.withColor(Formatting.AQUA);
+ private static final Style infoStyle = Style.EMPTY.withColor(Formatting.WHITE);
+ private static final Style stressStyle = Style.EMPTY.withColor(Formatting.AQUA);
+ private static final Style warnStyle = Style.EMPTY.withColor(Formatting.YELLOW);
+ private static final Style errorStyle = Style.EMPTY.withColor(Formatting.DARK_RED);
private static final Logger LOGGER = LogManager.getLogger();
private static PlayerManager playerManager = null;
@@ -41,7 +43,8 @@ public final class PrintUtil {
synchronized (syncBroadcast) {
Optional.ofNullable(playerManager)
.ifPresent(pm ->
- pm.sendToAll(new LiteralText(message).setStyle(style)));
+ pm.broadcastChatMessage(new LiteralText(message).setStyle(style),
+ MessageType.CHAT, UUID.randomUUID()));
}
}
@@ -80,8 +83,7 @@ public final class PrintUtil {
private static CommandContext<ServerCommandSource> message(@Nullable CommandContext<ServerCommandSource> context, String messageText, boolean broadcastToOps, Style style) {
if (context != null) {
synchronized (syncMessage) {
- Text text = new LiteralText(messageText);
- text.setStyle(style);
+ Text text = new LiteralText(messageText).setStyle(style);
context.getSource().sendFeedback(text, broadcastToOps);
}
return context;
diff --git a/src/main/java/com/keuin/kbackupfabric/util/cow/FileCowCopier.java b/src/main/java/com/keuin/kbackupfabric/util/cow/FileCowCopier.java
index e52a893..422ac68 100644
--- a/src/main/java/com/keuin/kbackupfabric/util/cow/FileCowCopier.java
+++ b/src/main/java/com/keuin/kbackupfabric/util/cow/FileCowCopier.java
@@ -26,6 +26,7 @@ public final class FileCowCopier {
FileCowCopier.init();
PrintUtil.info("kbackup-cow version: " + FileCowCopier.getVersion());
}
+ FileCowCopier.getVersion();
return new FileCopier() {
@Override
public void copy(String dst, String src) throws IOException {
diff --git a/src/main/java/me/lucko/fabric/api/permissions/v0/PermissionCheckEvent.java b/src/main/java/me/lucko/fabric/api/permissions/v0/PermissionCheckEvent.java
index d6b74f4..3e473d4 100644
--- a/src/main/java/me/lucko/fabric/api/permissions/v0/PermissionCheckEvent.java
+++ b/src/main/java/me/lucko/fabric/api/permissions/v0/PermissionCheckEvent.java
@@ -28,7 +28,7 @@ package me.lucko.fabric.api.permissions.v0;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.fabricmc.fabric.api.util.TriState;
-import net.minecraft.server.command.CommandSource;
+import net.minecraft.command.CommandSource;
import org.jetbrains.annotations.NotNull;
/**
diff --git a/src/main/java/me/lucko/fabric/api/permissions/v0/Permissions.java b/src/main/java/me/lucko/fabric/api/permissions/v0/Permissions.java
index f4c06db..7609bb6 100644
--- a/src/main/java/me/lucko/fabric/api/permissions/v0/Permissions.java
+++ b/src/main/java/me/lucko/fabric/api/permissions/v0/Permissions.java
@@ -26,8 +26,8 @@
package me.lucko.fabric.api.permissions.v0;
import net.fabricmc.fabric.api.util.TriState;
+import net.minecraft.command.CommandSource;
import net.minecraft.entity.Entity;
-import net.minecraft.server.command.CommandSource;
import net.minecraft.server.command.ServerCommandSource;
import org.jetbrains.annotations.NotNull;
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index 5996e4b..bcce838 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -25,7 +25,7 @@
"depends": {
"fabricloader": ">=0.7.4",
"fabric": "*",
- "minecraft": "1.14.x"
+ "minecraft": "1.16.x"
},
"suggests": {
"flamingo": "*"