-
Notifications
You must be signed in to change notification settings - Fork 2
/
resource.sk
186 lines (153 loc) · 6.68 KB
/
resource.sk
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
# ### Resource world reset tools by Roy Curtis
# ### Licensed under MIT, 2016
# ### Global variables
# resource.lock - boolean; set if regenerating resource
# ### Configuration
options:
# Name of the resource spawn schematic
schematic : resource_spawn
# Name of the resource spawn region
region : resource_spawn
# ### Global functions
function rrCheck(who: player) :: boolean:
if {_who} is online:
return true
else:
delete {resource.lock}
message "&c*** Resource reset interrupted; player has disconnected!" to console
console command "/broadcast-irc *** Oops! Resource world reset got interrupted mid-process! ***"
console command "/broadcast-irc *** Please do not attempt to visit resource until the mess is resolved! ***"
return false
function rrLog(who: player, msg: text):
message "&7*** Resource reset: %{_msg}%" to console
message "&7*** %{_msg}%" to {_who}
function rrCommand(who: player, cmd: text):
command {_cmd} by {_who}
# message "Command: %{_cmd}%" to console
function rrConsoleCommand(cmd: text):
console command {_cmd}
# message "Console command: %{_cmd}%" to console
# ### Commands
command /resource-reset <integer> [<text=null>]:
description: Performs a resource world reset
executable by: players
permission: gamealition.mod-high
usage: /resource-reset <seed> [--confirm]
trigger:
if {resource.lock} is set:
message "&c*** A reset is already in progress"
exit trigger
if arg 2 != "--confirm":
message "&c&l*** YOU ARE ABOUT TO RESET RESOURCE WORLDS!"
message "&c&l*** THIS PROCESS IS NOT UNDOABLE!"
message "Your player character will be teleported around and used to"
message " perform the reset. Please only proceed if it's time to reset"
message " resource. &cDo not move or disconnect during the process."
message ""
message "The seed you've chosen is: &c%arg 1%"
message "To continue, add &a--confirm &fto the command, like so:"
message "&a/resource-reset %arg 1% --confirm"
exit trigger
# Player preperation
message "&c*** %player% triggered resource reset with seed %arg 1%" to console
set {resource.lock} to true
set {_seed} to arg 1
set {_origin} to location at (0, 64, 0) "resource"
set {_origin2} to location at (0, 70, 0) "resource"
message "&c*** Reset in 5 seconds; please don't move or disconnect!"
rrConsoleCommand("/god %player% on")
rrConsoleCommand("/mvtp %player% a:world")
rrConsoleCommand("/mvconfirm")
wait 5 seconds
# Resource spawn backup
rrCheck(player) is true
rrLog(player, "Going to resource world...")
rrConsoleCommand("/mvtp %player% resource")
rrConsoleCommand("/mv confirm")
wait 3 seconds
rrCheck(player) is true
rrLog(player, "Copying resource spawn...")
rrConsoleCommand("/mvtp %player% e:resource:0.5,64,0.5")
rrConsoleCommand("/mv confirm")
rrCommand(player, "//chunk")
rrCommand(player, "//copy")
wait 3 seconds
# Regeneration
rrCheck(player) is true
rrLog(player, "Regenerating resource...")
rrConsoleCommand("/mv regen resource -s %{_seed}%")
rrConsoleCommand("/mv confirm")
wait 3 seconds
rrCheck(player) is true
rrLog(player, "Regenerating resource nether...")
rrConsoleCommand("/mv regen resource_nether -s %{_seed}%")
rrConsoleCommand("/mv confirm")
wait 3 seconds
rrCheck(player) is true
rrLog(player, "Regenerating resource end...")
rrConsoleCommand("/mv regen resource_the_end -s %{_seed}%")
rrConsoleCommand("/mv confirm")
wait 3 seconds
rrCheck(player) is true
rrLog(player, "Reloading Multiverse...")
rrConsoleCommand("/mv reload")
wait 3 seconds
# New world preperation
rrCheck(player) is true
rrLog(player, "Going to resource world...")
rrConsoleCommand("/mvtp %player% resource")
rrConsoleCommand("/mv confirm")
wait 3 seconds
rrCheck(player) is true
if player's world != "resource":
message "&c*** PANIC: You aren't in the expected world!"
message "&c*** PANIC: Player wasn't taken to expected world" to console
delete {resource.lock}
exit trigger
rrCheck(player) is true
rrLog(player, "Preparing resource world...")
rrConsoleCommand("/mvrule commandBlockOutput false resource")
set blocks between block at {_origin} and block at {_origin2} to air
set block below {_origin} to redstone block
wait 3 second
rrCheck(player) is true
rrLog(player, "Pasting the resource spawn chunk...")
rrConsoleCommand("/mvtp %player% e:resource:0.5,64,0.5")
rrConsoleCommand("/mv confirm")
rrCommand(player, "//paste")
wait 3 seconds
rrCheck(player) is true
rrLog(player, "Deleting PRISM history...")
rrConsoleCommand("/pr delete w:resource t:31d r:world")
rrConsoleCommand("/pr delete w:resource_nether t:31d r:world")
rrConsoleCommand("/pr delete w:resource_the_end t:31d r:world")
wait 3 second
rrCheck(player) is true
rrLog(player, "Reloading Multiverse once more...")
rrConsoleCommand("/mv reload")
wait 3 seconds
# Finalize
delete {resource.lock}
rrLog(player, "Resource reset finished!")
rrConsoleCommand("/god %player% off")
message "&c&l*** RESOURCE RESET IS NOT YET FINISHED!"
message "You must now do the following, manually:"
message ""
message "* Do &3/mvtp resource_nether&f and. . ."
message " * Create a portal near 0,0; destroy existing portals"
message " * Set spawn at safe place using &3/mvss"
message "* Do &3/mvtp resource_the_end&f and. . ."
message " * Set spawn at safe place using &3/mvss"
message "* Announce the resource reset in chat, twitter and forums"
message "* Update the forums' resource biomes list and map"
command /resource-unlock:
description: Disengages the resource reset lock
executable by: players and console
permission: gamealition.mod-high
usage: /resource-unlock
trigger:
if {resource.lock} is set:
delete {resource.lock}
message "&c*** Resource reset lock deleted; make sure you know what you're doing!"
else:
message "&c*** There is no resource reset lock"