Date: 2020/06/25 21:58:21 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
Decorator_Tool_Config:
type: data
Config:
# Change to true to warn players when they attempt to interact with decorative blocks.
# No message by default.
do_message: false
message: <dark_red>You cannot use this decorative <context.location.material.translated_name>.
cooldown: 1s
# Enables armor stand functionality with Decorator Tool.
# Disable if using another armor stand editor plugin.
do_armor_stands: true
# If true, converts player head blocks to armor stand entities when right-clicked.
# Generally only useful if armor stand functionality is enabled.
convert_heads: true
Data:
## The data in this section should not be changed.
armor_stand_mode: 1/rotate|2/move_x|3/move_z|4/move_y|5/base_plate|6/arms|7/size|8/invisibility
misc_blocks:
- loom
- crafting_table
- cartography_table
- anvil
- chipped_anvil
- damaged_anvil
- enchanting_table
- grindstone
- smithing_table
- stonecutter
- fletching_table
- light_weighted_pressure_plate
- heavy_weighted_pressure_plate
- jukebox
- daylight_detector
- bell
- cauldron
- ender_chest
- end_portal_frame
- composter
- campfire
- flower_pot
- beacon
- command_block
- cake
Decorator_Tool_Item:
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.
Decorator_Tool_Command:
type: command
name: decorate
usage: /decorate
permission: beruscripts.decorator
description: Gives the player a Decorator Tool.
script:
- if !<player.inventory.contains[decorator_tool_item]>:
- give decorator_tool_item
- 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_item
- narrate "<red>Removed your <blue>[Decorator Tool]<red>."
Decorator_Tool_Decorative_Blocks:
type: world
debug: false
events:
# Decorative Block functionality-- prevents use of blocks marked as decorative.
on player right clicks block priority:1:
- if <server.has_flag[decorative_block.<context.location.simple>]||false>:
- determine passively cancelled
- if <script[Decorator_Tool_Config].data_key[Config.do_message]> && !<player.has_flag[decorative_block_warn]>:
- narrate "<script[Decorator_Tool_Config].data_key[Config.message].parsed>"
- flag <player> decorative_block_warn duration:<script[Decorator_Tool_Config].data_key[Config.cooldown]>
on player stands on material:
- if <server.has_flag[decorative_block.<context.location.simple>]||false>:
- determine cancelled
# Decorator Tool functionality-- allows use of Decorator Tool item on various blocks.
on player clicks block with decorator_tool_item:
- determine passively cancelled
- if <player.is_sneaking> && <context.click_type> == right_click_block:
- if <context.location.material.name> == daylight_detector:
- adjustblock <context.location> switched:<context.location.material.switched.not>
- else:
- switch <context.location>
- stop
- choose <context.click_type>:
- case right_click_block:
- if <context.location.material.name> == player_head && <script[Decorator_Tool_Config].data_key[Config.convert_heads]>:
- spawn armor_stand[gravity=false;invulnerable=true;collidable=false;armor_pose=head|0,0,0;equipment=air|air|air|<item[player_head].with[skull_skin=<context.location.skull_skin.full>]>] <context.location.center.with_facing_direction[<context.location.direction>].below[1.94]> save:decorative_head
- flag <entry[decorative_head].spawned_entity> decorative
- modifyblock <context.location> air
- stop
- else if !<context.location.material.is_switchable> && !<context.location.has_inventory> && !<script[Decorator_Tool_Config].data_key[Data.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>]||false>:
- 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.other_block.simple||null> != null:
- 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>]||false>:
- 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.other_block||null> != null:
- 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_item:
- determine passively cancelled
- wait 1t
- take scriptname:decorator_tool_item
on player clicks in inventory with decorator_tool_item:
- if <context.clicked_inventory.inventory_type> != PLAYER:
- determine passively cancelled
- wait 1t
- inventory update
on player clicks decorator_tool_item in inventory:
- if <context.is_shift_click> && <context.inventory.inventory_type> != PLAYER:
- determine passively cancelled
- wait 1t
- inventory update
on player drags decorator_tool_item in inventory:
- if <context.clicked_inventory.inventory_type> != PLAYER:
- determine passively cancelled
- wait 1t
- inventory update
# 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>]||false>:
- narrate "<red>You broke a decorative <context.location.material.translated_name.to_lowercase>."
- flag server decorative_block.<context.location.simple>:!
- if <context.location.other_block||null> != null:
- narrate "<red>(Also removed adjacent block.)"
- flag server decorative_block.<context.location.other_block.simple>:!
- if <context.location.material.name> == chest:
- modifyblock <context.location.other_block> air
# Decorative Chest functionality-- for placing chests next to existing decorative chests.
# A chest placed next to a decorative chest will not conjoin to it, nor be decorative itself.
on player places *chest:
- if <context.location.other_block||null> != null && <server.has_flag[decorative_block.<context.location.other_block.simple>]>:
- determine passively cancelled
- if <player.gamemode> != creative:
- take iteminhand qty:1
- wait 1t
- modifyblock <context.location> <context.material.with[direction=<context.location.direction[<player.location>]>]>
# You can disable armor stand functionality in the Config!
# Set "do_armor_stands" to false.
Decorator_Tool_Armor_Stands:
type: world
debug: false
events:
on armor_stand damaged priority:1:
- if <context.entity.has_flag[decorative]>:
- determine passively cancelled
on armor_stand damaged by player with:decorator_tool_item:
- determine passively cancelled
- if !<script[Decorator_Tool_Config].data_key[Config.do_armor_stands]>:
- stop
- if !<context.entity.has_flag[decorative]>:
- flag <context.entity> decorative
- adjust <context.entity> gravity:false
- adjust <context.entity> invulnerable:true
- adjust <context.entity> collidable:false
- adjust <context.entity> armor_pose:head|0,0,0
- narrate "<aqua>Made this <gray>Armor Stand <aqua>decorative. <dark_gray>(Shift-left-click to destroy.)"
- stop
- if <player.is_sneaking>:
- if <player.flag[decorator_tool_delete_entity]||null> == <context.entity.uuid>:
- flag <player> decorator_tool_delete_entity:!
- remove <context.entity>
- narrate "<red>Removed!"
- else:
- flag <player> decorator_tool_delete_entity:<context.entity.uuid>
- adjust <context.entity> glowing:true
- narrate "<dark_red>Destroy this armor stand? <dark_gray>(Shift-left-click again to confirm.)"
- wait 3s
- flag <player> decorator_tool_delete_entity:!
- adjust <context.entity> glowing:false
- else:
- choose <player.flag[decorator_tool_armor_stand_mode]||1>:
- case 1:
- teleport <context.entity> <context.entity.location.with_yaw[<context.entity.location.yaw.sub[5]>]>
- case 2:
- teleport <context.entity> <context.entity.location.sub[0.02,0,0]>
- case 3:
- teleport <context.entity> <context.entity.location.sub[0,0,0.02]>
- case 4:
- teleport <context.entity> <context.entity.location.sub[0,0.02,0]>
- case 5:
- adjust <context.entity> base_plate:<context.entity.base_plate.not>
- case 6:
- adjust <context.entity> arms:<context.entity.arms.not>
- case 7:
- adjust <context.entity> is_small:<context.entity.is_small.not>
- case 8:
- adjust <context.entity> visible:<context.entity.visible.not>
on player right clicks armor_stand with:decorator_tool_item:
- determine passively cancelled
- if !<script[Decorator_Tool_Config].data_key[Config.do_armor_stands]>:
- stop
- if !<context.entity.has_flag[decorative]>:
- flag <context.entity> decorative
- adjust <context.entity> gravity:false
- adjust <context.entity> invulnerable:true
- adjust <context.entity> collidable:false
- adjust <context.entity> armor_pose:head|0,0,0
- narrate "<aqua>Made this <gray>Armor Stand <aqua>decorative. <dark_gray>(Shift-left-click to destroy.)"
- stop
- if <player.is_sneaking>:
- if <player.flag[decorator_tool_armor_stand_mode]> < 8:
- flag <player> decorator_tool_armor_stand_mode:++
- else:
- flag <player> decorator_tool_armor_stand_mode:1
- actionbar "<blue>[Decorator Tool]: <aqua>Armor Stand Mode - <script[Decorator_Tool_Config].data_key[Data.armor_stand_mode].as_map.get[<player.flag[decorator_tool_armor_stand_mode]>].replace[_].with[ ].to_titlecase>"
- else:
- choose <player.flag[decorator_tool_armor_stand_mode]||1>:
- case 1:
- teleport <context.entity> <context.entity.location.with_yaw[<context.entity.location.yaw.add[5]>]>
- case 2:
- teleport <context.entity> <context.entity.location.add[0.02,0,0]>
- case 3:
- teleport <context.entity> <context.entity.location.add[0,0,0.02]>
- case 4:
- teleport <context.entity> <context.entity.location.add[0,0.02,0]>
- case 5:
- adjust <context.entity> base_plate:<context.entity.base_plate.not>
- case 6:
- adjust <context.entity> arms:<context.entity.arms.not>
- case 7:
- adjust <context.entity> is_small:<context.entity.is_small.not>
- case 8:
- adjust <context.entity> visible:<context.entity.visible.not>