Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -289,23 +289,25 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
if ( player.hasPermission( "movecraft." + craft.getType().getCraftName() + ".move" ) ) {
if(craft.getType().getCanCruise()) {
if(args.length == 0) {
float yaw = player.getLocation().getYaw();
if(yaw >= 135 || yaw < -135) {
// north
craft.setCruiseDirection((byte)0x3);
craft.setCruising(true);
} else if(yaw >= 45) {
// Normalize yaw from [-360, 360] to [0, 360]
float yaw = (player.getLocation().getYaw() + 360.0f);
if (yaw >= 360.0f) yaw -= 360.0f;
if (yaw >= 45 && yaw < 135) {
// west
craft.setCruiseDirection((byte)0x5);
craft.setCruising(true);
} else if(yaw < -45) {
// south
craft.setCruiseDirection((byte)0x2);
} else if (yaw >= 135 && yaw < 225) {
// north
craft.setCruiseDirection((byte)0x3);
craft.setCruising(true);
} else {
} else if (yaw >= 225 && yaw <= 315){
// east
craft.setCruiseDirection((byte)0x4);
craft.setCruising(true);
} else {
// south
craft.setCruiseDirection((byte)0x2);
craft.setCruising(true);
}
return true;
}
Expand Down