Date: 2014/11/11 00:54:58 UTC-08: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
dRegions_Events:
type: world
debug: false
events:
on player clicks block with i@dRegions_Tool:
- determine passively CANCELLED
- if !<player.has_permission[dRegions.tool]> {
- take i@dRegions_Tool
- run s@dRegions_Msg 'def:<&4><&l>ERROR<&co><&r> <&a>You should not have this!' instantly
- queue stop
}
- define pos '<tern[<c.click_type.is[==].to[LEFT]||false>]:POS1||POS2>'
- run s@dRegions_Msg 'def:<&a>Set %pos% to <context.location.simple>'
- flag player dRegionTool%pos%:<context.location>
dRegions_Msg:
type: item
material: i@human_skull
display name: "<&4>[<&6>dRegions<&4>]"
lore:
- <&5>Click for Info
script:
- ^define text '<&4>[<&6>dRegions<&4>] <&co>'
- ^define hover '{<i@dRegionsMsg.json>}'
- ^define click '/dregions'
- ^define button "text:'%text%',clickEvent:{action:run_command,value:'%click%'},hoverEvent:{action:show_item,value:'%hover%'}"
- ^define spacer "text:' '"
- ^define msg "text:'%1%'"
- ^execute as_server "tellraw <player.name> {text:'',extra:[{%button%},{%spacer%},{%msg%}]}"
dRegions_Tool:
type: item
debug: false
material: m@wood_axe
display name: dRegion Selector
lore:
- <&7><&o>Left<&7> click to set pos1
- <&7><&o>Right<&7> click to set pos2
dWE_Commands:
type: command
debug: false
name: dwe
description: Denizen World Editor
usage: /dwe
aliases: ''
allowed help:
- determine true
script:
- define arg1 '<c.args.get[1].escaped||help>'
- define args 'li@help|tool|expand|contract|inset|outset|outline|set|undo'
- if !<def[args].contains[%arg1%]> inject locally help
else inject locally %arg1%
#
# END dWE Command Script Basics
#--------------------------------------
#
# dWE Command Arguments
#
# Each of these subscripts is an argument for the root command.
#
help:
- if <player.has_permission[dRegions.admin]> inject locally msgsHelpAdmin instantly
else inject locally msgsHelpUser instantly
- define footerText '<&f><&sp><&sp>Authors<&co> <&7>|Anthony| <&7>calico-kid'
- inject locally msgsFooter instantly
- queue stop
tool:
- if <player.has_permission[dRegions.tool]> {
- give i@dRestaurantTool
- run s@dRegions_Msg 'def:<&a>Right click to select pos1'
- run s@dRegions_Msg 'def:<&a>Left click to select pos2'
- queue stop
}
outline:
- define POS1 '<player.flag[dRegionToolPOS1].as_location||null>'
- define POS2 '<player.flag[dRegionToolPOS2].as_location||null>'
- if <def[POS1].is[==].to[null]> run s@dRegions_Msg 'def:<&c>Must select corner 1 with left-click.'
else if <def[POS1].is[==].to[null]> run s@dRegions_Msg 'def:<red>Must select corner 2 with right-click.'
else showfake m@wool <cu@%POS1%|%POS2%> to:<player> d:10s
set:
# Need config options for maxblocks to change
# Need config option for undo history size
- define material '<c.args.get[2]||null>'
- define POS1 '<player.flag[dRegionToolPOS1].as_location||null>'
- define POS2 '<player.flag[dRegionToolPOS2].as_location||null>'
- if %material% == null || %material% !matches material run s@dRegions_Msg 'def:<&c>Must specify a valid material.'
else if <def[POS1].is[==].to[null]> run s@dRegions_Msg 'def:<&c>Must select corner 1 with left-click.'
else if <def[POS1].is[==].to[null]> run s@dRegions_Msg 'def:<red>Must select corner 2 with right-click.'
else {
- define blocks <cu@%POS1%|%POS2%.get_blocks>
- define undoMaterials <def[blocks].parse[material.full]>
- modifyblock %blocks% %material%
- flag player 'dWE_UndoHistory:->:set_blocks;<cu@%1%|%2%>;%undoMaterials%'
}
undo:
- define last_action '<player.flag[dWE_UndoHistory].as_list.last||null>'
- if <def[last_action].is[==].to[null]> run s@dRegions_Msg 'def:<&6>Nothing to undo!'
else {
- inject locally 'p:undo_<def[last_action].split[;].get[1]>'
- flag player 'dWE_UndoHistory:<-:%last_action%'
}
undo_set_blocks:
- define cuboid '<def[last_action].split[;].get[2].as_cuboid.get_blocks||null>'
- define materials '<def[last_action].split[;].get[3]||li@>'
- modifyblock %cuboid% %materials%
- run s@dRegions_Msg 'def:<&a>Undo complete!'
#
# END dWE Command Arguments
#--------------------------------------
#
# dWE Command Messages
#
# These are not complete! They are mostly just stubs till the rest is fleshed out!
#
msgsHeader:
- narrate "<&5>|----------------------------------------|"
- narrate "<&5>|<&sp><&sp><&sp><&6>dWorldEditor <&7>%msgsHeaderTitle%"
# - narrate "<&5>|<&sp><&sp><&sp><&e>MineConomy <&f>Exclusive"
- narrate "<&5>|<&f>"
msgsFooter:
- define anthony "text:'<&7>|Anthony|',clickEvent:{action:open_url,value:'http://mineconomy.org'},hoverEvent:{action:show_item,value:'{<i@AnthonyBanner.json>}'}"
- define morphan "text:'<&7>Morphan1',clickEvent:{action:open_url,value:'http://google.com'},hoverEvent:{action:show_item,value:'{<i@Morphan1Banner.json>}'}"
- define spacer "text:' '"
- define prefix "text:'<&5>| <&f>Authors: '"
- execute as_server "tellraw <player.name> {text:'',extra:[{%prefix%},{%anthony%},{%spacer%},{%morphan%}]}"
- narrate "<&d>|-----------S-c-r-o-l-l---U-p-------------|"
msgsHelpAdmin:
- define msgsHeaderTitle 'Admin Help'
- inject locally msgsHeader instantly
- narrate "<&5>|<&sp><&sp><&sp><&f>"
- narrate "<&5>|<&sp><&sp><&f>"
- narrate "<&5>|<&sp><&sp><&f>"
- narrate "<&5>|<&sp><&sp><&f>"
- narrate "<&5>|<&sp><&sp><&f>"
- narrate "<&5>|<&sp><&sp><&f>"
- narrate "<&5>|<&sp><&f>"
msgsHelpUser:
- define msgsHeaderTitle 'User Help'
- inject locally msgsHeader instantly
- narrate "<&5>|<&sp><&sp><&sp><&sp><&f>"
- narrate "<&5>|<&sp><&sp><&f>"
- narrate "<&5>|<&sp><&sp><&f>"
- narrate "<&5>|<&sp><&f>"
#
# END dWE Command Messages
#--------------------------------------