Spooky season is here. Happy Halloween from Lattice!
Lattice
Docs/LatTrickOrTreat

LatTrickOrTreat

Knock on a player's door and see what they hand out: a treat or a trick

No reviews yet

Overview

Module id
trick-or-treat
Version
1.0.0
Platforms
paper
Price
$4.99
Authors
Atlantis Services

Install

  1. Install Lattice on a Paper or Folia server, if it is not there yet.
  2. Drop the LatTrickOrTreat jar into plugins/Lattice/modules/. It loads straight away.
  3. Put your license key in lattice.yml, then run /lat license refresh.
  4. Edit config/global/trick-or-treat/ and apply it with /lat reload trick-or-treat.

Commands

Command names and aliases are set in config.yml, so yours may differ. <required> [optional]

Command Description Permission
/trickortreat
also /tot
Your trick-or-treat knocks left today trickortreat.use
/trickortreat bag <player> [amount]
trickortreat.admin

Permissions

Permission Lets a player use
trickortreat.use
/trickortreat
trickortreat.admin
/trickortreat bag

Placeholders

Filled in Lattice's own messages, and in any plugin that reads PlaceholderAPI when it is installed.

Placeholder Notes
%trickortreat_left%
%trickortreat_total%

config.yml

Written to config/global/trick-or-treat/config.yml on first start. Edit it, then /lat reload trick-or-treat.

# Trick-or-treat: hold a candy bag and right-click a player to knock on their door.
# They hand out a treat, or play a harmless trick on you. Give bags with /trickortreat bag.

# Generated from TrickOrTreatSettings. Keys you delete return to their default;
# keys that are not in the schema are ignored and reported on load.

command:
  # Command for knocks left today, and for staff to give bags. Takes effect on restart.
  name: "trickortreat"
  aliases:
    - "tot"
  permission: "trickortreat.use"
  # Permission for /trickortreat bag.
  admin-permission: "trickortreat.admin"
# Timezone for start, end and the daily reset of knocks, e.g. Europe/London.
timezone: "UTC"
# First day, as MM-DD, repeating every year. Leave start and end empty to run all year.
# An end before the start runs over the new year.
start: "10-01"
# Last day, inclusive, as MM-DD.
end: "11-01"
# Knocks each player gets per day. Only the first knock on a door each day can be a treat,
# so two friends cannot farm each other.
knocks-per-day: 10
# Knock on a door already knocked on today, and it always answers with a trick.
# The repeat still spends one of the day's knocks. False refuses repeat knocks.
trick-on-same-door: false
# Chance, from 0 to 1, that a knock gets a trick instead of a treat.
trick-chance: 0.3
# How the candy bag looks. It is never placed or eaten, whatever its model.
bag:
  name: "<gradient:#ff7a00:#b14cff><bold>Candy Bag</bold></gradient>"
  lore:
    - "<gray>Right-click a player to knock"
    - "<gray>on their door."
    - ""
    - "<gold>Trick or treat!"
  # Item model, as namespace:key. A resource pack can supply its own.
  model: "minecraft:orange_bundle"
# Treats, picked by weight. The icon is what flies out of the pumpkin; the reward is what is given.
treats:
  - # Relative chance against the other treats.
    weight: 45
    # Item that flies out of the pumpkin to the player. Only for show.
    icon: "COOKIE"
    reward:
      # Console commands. {player} is the player's name.
      commands:
        - "minecraft:give {player} cookie 4"
      # Sent to the player as a success line in the server theme. Empty for none.
      message: "<body>A handful of cookies!"
      # Sound key, e.g. entity.player.levelup. Empty for none.
      sound: null
  - # Relative chance against the other treats.
    weight: 30
    # Item that flies out of the pumpkin to the player. Only for show.
    icon: "PUMPKIN_PIE"
    reward:
      # Console commands. {player} is the player's name.
      commands:
        - "minecraft:give {player} pumpkin_pie 2"
      # Sent to the player as a success line in the server theme. Empty for none.
      message: "<body>Fresh pumpkin pie!"
      # Sound key, e.g. entity.player.levelup. Empty for none.
      sound: null
  - # Relative chance against the other treats.
    weight: 20
    # Item that flies out of the pumpkin to the player. Only for show.
    icon: "CAKE"
    reward:
      # Console commands. {player} is the player's name.
      commands:
        - "minecraft:give {player} cake 1"
      # Sent to the player as a success line in the server theme. Empty for none.
      message: "<body>A whole cake. Generous!"
      # Sound key, e.g. entity.player.levelup. Empty for none.
      sound: null
  - # Relative chance against the other treats.
    weight: 5
    # Item that flies out of the pumpkin to the player. Only for show.
    icon: "GOLDEN_APPLE"
    reward:
      # Console commands. {player} is the player's name.
      commands:
        - "minecraft:give {player} golden_apple 1"
      # Sent to the player as a success line in the server theme. Empty for none.
      message: "<accent>The full-size candy bar of treats!"
      # Sound key, e.g. entity.player.levelup. Empty for none.
      sound: "ui.toast.challenge_complete"
