Fixed saving issues
This commit is contained in:
parent
79f37ee2bc
commit
27bf53aaad
8 changed files with 58 additions and 31 deletions
16
pom.xml
16
pom.xml
|
@ -14,7 +14,6 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<jackson.version>2.10.0</jackson.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
@ -53,6 +52,14 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<compilerArgument>-parameters</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@ -105,7 +112,12 @@
|
|||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<version>2.10.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-parameter-names</artifactId>
|
||||
<version>2.10.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
@ -8,12 +9,12 @@ import java.util.ArrayList;
|
|||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter @Setter
|
||||
@Getter @Setter @NoArgsConstructor
|
||||
public class Floor {
|
||||
private final String world;
|
||||
private final int y;
|
||||
private final ArrayList<LiftBlock> doorBlocks = new ArrayList<>();
|
||||
private final HashSet<UUID> whitelist = new HashSet<>();
|
||||
private String world;
|
||||
private int y;
|
||||
private ArrayList<LiftBlock> doorBlocks = new ArrayList<>();
|
||||
private HashSet<UUID> whitelist = new HashSet<>();
|
||||
|
||||
public Floor(int y, String world) {
|
||||
this.y = y;
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import nl.SBDeveloper.V10Lift.API.Runnables.DoorCloser;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
@NoArgsConstructor
|
||||
public class Lift {
|
||||
@Getter @Setter private String worldName;
|
||||
@Getter @Setter private int y;
|
||||
@Getter private final HashSet<UUID> owners;
|
||||
@Getter private HashSet<UUID> owners;
|
||||
//@Getter @Setter private ArrayList<String> whitelist;
|
||||
@Getter private final TreeSet<LiftBlock> blocks = new TreeSet<>();
|
||||
@Getter private final LinkedHashMap<String, Floor> floors = new LinkedHashMap<>();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
@ -9,22 +10,23 @@ import javax.annotation.Nonnull;
|
|||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
|
||||
@NoArgsConstructor
|
||||
public class LiftBlock implements Comparable<LiftBlock> {
|
||||
|
||||
@Getter @Setter private String world;
|
||||
@Getter private final int x;
|
||||
@Getter private int x;
|
||||
@Getter @Setter private int y;
|
||||
@Getter private final int z;
|
||||
@Getter private int z;
|
||||
|
||||
//Only used for cabine blocks, because those need caching!
|
||||
@Getter private final Material mat;
|
||||
@Getter private final byte data;
|
||||
@Getter private final BlockFace face;
|
||||
@Getter private final String bisected;
|
||||
@Getter private final String[] signLines;
|
||||
@Getter private Material mat;
|
||||
@Getter private byte data;
|
||||
@Getter private BlockFace face;
|
||||
@Getter private String bisected;
|
||||
@Getter private String[] signLines;
|
||||
|
||||
//Only used for inputs!
|
||||
@Getter private final String floor;
|
||||
@Getter private String floor;
|
||||
@Getter @Setter private boolean active = false;
|
||||
|
||||
//Only used for chests
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@Getter @Setter
|
||||
@Getter @Setter @NoArgsConstructor
|
||||
public class LiftRope {
|
||||
private final Material type;
|
||||
private final BlockFace face;
|
||||
private final String world;
|
||||
private final int x;
|
||||
private final int minY;
|
||||
private final int maxY;
|
||||
private final int z;
|
||||
private Material type;
|
||||
private BlockFace face;
|
||||
private String world;
|
||||
private int x;
|
||||
private int minY;
|
||||
private int maxY;
|
||||
private int z;
|
||||
private int currently;
|
||||
|
||||
public LiftRope(Material type, BlockFace face, String world, int x, int minY, int maxY, int z) {
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@Getter @Setter
|
||||
@Getter @Setter @NoArgsConstructor
|
||||
public class LiftSign {
|
||||
private String world;
|
||||
private int x;
|
||||
private int z;
|
||||
private int y;
|
||||
private String oldText = null;
|
||||
private final byte type;
|
||||
private byte type;
|
||||
private byte state;
|
||||
|
||||
public LiftSign(String world, int x, int y, int z, byte type, byte state) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package nl.SBDeveloper.V10Lift.API.Objects;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
@ -9,14 +10,14 @@ import org.bukkit.entity.Entity;
|
|||
import java.lang.reflect.Field;
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter
|
||||
@Getter @NoArgsConstructor
|
||||
public class V10Entity {
|
||||
private final UUID entityUUID;
|
||||
private UUID entityUUID;
|
||||
private String world;
|
||||
private int locX;
|
||||
private int locY;
|
||||
private int locZ;
|
||||
private final int y;
|
||||
private int y;
|
||||
@Setter private short step;
|
||||
|
||||
public V10Entity(UUID entityUUID, String worldName, int x, int y, int z, int cury) {
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package nl.SBDeveloper.V10Lift.Managers;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
|
||||
import nl.SBDeveloper.V10Lift.API.Objects.Lift;
|
||||
import nl.SBDevelopment.SBUtilities.Data.SQLiteDB;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -47,7 +50,9 @@ public class DBManager {
|
|||
|
||||
byte[] blob = liftSet.getBytes("liftData");
|
||||
String json = new String(blob);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
ObjectMapper mapper = new ObjectMapper()
|
||||
.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES)
|
||||
.registerModule(new ParameterNamesModule(JsonCreator.Mode.PROPERTIES));
|
||||
Lift lift = mapper.readValue(json, Lift.class);
|
||||
DataManager.addLift(liftSet.getString("liftName"), lift);
|
||||
|
||||
|
@ -93,7 +98,9 @@ public class DBManager {
|
|||
public void save() throws JsonProcessingException {
|
||||
for (Map.Entry<String, Lift> entry : DataManager.getLifts().entrySet()) {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
ObjectMapper mapper = new ObjectMapper()
|
||||
.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES)
|
||||
.registerModule(new ParameterNamesModule(JsonCreator.Mode.PROPERTIES));
|
||||
|
||||
byte[] blob = mapper.writeValueAsString(entry.getValue()).getBytes();
|
||||
|
||||
|
|
Loading…
Reference in a new issue