Doorbell
By
BloodEkoCreated: 2017/07/24 11:36:16 UTC-07:00 (7 years and 153 days ago)
Edited: 2017/08/01 11:36:14 UTC-07:00 (7 years and 145 days ago)
Likes: 1
Denizen Version: build 189 (1.10)
Script Version: 1.2
Description:
Sounds are optimized for 1.10.
Now with bungeecord support!
This project is also on GitHub https://github.com/BloodEko/Doorbell
Download script |
View raw script#----------------------------------------------+
#Created 24.07.17 - 31.07.17 |
#doorbell by BloodEko |
# |
#Easy way to add a doorbell |
# |
#Permission: doorbell.use |
# Access to the /doorbell command |
# |
#----------------------------------------------+
# Usage: /doorbell |
# /doorbell help |
#----------------------------------------------+
#Use /doorbell set while looking at a button |
#to assign your doorbell. |
#Breaking or /doorbell disable, delete it again|
#When players click the doorbell, owner gets |
#notified. |
#----------------------------------------------+
shelp_reposcripts:
type: version
author: BloodEko
name: doorbell
usage: /doorbell syntax
version: 1.2
id: 132
link: http://old.mcmonkey.org/denizen/repo/entry/132
#--------------------------------------------+
doorbell_bungee:
type: yaml data
# true or false
# requires a proper bungeecord setup
# how to setup: https://github.com/DenizenScript/Depenizen
#
bungee: false
doorbell_cmdhandler:
type: command
name: doorbell
usage: /doorbell help|set|disable|off|on|info
description: Sets and disables doorbells.
permission: doorbell.use
permission message: You don't have permission to use this command.
script:
#
# /doorbell
#
- choose <context.args.get[1]>:
- case help:
- narrate "/doorbell help<&nl><&7>- Displays this help page."
- narrate "/doorbell set<&nl><&7>- Converts a placed button to a doorbell."
- narrate "/doorbell disable<&nl><&7>- Removes your doorbell."
- narrate "/doorbell info<&nl><&7>- Displays information about a placed doorbell or your own doorbell."
- narrate "/doorbell off<&nl><&7>- Disables your doorbell for 12h."
- narrate "/doorbell on<&nl><&7>- Activates your doorbell again."
- case set:
- if <li@stone_button|wood_button.contains[<pl.location.cursor_on.material>]> && <server.has_flag[doorbell.<player.location.cursor_on>]> {
- narrate "<&4>This button is already a doorbell!"
} else if !<server.has_flag[doorbell.<player>]> {
- narrate "<&2>Created a new doorbell!"
- flag server doorbell.<player.location.cursor_on>:<player>
- flag server doorbell.<player>:<player.location.cursor_on>
}
else {
- narrate "<&4>You already have a doorbell!"
}
- case info:
- if <server.has_flag[doorbell.<player.location.cursor_on>]> {
- narrate "<&2>This doorbell is owned by <&6><server.flag[doorbell.<player.location.cursor_on>].as_player.name>"
}
else if <server.has_flag[doorbell.<player>]> {
- narrate "<&2>Your doorbell is located at <&6><server.flag[doorbell.<player>].as_location.simple>"
}
else {
- narrate "<&2>You have no doorbell."
}
- case disable:
- if <server.has_flag[doorbell.<player>]> {
- narrate "<&2>Disabled your doorbell."
- define location "<server.flag[doorbell.<player>]>"
- flag server doorbell.<player>:!
- flag server doorbell.<def[location]>:!
}
else {
- narrate "<&2>You have no doorbell."
}
- case off:
- narrate "<&2>Disabled your doorbell. (12h)"
- define location "<server.flag[doorbell.<player>]>"
- flag server doorbell.disabled.<def[location]> duration:d@12h
- case on:
- define location "<server.flag[doorbell.<player>]>"
- if <server.has_flag[doorbell.disabled.<def[location]>]> {
- narrate "<&2>Activated your dorbell again."
- flag server doorbell.disabled.<def[location]>:!
} else {
- narrate "<&9>Your doorbell is already on."
}
- default:
- narrate "<&4>/doorbell help|set|disable|off|on|info"
doorbell_handler:
type: world
events:
on player breaks wood_button:
- inject locally doorbell_break
on player breaks stone_button:
- inject locally doorbell_break
on player right clicks wood_button:
- inject locally doorbell_event_<s@doorbell_bungee.yaml_key[bungee]||off>
on player right clicks stone_button:
- inject locally doorbell_event_<s@doorbell_bungee.yaml_key[bungee]||off>
doorbell_event_false:
- if !<server.has_flag[doorbell.<context.location>]> queue clear
- if <server.has_flag[doorbell.cooldown.<context.location>]> queue clear
- if <server.has_flag[doorbell.disabled.<context.location>]> {
- narrate "Seems like this doorbell isn't activated at the moment."
- queue clear
}
- flag server doorbell.cooldown.<context.location> duration:d@4s
- if <server.flag[doorbell.<context.location>].as_player.is_online> {
- narrate "Ring ring ..." targets:<player.location.find.entities[player].within[10]>
- playsound <player.location> sound:BLOCK_NOTE_PLING
- playsound <server.flag[doorbell.<context.location>]> sound:BLOCK_NOTE_PLING
- narrate "<&6><&l>Somebody has used your doorbell!" targets:<server.flag[doorbell.<context.location>]>
}
else {
- narrate "Seems like nobody is there."
}
doorbell_event_true:
- if !<server.has_flag[doorbell.<context.location>]> queue clear
- if <server.has_flag[doorbell.cooldown.<context.location>]> queue clear
- if <server.has_flag[doorbell.disabled.<context.location>]> {
- narrate "Seems like this doorbell isn't activated at the moment."
- queue clear
}
- flag server doorbell.cooldown.<context.location> duration:d@4s
- narrate "Ring ring ..." targets:<player.location.find.entities[player].within[10]>
- playsound <context.location> sound:BLOCK_NOTE_PLING
- define player <server.flag[doorbell.<context.location>]>
- define back_to_player <player>
- define back_to <bungee.server>
- bungee <bungee.list_servers> {
- if <def[player].as_player.is_online> {
- playsound <def[player]> sound:BLOCK_NOTE_PLING
- narrate "<&6><&l>Somebody has used your doorbell!" targets:<def[player]>
- bungee <def[back_to]> {
- narrate "He must have heared it for sure!" targets:<def[back_to_player]>
}
}
}
doorbell_break:
- if !<server.has_flag[doorbell.<context.location>]> queue clear
- define user <server.flag[doorbell.<context.location>]>
- narrate "<&2>Disabled the doorbell from <&6><def[user].as_player.name>"
- flag server doorbell.<def[user]>:!
- flag server doorbell.<context.location>:!
View History