Automatic Door Closer

Share scripts you wrote for Denizen-Bukkit here!
Post Reply
Berufeng
New
New
Posts: 7
Joined: January 29th, 2020, 4:40 pm

Automatic Door Closer

Post by Berufeng » May 20th, 2020, 11:58 pm

Were you born in a barn? If so, please do not download this script.

This is a simple little script that automatically closes doors when you walk away and, like a heathen, forget to close them.

Haste Link: https://one.denizenscript.com/haste/69373

(Or click the spoiler for the script.)
Spoiler!

Code: Select all

Door_Closer:
  type: world
  debug: false
  events:
    after player right clicks *door|*_gate priority:2:
      - if !<context.location.material.switched>:
        - stop
      - wait 2s
      - waituntil <context.location.find.entities[player].within[3].size.is[==].to[0]>
      - if <context.location.material.switched>:
        - switch <context.location> state:off
        - choose <context.location.material.name.after_last[_]>:
          - case door:
            - playsound <context.location> BLOCK_WOODEN_DOOR_CLOSE
          - case trapdoor:
            - playsound <context.location> BLOCK_WOODEN_TRAPDOOR_CLOSE
          - case gate:
            - playsound <context.location> BLOCK_FENCE_GATE_CLOSE
Last edited by Berufeng on May 21st, 2020, 11:43 am, edited 4 times in total.

User avatar
mcmonkey
Site Admin
Site Admin
Posts: 267
Joined: August 5th, 2016, 7:27 pm
Location: Los Angeles, California, USA
Contact:

Re: Automatic Door Closer

Post by mcmonkey » May 21st, 2020, 2:23 am

Should add a /haste link
Denizen lead developer. On Discord as mcmonkey#6666.

Berufeng
New
New
Posts: 7
Joined: January 29th, 2020, 4:40 pm

Re: Automatic Door Closer

Post by Berufeng » May 21st, 2020, 3:37 am

Done. Also added a fix for a compatibility issue with my Decorator Tool script.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests