# -------------------------------------------------- # # Command: '/claim flags' # -------------------------------------------------- # cmd_claims_flags: type: task debug: false definitions: flag|text script: - if !: - narrate "<&[red]>You must be standing inside of a claim." - stop # Getting the ID is only necessary for SQL - define global_id - define type - define claim_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 !: - choose <[type]>: - case admin special: - if !: - 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[]> : - define skip_check true - if : - define skip_check true - if !<[skip_check].if_null[false]> && !|<[global_id]>]> && !|<[parent_global_id]>]>: - if !|<[parent_global_id]>]>: - narrate "<&[red]>You do not have access to this sectioned claim." - stop - if !|<[parent_global_id]>|flags]>: - narrate "<&[red]>You do have permission to change the flags of this sectioned claim." - stop - case player: - if !|<[global_id]>]>: - narrate "<&[red]>You do not have access to this claim." - stop - if !|<[global_id]>]> && !|<[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 !].exists>: - narrate "<&[red]>The flag <&[yellow]><[flag]><&[red]> is not a valid flag." - stop - if .admin].exists> && !: - narrate "<&[red]>Only administrators can change the flag <&[yellow]><[flag]><&[red]>." - stop - choose .type]>: - case bool: - if <[flag]> == allowPvp && ].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 ].flag[claim.flags.<[flag]>].if_null[.default]>]> - if <[status]>: - narrate .disablemsg]> - flag ]> claim.flags.<[flag]>:false - else: - narrate .enablemsg]> - flag ]> claim.flags.<[flag]>:true - case location: - if !: - narrate "<&[red]>You must be on the ground." - stop - if !: - narrate "<&[red]>Your position is not safe, select another area." - stop - narrate .setmsg]> - flag ]> claim.flags.<[flag]>: - case integer: - if <[text].if_null[NULL]> == NULL: - narrate .deleteMsg]> - flag ]> claim.flags.<[flag]>:NULL - stop - else: - if !<[text].is_integer>: - narrate "<&[yellow]><[text]> <&[red]>must be an integer." - stop - flag ]> claim.flags.<[flag]>:<[text]> - narrate ".editmsg]> <&[yellow]><[text].as[duration].formatted_words><&a>." - case string: - if <[text].if_null[NULL]> == NULL || <[text]> == REMOVE: - narrate .deleteMsg]> - flag ]> claim.flags.<[flag]>:NULL - stop - if .max].exists>: - define text <[text].proc[colors_parse_chat]> - define min .min]> - define max .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 ".editmsg]> <[text].parse_color.proc[colors_parse_chat]>" - flag ]> claim.flags.<[flag]>:<[text]>