Improves some code
This commit is contained in:
parent
5f4a90aabb
commit
61b05bcce9
@ -58,16 +58,11 @@ public class RelativeBlockVector {
|
|||||||
* @return <p>A new relative block vector with the property altered</p>
|
* @return <p>A new relative block vector with the property altered</p>
|
||||||
*/
|
*/
|
||||||
public RelativeBlockVector addToVector(Property propertyToAddTo, int valueToAdd) {
|
public RelativeBlockVector addToVector(Property propertyToAddTo, int valueToAdd) {
|
||||||
switch (propertyToAddTo) {
|
return switch (propertyToAddTo) {
|
||||||
case RIGHT:
|
case RIGHT -> new RelativeBlockVector(this.right + valueToAdd, this.down, this.out);
|
||||||
return new RelativeBlockVector(this.right + valueToAdd, this.down, this.out);
|
case DOWN -> new RelativeBlockVector(this.right, this.down + valueToAdd, this.out);
|
||||||
case DOWN:
|
case OUT -> new RelativeBlockVector(this.right, this.down, this.out + valueToAdd);
|
||||||
return new RelativeBlockVector(this.right, this.down + valueToAdd, this.out);
|
};
|
||||||
case OUT:
|
|
||||||
return new RelativeBlockVector(this.right, this.down, this.out + valueToAdd);
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException("Invalid relative block vector property given");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,9 +72,7 @@ public class PlayerTeleporter extends Teleporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Set the velocity of the teleported player after the teleportation is finished
|
//Set the velocity of the teleported player after the teleportation is finished
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Stargate.getInstance(), () -> {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(Stargate.getInstance(), () -> player.setVelocity(newVelocity), 1);
|
||||||
player.setVelocity(newVelocity);
|
|
||||||
}, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user