Fix portal deletion
Dieser Commit ist enthalten in:
Ursprung
773f072483
Commit
4fd06912c7
@ -56,10 +56,10 @@ public class Portal implements PortalHandler, ConfigurationSerializable {
|
||||
private final PortalType type;
|
||||
private final PortalHandler handler;
|
||||
|
||||
public Vector v1;
|
||||
public Vector v2;
|
||||
public Vector dv;
|
||||
public double degree;
|
||||
final Vector v1;
|
||||
final Vector v2;
|
||||
final Vector dv;
|
||||
final double degree;
|
||||
|
||||
public Portal(Map<String, Object> map) {
|
||||
this.id = (String) map.get("id");
|
||||
@ -67,6 +67,10 @@ public class Portal implements PortalHandler, ConfigurationSerializable {
|
||||
this.pos2 = (Location) map.get("pos2");
|
||||
this.type = PortalType.valueOf((String) map.get("type"));
|
||||
this.handler = type.deserialize(map, this);
|
||||
v1 = getPos1().toVector();
|
||||
v2 = getPos2().toVector();
|
||||
dv = v2.clone().subtract(v1);
|
||||
degree = NORMAL.angle(dv);
|
||||
|
||||
init();
|
||||
}
|
||||
@ -77,6 +81,10 @@ public class Portal implements PortalHandler, ConfigurationSerializable {
|
||||
this.pos2 = pos2;
|
||||
this.handler = handlerConstructor.apply(this);
|
||||
this.type = handler.type();
|
||||
v1 = pos1.toVector();
|
||||
v2 = pos2.toVector();
|
||||
dv = v2.clone().subtract(v1);
|
||||
degree = NORMAL.angle(dv);
|
||||
|
||||
init();
|
||||
LobbySystem.config().save();
|
||||
@ -93,11 +101,6 @@ public class Portal implements PortalHandler, ConfigurationSerializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
v1 = getPos1().toVector();
|
||||
v2 = getPos2().toVector();
|
||||
dv = v2.clone().subtract(v1);
|
||||
this.degree = NORMAL.angle(dv);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -122,7 +125,7 @@ public class Portal implements PortalHandler, ConfigurationSerializable {
|
||||
@Override
|
||||
public void delete() {
|
||||
handler.delete();
|
||||
portals.remove("id");
|
||||
portals.remove(id);
|
||||
posMap.values().removeIf(this::equals);
|
||||
LobbySystem.config().save();
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren