EssentialsX

EssentialsX

2M Downloads

Speed limit doesn't work

Sikatsu opened this issue ยท 3 comments

commented

I've mentioned this before, however the speed limit in the configuration doesn't work.
Players can just do /speed 10 and it works for them.

Someone here told me earlier that even tho it says it changed to speed 10, it doesn't actually work.
However I tested /speed 5 against /speed 10 as a normal player and the limit definatly does not work.

commented

private float getRealMoveSpeed(final float userSpeed, final boolean isFly, final boolean isBypass) {
final float defaultSpeed = isFly ? 0.1f : 0.2f;
float maxSpeed = 1f;
if (!isBypass) {
maxSpeed = (float) (isFly ? ess.getSettings().getMaxFlySpeed() : ess.getSettings().getMaxWalkSpeed());
}
if (userSpeed < 1f) {
return defaultSpeed * userSpeed;
} else {
float ratio = ((userSpeed - 1) / 9) * (maxSpeed - defaultSpeed);
return ratio + defaultSpeed;
}
}

The max-fly-speed and max-walk-speed config options don't limit the number that the user can use in /speed - instead, they exist to scale down the maximum fly speed (ie /speed 10). This means /speed 10 should be noticeably slower when you set max-fly-speed: 0.1 compared to max-fly-speed: 1.


I can't currently confirm whether this is actually the case, so if someone could confirm this it would be much appreciated.

commented

I think what you say is correct from some testing, however wouldn't it be better to change the system? I find it rather confusing.

commented

The options appear to work, but aren't intuitive, so for now, we could change the comments above them to make it clearer what they do.

In the long run, the config options could be replaced, perhaps with something like fly-speed-scale/walk-speed-scale which acts as the multiplier (like the current options), and fly-speed-steps/walk-speed-steps acting as the maximum number accepted in /speed, but this would break existing configs.