Fix CITIZENS-191

This commit is contained in:
fullwall 2012-09-17 17:54:56 +08:00
parent 892e9f6f59
commit 794d78a264
2 changed files with 4 additions and 1 deletions

View File

@ -71,6 +71,7 @@ public class Settings {
},
LOCALE("general.translation.locale", "en"),
MAX_NPC_LIMIT_CHECKS("npc.limits.max-permission-checks", 100),
MAX_SPEED("npc.limits.max-speed", 100),
NPC_COST("economy.npc.cost", 100D),
QUICK_SELECT("npc.selection.quick-select", false),
REMOVE_PLAYERS_FROM_PLAYER_LIST("npc.player.remove-from-list", true),

View File

@ -592,7 +592,9 @@ public class NPCCommands {
max = 2,
permission = "npc.speed")
public void speed(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
float newSpeed = (float) args.getDouble(1);
float newSpeed = (float) Math.abs(args.getDouble(1));
if (newSpeed >= Setting.MAX_SPEED.asDouble())
throw new CommandException("Speed is above the limit.");
npc.getNavigator().getDefaultParameters().speedModifier(newSpeed);
Messaging.sendF(sender, ChatColor.GREEN + "NPC speed modifier set to %s.",