Update Region.inBuildRegion and Region.inTestblockRegion

This commit is contained in:
2024-11-03 13:27:35 +01:00
parent 96daa2c861
commit 4e70a675c2
4 changed files with 57 additions and 6 deletions
@@ -21,11 +21,14 @@ package de.steamwar.bausystem.regionnew;
import org.bukkit.Location;
import java.lang.reflect.InvocationTargetException;
import java.util.Optional;
import java.util.stream.Stream;
public interface RegionSystem {
RegionSystem REGION_SYSTEM = init();
void load();
void save();
@@ -37,4 +40,48 @@ public interface RegionSystem {
Stream<Region> getRegions();
boolean isModular();
private static RegionSystem init() {
try {
return (RegionSystem) Class.forName("de.steamwar.bausystem.regionnew.FixedRegionSystem").getConstructor().newInstance();
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException |
InvocationTargetException e) {
return new RegionSystem() {
@Override
public void load() {
throw new UnsupportedOperationException();
}
@Override
public void save() {
throw new UnsupportedOperationException();
}
@Override
public Region getGlobalRegion() {
throw new UnsupportedOperationException();
}
@Override
public Region get(Location location) {
throw new UnsupportedOperationException();
}
@Override
public Optional<Region> getRegion(String name) {
throw new UnsupportedOperationException();
}
@Override
public Stream<Region> getRegions() {
throw new UnsupportedOperationException();
}
@Override
public boolean isModular() {
throw new UnsupportedOperationException();
}
};
}
}
}