# Tricks, picked by weight. None of them touch the inventory, blocks or health.
# Types: PUMPKIN_HEAD (a pumpkin on your head, as everyone sees you), BATS (a swarm of bats),
# SCARE (a jump scare only you see), DARKNESS (the darkness effect).
tricks:
  - type: PUMPKIN_HEAD
    # Relative chance against the other tricks.
    weight: 30
    # How long it lasts, 1 to 60. SCARE is instant and ignores it.
    seconds: 20
  - type: BATS
    # Relative chance against the other tricks.
    weight: 30
    # How long it lasts, 1 to 60. SCARE is instant and ignores it.
    seconds: 5
  - type: SCARE
    # Relative chance against the other tricks.
    weight: 20
    # How long it lasts, 1 to 60. SCARE is instant and ignores it.
    seconds: 5
  - type: DARKNESS
    # Relative chance against the other tricks.
    weight: 20
    # How long it lasts, 1 to 60. SCARE is instant and ignores it.
    seconds: 6
# The doorstep animation. Times are in ticks, twenty to a second.
animation:
  # Item that rises above the door's head, and turns into the trick.
  pumpkin: "CARVED_PUMPKIN"
  # What the pumpkin turns into on a trick.
  trick-face: "JACK_O_LANTERN"
  pumpkin-size: 0.9
  # Size of each piece of candy.
  candy-size: 0.45
  # Pieces of candy that burst out on a treat, 1 to 16. Only for show.
  candies: 7
  # Ticks the pumpkin takes to rise.
  appear-ticks: 12
  # Ticks it shakes while the door decides.
  suspense-ticks: 30
  # Ticks the candy, or the trick face, hangs in the air after the reveal.
  hang-ticks: 16
  # Ticks each piece takes to fly to the player.
  fly-ticks: 10
  # Ticks between one piece leaving and the next.
  fly-stagger: 2
  sounds:
    # Played twice at the door, as the knock. Empty for none, here and below.
    knock: "entity.zombie.attack_wooden_door"
    # Played every few ticks while the pumpkin shakes, rising in pitch.
    shake: "block.note_block.bit"
    treat: "entity.firework_rocket.twinkle"
    trick: "entity.witch.celebrate"
    # Played as each piece of candy reaches the player.
    collect: "entity.item.pickup"
    # Played when the trick pumpkin hits the player.
    hit: "entity.slime.squish"

Messages

Every line players see, in config/global/trick-or-treat/messages.yml. Uses MiniMessage formatting.

Show messages.yml (25 lines)
# Player-facing text for trick-or-treat.
# Placeholders in {braces} are filled in by the module.
# A key you delete falls back to its built-in default.

asking: <gradient:#ff7a00:#b14cff><bold>Trick or treat?</bold></gradient>
bad-amount: '''{amount}'' is not a number from 1 to 64.'
bag-given: <body>Gave <accent>{amount}</accent> candy bag(s) to <accent>{player}</accent>.
busy: Your knocks are still loading. Try again in a moment.
closed: Trick-or-treating is closed right now.
door-busy: Someone is already at <emphasis>{door}</emphasis>'s door.
door-treat: <accent>{knocker}</accent><body> knocked on your door. You handed out
  a treat!
door-trick: <accent>{knocker}</accent><body> knocked on your door. You played a trick
  on them!
left: '<body>Knocks left today: <accent>{left}</accent><muted>/</muted><accent>{total}</accent>'
out-of-knocks: No knocks left today. Come back tomorrow!
players-only: Only a player can do that.
same-door: You already knocked on <emphasis>{door}</emphasis>'s door today.
treat-banner: <gold><bold>TREAT!</bold></gold>
trick-banner: <dark_purple><bold>TRICK!</bold></dark_purple>
trick-bats: <body>Trick! Bats. So many bats.
trick-darkness: <body>Trick! Who turned the lights out?
trick-pumpkin-head: <body>Trick! Everyone can see the pumpkin on your head.
trick-scare: <body>Trick! Boo!
unknown-player: <emphasis>{player}</emphasis> is not online.