diff --git a/build.gradle b/build.gradle index 99a8ef8..66b89a4 100644 --- a/build.gradle +++ b/build.gradle @@ -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() diff --git a/src/main/java/dev/mikchan/mcnp/chat/ChatPlugin.kt b/src/main/java/dev/mikchan/mcnp/chat/ChatPlugin.kt index 56141b9..0c33506 100644 --- a/src/main/java/dev/mikchan/mcnp/chat/ChatPlugin.kt +++ b/src/main/java/dev/mikchan/mcnp/chat/ChatPlugin.kt @@ -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. @@ -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() diff --git a/src/main/java/dev/mikchan/mcnp/chat/events/listener/ChatListener.kt b/src/main/java/dev/mikchan/mcnp/chat/events/listener/ChatListener.kt index 2a9a637..2ce81bf 100644 --- a/src/main/java/dev/mikchan/mcnp/chat/events/listener/ChatListener.kt +++ b/src/main/java/dev/mikchan/mcnp/chat/events/listener/ChatListener.kt @@ -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()