Add Updater
Name needs to be the same to update correctly
Dieser Commit ist enthalten in:
Ursprung
a252544fbb
Commit
6de578df18
@ -19,11 +19,9 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.region;
|
package de.steamwar.bausystem.region;
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import yapion.hierarchy.types.YAPIONObject;
|
import yapion.hierarchy.types.YAPIONObject;
|
||||||
import yapion.hierarchy.types.YAPIONType;
|
import yapion.hierarchy.types.YAPIONType;
|
||||||
import yapion.serializing.YAPIONDeserializer;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -82,7 +80,9 @@ public class Prototype {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PROTOTYPE_MAP.containsKey(name)) {
|
if (PROTOTYPE_MAP.containsKey(name)) {
|
||||||
Region.getRegion(PROTOTYPE_MAP.remove(name)).forEach(region -> region.setPrototype(this));
|
Region.getRegion(PROTOTYPE_MAP.remove(name)).forEach(region -> {
|
||||||
|
region.setPrototype(this);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
PROTOTYPE_MAP.put(name, this);
|
PROTOTYPE_MAP.put(name, this);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,10 @@ import yapion.hierarchy.types.YAPIONValue;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -69,7 +72,7 @@ public class Region {
|
|||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private Prototype prototype;
|
private Prototype prototype;
|
||||||
private Set<Prototype> prototypes;
|
private Set<String> prototypes;
|
||||||
|
|
||||||
private Point minPoint;
|
private Point minPoint;
|
||||||
private Point maxPoint;
|
private Point maxPoint;
|
||||||
@ -115,7 +118,7 @@ public class Region {
|
|||||||
if (regionConfig.containsKey("prototypes", YAPIONType.ARRAY)) {
|
if (regionConfig.containsKey("prototypes", YAPIONType.ARRAY)) {
|
||||||
regionConfig.getArray("prototypes").forEach(yapionAnyType -> {
|
regionConfig.getArray("prototypes").forEach(yapionAnyType -> {
|
||||||
if (yapionAnyType instanceof YAPIONValue) {
|
if (yapionAnyType instanceof YAPIONValue) {
|
||||||
prototypes.add(Prototype.PROTOTYPE_MAP.get(((YAPIONValue<String>) yapionAnyType).get()));
|
prototypes.add(((YAPIONValue<String>) yapionAnyType).get());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -136,9 +139,6 @@ public class Region {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.prototype != null && !prototypes.contains(prototype)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.prototype = prototype;
|
this.prototype = prototype;
|
||||||
|
|
||||||
this.minPoint = point;
|
this.minPoint = point;
|
||||||
@ -259,10 +259,7 @@ public class Region {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPrototype(@NonNull Prototype prototype) {
|
public void setPrototype(@NonNull Prototype prototype) {
|
||||||
if (this.prototype == null) {
|
if (!prototypes.contains(prototype.getName()) && !prototypes.isEmpty()) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!prototypes.contains(prototype)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
generatePrototypeData(prototype, minPoint);
|
generatePrototypeData(prototype, minPoint);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren