Date: 2015/05/10 17:12:46 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
warps:
type: world
events:
on warps command:
- determine passively fulfilled
- inject locally loadYAML
- define arg1 '<c.args.get[1]>'
- define arg2 '<c.args.get[2]>'
- if %arg1% == 'set' {
- if %arg2% != 'null' {
- yaml set 'id:warpslist' 'warps.%arg2%:<player.location>'
- yaml 'savefile:warps/warpslist.yml' 'id:warpslist'
- narrate "<green>you set <def[arg2]>"
}
else {
- narrate "<red>no name set for this warp"
}
}
else if %arg1% == 'remove' {
- if %arg2% != 'null' {
- if !<yaml[warpslist].contains[warps.%arg2%]> {
- narrate "<red>no such warp named %arg2%"
- queue clear
}
- yaml set 'id:warpslist' 'warps.%arg2%:!'
- yaml 'savefile:warps/warpslist.yml' 'id:warpslist'
- narrate "<green>you removed <def[arg2]>"
}
else {
- narrate "<red>no name set for this warp"
}
}
else if %arg1% == 'list' {
- narrate "<green>valid warp destinations: <yaml[warpslist].list_keys[warps].replace[li@].with[<yellow>].replace[|].with[<&sp>]>"
}
else if <yaml[warpslist].contains[warps.%arg1%]> {
- narrate "<green> teleporting to %arg1%"
- teleport <player> <yaml[warpslist].read[warps.%arg1%]>
}
else {
- narrate "<red> %arg1% warp dosn't exist"
}
loadYAML:
- if !<yaml.list.contains[warpslist]> {
- if !<server.has_file[warps/warpslist.yml]> {
- yaml create 'id:warpslist'
- yaml 'savefile:warps/warpslist.yml' 'id:warpslist'
}
else {
- yaml 'load:warps/warpslist.yml' 'id:warpslist'
}
}