Configuration
On this page(2)
SnNPCs ships with the following YAML files. New keys are auto-merged on boot; your edits and comments are preserved.
config.yml
# ============================================================
# SnNPCs - configuration
# Managed by SnLib: new keys are auto-merged on boot; your values and
# comments are preserved. Do NOT add a config-version key (retired).
# Set update-configs: false to freeze this file (SnLib only warns about
# missing keys instead of inserting them).
# client-profiles is a list you own: edit its rules freely, or write
# "client-profiles: []" to have none.
# ============================================================
# Active language code; loads lang/messages_<code>.yml (falls back to en).
lang: en
# Master switch of the SnLib auto-updater for this plugin's managed files.
update-configs: true
# Runtime debug output (also toggleable live via /snnpcs debug).
debug:
# Master toggle of the debug output.
enabled: false
# Verbosity threshold: OFF, INFO, DEBUG or TRACE.
level: DEBUG
# Category filter; an empty list lets every category through.
categories: []
# ------------------------------------------------------------
# Main command.
# ------------------------------------------------------------
command:
# Aliases of /snnpcs. Re-read on /snnpcs reload.
aliases: [snpc, npc]
# ------------------------------------------------------------
# Public developer API.
# ------------------------------------------------------------
# Events other plugins can listen to. The query service stays available either way.
api-events:
# When false, no API event is dispatched (zero cost) and clicks and edits proceed uncancelled.
enabled: true
# ------------------------------------------------------------
# NPC defaults and view profiles.
# ------------------------------------------------------------
# Defaults every NPC file inherits; a file only writes a key to differ from them.
npc:
# Blocks within which a player sees an NPC; capped by tracking.max-view-distance.
view-distance: 48
# Blocks within which an NPC turns toward each viewer; 0 keeps it facing its own yaw.
look-at-players: 0
# Skin parts shown on a player NPC: all, none, or a list of cape, jacket, left-sleeve, right-sleeve,
# left-pants, right-pants, hat.
skin-layers: all
# Blocks between the top of what the viewer sees and the bottom line of the hologram.
hologram-gap: 0.3
# Global view profiles, checked in order after the NPC's own view-profiles; the first rule whose
# clients match the viewer wins. Each rule takes:
# clients: who it applies to, quoted: "*", "bedrock", "<1.20.5", ">=1.21", "1.20-1.20.4", "protocol>=767"
# form: what they see: model, player, hidden, entity:<TYPE>; omit to keep the NPC's own form
# scale: false makes those clients ignore the NPC's scale for height; omit to follow the default
# height: blocks they see above the feet, replacing the computed height
# hologram-offset: blocks added to the hologram position for them
# Clients older than 1.20.5 never draw the scale attribute, so this rule keeps their hologram at the
# unscaled height.
client-profiles:
- clients: "<1.20.5"
scale: false
# ------------------------------------------------------------
# Features.
# ------------------------------------------------------------
# Viewer tracking: which NPCs each player is sent.
tracking:
# Ticks between range checks of each viewer (2 or more); lower reacts faster and costs more.
check-interval: 10
# Hard cap in blocks on any NPC's view distance (1 to 1024).
max-view-distance: 128
# Ticks between the head turns of NPCs with look-at-players (2 or more); a packet is sent only when the
# angle changed.
look-interval: 4
# Skin resolution; every resolved skin is stored in cache/skins.yml.
skins:
# Days before a skin set by player name or UUID is fetched again; 0 never refreshes.
refresh-days: 7
# MineSkin, the service that signs URL and file: skins.
mineskin:
# API key from https://account.mineskin.org/keys; empty disables URL and file: skins.
api-key: ""
# Gallery visibility of generated skins: public, unlisted or private.
visibility: public
# Timeout in seconds of each skin HTTP request (1 to 60).
http-timeout-seconds: 10
# Seconds between two readings of the skins written as a %placeholder% (5 to 3600). When the
# answer names another player, the NPC is sent again wearing that player's skin.
placeholder-interval-seconds: 30
# ------------------------------------------------------------
# Limits.
# ------------------------------------------------------------
# Click handling.
clicks:
# Ticks a player waits between two clicks on the same NPC; an NPC file can set its own cooldown.
cooldown-ticks: 10npcs/example.yml
Seeded only when the npcs/ folder is missing. Files named example.yml are never loaded: copy it to a new name.
# ============================================================
# SnNPCs - example NPC
# NOT loaded: files named example.yml are always skipped. Copy this file
# to a new name and edit it, or create NPCs in game with /snnpcs create.
# ============================================================
# Where files go
# plugins/SnNPCs/npcs/<id>.yml a loose NPC
# plugins/SnNPCs/npcs/<folder>/<sub>/<id>.yml an NPC grouped in folders, at any depth
# - The file name without .yml is the NPC id. The editor commands take letters, digits, - and _ only,
# so name files that way if you want to address them in game.
# - Folders starting with a dot are ignored.
# - Ids are unique ignoring case across every folder. Files are read in sorted path
# order and the FIRST file with an id wins; a later duplicate is reported and skipped.
# - A file that cannot be read is reported with its path and skipped; the rest still load.
# - The in-game editor rewrites a file when you change an NPC with a command. It writes
# only the keys that differ from config.yml, and comments and keys it does not know
# are not kept: before the first rewrite of a file it saves a copy next to it as
# <id>.yml.bak (an existing .bak is never overwritten), which the loader ignores.
# Edit by hand, then run /snnpcs reload.
# - File names must end in a lower-case .yml; other spellings are skipped.
#
# YAML note: quote any value that starts with *, @, <, >, %, [, {, &, !, # or a digit-and-dot
# version such as "1.20", or YAML reads it as something else (every hologram, action and
# requirement line below is quoted for that reason).
# Whether the NPC is shown. A file without this key is enabled.
enabled: true
# Where the NPC stands. The world must exist when players are near; it may be unloaded
# or missing at startup. yaw and pitch default to 0.
location:
world: world
x: 0.5
y: 80.0
z: 0.5
yaw: 0.0
pitch: 0.0
# What the NPC is when it has no model: PLAYER, or any living vanilla entity type such as
# ZOMBIE, VILLAGER or ARMOR_STAND. Entities carry no type-specific data.
type: PLAYER
# Skin of a PLAYER NPC. One of these forms:
# Notch a premium player name, resolved through Mojang
# 069a79f4-44e9-4726-a5be-fca90e38aaf5 a player UUID, resolved through Mojang
# "https://example.com/skin.png" a PNG link, signed through MineSkin (needs skins.mineskin.api-key)
# "file:guard.png" a PNG under plugins/SnNPCs/skins/, signed through MineSkin
# "@viewer" the skin of the player looking at the NPC
# "%some_top_1_name%" a PlaceholderAPI placeholder read without a viewer that gives a
# player name or UUID; read again every skins.placeholder-interval-seconds
# and the skin follows whoever it names (an empty answer keeps the last one)
# none no skin (the default Steve or Alex)
# a texture and signature written here, no service involved:
# skin:
# texture: "<base64 texture value>"
# signature: "<base64 signature>"
# Every resolved skin is cached in cache/skins.yml, so a restart asks no service again.
skin: Notch
# Skin parts shown on a PLAYER NPC: all, none, or a list of cape, jacket, left-sleeve,
# right-sleeve, left-pants, right-pants, hat. Without this key: npc.skin-layers.
skin-layers: all
# Scale attribute of the NPC, 0.0625 to 16. Clients older than 1.20.5 ignore it, and the
# hologram height follows what each viewer sees.
scale: 1.5
# Glowing outline: true, false, or a #RRGGBB color.
glow: "#ffaa00"
# Blocks within which a player sees the NPC (capped by tracking.max-view-distance).
# Without this key: npc.view-distance.
view-distance: 48
# Blocks within which the NPC turns toward each viewer; 0 keeps its own yaw.
# Without this key: npc.look-at-players.
look-at-players: 6
# Model of the NPC, written prefix:id. Prefixes:
# bm:<model> a BetterModel model
# meg:<model> a ModelEngine model
# item:<MATERIAL>[:<custom-model-data>] an item display; also serves Oraxen, ItemsAdder and Nexo items
# item:<namespace:item_model> an item display by item model
# any other prefix a model source has been registered for (none until a plugin registers one)
# A viewer whose view profile resolves to the model form sees it; when the engine is not
# installed the viewer sees the player form instead. Remove the key for an NPC without a model.
model: bm:knight
# Scale applied to the model.
model-scale: 1.0
# Height of the model in blocks at scale 1, used for the hologram when the engine cannot
# report one (item models always need it). Optional.
model-height: 2.0
# Animation the model loops on its own, from the moment it appears (an animation name of the
# model, for example idle). Started again whenever the model is created again: after a reload,
# after the engine reloads its models, or when a player comes back after nobody was viewing it.
# Without this key the model holds its rest pose. In game: /snnpcs set <id> animation <name>.
animation: idle
# Animations played ONCE every few seconds on top of the loop above; when one ends the model
# goes back to the loop. every: seconds between two plays (at least 1), play: the animation name.
# The first play comes one full period after the model appears.
timed-animations:
- every: 20
play: pose
# What the NPC wears. Slots: main-hand, off-hand, head, chest, legs, feet. An item is a
# material name, or a map of SnLib item keys with a material (custom-model-data, glow,
# color, trim-pattern, trim-material, skull-owner...).
equipment:
main-hand: DIAMOND_SWORD
head:
material: LEATHER_HELMET
color: "#8354f2"
glow: true
# The text above the NPC. The same schema as a SnHolograms file (lines, pages, look,
# line-spacing, update-interval, page-rotation, view-requirements; see
# plugins/SnHolograms/holograms/example.yml) without location or enabled: the NPC places it.
# Needs SnHolograms; without it the NPC shows no text.
hologram:
# Blocks between the top of what the viewer sees and the hologram.
# Without this key: npc.hologram-gap.
gap: 0.3
lines:
- "₢f2&lGuard"
- "&7Right click to talk"
# What clicks run: SnLib action lines, written [tag] argument. Keys: left, right,
# shift-left, shift-right, any. A shift click runs its shift key, then the plain side,
# then any: the first non-empty list wins. In a line, {player} is the clicker and {npc}
# the NPC id, and PlaceholderAPI placeholders (%player_name%) resolve for the clicker when
# PlaceholderAPI is installed. [console], [player-as-op] and [op] run with more permission than
# the clicker: adding one in game needs snnpcs.admin.action.elevated. [player] runs a command
# directly; [player-chat] makes the player type it (the / is optional), so plugins that react to
# a typed command (ConditionalEvents player_command, DeluxeMenus open_command) see it too.
actions:
right:
- "[message] &7Hello, {player}."
- "[sound] ENTITY_VILLAGER_YES"
shift-right:
- "[player] spawn"
# Conditions a player must meet for a click to run, one expression per line, all of them
# must pass. Operators: = == != > < >= <= joined with && and || (parentheses allowed).
# Placeholders need PlaceholderAPI. A line that cannot be parsed, or that fails while it
# is evaluated, makes the NPC refuse every click (the console says why).
requirements:
- "%player_level% >= 5"
# Ticks a player waits between two clicks on this NPC. Without this key: clicks.cooldown-ticks.
cooldown: 20
# What each client sees, as an ordered list. The first rule that matches the viewer wins,
# these before the global client-profiles of config.yml. Without a match the viewer sees
# the NPC's own form: the model when it has one, otherwise the type above.
# Keys of a rule:
# clients who it applies to (quoted):
# "*" every client, Bedrock included
# "bedrock" Bedrock players (Floodgate)
# "<1.20.5", "<=1.20.4", ">1.20.4", ">=1.21", "=1.21" a comparison with a release
# "1.21" that release only
# "1.20-1.20.4" a range of releases, both ends included
# "protocol>=767" a protocol number, for a client newer than the plugin knows
# form what they see: model, player, hidden or entity:<TYPE>. Omit it to keep the
# NPC's own form and only adjust the numbers below.
# scale false makes those clients ignore the NPC's scale for the height they see.
# height blocks they see above the feet, replacing the computed height.
# hologram-offset blocks added to the hologram position for those clients.
# Releases that share a protocol number (1.21 and 1.21.1) cannot be told apart.
view-profiles:
# Bedrock players see a zombie, with the hologram 0.2 blocks higher.
- clients: "bedrock"
form: "entity:ZOMBIE"
hologram-offset: 0.2
# Java clients below 1.20.5 see a player with the skin above; they do not draw the scale
# attribute, so the hologram stays at the unscaled height.
- clients: "<1.20.5"
form: player
scale: false
# Clients on 1.21 and 1.21.1 see the model, and the hologram is placed for a 4 block height.
- clients: "1.21-1.21.1"
form: model
height: 4.0
# Every other client matches no rule and sees the NPC's own form (here the model).