Date: 2019/12/10 17:36:23 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
LockItLikeItsHot:
type: world
debug: false
events:
on player right clicks *chest|furnace|*door|hopper|*gate|dispenser|dropper|*shulker_box:
- define sign_locations <context.location.find.blocks.within[3].filter[material.name.ends_with[wall_sign]]>
- foreach <[sign_locations]> as:sign:
- if <[sign].sub[<[sign].block_facing>].is[==].to[<context.location>]>:
- if <[sign].sign_contents.get[1].contains[<&lb>Private<&rb>]>:
- define lock <[sign]>
- if <[sign].sign_contents.get[1].contains[<&lb>Other<&sp>Users<&rb>]>:
- define lock_extra <[sign]>
- if <[sign].sub[<[sign].block_facing>].is[==].to[<context.location.other_block||false>]||false>:
- if <[sign].sign_contents.get[1].contains[<&lb>Private<&rb>]>:
- define lock <[sign]>
- if <[sign].sign_contents.get[1].contains[<&lb>Other<&sp>Users<&rb>]>:
- define lock_extra <[sign]>
- if <[lock].sign_contents.contains[<player.name>].not||false>:
- if <player.is_op>:
- narrate "<&4>You bypass this lock!"
- stop
- if <[lock_extra].sign_contents.contains[<player.name>]||false>:
- stop
- narrate "<&4>You do not have access to this!"
- determine cancelled
- if <context.item.material.contains[sign]>:
- if <context.relative.material.name.is[!=].to[air]>:
- stop
- if <[lock].sign_contents.contains[<player.name>].not||false>:
- narrate "<&4>This object is already locked!"
- if <definition[lock_extra].exists>:
- narrate "You cannot add another lock sign!"
- determine cancelled
- if <definition[lock].exists||false>:
- sign <context.relative> direction:<context.location.direction[<context.relative>].to_list.first> type:wall_sign "<&lb>Other Users<&rb>|<player.name>"
- determine cancelled
- sign <context.relative> direction:<context.location.direction[<context.relative>].to_list.first> type:wall_sign "<&lb>Private<&rb>|<player.name>"
- narrate "You successfully lock this object!"
- determine cancelled
on player breaks chest|furnace|*door:
- define sign_locations <context.location.find.blocks.within[2].filter[material.name.ends_with[wall_sign]]>
- define lock false
- foreach <[sign_locations]> as:sign:
- if <[sign].sub[<[sign].block_facing>].is[==].to[<context.location>]>:
- if <[sign].sign_contents.get[1].contains[<&lb>Private<&rb>]>:
- narrate "<&4>You may not break this locked item!"
- determine cancelled
- if <[sign].sub[<[sign].block_facing>].is[==].to[<context.location.other_block||false>]||false>:
- if <[sign].sign_contents.get[1].contains[<&lb>Private<&rb>]>:
- narrate "<&4>You may not break this locked item!"
- determine cancelled
on player breaks wall_sign:
- if <context.location.sign_contents.get[1].contains[<&lb>Private<&rb>].or[<context.location.sign_contents.get[1].contains[<&lb>Other<&sp>Users<&rb>]>]>:
- if <context.location.sign_contents.get[2].contains[<player.name>].not||false>:
- if <player.is_op>:
- narrate "<&4>You broke this lock!"
- stop
- narrate "<&4>You may not break this lock!"
- determine cancelled
on player right clicks wall_sign:
- if <context.location.sign_contents.get[1].contains[<&lb>Private<&rb>]||false.or[<context.location.sign_contents.get[1].contains[<&lb>Other<&sp>Users<&rb>]||false>]>:
- if <context.location.sign_contents.contains[<player.name>]||false>:
- narrate "____________________________________"
- narrate "<&6>/lock <&e>edit <&2>(line) <&7>(PLAYERNAME)"
- narrate "<&2>This allows the lock owner to add or remove names."
- narrate "<&2>Line input is either 3 or 4"
- narrate "<&2>Name input is either a username or 'clear' to remove that line"
EditThatLockLikeItsHot:
type: command
usage: /lock
name: lock
debug: false
script:
- if <list[3|4].contains[<context.args.get[2]||false>].not.or[<context.args.get[3]||false.is[!=].to[false]>]>:
- narrate "____________________________________"
- narrate "<&6>/lock <&e>edit <&2>(line) <&7>(PLAYERNAME)"
- narrate "<&2>This allows the lock owner to add or remove names."
- narrate "<&2>Line input is either 3 or 4"
- narrate "<&2>Name input is either a username or 'clear' to remove that line"
- stop
- if <context.args.get[1].is[==].to[edit]||false>:
- define local <player.location.cursor_on[5]>
- if <[local].material.name.contains[wall_sign]>:
- define sign_text <[local].sign_contents>
- if <[sign_text].get[1].contains[<&lb>Private<&rb>].or[<[sign_text].get[1].contains[<&lb>Other<&sp>Users<&rb>]||false>]||false>:
- if <player.name.is[==].to[<[sign_text].get[2]>]>:
- if <context.args.get[3].is[==].to[clear]>:
- define new_name <element[]>
- else:
- define new_name <context.args.get[3]>
- define list <[sign_text].set[<[new_name]>].at[<context.args.get[2]>]>
- sign <[local]> "<[list]>"
- narrate "Sign Changed!"
- else:
- narrate "<&4>You cannot edit someone elses lock!"