forked from SteamWar/SteamWar
Update stuff from peer review
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ public class TraceRepository {
|
||||
/**
|
||||
* Increment this when changing serialisation format
|
||||
*/
|
||||
public static final int SERIALISATION_VERSION = 2;
|
||||
public static final int SERIALISATION_VERSION = 3;
|
||||
public static final int WRITE_TICK_DATA = 0b00000001;
|
||||
public static final int EXPLOSION = 0b00000010;
|
||||
public static final int IN_WATER = 0b00000100;
|
||||
|
||||
+5
-2
@@ -33,17 +33,20 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
public class RegionConfig {
|
||||
public class GameModeConfig {
|
||||
|
||||
private final boolean loaded;
|
||||
|
||||
/**
|
||||
* See gamemode config Times key
|
||||
*/
|
||||
private Times Times = new Times();
|
||||
private Schematic Schematic = new Schematic();
|
||||
private Arena Arena = new Arena();
|
||||
private Server Server = new Server();
|
||||
private Techhider Techhider = new Techhider();
|
||||
|
||||
public RegionConfig(File file) {
|
||||
public GameModeConfig(File file) {
|
||||
if (file == null || !file.exists()) {
|
||||
loaded = false;
|
||||
return;
|
||||
@@ -64,7 +64,7 @@ public interface Region {
|
||||
Area getTestblockArea();
|
||||
|
||||
@NonNull
|
||||
RegionConfig getGameModeConfig();
|
||||
GameModeConfig getGameModeConfig();
|
||||
|
||||
@NonNull
|
||||
RegionHistory getHistory();
|
||||
|
||||
@@ -74,8 +74,6 @@ public interface RegionSystem {
|
||||
@NonNull
|
||||
Stream<Region> getRegions();
|
||||
|
||||
boolean isModular();
|
||||
|
||||
private static RegionSystem init() {
|
||||
try {
|
||||
return (RegionSystem) Class.forName("de.steamwar.bausystem.region.FixedRegionSystem").getConstructor().newInstance();
|
||||
@@ -116,11 +114,6 @@ public interface RegionSystem {
|
||||
public Stream<Region> getRegions() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModular() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ package de.steamwar.bausystem.region.flags;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* ChangedMode defines that a Region has changed or not
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ChangedMode implements Flag.Value<ChangedMode> {
|
||||
@@ -36,7 +39,7 @@ public enum ChangedMode implements Flag.Value<ChangedMode> {
|
||||
@Override
|
||||
public ChangedMode[] getValues() {
|
||||
if (ChangedMode.values == null) {
|
||||
ChangedMode.values = ChangedMode.values(); //NOSONAR
|
||||
ChangedMode.values = ChangedMode.values();
|
||||
}
|
||||
return ChangedMode.values;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ package de.steamwar.bausystem.region.flags;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* ColorMode defines the colors a Region can have
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ColorMode implements Flag.Value<ColorMode> {
|
||||
@@ -49,7 +52,7 @@ public enum ColorMode implements Flag.Value<ColorMode> {
|
||||
@Override
|
||||
public ColorMode[] getValues() {
|
||||
if (ColorMode.values == null) {
|
||||
ColorMode.values = ColorMode.values(); //NOSONAR
|
||||
ColorMode.values = ColorMode.values();
|
||||
}
|
||||
return ColorMode.values;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ package de.steamwar.bausystem.region.flags;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* FireMode defines if fire should be enabled or disabled in a Region
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FireMode implements Flag.Value<FireMode> {
|
||||
@@ -35,7 +38,7 @@ public enum FireMode implements Flag.Value<FireMode> {
|
||||
@Override
|
||||
public FireMode[] getValues() {
|
||||
if (FireMode.values == null) {
|
||||
FireMode.values = FireMode.values(); //NOSONAR
|
||||
FireMode.values = FireMode.values();
|
||||
}
|
||||
return FireMode.values;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ package de.steamwar.bausystem.region.flags;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* FreezeMode defines if freeze should be enabled or disabled in a Region
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FreezeMode implements Flag.Value<FreezeMode> {
|
||||
@@ -36,7 +39,7 @@ public enum FreezeMode implements Flag.Value<FreezeMode> {
|
||||
@Override
|
||||
public FreezeMode[] getValues() {
|
||||
if (FreezeMode.values == null) {
|
||||
FreezeMode.values = FreezeMode.values(); //NOSONAR
|
||||
FreezeMode.values = FreezeMode.values();
|
||||
}
|
||||
return FreezeMode.values;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ package de.steamwar.bausystem.region.flags;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* ItemMode defines if items should be droppable or deleted in a Region
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ItemMode implements Flag.Value<ItemMode> {
|
||||
@@ -35,7 +38,7 @@ public enum ItemMode implements Flag.Value<ItemMode> {
|
||||
@Override
|
||||
public ItemMode[] getValues() {
|
||||
if (ItemMode.values == null) {
|
||||
ItemMode.values = ItemMode.values(); //NOSONAR
|
||||
ItemMode.values = ItemMode.values();
|
||||
}
|
||||
return ItemMode.values;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ package de.steamwar.bausystem.region.flags;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* NoGravityMode defines if entities and items should have gravity or not in a Region
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum NoGravityMode implements Flag.Value<NoGravityMode> {
|
||||
@@ -35,7 +38,7 @@ public enum NoGravityMode implements Flag.Value<NoGravityMode> {
|
||||
@Override
|
||||
public NoGravityMode[] getValues() {
|
||||
if (NoGravityMode.values == null) {
|
||||
NoGravityMode.values = NoGravityMode.values(); //NOSONAR
|
||||
NoGravityMode.values = NoGravityMode.values();
|
||||
}
|
||||
return NoGravityMode.values;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ package de.steamwar.bausystem.region.flags;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* ProtectMode defines if the floor should be protected inside a Region
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ProtectMode implements Flag.Value<ProtectMode> {
|
||||
@@ -35,7 +38,7 @@ public enum ProtectMode implements Flag.Value<ProtectMode> {
|
||||
@Override
|
||||
public ProtectMode[] getValues() {
|
||||
if (ProtectMode.values == null) {
|
||||
ProtectMode.values = ProtectMode.values(); //NOSONAR
|
||||
ProtectMode.values = ProtectMode.values();
|
||||
}
|
||||
return ProtectMode.values;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ package de.steamwar.bausystem.region.flags;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* TNTMode defines what TNT Explosions should destroy in a Region
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TNTMode implements Flag.Value<TNTMode> {
|
||||
@@ -36,7 +39,7 @@ public enum TNTMode implements Flag.Value<TNTMode> {
|
||||
@Override
|
||||
public TNTMode[] getValues() {
|
||||
if (TNTMode.values == null) {
|
||||
TNTMode.values = TNTMode.values(); //NOSONAR
|
||||
TNTMode.values = TNTMode.values();
|
||||
}
|
||||
return TNTMode.values;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ package de.steamwar.bausystem.region.flags;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* TestblockMode defines where the Testblock should be inside a Region
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TestblockMode implements Flag.Value<TestblockMode> {
|
||||
@@ -37,7 +40,7 @@ public enum TestblockMode implements Flag.Value<TestblockMode> {
|
||||
@Override
|
||||
public TestblockMode[] getValues() {
|
||||
if (TestblockMode.values == null) {
|
||||
TestblockMode.values = TestblockMode.values(); //NOSONAR
|
||||
TestblockMode.values = TestblockMode.values();
|
||||
}
|
||||
return TestblockMode.values;
|
||||
}
|
||||
|
||||
-5
@@ -79,9 +79,4 @@ public class FixedRegionSystem implements RegionSystem {
|
||||
public Stream<Region> getRegions() {
|
||||
return REGION_MAP.values().stream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModular() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -90,7 +90,7 @@ public final class FixedGlobalRegion implements Region {
|
||||
}
|
||||
};
|
||||
|
||||
private static final RegionConfig GLOBAL_CONFIG = new RegionConfig(null);
|
||||
private static final GameModeConfig GLOBAL_CONFIG = new GameModeConfig(null);
|
||||
|
||||
private FixedGlobalRegion() {
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public final class FixedGlobalRegion implements Region {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionConfig getGameModeConfig() {
|
||||
public @NonNull GameModeConfig getGameModeConfig() {
|
||||
return GLOBAL_CONFIG;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -56,7 +56,7 @@ public class FixedRegion implements Region {
|
||||
private final Area testblock;
|
||||
private final int floorLevel;
|
||||
private final int waterLevel;
|
||||
private final RegionConfig regionConfig;
|
||||
private final GameModeConfig gameModeConfig;
|
||||
private final RegionHistory regionHistory = new RegionHistory.Impl(20);
|
||||
|
||||
private final RegionBackups regionBackups = new RegionBackups() {
|
||||
@@ -336,7 +336,7 @@ public class FixedRegion implements Region {
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.regionConfig = new RegionConfig(found);
|
||||
this.gameModeConfig = new GameModeConfig(found);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -370,8 +370,8 @@ public class FixedRegion implements Region {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull RegionConfig getGameModeConfig() {
|
||||
return regionConfig;
|
||||
public @NonNull GameModeConfig getGameModeConfig() {
|
||||
return gameModeConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user