#########################################
# STAFF MANAGEMENT COMMANDS AND HANDLER #
#########################################
Staff_Management:
type: world
debug: false
events:
on demote command:
- if <player.is_op>.not {
- queue clear
}
- determine passively fulfilled
- run Staff_Management_Task instantly def:demote|currently|<context.args>
on promote command:
- if <player.is_op>.not {
- queue clear
}
- determine passively fulfilled
- run Staff_Management_Task instantly def:promote|not|<context.args>
Staff_Management_Task:
type: task
debug: false
failure:
- narrate "<&c>You must specify a player who is <def[2]> part of the staff team."
- narrate "<&f> e.g. /<def[1]> Gleavie09"
script:
- if <player.is_op> || <player.has_flag[owner]> {
- determine passively fulfilled
- if <def[3].size> == 0 {
- inject locally failure instantly
} else if <def[3].size> > 1 {
- narrate "<&c>Too many arguments!"
- narrate "<&f> e.g. /<def[1]> Gleavie09"
} else {
- define message <def[3].get[1]>
- if <def[1]> == demote {
- if <def[message].as_player.has_flag[staff]||false> {
- flag <def[message].as_player> staff:!
- narrate target:<def[message].as_player> "<&4>You have been removed from the staff team. Returning to survival mode and setting chat to <&2>Local<&4>."
- flag <def[message].as_player> chat_channel:local
- execute as_server "gamemode survival <def[message]>"
- narrate "<&a>Successfully demoted <def[message]>"
} else {
- inject locally failure instantly
}
} else if <def[1]> == promote {
- if <def[message].as_player.has_flag[staff].not||false> {
- flag <def[message].as_player> staff
- narrate target:<def[message].as_player> "<&a>You have been added to the <&4>Staff <&a>team! You may now access the <&4>Staff <&a>chat channel using the /staff command."
- narrate "<&a>Successfully promoted <def[message]>"
} else {
- inject locally failure instantly
}
}
}
}
#############################################################
# CHAT CHANNELS - NOTE: FOR TRADE CHANNEL TO WORK, YOU MUST #
# FIRST CREATE NOTABLE REGIONS WITH THE SUFFIX _TOWN #
#############################################################
LocalChat_Format:
type: format
debug: false
format: <&2><&lb><player.name><&rb><&co> <&f><text>
GlobalChat_Format:
type: format
debug: false
format: <&7><&lb>Global<&rb> <&8><player.name><&7><&co> <&a><text>
TradeChat_Format:
type: format
debug: false
format: <&5><&lb>Trade - <player.location.cuboids.filter[contains[_town]].get[1].before[_town].after[cu@].replace[_].with[<&sp>].to_titlecase><&rb> <&d><player.name><&5><&co> <&b><text>
StaffChat_Format:
type: format
debug: false
format: <&4><&lb>Staff<&rb> <&8><player.name><&7><&co> <&f><text>
Chat_Channels:
type: world
debug: false
Local_Radius:
- 20
Global_Chat_Limit:
- 10
Global_Chat_Period:
- 1h
help:
- narrate "<&3>====== <&b>Chat Help <&3>======"
- narrate ""
- narrate " - <&l>/local <&r>For speaking to everyone in a <script.yaml_key[Local_Radius].after[li@]> block radius."
- narrate " - <&l>/global <&r><&a>Chat to everyone, limited to <script.yaml_key[Global_Chat_Limit].after[li@]> per <script.yaml_key[Global_Chat_Period].after[li@]>."
- narrate " - <&l>/trade <&r><&b>Arrange trades with others in the same city."
- narrate ""
- determine passively fulfilled
events:
on player chats:
- determine passively cancelled
- choose <player.flag[chat_channel]>:
- case global:
- if <pl.has_flag[staff].not> {
- inject GlobalChat_Monitor instantly
}
- announce format:GlobalChat_Format <c.message>
- case local:
- narrate format:LocalChat_Format <c.message> targets:<pl.location.find.players.within[<script.yaml_key[Local_Radius]>]>
- case trade:
- if <pl.location.cuboids.filter[contains[_town]].size.is[LESS].than[1]> {
- narrate "<&4>You cannot use Trade Chat unless you are in a town."
} else {
- narrate format:TradeChat_Format <c.message> targets:<pl.location.cuboids.filter[contains[_town]].get[1].list_players>
}
- case staff:
- if <pl.has_flag[staff].not> {
- flag <player> chat_channel:local
- narrate "<&c>You do not have access to this channel. Returning to <&2>Local Chat"
} else {
- narrate format:StaffChat_Format <c.message> targets:<server.list_players.filter[has_flag[staff]]>
}
on chat command:
- inject locally help
on global command:
- determine passively fulfilled
- define message <c.raw_args>
- if <c.raw_args.length.is[MORE].than[0]> {
- inject GlobalChat_Monitor instantly
- announce format:GlobalChat_Format <def[message]>
- queue clear
}
- if <player.flag[chat_channel].is[==].to[global]> {
- narrate "<&4>Your default channel is already Global Chat."
} else {
- narrate "<&3>Set your chat channel to <&8><&lb><&7>Global<&8><&rb>"
- flag player chat_channel:global
}
on trade command:
- determine passively fulfilled
- define message <c.raw_args>
- if <c.raw_args.length.is[MORE].than[0]> {
- if <pl.location.cuboids.filter[contains[_town]].size.is[LESS].than[1]> {
- narrate "<&4>You cannot use Trade Chat unless you are in a town."
} else {
- narrate format:TradeChat_Format <def[message]> targets:<pl.location.cuboids.filter[contains[_town]].get[1].list_players>
}
- queue clear
}
- if <player.flag[chat_channel].is[==].to[trade]> {
- narrate "<&4>Your default channel is already Trade Chat."
} else {
- narrate "<&3>Set your chat channel to <&8><&lb><&5>Trade<&8><&rb>"
- flag player chat_channel:trade
}
on local command:
- determine passively fulfilled
- define message <c.raw_args>
- if <c.raw_args.length.is[MORE].than[0]> {
- narrate format:LocalChat_Format <def[message]> targets:<pl.location.find.players.within[<script.yaml_key[Local_Radius]>]>
- queue clear
}
- if <player.flag[chat_channel].is[==].to[local]> {
- narrate "<&4>Your default channel is already Local."
} else {
- narrate "<&3>Set your chat channel to <&2><&lb>Local<&rb>"
- flag player chat_channel:local
}
on player joins:
- if <player.has_flag[chat_channel].not> {
- flag player chat_channel:local
}
on staff command:
- define message <c.raw_args>
- if <player.has_flag[staff].not> {
- queue clear
} else {
- determine passively fulfilled
}
- if <c.raw_args.length.is[MORE].than[0]> {
- narrate format:StaffChat_Format <def[message]> targets:<server.list_players.filter[has_flag[staff]]>
- queue clear
}
- if <player.flag[chat_channel].is[==].to[staff]> {
- narrate "<&4>Your default channel is already Staff"
} else {
- narrate "<&3>Set your chat channel to <&4><&lb>Staff<&rb>"
- flag <player> chat_channel:staff
}
GlobalChat_Monitor:
type: task
script:
- if <pl.flag[global_chat_count].is[MORE].than[9]> {
- narrate "<&4>You have reached your limit for Global Chat. Please try again later."
- queue clear
}
- flag player global_chat_count:++
- if <pl.flag[global_chat_count].is[==].to[7]> {
- narrate "<&8>Warning<&co> You may use global chat 2 more times this hour."
}
- if <pl.flag[global_chat_count].is[==].to[8]> {
- narrate "<&8>Warning<&co> You may use global chat 1 more times this hour."
}
- run GlobalChat_Decay delay:<s@Chat_Channels.yaml_key[Global_Chat_Period]> def:<player>
GlobalChat_Decay:
type: task
script:
- if <def[1].as_player.flag[global_chat_count].is[MORE].than[0]> {
- flag <def[1].as_player> global_chat_count:--
}