Skip to content

Commit f3f57f5

Browse files
For jumpheight setting in /hacks, user should be able to input height in decimal (instead of cryptic 'unit of 32')
1 parent 1617f8b commit f3f57f5

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

fCraft/Commands/CpeCommands.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,16 +2151,19 @@ static void HackControlHandler(Player player, CommandReader cmd) {
21512151
case "jump":
21522152
case "height":
21532153
case "jh":
2154-
short height;
2154+
float height;
21552155
string third = cmd.Next();
2156-
if (short.TryParse(third, out height)) {
2156+
if (!float.TryParse(third, out height)) {
2157+
player.Message("Error: Could not parse \"&a{0}&S\" as a decimal.", third);
2158+
return;
2159+
} else if (height < 0 || height > short.MaxValue / 32.0f) {
2160+
player.Message("Error: Jump height must be between &a0&S and &a1023.", third);
2161+
return;
2162+
} else {
21572163
player.Message("Hacks for {0}", target.ClassyName);
2158-
player.Message(" JumpHeight: &a{0} &S--> &a{1}", target.JumpHeight, height);
2159-
target.JumpHeight = height;
2164+
player.Message(" JumpHeight: &a{0} &S--> &a{1}", target.JumpHeight / 32.0f, height);
2165+
target.JumpHeight = (short)(height * 32);
21602166
hackStr = "jumpheight";
2161-
} else {
2162-
player.Message("Error: Could not parse \"&a{0}&S\" as a short. Try something between &a0&S and &a32767", third);
2163-
return;
21642167
}
21652168
break;
21662169
default:

0 commit comments

Comments
 (0)