Date: 2015/03/09 19:58:31 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
schematicbuild:
type: world
debug: false
events:
on player places i@buildchest:
- flag player sb.buildingname:<context.item_in_hand.display>
- flag server sb.buildinglc:<context.location>
- flag player sb.buildinglore:<context.item_in_hand.lore>
- schematic load name:<player.flag[sb.buildingname]>
- if <player.location.yaw.simple> == East {
- schematic rotate name:<player.flag[sb.buildingname]> angle:0
}
- if <player.location.yaw.simple> == south {
- schematic rotate name:<player.flag[sb.buildingname]> angle:90
}
- if <player.location.yaw.simple> == west {
- schematic rotate name:<player.flag[sb.buildingname]> angle:180
}
- if <player.location.yaw.simple> == north {
- schematic rotate name:<player.flag[sb.buildingname]> angle:270
}
- if <schematic[<player.flag[sb.buildingname]>].cuboid[<context.location>].has_region> {
- narrate "<&4>You cannot build this here!"
- schematic unload name:<player.flag[sb.buildingname]>
- determine passively cancelled
- flag player sb.buildinglore:!
- flag player sb.buildingname:!
- flag server sb.buildinglc:!
}
else {
- if <schematic[<player.flag[sb.buildingname]>].cuboid[<context.location>].has_town> {
- if <schematic[<player.flag[sb.buildingname]>].cuboid[<context.location>].list_towns> == li@<player.town> {
- flag player sb.buildlocation:<context.location>
- flag player sb.building:<context.item_in_hand>
- inventory open d:in@confirmation
}
else {
- narrate "<&4>You cannot build this here!"
- schematic unload name:<player.flag[sb.buildingname]>
- determine passively cancelled
- flag player sb.buildinglore:!
- flag player sb.buildingname:!
- flag server sb.buildinglc:!
}
}
else {
- flag player sb.buildlocation:<context.location>
- flag player sb.building:<context.item_in_hand>
- inventory open d:in@confirmation
}
}
on player clicks in in@confirmation:
- if <context.item.scriptname||null> == accept {
- schematic load name:<player.flag[sb.buildingname]>
- schematic paste name:<player.flag[sb.buildingname]> <player.flag[sb.buildlocation]> noair
- flag player sb.buildresponse:true
- narrate "<&2>building <player.flag[sb.buildingname]>!"
- modifyblock <player.flag[sb.buildlocation]> air
- schematic unload name:<player.flag[sb.buildingname]>
- flag player sb.buildlocation:!
- flag player sb.building:!
- flag player sb.buildingname:!
- flag server sb.buildinglc:!
- flag palyer sb.buildinglore:!
- determine passively cancelled
- inventory close
}
- if <context.item.scriptname||null> == deny {
- narrate "<&4>cancelled!"
- flag player sb.buildresponse:true
- modifyblock <player.flag[sb.buildlocation]> air
- !flag player sb.buildlocation:!
- give <player.name> "<player.flag[sb.building]>[display_name=<player.flag[sb.buildingname]>;lore=<player.flag[sb.buildinglore]>]" qty:1
- schematic unload name:<player.flag[sb.buildingname]>
- flag player sb.building:!
- flag player sb.buildingname:!
- flag palyer sb.buildinglore:!
- flag server sb.buildinglc:!
- determine passively cancelled
- inventory close
}
on player closes inventory:
- if <context.inventory> == in@confirmation {
- if <player.flag[sb.buildresponse]> == true {
- flag player sb.buildresponse:false
}
else {
- narrate "<&4>cancelled!"
- modifyblock <player.flag[sb.buildlocation]> air
- determine passively cancelled
- give <player.name> "<player.flag[sb.building]>[display_name=<player.flag[sb.buildingname]>;lore=<player.flag[sb.buildinglore]>]" qty:1
- schematic unload name:<player.flag[sb.buildingname]>
- flag player sb.buildlocation:!
- flag player sb.building:!
- flag player sb.buildingname:!
- flag server sb.buildinglc:!
- flag player sb.buildinglore:!
}
}
on player breaks CHEST:
- if <context.location> == <server.flag[sb.buildinglc]> {
- narrate "someone is building!"
- determine cancelled
}
buildchest:
type: item
material: CHEST
display name: "build"
lore:
- Place this to build!
NewBuild:
type: command
name: buildchest
script:
- give "i@buildchest[display_name=<context.raw_args>;lore=Place this to build <context.raw_args>]"
accept:
type: item
material: 159,13
display name: "<&2>Accept"
deny:
type: item
material: 159,14
display name: "<&4>Deny"
confirmation:
type: inventory
inventory: Chest
title: "Build this here?"
size: 27
definitions:
slots:
- "[] [] [] [] [] [] [] [] []"
- "[] [] [i@accept] [] [] [] [i@deny] [] []"
- "[] [] [] [] [] [] [] [] []"