Skip to content

Commit 12e6c8b

Browse files
committed
Clean up
1 parent 210fa39 commit 12e6c8b

File tree

1 file changed

+19
-31
lines changed

1 file changed

+19
-31
lines changed

src/main/kotlin/LongJump.kt

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,42 @@ internal object LongJump : PluginModule(
1010
description = "Jump Longer",
1111
pluginMain = LongJumpController
1212
) {
13-
private val mode by setting("Mode", enumMode.Peak)
14-
private val farSpeed by setting("Peak Speed", 1.0f, 0.0f..10.0f, 0.1f, { mode.equals(enumMode.Peak) }, description = "Speed When Falling")
15-
private val groundSpeed by setting("Ground Speed", 2.0f, 0.0f..10.0f, 0.1f, { mode.equals(enumMode.Ground) }, description = "Speed When Jumping")
13+
private val mode by setting("Mode", Mode.PEAK)
14+
private val farSpeed by setting("Peak Speed", 1.0f, 0.0f..10.0f, 0.1f, { mode == Mode.PEAK }, description = "Speed When Falling")
15+
private val groundSpeed by setting("Ground Speed", 2.0f, 0.0f..10.0f, 0.1f, { mode == Mode.GROUND }, description = "Speed When Jumping")
1616
private val disableOnRubberband by setting("Rubberband disable", false)
1717

18-
var has = false;
19-
20-
private enum class enumMode {
21-
22-
Peak,
23-
Ground
18+
private var has = false
2419

20+
private enum class Mode {
21+
PEAK,
22+
GROUND
2523
}
2624

2725
init {
28-
2926
onEnable {
3027
has = false
3128
}
3229

3330
safeListener<PlayerTravelEvent> {
34-
3531
if (LagNotifier.paused && disableOnRubberband) {
36-
3732
disable()
38-
3933
}
4034

41-
if (mode.equals(enumMode.Peak)) {
42-
if (mc.player.motionY <= 0 && !has) {
43-
44-
has = true
45-
46-
mc.player.jumpMovementFactor = farSpeed
47-
35+
when {
36+
mode == Mode.PEAK -> {
37+
if (player.motionY <= 0 && !has) {
38+
has = true
39+
player.jumpMovementFactor = farSpeed
40+
}
41+
if (player.onGround) has = false
42+
}
43+
player.onGround -> {
44+
player.jump()
45+
player.motionX *= groundSpeed
46+
player.motionY *= groundSpeed
4847
}
49-
50-
if (mc.player.onGround)
51-
has = false
52-
53-
} else if (mc.player.onGround) {
54-
55-
mc.player.jump();
56-
mc.player.motionX *= groundSpeed
57-
mc.player.motionY *= groundSpeed
58-
5948
}
60-
6149
}
6250
}
6351
}

0 commit comments

Comments
 (0)