getMinecraftServer was renamed to getServer
Also updated to mc 1.17.1
This commit is contained in:
parent
e9f6a29eb2
commit
cdd2b78c43
@ -1,12 +1,12 @@
|
||||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
minecraft_version=1.17
|
||||
yarn_mappings=1.17+build.10
|
||||
loader_version=0.11.5
|
||||
minecraft_version=1.17.1
|
||||
yarn_mappings=1.17.1+build.1
|
||||
loader_version=0.11.6
|
||||
|
||||
#Fabric api
|
||||
fabric_version=0.35.1+1.17
|
||||
fabric_version=0.36.1+1.17
|
||||
|
||||
#Cloth Config
|
||||
cloth_version=5.0.34
|
||||
|
@ -98,7 +98,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.getMinecraftServer().isSinglePlayer() &&
|
||||
(ctx.getServer().isSinglePlayer() &&
|
||||
config.get().alwaysSingleplayerAllowed);
|
||||
} catch (Exception ignored) { //Command was called from server console.
|
||||
return true;
|
||||
|
@ -28,7 +28,6 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.szum123321.textile_backup.Statics;
|
||||
import net.szum123321.textile_backup.core.restore.RestoreHelper;
|
||||
import org.lwjgl.system.CallbackI;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@ -43,7 +42,7 @@ public final class FileSuggestionProvider implements SuggestionProvider<ServerCo
|
||||
public CompletableFuture<Suggestions> getSuggestions(CommandContext<ServerCommandSource> ctx, SuggestionsBuilder builder) throws CommandSyntaxException {
|
||||
String remaining = builder.getRemaining();
|
||||
|
||||
for (RestoreHelper.RestoreableFile file : RestoreHelper.getAvailableBackups(ctx.getSource().getMinecraftServer())) {
|
||||
for (RestoreHelper.RestoreableFile file : RestoreHelper.getAvailableBackups(ctx.getSource().getServer())) {
|
||||
String formattedCreationTime = file.getCreationTime().format(Statics.defaultDateTimeFormatter);
|
||||
|
||||
if (formattedCreationTime.startsWith(remaining)) {
|
||||
|
@ -38,7 +38,7 @@ public class CleanupCommand {
|
||||
log.sendInfo(
|
||||
source,
|
||||
"Deleted: {} files.",
|
||||
BackupHelper.executeFileLimit(source, Utilities.getLevelName(source.getMinecraftServer()))
|
||||
BackupHelper.executeFileLimit(source, Utilities.getLevelName(source.getServer()))
|
||||
);
|
||||
|
||||
return 1;
|
||||
|
@ -73,7 +73,7 @@ public class BlacklistCommand {
|
||||
|
||||
builder.append(" successfully.");
|
||||
|
||||
ctx.getSource().getMinecraftServer().getCommandManager().sendCommandTree(player);
|
||||
ctx.getSource().getServer().getCommandManager().sendCommandTree(player);
|
||||
|
||||
log.sendInfo(ctx.getSource(), builder.toString());
|
||||
}
|
||||
@ -90,7 +90,7 @@ public class BlacklistCommand {
|
||||
config.get().playerBlacklist.remove(player.getEntityName());
|
||||
config.save();
|
||||
|
||||
ctx.getSource().getMinecraftServer().getCommandManager().sendCommandTree(player);
|
||||
ctx.getSource().getServer().getCommandManager().sendCommandTree(player);
|
||||
|
||||
log.sendInfo(ctx.getSource(), "Player: {} removed from the blacklist successfully.", player.getEntityName());
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class DeleteCommand {
|
||||
throw CommandExceptions.DATE_TIME_PARSE_COMMAND_EXCEPTION_TYPE.create(e);
|
||||
}
|
||||
|
||||
File root = Utilities.getBackupRootPath(Utilities.getLevelName(source.getMinecraftServer()));
|
||||
File root = Utilities.getBackupRootPath(Utilities.getLevelName(source.getServer()));
|
||||
|
||||
Optional<File> optionalFile = Arrays.stream(root.listFiles())
|
||||
.filter(Utilities::isValidBackup)
|
||||
|
@ -33,7 +33,7 @@ public class ListBackupsCommand {
|
||||
public static LiteralArgumentBuilder<ServerCommandSource> register() {
|
||||
return CommandManager.literal("list")
|
||||
.executes(ctx -> { StringBuilder builder = new StringBuilder();
|
||||
List<RestoreHelper.RestoreableFile> backups = RestoreHelper.getAvailableBackups(ctx.getSource().getMinecraftServer());
|
||||
List<RestoreHelper.RestoreableFile> backups = RestoreHelper.getAvailableBackups(ctx.getSource().getServer());
|
||||
|
||||
if(backups.size() == 0) {
|
||||
builder.append("There a no backups available for this world.");
|
||||
|
@ -73,7 +73,7 @@ public class WhitelistCommand {
|
||||
|
||||
builder.append(" successfully.");
|
||||
|
||||
ctx.getSource().getMinecraftServer().getCommandManager().sendCommandTree(player);
|
||||
ctx.getSource().getServer().getCommandManager().sendCommandTree(player);
|
||||
|
||||
log.sendInfo(ctx.getSource(), builder.toString());
|
||||
}
|
||||
@ -90,7 +90,7 @@ public class WhitelistCommand {
|
||||
config.get().playerWhitelist.remove(player.getEntityName());
|
||||
config.save();
|
||||
|
||||
ctx.getSource().getMinecraftServer().getCommandManager().sendCommandTree(player);
|
||||
ctx.getSource().getServer().getCommandManager().sendCommandTree(player);
|
||||
|
||||
log.sendInfo(ctx.getSource(), "Player: {} removed from the whitelist successfully.", player.getEntityName());
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class RestoreBackupCommand {
|
||||
throw CommandExceptions.DATE_TIME_PARSE_COMMAND_EXCEPTION_TYPE.create(e);
|
||||
}
|
||||
|
||||
Optional<RestoreHelper.RestoreableFile> backupFile = RestoreHelper.findFileAndLockIfPresent(dateTime, source.getMinecraftServer());
|
||||
Optional<RestoreHelper.RestoreableFile> backupFile = RestoreHelper.findFileAndLockIfPresent(dateTime, source.getServer());
|
||||
|
||||
if(backupFile.isPresent()) {
|
||||
log.info("Found file to restore {}", backupFile.get().getFile().getName());
|
||||
|
@ -121,8 +121,7 @@ public record BackupContext(MinecraftServer server,
|
||||
}
|
||||
|
||||
if (server == null) {
|
||||
if (commandSource != null)
|
||||
setServer(commandSource.getMinecraftServer());
|
||||
if (commandSource != null) setServer(commandSource.getServer());
|
||||
else
|
||||
throw new RuntimeException("Both MinecraftServer and ServerCommandSource weren't provided!");
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public record RestoreContext(RestoreHelper.RestoreableFile file,
|
||||
}
|
||||
|
||||
public RestoreContext build() {
|
||||
if (server == null) server = serverCommandSource.getMinecraftServer();
|
||||
if (server == null) server = serverCommandSource.getServer();
|
||||
|
||||
ActionInitiator initiator = serverCommandSource.getEntity() instanceof PlayerEntity ? ActionInitiator.Player : ActionInitiator.ServerConsole;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user