Fix Core loading in test... somehow
I just tried stuff until it started working
This commit is contained in:
parent
5615bbcb22
commit
9eb2354b3f
4 changed files with 21 additions and 4 deletions
16
build.sbt
16
build.sbt
|
@ -11,7 +11,7 @@ resolvers += Resolver.mavenLocal
|
|||
// assembly / assemblyOption := (assembly / assemblyOption).value.copy(includeScala = false)
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
"io.papermc.paper" % "paper-api" % "1.19.1-R0.1-SNAPSHOT" % Provided,
|
||||
"io.papermc.paper" % "paper-api" % "1.19-R0.1-SNAPSHOT" % Provided,
|
||||
|
||||
"com.discord4j" % "discord4j-core" % "3.2.3",
|
||||
"com.vdurmont" % "emoji-java" % "5.1.1",
|
||||
|
@ -24,12 +24,12 @@ libraryDependencies ++= Seq(
|
|||
// https://mvnrepository.com/artifact/net.kyori/examination-api
|
||||
"net.kyori" % "examination-api" % "1.3.0" % "provided",
|
||||
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib
|
||||
"org.jetbrains.kotlin" % "kotlin-stdlib" % "1.8.20" % "provided",
|
||||
//"org.jetbrains.kotlin" % "kotlin-stdlib" % "1.8.20" % "provided",
|
||||
// https://mvnrepository.com/artifact/org.scalatest/scalatest
|
||||
"org.scalatest" %% "scalatest" % "3.2.16" % Test,
|
||||
// https://mvnrepository.com/artifact/com.github.seeseemelk/MockBukkit-v1.19
|
||||
"com.github.seeseemelk" % "MockBukkit-v1.19" % "2.29.0" % Test,
|
||||
"org.yaml" % "snakeyaml" % "1.32" % Compile
|
||||
"com.github.milkbowl" % "vault" % "master-SNAPSHOT" % Test
|
||||
)
|
||||
|
||||
assembly / assemblyJarName := "Chroma-Discord.jar"
|
||||
|
@ -55,3 +55,13 @@ saveConfigComments := {
|
|||
Compile / resourceGenerators += saveConfigComments
|
||||
//scalacOptions ++= Seq("-release", "17", "--verbose")
|
||||
scalacOptions ++= Seq("-release", "17")
|
||||
//Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat
|
||||
Test / fork := true // This changes the tests ran through sbt to work like IntelliJ tests, fixes mocking issues
|
||||
/*excludeDependencies ++= Seq(
|
||||
ExclusionRule("org.bukkit"),
|
||||
ExclusionRule("io.papermc.paper"),
|
||||
ExclusionRule("com.destroystokyo")
|
||||
)*/
|
||||
excludeDependencies ++= Seq(
|
||||
ExclusionRule("net.milkbowl.vault", "VaultAPI")
|
||||
)
|
|
@ -30,6 +30,8 @@ import discord4j.rest.interaction.Interactions
|
|||
import discord4j.store.jdk.JdkStoreService
|
||||
import org.bukkit.command.CommandSender
|
||||
import org.bukkit.configuration.file.YamlConfiguration
|
||||
import org.bukkit.plugin.PluginDescriptionFile
|
||||
import org.bukkit.plugin.java.JavaPluginLoader
|
||||
import org.mockito.internal.util.MockUtil
|
||||
import reactor.core.Disposable
|
||||
import reactor.core.publisher.Mono
|
||||
|
@ -54,7 +56,7 @@ import scala.jdk.OptionConverters._
|
|||
private[discordplugin] val DELIVERED_REACTION = ReactionEmoji.unicode("✅")
|
||||
}
|
||||
|
||||
@ButtonPlugin.ConfigOpts(disableConfigGen = true) class DiscordPlugin extends ButtonPlugin {
|
||||
@ButtonPlugin.ConfigOpts(disableConfigGen = true) class DiscordPlugin(loader: JavaPluginLoader, description: PluginDescriptionFile, folder: File, file: File) extends ButtonPlugin(loader, description, folder, file) {
|
||||
private var _manager: Command2DC = null
|
||||
|
||||
def manager: Command2DC = _manager
|
||||
|
|
|
@ -16,6 +16,7 @@ class Command2DC extends Command2[ICommand2DC, Command2DCSender]('/', false) {
|
|||
|
||||
def registerCommand(command: ICommand2DC, appId: Long, guildId: Option[Long] = None): Unit = {
|
||||
val mainNode = super.registerCommandSuper(command) //Needs to be configurable for the helps
|
||||
println("Main node name is " + mainNode.getName)
|
||||
// TODO: Go through all subcommands and register them
|
||||
val greetCmdRequest = ApplicationCommandRequest.builder()
|
||||
.name(mainNode.getName)
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
import be.seeseemelk.mockbukkit.MockBukkit.{load, mock}
|
||||
import buttondevteam.core.MainPlugin
|
||||
import buttondevteam.discordplugin.DiscordPlugin
|
||||
import org.bukkit.configuration.file.YamlConfiguration
|
||||
import org.scalatest.flatspec.AnyFlatSpec
|
||||
|
||||
class DiscordTest extends AnyFlatSpec {
|
||||
"DiscordPlugin" should "boot" in {
|
||||
println("Mocking Bukkit")
|
||||
mock()
|
||||
//new YamlConfiguration().set("asd", "dsa")
|
||||
println("Loading Core")
|
||||
load(classOf[MainPlugin], true)
|
||||
load(classOf[DiscordPlugin])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue