Date: 2022/12/13 12:15:45 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
rent_cmd:
type: command
debug: true
name: rent
description: Used to Manage Rent.
usage: /rent
tab completions:
1: claim|unclaim
script:
- if <context.args.size> == 0:
- narrate " "
- narrate "<dark_gray>[<blue>Aegorin<dark_gray>] <gold>Rent Befehle"
- narrate " "
- stop
- if <context.args.first> == claim:
- if <player.location.regions.find_match[region@rrg_*]> == -1:
- narrate "error, house region not found"
- stop
- define region <player.location.regions.get[<player.location.regions.find_match[region@rrg_*]>]>
- run rent_start_task def:<[region]>|<player>
- stop
- if <context.args.first> == unclaim:
- if !<player.has_flag[house.region]>:
- narrate "no house claimed"
- stop
- define region <player.flag[house.region]>
- run rent_cancel_task def:<[region]>|<player>
- stop
rent_start_task:
type: task
debug: true
definitions: region|player
script:
- if <[region].members.size> >= 1:
- narrate "already claimed"
- stop
- execute as_server 'rg addmember -w world <[region].id> <[player].name>'
- flag <[player]> house.region:<[region]>
- ~schematic create name:<[region].id> area:<[region].area> <[player].location>
- ~schematic save name:<[region].id>
- ~schematic unload name:<[region].id>
- narrate "started "
rent_cancel_task:
type: task
debug: true
definitions: region|player
script:
- if !(<[player].flag[house.region]> == <[region]>):
- narrate "regions dont match"
- stop
- execute as_server 'rg removemember -w world -a <[region].id>'
- flag <[player]> house.region:!
- ~schematic load name:<[region].id>
- ~schematic paste name:<[region].id> <schematic[<[region].id>].origin>
- ~schematic unload name:<[region].id>
- narrate "cancelled "