Date: 2017/11/13 05:32:01 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
NODES_FILE_LOADER:
type: world
debug: false
events:
on server start:
- if !<server.has_file[dNations/dNodes.yml]> {
- yaml create id:dNodes
}
- yaml "load:dNations/dNodes.yml" id:dNodes
- yaml "savefile:dNations/dNodes.yml" id:dNodes
NODES_COMMAND:
type: command
name: nodes
script:
- choose "<context.args.get[1]>":
- case "create":
- choose "<context.args.get[2]>":
- case "copper":
- yaml "load:dNations/dNodes.yml" id:dNodes
- yaml id:dNodes set mine.quartz_ore:->:<player.location.chunk>"
- yaml "savefile:dNations/dNodes.yml" id:dNodes
- narrate "<&a>You have successfully created a copper node at <player.location.chunk>!"
- case "iron":
- yaml "load:dNations/dNodes.yml" id:dNodes
- yaml id:dNodes set mine.iron_ore:->:<player.location.chunk>"
- yaml "savefile:dNations/dNodes.yml" id:dNodes
- narrate "<&a>You have successfully created an iron at <player.location.chunk>!"
- case "gold":
- yaml "load:dNations/dNodes.yml" id:dNodes
- yaml id:dNodes set mine.gold_ore:->:<player.location.chunk>"
- yaml "savefile:dNations/dNodes.yml" id:dNodes
- narrate "<&a>You have successfully created a gold node at <player.location.chunk>!"
- case "sapphire":
- yaml "load:dNations/dNodes.yml" id:dNodes
- yaml id:dNodes set mine.lapis_ore:->:<player.location.chunk>"
- yaml "savefile:dNations/dNodes.yml" id:dNodes
- narrate "<&a>You have successfully created a sapphire node at <player.location.chunk>!"
- case "sparkstone":
- yaml "load:dNations/dNodes.yml" id:dNodes
- yaml id:dNodes set mine.redstone_ore:->:<player.location.chunk>"
- yaml "savefile:dNations/dNodes.yml" id:dNodes
- narrate "<&a>You have successfully created a sparkstone node at <player.location.chunk>!"
- case "emerald":
- yaml "load:dNations/dNodes.yml" id:dNodes
- yaml id:dNodes set mine.emerald_ore:->:<player.location.chunk>"
- yaml "savefile:dNations/dNodes.yml" id:dNodes
- narrate "<&a>You have successfully created an emerald node at <player.location.chunk>!"
- default:
- narrate "<&c>That is not a valid node type! Valid node types are:"
- narrate "<&c>copper, iron, gold, sapphire, sparkstone."
- case "remove":
- foreach <server.list_flags[nodes.]> {
- if <server.flag[<def[value]>].contains[<player.location.chunk>]> {
- flag server <server.flag[nodes.].before[<&dot>]>:->:<player.location.chunk>:!
}
}
- default:
- narrate "<&c>That is not a valid nodes command! Valid nodes commands are: create, remove."
NODES_REPLENISH:
type: world
events:
on player breaks block:
- narrate "<yaml[dNodes].read[mine.<context.material.name>].filter[cuboid.contains[<context.location>]].size> > 0"
- if <yaml[dNodes].read[mine.<context.material.name>].filter[cuboid.contains[<context.location>]].size> > 0 {
- narrate "replenishing.<context.location>:<context.material>"
- flag server replenishing.<context.location>:<context.material> duration:30s
}
on system time minutely:
- foreach <server.list_flags[replenishing.]> {
- narrate "<server.list_flags[replenishing.]>"
- if <def[value].is_expired> {
- modifyblock <def[value].after[replenishing.]> <server.flag[<def[value]>]>
- narrate "<def[value].after[replenishing.]> <server.flag[<def[value]>]>"
}
}