Add a random text delay default setting of 20-40ticks

This commit is contained in:
fullwall 2023-01-02 08:37:27 +08:00
parent 402095c946
commit 433121979c
2 changed files with 6 additions and 0 deletions

View File

@ -110,6 +110,8 @@ public class Settings {
value = list;
}
},
DEFAULT_TEXT_DELAY_MAX("npc.text.default-random-text-delay-max", 40),
DEFAULT_TEXT_DELAY_MIN("npc.text.default-random-text-delay-min", 20),
DEFAULT_TEXT_SPEECH_BUBBLE_TICKS("npc.text.speech-bubble-ticks", 50),
DISABLE_LOOKCLOSE_WHILE_NAVIGATING("npc.default.look-close.disable-while-navigating", true),
DISABLE_MC_NAVIGATION_FALLBACK("npc.pathfinding.disable-mc-fallback-navigation", true),

View File

@ -278,6 +278,10 @@ public class Text extends Trait implements Runnable, Listener {
sendText(player);
int delay = this.delay == -1
? Util.getFastRandom().nextInt(Setting.DEFAULT_TEXT_DELAY_MIN.asInt(),
Setting.DEFAULT_TEXT_DELAY_MAX.asInt())
: this.delay;
if (delay <= 0)
return;
cooldowns.put(player.getUniqueId(), System.currentTimeMillis() + (delay * 50));