mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-20 02:54:46 +00:00
adding way to allow bang-commands that only a gm would have access to for everyone
This commit is contained in:
parent
197c37315e
commit
941228974c
|
|
@ -542,9 +542,12 @@ network {
|
|||
}
|
||||
|
||||
development {
|
||||
# List of GM commands available to everyone
|
||||
# List of GM commands made available to everyone
|
||||
# Values are `ChatMessageType` members, for example: [CMT_ADDBATTLEEXPERIENCE, CMT_CAPTUREBASE]
|
||||
unprivileged-gm-commands = []
|
||||
# List of GM bang commands made available to everyone
|
||||
# Since the commands come in as plain chat preceded by a bang (!) character, values are the names of the commands
|
||||
unprivileged-gm-bang-commands = []
|
||||
|
||||
net-sim {
|
||||
# Enable artificial packet unreliability. Used for development testing.
|
||||
|
|
|
|||
|
|
@ -723,7 +723,7 @@ class ChatActor(
|
|||
(message.messageType, message.recipient.trim, message.contents.trim) match {
|
||||
/** Messages starting with ! are custom chat commands */
|
||||
case (_, _, contents) if contents.startsWith("!") &&
|
||||
customCommandMessages(message, session, chatService, cluster, gmCommandAllowed) => ()
|
||||
customCommandMessages(message, session, chatService, cluster) => ()
|
||||
|
||||
case (CMT_FLY, recipient, contents) if gmCommandAllowed =>
|
||||
val (token, flying) = contents match {
|
||||
|
|
@ -1492,8 +1492,7 @@ class ChatActor(
|
|||
message: ChatMsg,
|
||||
session: Session,
|
||||
chatService: ActorRef[ChatService.Command],
|
||||
cluster: ActorRef[InterstellarClusterService.Command],
|
||||
gmCommandAllowed: Boolean
|
||||
cluster: ActorRef[InterstellarClusterService.Command]
|
||||
): Boolean = {
|
||||
val contents = message.contents
|
||||
if (contents.startsWith("!")) {
|
||||
|
|
@ -1501,8 +1500,9 @@ class ChatActor(
|
|||
case a :: b => (a, b)
|
||||
case _ => ("", Seq(""))
|
||||
}
|
||||
val gmBangCommandAllowed = session.account.gm || Config.app.development.unprivilegedGmBangCommands.contains(command)
|
||||
//try gm commands
|
||||
val tryGmCommandResult = if (gmCommandAllowed) {
|
||||
val tryGmCommandResult = if (gmBangCommandAllowed) {
|
||||
command match {
|
||||
case "whitetext" => Some(customCommandWhitetext(session, params, chatService))
|
||||
case "list" => Some(customCommandList(session, params, message, sessionActor))
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ case class HartConfig(
|
|||
|
||||
case class DevelopmentConfig(
|
||||
unprivilegedGmCommands: Seq[ChatMessageType],
|
||||
unprivilegedGmBangCommands: Seq[String],
|
||||
netSim: NetSimConfig
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue