Got rid of cancerous Cloneable interface and fixed possible NPE when cloning a Position Keyframe

This commit is contained in:
CrushedPixel
2015-06-12 23:27:43 +02:00
parent b1864424d9
commit 8ef7e768d6
5 changed files with 14 additions and 15 deletions

View File

@@ -1,11 +1,10 @@
package eu.crushedpixel.replaymod.holders;
public class Keyframe implements Cloneable {
public class Keyframe {
private int realTimestamp;
@Override
public Object clone() {
public Keyframe clone() {
return new Keyframe(realTimestamp);
}

View File

@@ -8,7 +8,7 @@ public class MarkerKeyframe extends Keyframe {
private String name;
@Override
public Object clone() {
public Keyframe clone() {
return new MarkerKeyframe(this.getPosition(), this.getRealTimestamp(), this.getName());
}

View File

@@ -8,8 +8,8 @@ public class PositionKeyframe extends Keyframe {
private Integer spectatedEntityID = null;
@Override
public Object clone() {
return new PositionKeyframe(this.getRealTimestamp(), this.getPosition(), this.getSpectatedEntityID());
public Keyframe clone() {
return new PositionKeyframe(getRealTimestamp(), position, spectatedEntityID);
}
public PositionKeyframe(int realTime, Position position) {
@@ -17,7 +17,7 @@ public class PositionKeyframe extends Keyframe {
this.position = position;
}
public PositionKeyframe(int realTime, Position position, int spectatedEntityID) {
public PositionKeyframe(int realTime, Position position, Integer spectatedEntityID) {
super(realTime);
this.position = position;
this.spectatedEntityID = spectatedEntityID;

View File

@@ -7,7 +7,7 @@ public class TimeKeyframe extends Keyframe {
private final int timestamp;
@Override
public Object clone() {
public Keyframe clone() {
return new TimeKeyframe(this.getRealTimestamp(), this.getTimestamp());
}