From 8bc15a8ae79f2fc27f04731f28da7a2593d7f70f Mon Sep 17 00:00:00 2001 From: Nikomaru Date: Sat, 5 Feb 2022 12:43:45 +0900 Subject: [PATCH] Fixed a bug in the process of setting the degree. --- .../race/commands/place/PlaceDegreeCommand.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/dev/nikomaru/raceassist/race/commands/place/PlaceDegreeCommand.kt b/src/main/kotlin/dev/nikomaru/raceassist/race/commands/place/PlaceDegreeCommand.kt index 8b9e500..3a3deb2 100644 --- a/src/main/kotlin/dev/nikomaru/raceassist/race/commands/place/PlaceDegreeCommand.kt +++ b/src/main/kotlin/dev/nikomaru/raceassist/race/commands/place/PlaceDegreeCommand.kt @@ -68,12 +68,13 @@ class PlaceDegreeCommand { TextColor.color(NamedTextColor.RED) ) ) - var nowX = sender.location.blockX - centralXPoint - val nowY = sender.location.blockZ - centralYPoint - if (reverse) { - nowX = -nowX - } - val currentDegree = getRaceDegree(nowX.toDouble(), nowY.toDouble()) + val nowX = sender.location.blockX + val nowY = sender.location.blockZ + val relativeNowX = if (!reverse) nowX - centralXPoint else -1 * (nowX - centralXPoint) + val relativeNowY = nowY - centralYPoint + val currentDegree = getRaceDegree(relativeNowY.toDouble(), relativeNowX.toDouble()) + + sender.sendMessage("Degree: $currentDegree") var degree = 0 when (currentDegree) { in 0..45 -> {