Add initial Region.protect
Dieser Commit ist enthalten in:
Ursprung
f1e6006c51
Commit
2353fb17e7
@ -29,6 +29,7 @@ import de.steamwar.bausystem.world.Color;
|
|||||||
import de.steamwar.bausystem.world.SizedStack;
|
import de.steamwar.bausystem.world.SizedStack;
|
||||||
import de.steamwar.sql.NoClipboardException;
|
import de.steamwar.sql.NoClipboardException;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
@ -133,10 +134,19 @@ public class Region {
|
|||||||
|
|
||||||
private JsonObject regionOptions = new JsonObject();
|
private JsonObject regionOptions = new JsonObject();
|
||||||
|
|
||||||
|
@Getter
|
||||||
private TNTMode tntMode = Region.buildAreaEnabled() ? TNTMode.ONLY_TB : TNTMode.OFF;
|
private TNTMode tntMode = Region.buildAreaEnabled() ? TNTMode.ONLY_TB : TNTMode.OFF;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private boolean freeze = false;
|
private boolean freeze = false;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private boolean fire = false;
|
private boolean fire = false;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private boolean protect = false;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private Color color = Color.YELLOW;
|
private Color color = Color.YELLOW;
|
||||||
|
|
||||||
private Region(ConfigurationSection config) {
|
private Region(ConfigurationSection config) {
|
||||||
@ -178,6 +188,10 @@ public class Region {
|
|||||||
freeze = regionOptions.getAsJsonPrimitive("freeze").getAsBoolean();
|
freeze = regionOptions.getAsJsonPrimitive("freeze").getAsBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (regionOptions.has("protect")) {
|
||||||
|
protect = regionOptions.getAsJsonPrimitive("protect").getAsBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
if (regionOptions.has("color")) {
|
if (regionOptions.has("color")) {
|
||||||
String colorName = regionOptions.getAsJsonPrimitive("color").getAsString();
|
String colorName = regionOptions.getAsJsonPrimitive("color").getAsString();
|
||||||
try {
|
try {
|
||||||
@ -191,10 +205,6 @@ public class Region {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColor(Color color) {
|
public void setColor(Color color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
regionOptions.add("color", new JsonPrimitive(color.name()));
|
regionOptions.add("color", new JsonPrimitive(color.name()));
|
||||||
@ -217,36 +227,42 @@ public class Region {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TNTMode getTntMode() {
|
|
||||||
return tntMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTntMode(TNTMode tntMode) {
|
public void setTntMode(TNTMode tntMode) {
|
||||||
this.tntMode = tntMode;
|
this.tntMode = tntMode;
|
||||||
setLinkedRegion(region -> region.tntMode = tntMode);
|
setLinkedRegion(region -> {
|
||||||
|
region.tntMode = tntMode;
|
||||||
|
region.regionOptions.add("tnt", new JsonPrimitive(tntMode.name()));
|
||||||
|
});
|
||||||
regionOptions.add("tnt", new JsonPrimitive(tntMode.name()));
|
regionOptions.add("tnt", new JsonPrimitive(tntMode.name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFreeze() {
|
|
||||||
return freeze;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFreeze(boolean freeze) {
|
public void setFreeze(boolean freeze) {
|
||||||
this.freeze = freeze;
|
this.freeze = freeze;
|
||||||
setLinkedRegion(region -> region.freeze = freeze);
|
setLinkedRegion(region -> {
|
||||||
|
region.freeze = freeze;
|
||||||
|
region.regionOptions.add("freeze", new JsonPrimitive(freeze));
|
||||||
|
});
|
||||||
regionOptions.add("freeze", new JsonPrimitive(freeze));
|
regionOptions.add("freeze", new JsonPrimitive(freeze));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFire() {
|
|
||||||
return fire;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFire(boolean fire) {
|
public void setFire(boolean fire) {
|
||||||
this.fire = fire;
|
this.fire = fire;
|
||||||
setLinkedRegion(region -> region.fire = fire);
|
setLinkedRegion(region -> {
|
||||||
|
region.fire = fire;
|
||||||
|
region.regionOptions.add("fire", new JsonPrimitive(fire));
|
||||||
|
});
|
||||||
regionOptions.add("fire", new JsonPrimitive(fire));
|
regionOptions.add("fire", new JsonPrimitive(fire));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setProtect(boolean protect) {
|
||||||
|
this.protect = protect;
|
||||||
|
setLinkedRegion(region -> {
|
||||||
|
region.protect = protect;
|
||||||
|
region.regionOptions.add("protect", new JsonPrimitive(protect));
|
||||||
|
});
|
||||||
|
regionOptions.add("protect", new JsonPrimitive(protect));
|
||||||
|
}
|
||||||
|
|
||||||
public Point getMinPoint(RegionType regionType, RegionExtensionType regionExtensionType) {
|
public Point getMinPoint(RegionType regionType, RegionExtensionType regionExtensionType) {
|
||||||
switch (regionType) {
|
switch (regionType) {
|
||||||
case BUILD:
|
case BUILD:
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren