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