Skip to content

Commit

Permalink
fix #50
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyDynamic committed Sep 19, 2024
1 parent e6af425 commit 3d37f2b
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 47 deletions.
32 changes: 5 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "fabric-loom" version "1.7-SNAPSHOT" apply false
id "maven-publish"
id "com.replaymod.preprocess" version "SNAPSHOT"
id "com.replaymod.preprocess" version "88169fcbc9"
}

preprocess {
Expand All @@ -13,30 +13,8 @@ preprocess {
def mc1210 = createNode("1.21", 1_21_00, "yarn")

mc118.link(mc119, file("versions/mapping-1.18-1.19.txt"))
mc119.link(mc1200, file("versions/mapping-empty.txt"))
mc1200.link(mc1203, file("versions/mapping-empty.txt"))
mc1203.link(mc1205, file("versions/mapping-empty.txt"))
mc1205.link(mc1210, file("versions/mapping-empty.txt"))
}

tasks.register("buildAndGather") {
subprojects {
dependsOn project.name + ":remapJar"
}
doFirst {
delete fileTree(project.projectDir.toPath().resolve('build/libs')) {
include '*'
}
copy {
subprojects {
def libDir = project.projectDir.toPath().resolve('build/libs')
from(libDir) {
include '*.jar'
exclude '*-dev.jar', '*-sources.jar'
}
into 'build/libs/'
duplicatesStrategy DuplicatesStrategy.INCLUDE
}
}
}
mc119.link(mc1200, null)
mc1200.link(mc1203, null)
mc1203.link(mc1205, null)
mc1205.link(mc1210, null)
}
24 changes: 10 additions & 14 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import groovy.json.JsonSlurper

pluginManagement {
repositories {
maven {
Expand All @@ -15,7 +17,7 @@ pluginManagement {
eachPlugin {
switch (requested.id.id) {
case "com.replaymod.preprocess": {
useModule("com.github.SkyDynamic:preprocessor:${requested.version}")
useModule("com.github.Fallen-Breath:preprocessor:${requested.version}")
break
}
}
Expand All @@ -26,19 +28,13 @@ pluginManagement {
}
}

def versions = Arrays.asList(
"1.18.2",
"1.19.4",
"1.20",
"1.20.3",
"1.20.5",
"1.21"
)
Map<String, List<String>> settings = file("settings.json").withReader {
new JsonSlurper().parse(it) as Map<String, List<String>>
}

for (String version : versions) {
for (String version : settings.get("versions")) {
include(":$version")

def proj = project(":$version")
proj.projectDir = file("versions/$version")
proj.buildFileName = "../../common.gradle"
ProjectDescriptor proj = project(":$version")
proj.setProjectDir(file("versions/$version"))
proj.setBuildFileName("../${settings.versions.get(0)}/build.gradle")
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public void run() {
Text title = Text.of(Translate.tr("quickbackupmulti.toast.end_title"));
Text content = Text.of(Translate.tr("quickbackupmulti.toast.end_content"));
//#if MC>=11800
SystemToast.show(minecraftClient.toastManager, SystemToast.Type.PERIODIC_NOTIFICATION, title, content);
SystemToast.show(minecraftClient.getToastManager(), SystemToast.Type.PERIODIC_NOTIFICATION, title, content);
//#else
//$$ SystemToast.show(minecraftClient.toastManager, SystemToast.Type.WORLD_BACKUP, title, content);
//$$ SystemToast.show(minecraftClient.getToastManager(), SystemToast.Type.WORLD_BACKUP, title, content);
//#endif
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.skydynamic.quickbackupmulti.QbmConstant;
import io.github.skydynamic.quickbackupmulti.config.Config;
import io.github.skydynamic.quickbackupmulti.utils.QbmManager;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.server.MinecraftServer;
Expand Down Expand Up @@ -30,6 +31,7 @@ private void initQuickBackupMultiClient(CallbackInfo ci) {
String worldName = saveDirectoryPath.getParent().getFileName().toString();
Config.TEMP_CONFIG.setWorldName(worldName);
Path backupDir = Path.of(QbmConstant.pathGetter.getGamePath() + "/QuickBackupMulti/").resolve(worldName);
QbmManager.savePath = saveDirectoryPath;
createBackupDir(backupDir);
setDataBase(worldName);
startSchedule();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import io.github.skydynamic.quickbackupmulti.QbmConstant;
import io.github.skydynamic.quickbackupmulti.config.Config;
import io.github.skydynamic.quickbackupmulti.utils.QbmManager;
import net.fabricmc.api.Environment;
import net.fabricmc.api.EnvType;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.WorldSavePath;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand All @@ -20,7 +23,9 @@

@Environment(EnvType.SERVER)
@Mixin(MinecraftServer.class)
public class MinecraftServer_ServerMixin {
public abstract class MinecraftServer_ServerMixin {
@Shadow public abstract Path getSavePath(WorldSavePath worldSavePath);

@Inject(method = "<init>", at = @At("TAIL"))
private void setServer(CallbackInfo ci) {
Config.TEMP_CONFIG.setServerValue((MinecraftServer)(Object)this);
Expand All @@ -30,6 +35,7 @@ private void setServer(CallbackInfo ci) {
private void initQuickBackupMulti(CallbackInfo ci) {
Path backupDir = Path.of(QbmConstant.pathGetter.getGamePath() + "/QuickBackupMulti/");
Config.TEMP_CONFIG.setWorldName("");
QbmManager.savePath = this.getSavePath(WorldSavePath.ROOT);
createBackupDir(backupDir);
setDataBase("server");
startSchedule();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.Text;
import net.minecraft.util.WorldSavePath;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.IOFileFilter;
Expand All @@ -33,7 +32,7 @@

public class QbmManager {
public static Path backupDir = Path.of(QbmConstant.pathGetter.getGamePath() + "/QuickBackupMulti/");
public static Path savePath = Config.TEMP_CONFIG.server.getSavePath(WorldSavePath.ROOT);
public static Path savePath;
public static IOFileFilter fileFilter = new NotFileFilter(new NameFileFilter(Config.INSTANCE.getIgnoredFiles()));
// public static IOFileFilter dirFilter = new NonRecursiveDirFilter();

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion versions/1.21/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
minecraft_version=1.21
minecraft_support_version=>=1.21
yarn_mappings=1.21+build.9
loader_version=0.15.10
loader_version=0.15.11
fabric_version=0.100.6+1.21
game_versions=1.21
Empty file removed versions/mapping-empty.txt
Empty file.

0 comments on commit 3d37f2b

Please sign in to comment.