FIx things and attempt to add test
The test can't find a YAML method
This commit is contained in:
parent
cde0d44b04
commit
5615bbcb22
6 changed files with 24 additions and 14 deletions
14
build.sbt
14
build.sbt
|
@ -2,7 +2,7 @@ name := "Chroma-Discord"
|
||||||
|
|
||||||
version := "1.1"
|
version := "1.1"
|
||||||
|
|
||||||
scalaVersion := "2.13.0"
|
scalaVersion := "2.13.11"
|
||||||
|
|
||||||
resolvers += "jitpack.io" at "https://jitpack.io"
|
resolvers += "jitpack.io" at "https://jitpack.io"
|
||||||
resolvers += "paper-repo" at "https://papermc.io/repo/repository/maven-public/"
|
resolvers += "paper-repo" at "https://papermc.io/repo/repository/maven-public/"
|
||||||
|
@ -11,11 +11,10 @@ resolvers += Resolver.mavenLocal
|
||||||
// assembly / assemblyOption := (assembly / assemblyOption).value.copy(includeScala = false)
|
// assembly / assemblyOption := (assembly / assemblyOption).value.copy(includeScala = false)
|
||||||
|
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"io.papermc.paper" % "paper-api" % "1.19.4-R0.1-SNAPSHOT" % Provided,
|
"io.papermc.paper" % "paper-api" % "1.19.1-R0.1-SNAPSHOT" % Provided,
|
||||||
|
|
||||||
"com.discord4j" % "discord4j-core" % "3.2.3",
|
"com.discord4j" % "discord4j-core" % "3.2.3",
|
||||||
"com.vdurmont" % "emoji-java" % "5.1.1",
|
"com.vdurmont" % "emoji-java" % "5.1.1",
|
||||||
"org.mockito" % "mockito-core" % "5.2.0",
|
|
||||||
"io.projectreactor" % "reactor-scala-extensions_2.13" % "0.8.0",
|
"io.projectreactor" % "reactor-scala-extensions_2.13" % "0.8.0",
|
||||||
|
|
||||||
"com.github.TBMCPlugins.ChromaCore" % "Chroma-Core" % "v2.0.0-SNAPSHOT" % Provided,
|
"com.github.TBMCPlugins.ChromaCore" % "Chroma-Core" % "v2.0.0-SNAPSHOT" % Provided,
|
||||||
|
@ -25,12 +24,17 @@ libraryDependencies ++= Seq(
|
||||||
// https://mvnrepository.com/artifact/net.kyori/examination-api
|
// https://mvnrepository.com/artifact/net.kyori/examination-api
|
||||||
"net.kyori" % "examination-api" % "1.3.0" % "provided",
|
"net.kyori" % "examination-api" % "1.3.0" % "provided",
|
||||||
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib
|
// 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
|
||||||
)
|
)
|
||||||
|
|
||||||
assembly / assemblyJarName := "Chroma-Discord.jar"
|
assembly / assemblyJarName := "Chroma-Discord.jar"
|
||||||
assembly / assemblyShadeRules := Seq(
|
assembly / assemblyShadeRules := Seq(
|
||||||
"io.netty", "com.fasterxml", "org.mockito", "org.slf4j"
|
"io.netty", "com.fasterxml", "org.slf4j"
|
||||||
).map { p =>
|
).map { p =>
|
||||||
ShadeRule.rename(s"$p.**" -> "btndvtm.dp.@0").inAll
|
ShadeRule.rename(s"$p.**" -> "btndvtm.dp.@0").inAll
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
sbt.version=1.8.2
|
sbt.version=1.8.2
|
||||||
scala.version=2.13.0
|
scala.version=2.13.11
|
|
@ -5,8 +5,8 @@ import buttondevteam.discordplugin.DPUtils.MonoExtensions
|
||||||
import buttondevteam.discordplugin.mcchat.sender.DiscordConnectedPlayer
|
import buttondevteam.discordplugin.mcchat.sender.DiscordConnectedPlayer
|
||||||
import buttondevteam.discordplugin.util.DPState
|
import buttondevteam.discordplugin.util.DPState
|
||||||
import buttondevteam.discordplugin.{ChannelconBroadcast, DPUtils, DiscordPlugin}
|
import buttondevteam.discordplugin.{ChannelconBroadcast, DPUtils, DiscordPlugin}
|
||||||
|
import buttondevteam.lib.architecture.Component
|
||||||
import buttondevteam.lib.architecture.config.IConfigData
|
import buttondevteam.lib.architecture.config.IConfigData
|
||||||
import buttondevteam.lib.architecture.{Component, ConfigData}
|
|
||||||
import buttondevteam.lib.{TBMCCoreAPI, TBMCSystemChatEvent}
|
import buttondevteam.lib.{TBMCCoreAPI, TBMCSystemChatEvent}
|
||||||
import com.google.common.collect.Lists
|
import com.google.common.collect.Lists
|
||||||
import discord4j.common.util.Snowflake
|
import discord4j.common.util.Snowflake
|
||||||
|
@ -14,13 +14,10 @@ import discord4j.core.`object`.entity.channel.MessageChannel
|
||||||
import discord4j.core.spec.EmbedCreateSpec
|
import discord4j.core.spec.EmbedCreateSpec
|
||||||
import discord4j.rest.util.Color
|
import discord4j.rest.util.Color
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import reactor.core.publisher.Mono
|
|
||||||
import reactor.core.scala.publisher.SMono
|
import reactor.core.scala.publisher.SMono
|
||||||
|
|
||||||
import java.util
|
import java.util
|
||||||
import java.util.stream.Collectors
|
|
||||||
import java.util.{Objects, UUID}
|
import java.util.{Objects, UUID}
|
||||||
import scala.collection.mutable
|
|
||||||
import scala.jdk.CollectionConverters.IterableHasAsScala
|
import scala.jdk.CollectionConverters.IterableHasAsScala
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -191,9 +191,6 @@ abstract class DiscordConnectedPlayer(user: User, channel: MessageChannel, val u
|
||||||
override def getValue: Double = getDefaultValue
|
override def getValue: Double = getDefaultValue
|
||||||
|
|
||||||
override def getDefaultValue: Double = 20 //Works for max health, should be okay for the rest
|
override def getDefaultValue: Double = 20 //Works for max health, should be okay for the rest
|
||||||
|
|
||||||
override def addTransientModifier(modifier: AttributeModifier): Unit = {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override def getGameMode = GameMode.SPECTATOR
|
override def getGameMode = GameMode.SPECTATOR
|
||||||
|
|
|
@ -120,7 +120,7 @@ import scala.jdk.CollectionConverters.SeqHasAsJava
|
||||||
val rc = roleColor.get
|
val rc = roleColor.get
|
||||||
if (r.getColor equals rc)
|
if (r.getColor equals rc)
|
||||||
DiscordPlugin.dc.getSelf.^^().flatMap(u => u.asMember(DiscordPlugin.mainServer.getId).^^())
|
DiscordPlugin.dc.getSelf.^^().flatMap(u => u.asMember(DiscordPlugin.mainServer.getId).^^())
|
||||||
.flatMap(_.hasHigherRoles(Collections.singleton(r.getId)).^^()).cast[Boolean].defaultIfEmpty(false) //Below one of our roles
|
.flatMap(_.hasHigherRoles(Collections.singleton(r.getId)).^^().map(b => b: Boolean)).defaultIfEmpty(false) //Below one of our roles
|
||||||
else SMono.just(false)
|
else SMono.just(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
12
src/test/scala/DiscordTest.scala
Normal file
12
src/test/scala/DiscordTest.scala
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import be.seeseemelk.mockbukkit.MockBukkit.{load, mock}
|
||||||
|
import buttondevteam.core.MainPlugin
|
||||||
|
import org.scalatest.flatspec.AnyFlatSpec
|
||||||
|
|
||||||
|
class DiscordTest extends AnyFlatSpec {
|
||||||
|
"DiscordPlugin" should "boot" in {
|
||||||
|
println("Mocking Bukkit")
|
||||||
|
mock()
|
||||||
|
println("Loading Core")
|
||||||
|
load(classOf[MainPlugin], true)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue