mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-04-29 16:25:30 +00:00
Merge pull request #1244 from psforever/fix-some-commands
Fix up some chat commands
This commit is contained in:
commit
2cdb1aaf16
3 changed files with 22 additions and 6 deletions
|
|
@ -236,7 +236,7 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
||||||
message.note
|
message.note
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
false
|
true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,18 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
||||||
case "list" => ops.customCommandList(session, params, message)
|
case "list" => ops.customCommandList(session, params, message)
|
||||||
case "nearby" => ops.customCommandNearby(session)
|
case "nearby" => ops.customCommandNearby(session)
|
||||||
case "loc" => ops.customCommandLoc(session, message)
|
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 {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
|
||||||
|
|
@ -626,8 +626,9 @@ class ChatOperations(
|
||||||
}
|
}
|
||||||
|
|
||||||
def commandAddCertification(session: Session, message: ChatMsg, contents: String): Unit = {
|
def commandAddCertification(session: Session, message: ChatMsg, contents: String): Unit = {
|
||||||
val certs = cliTokenization(contents).map(name => Certification.values.find(_.name == name))
|
val tokens = cliTokenization(contents)
|
||||||
val result = if (certs.nonEmpty) {
|
val certs = tokens.map(name => Certification.values.find(_.name == name))
|
||||||
|
val result = if (tokens.nonEmpty) {
|
||||||
if (certs.contains(None)) {
|
if (certs.contains(None)) {
|
||||||
s"@AckErrorCertifications"
|
s"@AckErrorCertifications"
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -646,7 +647,7 @@ class ChatOperations(
|
||||||
}
|
}
|
||||||
|
|
||||||
def commandKick(session: Session, message: ChatMsg, contents: String): Unit = {
|
def commandKick(session: Session, message: ChatMsg, contents: String): Unit = {
|
||||||
val inputs = cliTokenization(contents)
|
val inputs = cliTokenizationCaseSensitive(contents)
|
||||||
inputs.headOption match {
|
inputs.headOption match {
|
||||||
case Some(input) =>
|
case Some(input) =>
|
||||||
val determination: Player => Boolean = input.toLongOption match {
|
val determination: Player => Boolean = input.toLongOption match {
|
||||||
|
|
@ -1299,7 +1300,11 @@ class ChatOperations(
|
||||||
}
|
}
|
||||||
|
|
||||||
def cliTokenization(str: String): List[String] = {
|
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 = {
|
def commandIncomingSend(message: ChatMsg): Unit = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue