Add max-text-range setting defaulted to 500

This commit is contained in:
fullwall 2013-07-29 23:51:00 +08:00
parent a84fbbbe53
commit 0290531517
2 changed files with 3 additions and 1 deletions

View File

@ -90,6 +90,7 @@ public class Settings {
LOCALE("general.translation.locale", ""),
MAX_NPC_LIMIT_CHECKS("npc.limits.max-permission-checks", 100),
MAX_SPEED("npc.limits.max-speed", 100),
MAX_TEXT_RANGE("npc.chat.options.max-text-range", 500),
MESSAGE_COLOUR("general.color-scheme.message", "<a>"),
NPC_ATTACK_DISTANCE("npc.pathfinding.attack-range", 1.75 * 1.75),
NPC_COST("economy.npc.cost", 100D),

View File

@ -1,5 +1,6 @@
package net.citizensnpcs.trait.text;
import net.citizensnpcs.Settings.Setting;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.util.Messages;
@ -35,7 +36,7 @@ public class TextStartPrompt extends StringPrompt {
Messaging.sendTr(sender, Messages.TEXT_EDITOR_CLOSE_TALKER_SET, text.toggle());
else if (input.equalsIgnoreCase("range")) {
try {
double range = Math.max(0, Double.parseDouble(parts[1]));
double range = Math.min(Math.max(0, Double.parseDouble(parts[1])), Setting.MAX_TEXT_RANGE.asDouble());
text.setRange(range);
Messaging.sendTr(sender, Messages.TEXT_EDITOR_RANGE_SET, range);
} catch (NumberFormatException e) {