Skip to content

Commit 00b4a5b

Browse files
authored
Make /flyspeed and /walkspeed force the correct speed type (#6485)
Fixes #4883
1 parent 73aa657 commit 00b4a5b

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

Essentials/src/main/java/com/earth2me/essentials/commands/Commandspeed.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ protected void run(final Server server, final User user, final String commandLab
3737
final float speed;
3838
final boolean isBypass = user.isAuthorized("essentials.speed.bypass");
3939
if (args.length == 1) {
40-
isFly = flyPermCheck(user, user.getBase().isFlying());
40+
final boolean inferredFly = isFlyAlias(commandLabel) ? true : isWalkAlias(commandLabel) ? false : user.getBase().isFlying();
41+
isFly = flyPermCheck(user, inferredFly);
4142
speed = getMoveSpeed(args[0]);
4243
} else {
4344
isFly = flyPermCheck(user, isFlyMode(args[0]));
@@ -91,6 +92,14 @@ private Boolean flyPermCheck(final User user, final boolean input) {
9192
} else return !canWalk;
9293
}
9394

95+
private boolean isFlyAlias(final String label) {
96+
return label.contains("fly") || label.equalsIgnoreCase("fspeed") || label.equalsIgnoreCase("efspeed");
97+
}
98+
99+
private boolean isWalkAlias(final String label) {
100+
return label.contains("walk") || label.equalsIgnoreCase("wspeed") || label.equalsIgnoreCase("ewspeed");
101+
}
102+
94103
private boolean isFlyMode(final String modeString) throws NotEnoughArgumentsException {
95104
final boolean isFlyMode;
96105
if (modeString.contains("fly") || modeString.equalsIgnoreCase("f")) {

0 commit comments

Comments
 (0)