Reduce to 24 compiler errors

This commit is contained in:
2025-07-30 20:37:52 +02:00
parent 598daadd33
commit fb518efe63
7 changed files with 109 additions and 47 deletions
@@ -1,6 +1,5 @@
package de.steamwar.bausystem.region;
import com.sk89q.worldedit.EditSession;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.region.flags.ChangedMode;
import de.steamwar.bausystem.region.flags.Flag;
@@ -9,6 +8,7 @@ import de.steamwar.linkage.api.Enable;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.Iterator;
import java.util.Optional;
@Linked
public class BackupScheduler implements Enable {
@@ -41,10 +41,11 @@ public class BackupScheduler implements Enable {
}
Region region = regionsToBackup.next();
EditSession editSession = region.getArea()
.copy(false);
// TODO: Implement saving EditSession to schematic!
region.getFlags().set(Flag.CHANGED, ChangedMode.NO_CHANGE);
Optional<RegionBackups.Backup> backup = region.getBackups()
.create(RegionBackups.BackupType.AUTOMATIC);
if (backup.isPresent()) {
region.getFlags().set(Flag.CHANGED, ChangedMode.NO_CHANGE);
}
}
}.runTaskTimer(BauSystem.getInstance(), 0, 20 * 60);
}
@@ -35,9 +35,11 @@ public interface Region {
static Stream<Region> getRegions() {
return RegionSystem.INSTANCE.getRegions();
}
static Region getRegion(Location location) {
return RegionSystem.INSTANCE.get(location);
}
static Region getGlobalRegion() {
return RegionSystem.INSTANCE.getGlobalRegion();
}
@@ -58,6 +60,8 @@ public interface Region {
RegionHistory getHistory();
RegionBackups getBackups();
interface Area {
Area EMPTY = new Area() {
@@ -0,0 +1,56 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.region;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.List;
import java.util.Optional;
public interface RegionBackups {
@RequiredArgsConstructor
enum BackupType {
MANUAL(5),
AUTOMATIC(20),
;
private final int maxBackups;
}
@RequiredArgsConstructor
@Getter
abstract class Backup {
private final BackupType type;
private final String name;
private final FlagStorage flags;
public abstract boolean load();
public abstract void delete();
}
Optional<Backup> create(BackupType backupType);
List<Backup> list();
Backup get(String name);
}