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