Date: 2017/07/30 10:08:43 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
#---------------------------------------------+
#Created 24.07.17 - 24.07.17 |
#Dorbell by BloodEko |
# |
#Easy way to add a dorbell |
# |
#Permission: dorbell.use , OP for admins |
# Access to the /dorbell command |
# |
#---------------------------------------------+
# Usage: /dorbell |
# /dorbell set|disable|info |
#---------------------------------------------+
#Use /dorbell set while looking at a button |
#to assign your dorbell. |
#Breaking or /dorbell disable, delete it again|
#When players click the dorbell, owner gets |
#notified. |
#---------------------------------------------+
shelp_reposcripts:
type: version
author: BloodEko
name: Dorbell
usage: /dorbell syntax
version: 0.6
id: 132
link: http://old.mcmonkey.org/denizen/repo/entry/132
#--------------------------------------------+
dorbell_cmdhandler:
type: command
name: dorbell
usage: /dorbell set|disable|info
description:
permission: dorbell.use
permission message: You don't have the permission for using this command.
script:
#
# /dorbell
#
- if <context.args.size> == 1 {
#
# set
#
- if <context.args.get[1]> == set {
- if <li@stone_button|wood_button.contains[<pl.location.cursor_on.material>]>
&& <server.has_flag[dorbell.<player.location.cursor_on.simple>]> {
- narrate "<&4>There is already a dorbell!"
} else if !<server.has_flag[dorbell.<player>]> {
- narrate "<&2>Created a new dorbell!"
- flag server dorbell.<player.location.cursor_on.simple>:<player>
- flag server dorbell.<player>:<player.location.cursor_on.simple>
}
else {
- narrate "<&4>You already have a dorbell!"
}
}
#
# info
#
else if <context.args.get[1]> == info {
- if <server.has_flag[dorbell.<player.location.cursor_on.simple>]> {
- narrate "<&2>This dorbell is owned by <&6><server.flag[dorbell.<player.location.cursor_on.simple>].as_player.name>"
}
else if <server.has_flag[dorbell.<player>]> {
- narrate "<&2>Your dorbell is located at <&6><server.flag[dorbell.<player>]>"
}
else {
- narrate "<&2>You have no dorbell."
}
}
#
# disable
#
else if <context.args.get[1]> == disable {
- if <server.has_flag[dorbell.<player>]> {
- narrate "<&2>Disabled your dorbell."
- define location "<server.flag[dorbell.<player>]>"
- flag server dorbell.<player>:!
- flag server dorbell.<def[location]>:!
}
else {
- narrate "<&2>You have no dorbell."
}
}
else {
- inject locally dorbell_false_syntax
}
}
else {
- inject locally dorbell_false_syntax
}
dorbell_false_syntax:
- narrate "<&4>/dorbell set|disable|info"
dorbell_handler:
type: world
events:
on player breaks wood_button:
- inject locally dorbell_break
on player breaks stone_button:
- inject locally dorbell_break
on player right clicks wood_button:
- inject locally dorbell_event
on player right clicks stone_button:
- inject locally dorbell_event
dorbell_event:
- if !<server.has_flag[dorbell.<context.location.simple>]> queue clear
- if <server.has_flag[dorbell.cooldown.<context.location.simple>]> queue clear
- flag server dorbell.cooldown.<context.location.simple> duration:d@4s
- if <server.flag[dorbell.<context.location.simple>].as_player.is_online> {
- narrate "Ring ring ..." targets:<player.location.find.entities[player].within[10]>
- playsound <player.location> sound:BLOCK_NOTE_PLING
- playsound <server.flag[dorbell.<context.location.simple>]> sound:BLOCK_NOTE_PLING
- narrate "<&l><&6>Somebody has used your dorbell!" targets:<server.flag[dorbell.<context.location.simple>]>
}
else {
- narrate "Seems like nobody is there."
}
dorbell_break:
- if !<server.has_flag[dorbell.<context.location.simple>]> queue clear
- define user <server.flag[dorbell.<context.location.simple>]>
- narrate "<&2>Disabled the dorbell from <&6><def[user].as_player.name>"
- flag server dorbell.<def[user]>:!
- flag server dorbell.<context.location.simple>:!