mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
Merge pull request #1244 from psforever/fix-some-commands
Fix up some chat commands
This commit is contained in:
commit
2cdb1aaf16
|
|
@ -236,7 +236,7 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
message.note
|
||||
)
|
||||
)
|
||||
false
|
||||
true
|
||||
}
|
||||
} else {
|
||||
false
|
||||
|
|
|
|||
|
|
@ -143,7 +143,18 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
case "list" => ops.customCommandList(session, params, message)
|
||||
case "nearby" => ops.customCommandNearby(session)
|
||||
case "loc" => ops.customCommandLoc(session, message)
|
||||
case _ => false
|
||||
case _ =>
|
||||
// command was not handled
|
||||
sendResponse(
|
||||
ChatMsg(
|
||||
ChatMessageType.CMT_GMOPEN, // CMT_GMTELL
|
||||
message.wideContents,
|
||||
"Server",
|
||||
s"Unknown command !$command",
|
||||
message.note
|
||||
)
|
||||
)
|
||||
true
|
||||
}
|
||||
} else {
|
||||
false
|
||||
|
|
|
|||
|
|
@ -626,8 +626,9 @@ class ChatOperations(
|
|||
}
|
||||
|
||||
def commandAddCertification(session: Session, message: ChatMsg, contents: String): Unit = {
|
||||
val certs = cliTokenization(contents).map(name => Certification.values.find(_.name == name))
|
||||
val result = if (certs.nonEmpty) {
|
||||
val tokens = cliTokenization(contents)
|
||||
val certs = tokens.map(name => Certification.values.find(_.name == name))
|
||||
val result = if (tokens.nonEmpty) {
|
||||
if (certs.contains(None)) {
|
||||
s"@AckErrorCertifications"
|
||||
} else {
|
||||
|
|
@ -646,7 +647,7 @@ class ChatOperations(
|
|||
}
|
||||
|
||||
def commandKick(session: Session, message: ChatMsg, contents: String): Unit = {
|
||||
val inputs = cliTokenization(contents)
|
||||
val inputs = cliTokenizationCaseSensitive(contents)
|
||||
inputs.headOption match {
|
||||
case Some(input) =>
|
||||
val determination: Player => Boolean = input.toLongOption match {
|
||||
|
|
@ -1299,7 +1300,11 @@ class ChatOperations(
|
|||
}
|
||||
|
||||
def cliTokenization(str: String): List[String] = {
|
||||
str.replaceAll("\\s+", " ").toLowerCase.trim.split("\\s").toList
|
||||
str.replaceAll("\\s+", " ").toLowerCase.trim.split("\\s").toList.filter(!_.equals(""))
|
||||
}
|
||||
|
||||
def cliTokenizationCaseSensitive(str: String): List[String] = {
|
||||
str.replaceAll("\\s+", " ").trim.split("\\s").toList.filter(!_.equals(""))
|
||||
}
|
||||
|
||||
def commandIncomingSend(message: ChatMsg): Unit = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue