Date: 2022/11/24 13:13:41 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
# -------------------------------------------------- #
# Command: '/claim flags'
# -------------------------------------------------- #
cmd_claims_flags:
type: task
debug: false
definitions: flag|text
script:
- if !<proc[claims_ply_inside_claim]>:
- narrate "<&[red]>You must be standing inside of a claim."
- stop
# Getting the ID is only necessary for SQL
- define global_id <proc[claims_ply_get_global]>
- define type <proc[claims_ply_get_type]>
- define claim_id <proc[claims_ply_get_id]>
# Display the flags menu, otherwise run the command.
- if !<[flag].exists> || <[flag]> == NULL:
- run claims_menu_flags_list def:<[global_id]>
- stop
# If they have do not have ignore mode on .
- if !<player.proc[claims_ignoring]>:
- choose <[type]>:
- case admin special:
- if !<player.proc[player_is_admin]>:
- narrate "<&[red]>You do not have permission to edit administrative claims."
- stop
- case section:
- define parent_global_id <[global_id].proc[claims_parent]>
- if <[parent_global_id].after[-].before[-].is_in[<list[admin|special]>]> <player.proc[player_is_admin]>:
- define skip_check true
- if <player.proc[claims_ignoring]>:
- define skip_check true
- if !<[skip_check].if_null[false]> && !<proc[claims_ply_is_manager].context[<player>|<[global_id]>]> && !<proc[claims_ply_is_manager].context[<player>|<[parent_global_id]>]>:
- if !<proc[claims_ply_is_member].context[<player>|<[parent_global_id]>]>:
- narrate "<&[red]>You do not have access to this sectioned claim."
- stop
- if !<proc[claims_member_has_permission].context[<player>|<[parent_global_id]>|flags]>:
- narrate "<&[red]>You do have permission to change the flags of this sectioned claim."
- stop
- case player:
- if !<proc[claims_ply_is_member].context[<player>|<[global_id]>]>:
- narrate "<&[red]>You do not have access to this claim."
- stop
- if !<proc[claims_ply_is_manager].context[<player>|<[global_id]>]> && !<proc[claims_member_has_permission].context[<player>|<[global_id]>|flags]>:
- narrate "<&[red]>You do have permission to change the flags of this claim."
- stop
- if !<[flag].exists> || <[flag]> == NULL:
- narrate "<&[red]>You need to supply a flag name."
- stop
# Verify it's a default allowed flag.
- if !<script[cfg_claims_flags].data_key[flags.<[flag]>].exists>:
- narrate "<&[red]>The flag <&[yellow]><[flag]><&[red]> is not a valid flag."
- stop
- if <script[cfg_claims_flags].data_key[flags.<[flag]>.admin].exists> && !<player.proc[player_is_admin]>:
- narrate "<&[red]>Only administrators can change the flag <&[yellow]><[flag]><&[red]>."
- stop
- choose <script[cfg_claims_flags].data_key[flags.<[flag]>.type]>:
- case bool:
- if <[flag]> == allowPvp && <list[NETHER|THE_END].contains[<cuboid[<[global_id]>].world.environment>]>:
- narrate "<&[red]>You can not change <&[yellow]><[flag]><&[red]> in this world environment."
- stop
# Defines the status of the current flag we're editing
- define status <cuboid[<[global_id]>].flag[claim.flags.<[flag]>].if_null[<script[cfg_claims_flags].data_key[flags.<[flag]>.default]>]>
- if <[status]>:
- narrate <script[cfg_claims_flags].parsed_key[flags.<[flag]>.disablemsg]>
- flag <cuboid[<[global_id]>]> claim.flags.<[flag]>:false
- else:
- narrate <script[cfg_claims_flags].parsed_key[flags.<[flag]>.enablemsg]>
- flag <cuboid[<[global_id]>]> claim.flags.<[flag]>:true
- case location:
- if !<player.is_on_ground>:
- narrate "<&[red]>You must be on the ground."
- stop
- if !<player.location.proc[location_is_empty]>:
- narrate "<&[red]>Your position is not safe, select another area."
- stop
- narrate <script[cfg_claims_flags].parsed_key[flags.<[flag]>.setmsg]>
- flag <cuboid[<[global_id]>]> claim.flags.<[flag]>:<player.location>
- case integer:
- if <[text].if_null[NULL]> == NULL:
- narrate <script[cfg_claims_flags].parsed_key[flags.<[flag]>.deleteMsg]>
- flag <cuboid[<[global_id]>]> claim.flags.<[flag]>:NULL
- stop
- else:
- if !<[text].is_integer>:
- narrate "<&[yellow]><[text]> <&[red]>must be an integer."
- stop
- flag <cuboid[<[global_id]>]> claim.flags.<[flag]>:<[text]>
- narrate "<script[cfg_claims_flags].parsed_key[flags.<[flag]>.editmsg]> <&[yellow]><[text].as[duration].formatted_words><&a>."
- case string:
- if <[text].if_null[NULL]> == NULL || <[text]> == REMOVE:
- narrate <script[cfg_claims_flags].parsed_key[flags.<[flag]>.deleteMsg]>
- flag <cuboid[<[global_id]>]> claim.flags.<[flag]>:NULL
- stop
- if <script[cfg_claims_flags].data_key[flags.<[flag]>.max].exists>:
- define text <[text].proc[colors_parse_chat]>
- define min <script[cfg_claims_flags].data_key[flags.<[flag]>.min]>
- define max <script[cfg_claims_flags].data_key[flags.<[flag]>.max]>
- if <[text].strip_color.length> < <[min]>:
- narrate "<&[red]>The title <&[yellow]><[text]><&[red]> is too short. <&[lightgrey]>( <[min]> Characters Minimum )"
- stop
- if <[text].strip_color.length> > <[max]>:
- narrate "<&[red]>The title <&[yellow]><[text]><&[red]> is too long. <&[lightgrey]>( <[max]> Characters Maximum )"
- stop
- foreach <[text].strip_color.split> as:word:
- if !<[word].to_lowercase.regex_matches[^[a-z0-9-_]+$]>:
- narrate "<&[red]>Bad character detected in <&[yellow]><[word]><&[red]>, please use letters, numbers, and underscores only."
- stop
- if <[word].proc[filter_is_offensive]>:
- narrate "<&[red]>The word <&[yellow]><[word]><&[red]> is considered offensive, these are prohibited by the server."
- stop
- if <[word].proc[filter_is_explicit]>:
- narrate "<&[red]>Profane and explicit words are prohibited."
- stop
- narrate "<script[cfg_claims_flags].parsed_key[flags.<[flag]>.editmsg]> <[text].parse_color.proc[colors_parse_chat]>"
- flag <cuboid[<[global_id]>]> claim.flags.<[flag]>:<[text]>