Date: 2018/02/25 09:07:59 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
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
Plot_Cells_Events:
type: world
events:
on system time hourly:
- inject Plot_Cells_Check_PlotCells
on player changes sign:
- if <context.new.get[1]> == "[Cell]" {
- define plot <context.location.plotsquared_plot||null>
- if <def[plot]> == null {
- queue clear
}
- define cells <server.flag[Plots.<def[plot]>.Config.Plot_Cells].as_list||li@>
- if <def[cells].is_empty||true> {
- narrate "<&c>Du har ikke nogen celler på dit plot"
- determine "<&4>[Cell]|<context.new.get[2]>|<context.new.get[3]>|<context.new.get[4]>" passively
- queue clear
}
- if <def[cells].contains[<context.new.get[2]>].not||true> {
- narrate format:util_ff "<&c>Denne celle eksistere ikke på dette plot"
- determine "<&4>[Cell]|<context.new.get[2]>|<context.new.get[3]>|<context.new.get[4]>" passively
- queue clear
}
- define cell_id <context.new.get[2]>
- if <server.has_flag[Plots.<def[plot]>.Config.Plot_Cell.cells.<def[cell_id]>.sign]> {
- define pos <server.flag[Plots.<def[plot]>.Config.Plot_Cell.cells.<def[cell_id]>.sign]>
- if <def[pos].as_location.material.name.contains[sign]> {
- if <def[pos]> != <context.location> {
- narrate format:util_ff "<&e>Fjernede forrige celle skilt."
- sign type:automatic "<&sp>|<&sp>|<&sp>|<&sp>" <server.flag[Plots.<def[plot]>.Config.Plot_Cell.cells.<def[cell_id]>.sign]>
}
}
}
- if <server.has_flag[Plots.<def[plot]>.Config.Plot_Cell.cells.<def[cell_id]>.owner]> {
- define time_left <server.flag[Plots.<def[plot]>.Config.Plot_Cell.cells.<def[cell_id]>.time_left].div[1000].as_duration>
- define time_prefix "<def[time_left].time.day>-<def[time_left].time.month>-<def[time_left].time.year>"
- determine "<&1>[Cell]|<&b><def[cell_id]>|<&b><server.flag[Plots.<def[plot]>.Config.Plot_Cell.cells.<def[cell_id]>.owner].as_player.name>|<&3><def[time_prefix]>" passively
}
else {
- if <context.new.get[3].replace[$].as_int||null> == null {
- define price "$100"
}
else {
- define price <context.new.get[3]>
}
- determine "<&1>[Cell]|<&b><def[cell_id]>|<&3><def[price]>|<&2><&l>Ledig" passively
- flag server Plots.<def[plot]>.Config.Plot_Cell.cells.<def[cell_id]>.price:<def[price]>
}
- flag server Plots.<def[plot]>.Config.Plot_Cell.cells.<def[cell_id]>.sign:<context.location>
- narrate format:util_ff "<&a>Oprettet celle skilt<&co> <&6><def[cell_id]>"
}
on player right clicks WALL_SIGN:
- inject Plot_Cells_Sign_Task
on player right clicks SIGN_POST:
- inject Plot_Cells_Sign_Task
on player left clicks WALL_SIGN:
- if <player.gamemode> == CREATIVE {
- queue clear
}
- inject Plot_Cells_Sign_Task
on player left clicks SIGN_POST:
- if <player.gamemode> == CREATIVE {
- queue clear
}
- inject Plot_Cells_Sign_Task
on player clicks Plot_Cells_Item_Add in Plot_Cells_Menu_Cell_Owner:
- determine cancelled passively
on player clicks Plot_Cells_Item_Remove in Plot_Cells_Menu_Cell_Owner:
- determine cancelled passively
on player clicks Plot_Cells_Item_Leave in Plot_Cells_Menu_Cell_Owner:
- determine cancelled passively
- inventory close d:<context.inventory>
- define plot <player.flag[Plot_Target].as_plotsquared_plot>
- define cell_id <player.flag[Cell_Target]>
- narrate format:util_ff "<&a>Du forlod din celle på dette plot"
- run Plot_Cells_Reset_Cell instantly context:<def[plot]>|<def[cell_id]>
on player clicks Plot_Cells_Item_Extend in Plot_Cells_Menu_Cell_Owner:
- determine cancelled passively
- flag server Plot_Target:<player.flag[Plot_Target]>
- flag server Cell_Target:<player.flag[Cell_Target]>
- inventory open d:in@Plot_Cells_Menu_Extend
on player drags in Plot_Cells_Menu_Cell_Owner:
- determine cancelled passively
on player clicks Plot_Cells_Item_Buy in Plot_Cells_Menu_Buy_Cell:
- determine cancelled passively
- define plot <player.flag[Plot_Target].as_plotsquared_plot>
- define cell_id <player.flag[Cell_Target]>
- foreach <server.flag[Plots.<def[plot]>.Config.Plot_Cells].as_list||li@> {
- if <server.flag[Plots.<def[plot]>.Config.Plot_Cell.cells.<def[value]>.Owner]||null> == <player> {
- narrate format:util_ff "<&c>Du har allerede en celle på dette plot"
- queue clear
}
}
- define price <context.location.sign_contents.get[3].strip_color.replace[$].as_int||100>
- if <player.money> < <def[price]> {
- narrate format:util_ff "<&c>Du har ikke råd til at leje denne celle"
- queue clear
}
- money take quantity:<def[price]> from:<player>
- define time_left <util.date.time.duration.add[1d]>
- define time_prefix "<def[time_left].time.day>-<def[time_left].time.month>-<def[time_left].time.year>"
- narrate format:util_ff "<&a>Du har lejet denne celle for <def[price]>$ til <def[time_prefix]>"
- flag server Plots.<def[plot]>.Config.Plot_Cell.cells.<def[cell_id]>.time_left:<def[time_left].in_milliseconds>
# - flag server Plots.<def[plot]>.Config.Plot_Cell.cells.<def[cell_id]>.price:<context.location.sign_contents.get[3]||100>
- flag server Plots.<def[plot]>.Config.Plot_Cell.cells.<def[cell_id]>.owner:<player>
- sign type:automatic "<&1>[Cell]|<&b><def[cell_id]>|<&b><player.name>|<&3><def[time_prefix]>" <server.flag[Plots.<def[plot]>.Config.Plot_Cell.cells.<def[cell_id]>.sign]>
- flag server Plot_Target:<def[plot]>
- flag server Cell_Target:<def[cell_id]>
- inventory open d:in@Plot_Cells_Menu_Cell_Owner
- define world <def[plot].world>
- define region_id "Cell_<def[world].name>_<def[plot].x>_<def[plot].z>_<def[cell_id]>"
- execute as_server "worldguard:region addmember <def[region_id]> <player.name> -w <def[world].name>"
# Execute addowner to WorldGuard (command)
on player drags in Plot_Cells_Menu_Buy_Cell:
- determine cancelled passively
on player clicks Plot_Cells_Item_Info in inventory:
- determine cancelled passively
on player clicks Plot_Cells_Item_Wall in inventory:
- determine cancelled passively
on player clicks Plot_Cells_Item_Back in inventory:
- determine cancelled passively
- flag server Plot_Target:<player.flag[Plot_Target]>
- flag server Cell_Target:<player.flag[Cell_Target]>
- inventory open d:in@Plot_Cells_Menu_Cell_Owner
on player clicks in Plot_Cells_Menu_Extend:
- determine cancelled passively
- if <context.item.scriptname.starts_with[Plot_Cells_Item_Extend].not||true> {
- queue clear
}
- define plot <player.flag[Plot_Target].as_plotsquared_plot>
- define cell_id <player.flag[Cell_Target]>
- define times <context.item.scriptname.after[Plot_Cells_Item_Extend_].before[Day]>
- inject Plot_Cells_Extend_Rent
on player drags in Plot_Cells_Menu_Extend:
- determine cancelled passively
on player clicks Plot_Cells_Item_Reset in Plot_Cells_Menu_KontrolPanel:
- determine cancelled passively
- inventory close d:<context.inventory>
- define plot <player.flag[Plot_Target].as_plotsquared_plot>
- define cell_id <player.flag[Cell_Target]>
- narrate format:util_ff "<&a>Denne celle er nu blevet resat"
- run Plot_Cells_Reset_Cell instantly context:<def[plot]>|<def[cell_id]>
on player clicks Plot_Cells_Item_Delete in Plot_Cells_Menu_KontrolPanel:
- determine cancelled passively
- inventory close d:<context.inventory>
- define plot <player.flag[Plot_Target].as_plotsquared_plot>
- define cell_id <player.flag[Cell_Target]>
- run Plot_Cells_Remove instantly context:<def[cell_id]>|<def[plot]> player:<player>
on player drags in Plot_Cells_Menu_KontrolPanel:
- determine cancelled passively
on player drags in Plot_Cells_Menu_RemoveMember:
- determine cancelled passively