Paste #134049: Marry Me

Date: 2025/06/15 02:39:47 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


marryCommand:
    type: command
    debug: false
    usage: /marry
    name: marry
    description: In love, engaged, married!
    tab completions:
        1: help|me|accept|deny|divorce|info|seen|sethome|delhome|home|gift|list|tp
        2: <context.args.first.equals[me].if_true[<server.online_players.parse[name]>].if_false[]>
    script:
        - if <context.args.size> == 0:
            - narrate "<&c>Nutze /marry [help|me|accept|deny|divorce|info|seen|sethome|delhome|home|gift|list|tp] [player]"
        - if <context.args.size> >= 1:
            - define arg1 <context.args.first>
            - if <[arg1].equals[me]>:
                - if <player.has_flag[marriage_partner]>:
                    - narrate "<&c>You are already married!"
                    - stop
                - if <context.args.size> == 1:
                    - narrate "<&c>Use /marry me [player] - To make a marriage proposal."
                - if <context.args.size> >= 2:
                    - define playerName <context.args.get[2]>
                    - define target <server.match_player[<[playerName]>].if_null[null]>
                    - if <player[<[target]>]> == null:
                        - narrate "<&c>Person not found, try again!"
                        - stop
                    - if <player[<[target]>].has_flag[marriage_partner]>:
                        - narrate "<&c>The person is already married!"
                        - stop
                    - flag <player[<[target]>]> marriage_request:<player.name> duration:1m
                    - narrate "<&a>You sent <&6><player[<[target]>].name><&a> a marriage proposal!"
                    - narrate "<&a><player.name> has sent you a marriage proposal!" targets:<player[<[target]>]>
                    - narrate "<&a>Use <&e>/marry accept <&a>or <&c>/marry deny" targets:<player[<[target]>]>
            - else if <[arg1].equals[accept]>:
                - if <player.has_flag[marriage_request].not>:
                    - narrate "<&c>You don't have a marriage proposal!"
                    - stop
                - define target <player.flag[marriage_request].if_null[null]>
                - if <[target]> == null:
                    - narrate "<&c>The person is not online!"
                    - stop
                - if <player[<[target]>].has_flag[marriage_partner]>:
                    - narrate "<&c>The person is already married!"
                    - stop
                - flag <player> marriage_date:<util.time_now>
                - flag <player> marriage_partner:<[target]>
                - flag <player> marriage_request:!
                - flag <player[<[target]>]> marriage_date:<util.time_now>
                - flag <player[<[target]>]> marriage_partner:<player.name>
                - flag <player[<[target]>]> marriage_request:!
                - define name <player[<[target]>].name>
                - narrate "<&a>You are now married to: <[name]> !"
                - narrate "<&a>You are now married to: <player.name> !" targets:<player[<[target]>]>
                - announce "<&a><&l><player.name> and <[name]> are now married!"
            - else if <[arg1].equals[deny]>:
                - if <player.has_flag[marriage_request].not>:
                    - narrate "<&c>You don't have a marriage proposal!"
                    - stop
                - define target <player.flag[marriage_request].if_null[null]>
                - if <[target]> == null:
                    - narrate "<&c>The person is not online!"
                    - stop
                - define name <server.match_player[<[target]>]>
                - narrate "<&a>Du hast den Heiratsantrag von <player[<[target]>].name> abgelehnt!"
                - narrate "<&a><player.name> hat deinen Heiratsantrag abgelehnt!" targets:<player[<[target]>]>
                - flag <player> marriage_request:!
            - else if <[arg1].equals[divorce]>:
                - if <player.has_flag[marriage_partner].not>:
                    - narrate "<&c>You are not married!"
                    - stop
                - define target <player.flag[marriage_partner].if_null[null]>
                - if <[target]> == null:
                    - narrate "<&c>The person is not online!"
                    - stop
                - flag <player> marriage_partner:!
                - flag <player> marriage_date:!
                - flag <player> marriage_home:!
                - flag <player[<[target]>]> marriage_partner:!
                - flag <player[<[target]>]> marriage_date:!
                - flag <player[<[target]>]> marriage_home:!
                - narrate "<&a>You got divorced from: <&6><[target]><&a>!"
                - narrate "<&6><[target]><&a> has divorced you!" targets:<player[<[target]>]>
            - else if <[arg1].equals[info]>:
                - narrate "<&l><&a>------------- Marriage Info -------------"
                - narrate "<&a>You are married to:<&e> <player.flag[marriage_partner]||none>"
                - if <player.has_flag[marriage_date]>:
                    - narrate "<&a>Married since:<&e> <player.flag[marriage_date].format>"
                - narrate "<&l><&a>-----------------------------------------"
            - else if <[arg1].equals[tp]>:
                - if <player.has_flag[marriage_partner].not>:
                    - narrate "<&c>You are not married!"
                    - stop
                - define target <player.flag[marriage_partner].if_null[null]>
                - narrate "<&a>You have teleported to your partner!"
                - teleport <player> <player[<[target]>].location>
                - narrate "<&a>Your partner has teleported to you!" targets:<player[<[target]>]>
            - else if <[arg1].equals[help]>:
                - narrate "<&l><&a>------------- Marriage Help -------------"
                - narrate "<&a>/marry me (player) <&r>- <&7>Propose marriage to a player."
                - narrate "<&a>/marry divorce <&r>- <&7>Get divorced."
                - narrate "<&a>/marry tp <&r>- <&7>Teleport to your partner."
                - narrate "<&a>/marry info <&r>- <&7>Information about your marriage."
                - narrate "<&a>/marry accept <&r>- <&7>Accept marriage proposal."
                - narrate "<&a>/marry deny <&r>- <&7>Reject marriage proposal."
                - narrate "<&a>/marry seen <&r>- <&7>Displays when your partner was online."
                - narrate "<&a>/marry list <&r>- <&7>Displays all married people."
                - narrate "<&a>/marry sethome <&r>- <&7>Create a shared home."
                - narrate "<&a>/marry delhome <&r>- <&7>Delete a shared home."
                - narrate "<&a>/marry home <&r>- <&7>Teleport home."
                - narrate "<&a>/marry gift <&r>- <&7>Give your partner the item in your hand."
                - narrate "<&l><&a>-----------------------------------------"
            - else if <[arg1].equals[seen]>:
                - if <player.has_flag[marriage_partner].not>:
                    - narrate "<&c>You are not married!"
                    - stop
                - define partner <player.flag[marriage_partner]>
                - if <[partner].is_online>:
                    - narrate "<&a>Your partner <&e><[partner]> <&a>is currently online."
                - else:
                    - define last_seen <server.match_offline_player[<[partner]>].last_played_time>
                    - narrate "<&a>Your partner  <&e><[partner]> <&a>was last online on: <&e><[last_seen].format>"
            - else if <[arg1].equals[list]>:
                - define married_players <server.players_flagged[marriage_partner]>
                - if <[married_players].is_empty>:
                    - narrate "<&c>No one is currently married."
                    - stop
                - narrate "<&a>Married players:"
                - foreach <[married_players]>:
                    - define partner <[value].flag[marriage_partner]>
                    - narrate "<&e><[value].name> <&7><&e><[partner]>"
            - else if <[arg1].equals[sethome]>:
                - if <player.has_flag[marriage_partner].not>:
                    - narrate "<&c>You are not married!"
                    - stop
                - flag <player> marriage_home:<player.location>
                - flag <player[<player.flag[marriage_partner]>]> marriage_home:<player.location>
                - narrate "<&a>You have set your shared home."
                - narrate "<&a><player.name> has set your shared home!" targets:<player[<player.flag[marriage_partner]>]>
            - else if <[arg1].equals[home]>:
                - if <player.has_flag[marriage_partner].not>:
                    - narrate "<&c>You are not married!"
                    - stop
                - if <player.has_flag[marriage_home].not>:
                    - narrate "<&c>You haven't set a shared home yet!"
                    - stop
                - teleport <player> <player.flag[marriage_home]>
                - narrate "<&a>Welcome home!"
            - else if <[arg1].equals[delhome]>:
                - if <player.has_flag[marriage_partner].not>:
                    - narrate "<&c>You are not married!"
                    - stop
                - if <player.has_flag[marriage_home].not>:
                    - narrate "<&c>You haven't set a shared home yet!"
                    - stop
                - flag <player> marriage_home:!
                - flag <player[<player.flag[marriage_partner]>]> marriage_home:!
                - narrate "<&a>You have deleted your shared home!"
                - narrate "<&a><player.name>  has deleted the shared home!" targets:<player[<player.flag[marriage_partner]>]>
            - else if <[arg1].equals[gift]>:
                - if <player.has_flag[marriage_partner].not>:
                    - narrate "<&c>You are not married!"
                    - stop
                - define name <player.flag[marriage_partner]>
                - define partner <player[<[name]>]>
                - if <[partner].is_online.not>:
                    - narrate "<&c>Your partner is not online!"
                    - stop
                - define item <player.item_in_hand>
                - if <[item].material> == air:
                    - narrate "<&c>You have to hold an item in your hand to give it away!"
                    - stop
                - take iteminhand
                - give <[item]> player:<[partner]> quantity:1
                - narrate "<&a>You have given  <&6><[name]> <&a>a gift!"
                - narrate "<&a><player.name> has given you a gift!" targets:<[partner]>