Date: 2020/05/25 10:38:05 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Decorator_Tool:
type: item
material: stick
display name: <blue>Decorator Tool
lore:
- Right-click to mark location as decorative.
- Left-click to unmark location.
- Shift-right-click to toggle block state.
Decorate_Command:
type: command
name: decorate
usage: /decorate
permission: beruscripts.decorator
description: Gives the player a Decorator Tool.
script:
- if !<player.inventory.contains[decorator_tool]>:
- give decorator_tool
- narrate "<aqua>You received a <blue>[Decorator Tool]<aqua>."
- narrate "<gray>Right-click to decorate, left-click to un-decorate."
- narrate "<gray>Right-click while sneaking to toggle open/closed."
- else:
- take scriptname:decorator_tool
- narrate "<red>Removed your <blue>[Decorator Tool]<red>."
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 player right clicks block priority:1:
- if <server.has_flag[decorative_block.<context.location.simple>]>:
- determine cancelled
on player stands on material:
- if <server.has_flag[decorative_block.<context.location.simple>]>:
- determine cancelled
# Decorator tool functionality.
on player clicks block with decorator_tool:
- determine passively cancelled
- if <player.is_sneaking> && <context.click_type> == right_click_block:
- switch <context.location>
- stop
- 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>]> && !<context.location.material.name.ends_with[_bed]>:
- narrate "<dark_gray>You cannot make <context.location.material.item.formatted> decorative."
- stop
- if <server.has_flag[decorative_block.<context.location.simple>]>:
- narrate "<dark_gray>This <gray><context.location.material.translated_name> <dark_gray>is already decorative!"
- stop
- narrate "<aqua>Made this <gray><context.location.material.translated_name> <aqua>decorative."
- flag server decorative_block.<context.location.simple>
- if <context.location.material.is_bisected> && !<context.location.material.name.ends_with[_trapdoor]>:
- narrate "<aqua>(Also added adjacent block.)"
- flag server decorative_block.<context.location.other_block.simple>
- case left_click_block:
- if !<server.has_flag[decorative_block.<context.location.simple>]>:
- narrate "<dark_gray>This <gray><context.location.material.translated_name> <dark_gray>is not decorative!"
- stop
- narrate "<red>This <gray><context.location.material.translated_name> <red>is no longer decorative."
- flag server decorative_block.<context.location.simple>:!
- if <context.location.material.is_bisected> && !<context.location.material.name.ends_with[_trapdoor]>:
- narrate "<red>(Also removed adjacent block.)"
- flag server decorative_block.<context.location.other_block.simple>:!
# Item protection. (Prevents decorator tool from being transfered to another inventory.)
on player drops decorator_tool:
- determine cancelled
on player clicks in inventory with decorator_tool:
- if <context.clicked_inventory.inventory_type> != PLAYER:
- determine cancelled
on player clicks decorator_tool in inventory:
- if <context.is_shift_click> && <context.inventory.inventory_type> != PLAYER:
- determine cancelled
on player drags decorator_tool in inventory:
- if <context.clicked_inventory.inventory_type> != PLAYER:
- determine cancelled
# If any player breaks a decorative block, alerts them and removes decoration flag.
on player breaks block priority:1:
- if <server.has_flag[decorative_block.<context.location.simple>]>:
- narrate "<red>You broke a decorative <context.location.material.translated_name.to_lowercase>."
- flag server decorative_block.<context.location.simple>:!
- if <context.location.material.is_bisected> && !<context.location.material.name.ends_with[_trapdoor]>:
- narrate "<red>(Also removed adjacent block.)"
- flag server decorative_block.<context.location.other_block.simple>:!