KtSkript - Endless customizations for your server

Simple roleplay chat

Script on GitHub

val SHOUTING_PREFIX = "!"

registerListener<MessageChannelEvent.Chat> {

  val isShouting = rawMessage.toPlain().startsWith(SHOUTING_PREFIX)

  val range = if (isShouting) 100 else 50
  val playerLoc = causingPlayer.location
  val targetedPlayers = playerLoc.extent
    .getNearbyEntities(playerLoc.position, range.toDouble())
    .mapNotNull { it as? Player }
  setChannel(MessageChannel.fixed(targetedPlayers))

  formatter.setBody(rawMessage.toPlain().removePrefix(SHOUTING_PREFIX).toText())
  
  val prefix = if (isShouting) "&7[&aShout&7] ".t else "&7[&aLocal&7] ".t
  formatter.setHeader(prefix + formatter.header.toText())
}

This is a roleplay chat system which limits the range players can “understand” each other. This was suggested by @Louie_Beltran here.

By default players can chat with each other as in vanilla Minecraft within 50 blocks. To extend that range to 100 a ! has to be appending before the message.
Modify the script as you like, change the shouting prefix, the range or anything else. Let me know if you have any questions.