Date: 2020/05/21 02:06:12 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Decorator_Tool:
type: item
material: stick
display name: <blue>Decorate!
lore:
- Right click to mark location as decorative.
- Left click to unmark location.
Decorative_Blocks:
type: world
debug: false
misc_blocks:
- loom
- crafting_table
- cartography_table
- anvil
- chipped_anvil
- damaged_anvil
- enchanting_table
- grindstone
- smithing_table
- stonecutter
- fletching_table
events:
on decorate command:
# Don't forget permissions!
- determine passively fulfilled
- if <player.has_flag[decorating]>:
- flag <player> decorating:!
- take <player> decorator_tool
- narrate "<aqua>Decorator Mode <red>[DISABLED]"
- else:
- flag <player> decorating
- if !<player.inventory.contains[decorator_tool]>:
- give <player> decorator_tool
- narrate "<aqua>Decorator Mode <green>[ENABLED]"
- narrate "<gray>Use the <blue>Decorate! <gray>stick to decorate."
- narrate "<gray>Right click to add, left click to remove."
# Prevents players from interacting with decorative blocks.
on player right clicks block:
- if <server.flag[decorative_block_locations].contains[<context.location>]>:
- if !<player.has_flag[decorating]>:
- determine cancelled
on player stands on material:
- if <server.flag[decorative_block_locations].contains[<context.location>]>:
- determine cancelled
# Decorator tool functionality.
on player clicks block with decorator_tool flagged:decorating:
- determine passively cancelled
- choose <context.click_type>:
- case right_click_block:
- if !<context.location.material.is_switchable> && !<context.location.has_inventory> && !<script.yaml_key[misc_blocks].contains[<context.location.material.name>]>:
- narrate "<dark_gray>You cannot make <context.location.material.item.formatted> decorative."
- stop
- if <server.flag[decorative_block_locations].contains[<context.location>]>:
- narrate "<dark_gray>This <context.location.material.item.formatted.after[ ]> is already decorative!"
- stop
- narrate "<aqua>Made this <context.location.material.item.formatted.after[ ]> decorative."
- flag server decorative_block_locations:->:<context.location>
- case left_click_block:
- if !<server.flag[decorative_block_locations].contains[<context.location>]>:
- narrate "<dark_gray>This <context.location.material.item.formatted.after[ ]> is not decorative!"
- stop
- narrate "<red>This <context.location.material.item.formatted.after[ ]> is no longer decorative."
- flag server decorative_block_locations:<-:<context.location>
# If any player breaks a decorative block, alerts them and removes decoration flag.
on player breaks block:
- if <server.flag[decorative_block_locations].contains[<context.location>]>:
- narrate "<red>You broke a decorative <context.location.material.item.formatted.after[ ]>."
- flag server decorative_block_locations:<-:<context.location>