Skip to content

Commit

Permalink
Paper fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wtlgo committed Feb 28, 2023
1 parent 28858ce commit b80a25d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static def determineVersion(String defaultVersion) {
}

group = 'dev.mikchan.mcnp'
version = determineVersion('1.1.2')
version = determineVersion('1.1.3')

repositories {
mavenCentral()
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/dev/mikchan/mcnp/chat/ChatPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import dev.mikchan.mcnp.chat.keys.IKeys
import dev.mikchan.mcnp.chat.users.IUserManager
import org.bstats.bukkit.Metrics
import org.bukkit.plugin.java.JavaPlugin
import java.util.*

/**
* The main plugin class.
Expand All @@ -25,6 +26,8 @@ class ChatPlugin : JavaPlugin() {
val eventManager: IEventManager = Creators.eventManager.create(this)
val keys: IKeys = Creators.keys.create(this)

val notSpigot = !server.version.contains("spigot", ignoreCase = true)

override fun onEnable() {
commandManager.enableAll()
eventManager.register()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ internal class ChatListener(private val plugin: ChatPlugin) : Listener {
return false
}

// TODO: Should find a better way, this sucks
if (plugin.notSpigot && !isPreview) {
plugin.server.scheduler.scheduleSyncDelayedTask(plugin) {
val fMsg = String.format(mcncEvent.formattedMessage, mcncEvent.sender.name, mcncEvent.message)
for (recipient in recipients) {
recipient.sendMessage(mcncEvent.sender.uniqueId, fMsg)
}
plugin.server.consoleSender.sendMessage(fMsg)
}

return false
}

event.message = msg
event.format = mcncEvent.formattedMessage
event.recipients.clear()
Expand Down

0 comments on commit b80a25d

Please sign in to comment.