Add one half of broadcasted message check and move mcchat classes
This commit is contained in:
parent
6183c034c6
commit
a4f1463314
32 changed files with 78 additions and 54 deletions
|
@ -8,12 +8,14 @@ name := "Chroma-Discord"
|
||||||
|
|
||||||
version := "1.1"
|
version := "1.1"
|
||||||
|
|
||||||
scalaVersion := "3.0.0"
|
scalaVersion := "3.1.0"
|
||||||
|
|
||||||
resolvers += "spigot-repo" at "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
|
resolvers += "spigot-repo" at "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
|
||||||
resolvers += "jitpack.io" at "https://jitpack.io"
|
resolvers += "jitpack.io" at "https://jitpack.io"
|
||||||
resolvers += Resolver.mavenLocal
|
resolvers += Resolver.mavenLocal
|
||||||
|
|
||||||
|
// assembly / assemblyOption := (assembly / assemblyOption).value.copy(includeScala = false)
|
||||||
|
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"org.spigotmc" % "spigot-api" % "1.12.2-R0.1-SNAPSHOT" % Provided,
|
"org.spigotmc" % "spigot-api" % "1.12.2-R0.1-SNAPSHOT" % Provided,
|
||||||
"org.spigotmc" % "spigot" % "1.12.2-R0.1-SNAPSHOT" % Provided,
|
"org.spigotmc" % "spigot" % "1.12.2-R0.1-SNAPSHOT" % Provided,
|
||||||
|
|
|
@ -10,3 +10,9 @@ commands:
|
||||||
description: 'Main command for Chroma-Discord'
|
description: 'Main command for Chroma-Discord'
|
||||||
website: 'https://github.com/TBMCPlugins/Chroma-Discord'
|
website: 'https://github.com/TBMCPlugins/Chroma-Discord'
|
||||||
api-version: '1.13'
|
api-version: '1.13'
|
||||||
|
#libraries:
|
||||||
|
# - 'org.slf4j:slf4j-jdk14:1.7.32'
|
||||||
|
# - 'com.vdurmont:emoji-java:5.1.1'
|
||||||
|
# - 'org.mockito:mockito-core:4.2.0'
|
||||||
|
# - 'io.projectreactor:reactor-scala-extensions_2.13:0.8.0'
|
||||||
|
# - 'org.scala-lang:scala3-library_3:3.1.0'
|
|
@ -8,6 +8,7 @@ import buttondevteam.discordplugin.exceptions.ExceptionListenerModule
|
||||||
import buttondevteam.discordplugin.fun.FunModule
|
import buttondevteam.discordplugin.fun.FunModule
|
||||||
import buttondevteam.discordplugin.listeners.{CommonListeners, MCListener}
|
import buttondevteam.discordplugin.listeners.{CommonListeners, MCListener}
|
||||||
import buttondevteam.discordplugin.mcchat.MinecraftChatModule
|
import buttondevteam.discordplugin.mcchat.MinecraftChatModule
|
||||||
|
import buttondevteam.discordplugin.mcchat.sender.{DiscordPlayer, DiscordSenderBase}
|
||||||
import buttondevteam.discordplugin.mccommands.DiscordMCCommand
|
import buttondevteam.discordplugin.mccommands.DiscordMCCommand
|
||||||
import buttondevteam.discordplugin.role.GameRoleModule
|
import buttondevteam.discordplugin.role.GameRoleModule
|
||||||
import buttondevteam.discordplugin.util.{DPState, Timings}
|
import buttondevteam.discordplugin.util.{DPState, Timings}
|
||||||
|
@ -32,6 +33,7 @@ import org.bukkit.configuration.file.YamlConfiguration
|
||||||
import org.mockito.internal.util.MockUtil
|
import org.mockito.internal.util.MockUtil
|
||||||
import reactor.core.Disposable
|
import reactor.core.Disposable
|
||||||
import reactor.core.scala.publisher.SMono
|
import reactor.core.scala.publisher.SMono
|
||||||
|
import reactor.core.scala.publisher.scalaOption2JavaOptional
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
|
@ -129,16 +131,11 @@ import java.util.Optional
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
starting = true
|
starting = true
|
||||||
//System.out.println("This line should show up for sure");
|
|
||||||
val cb = DiscordClientBuilder.create(token).build.gateway
|
val cb = DiscordClientBuilder.create(token).build.gateway
|
||||||
//System.out.println("Got gateway bootstrap");
|
|
||||||
cb.setInitialPresence((si: ShardInfo) => ClientPresence.doNotDisturb(ClientActivity.playing("booting")))
|
cb.setInitialPresence((si: ShardInfo) => ClientPresence.doNotDisturb(ClientActivity.playing("booting")))
|
||||||
//cb.setStore(new JdkStoreService) //The default doesn't work for some reason - it's waaay faster now
|
|
||||||
//System.out.println("Initial status and store service set");
|
|
||||||
cb.login.doOnError((t: Throwable) => {
|
cb.login.doOnError((t: Throwable) => {
|
||||||
def foo(t: Throwable): Unit = {
|
def foo(t: Throwable): Unit = {
|
||||||
stopStarting()
|
stopStarting()
|
||||||
//System.out.println("Got this error: " + t); t.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foo(t)
|
foo(t)
|
||||||
|
@ -192,10 +189,10 @@ import java.util.Optional
|
||||||
CommonListeners.register(DiscordPlugin.dc.getEventDispatcher)
|
CommonListeners.register(DiscordPlugin.dc.getEventDispatcher)
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new MCListener, this)
|
TBMCCoreAPI.RegisterEventsForExceptions(new MCListener, this)
|
||||||
TBMCCoreAPI.RegisterUserClass(classOf[DiscordPlayer], () => new DiscordPlayer)
|
TBMCCoreAPI.RegisterUserClass(classOf[DiscordPlayer], () => new DiscordPlayer)
|
||||||
ChromaGamerBase.addConverter((sender: CommandSender) => Optional.ofNullable(sender match {
|
ChromaGamerBase.addConverter((sender: CommandSender) => sender match {
|
||||||
case dsender: DiscordSenderBase => dsender.getChromaUser
|
case dsender: DiscordSenderBase => Some(dsender.getChromaUser)
|
||||||
case _ => null
|
case _ => None
|
||||||
}))
|
})
|
||||||
IHaveConfig.pregenConfig(this, null)
|
IHaveConfig.pregenConfig(this, null)
|
||||||
ChromaBot.enabled = true //Initialize ChromaBot
|
ChromaBot.enabled = true //Initialize ChromaBot
|
||||||
Component.registerComponent(this, new GeneralEventBroadcasterModule)
|
Component.registerComponent(this, new GeneralEventBroadcasterModule)
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
package buttondevteam.discordplugin
|
|
||||||
|
|
||||||
import buttondevteam.discordplugin.playerfaker.VCMDWrapper
|
|
||||||
import org.bukkit.entity.Player
|
|
||||||
|
|
||||||
trait IMCPlayer[T] extends Player {
|
|
||||||
def getVanillaCmdListener: VCMDWrapper
|
|
||||||
}
|
|
|
@ -1,6 +1,7 @@
|
||||||
package buttondevteam.discordplugin.announcer
|
package buttondevteam.discordplugin.announcer
|
||||||
|
|
||||||
import buttondevteam.discordplugin.{DPUtils, DiscordPlayer, DiscordPlugin}
|
import buttondevteam.discordplugin.mcchat.sender.DiscordPlayer
|
||||||
|
import buttondevteam.discordplugin.{DPUtils, DiscordPlugin}
|
||||||
import buttondevteam.lib.TBMCCoreAPI
|
import buttondevteam.lib.TBMCCoreAPI
|
||||||
import buttondevteam.lib.architecture.{Component, ComponentMetadata}
|
import buttondevteam.lib.architecture.{Component, ComponentMetadata}
|
||||||
import buttondevteam.lib.player.ChromaGamerBase
|
import buttondevteam.lib.player.ChromaGamerBase
|
||||||
|
@ -9,6 +10,7 @@ import discord4j.core.`object`.entity.channel.MessageChannel
|
||||||
import reactor.core.scala.publisher.SMono
|
import reactor.core.scala.publisher.SMono
|
||||||
|
|
||||||
import scala.annotation.tailrec
|
import scala.annotation.tailrec
|
||||||
|
import scala.collection.mutable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Posts new posts from Reddit to the specified channel(s). It will pin the regular posts (not the mod posts).
|
* Posts new posts from Reddit to the specified channel(s). It will pin the regular posts (not the mod posts).
|
||||||
|
@ -55,8 +57,8 @@ import scala.annotation.tailrec
|
||||||
if (isEnabled) try { //If not enabled, just wait
|
if (isEnabled) try { //If not enabled, just wait
|
||||||
val body = TBMCCoreAPI.DownloadString(subredditURL.get + "/new/.json?limit=10")
|
val body = TBMCCoreAPI.DownloadString(subredditURL.get + "/new/.json?limit=10")
|
||||||
val json = new JsonParser().parse(body).getAsJsonObject.get("data").getAsJsonObject.get("children").getAsJsonArray
|
val json = new JsonParser().parse(body).getAsJsonObject.get("data").getAsJsonObject.get("children").getAsJsonArray
|
||||||
val msgsb = new StringBuilder
|
val msgsb = new mutable.StringBuilder
|
||||||
val modmsgsb = new StringBuilder
|
val modmsgsb = new mutable.StringBuilder
|
||||||
var lastanntime = lastAnnouncementTime.get
|
var lastanntime = lastAnnouncementTime.get
|
||||||
for (i <- json.size - 1 to 0 by -1) {
|
for (i <- json.size - 1 to 0 by -1) {
|
||||||
val item = json.get(i).getAsJsonObject
|
val item = json.get(i).getAsJsonObject
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package buttondevteam.discordplugin.broadcaster
|
package buttondevteam.discordplugin.broadcaster
|
||||||
|
|
||||||
import buttondevteam.discordplugin.mcchat.MCChatUtils
|
import buttondevteam.discordplugin.mcchat.MCChatUtils
|
||||||
import buttondevteam.discordplugin.playerfaker.DelegatingMockMaker
|
import buttondevteam.discordplugin.mcchat.playerfaker.DelegatingMockMaker
|
||||||
import buttondevteam.lib.TBMCCoreAPI
|
import buttondevteam.lib.TBMCCoreAPI
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package buttondevteam.discordplugin.commands
|
package buttondevteam.discordplugin.commands
|
||||||
|
|
||||||
import buttondevteam.discordplugin.DiscordPlayer
|
import buttondevteam.discordplugin.mcchat.sender.DiscordPlayer
|
||||||
import buttondevteam.lib.chat.{Command2, CommandClass}
|
import buttondevteam.lib.chat.{Command2, CommandClass}
|
||||||
import buttondevteam.lib.player.{TBMCPlayer, TBMCPlayerBase}
|
import buttondevteam.lib.player.{TBMCPlayer, TBMCPlayerBase}
|
||||||
import com.google.common.collect.HashBiMap
|
import com.google.common.collect.HashBiMap
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package buttondevteam.discordplugin.commands
|
package buttondevteam.discordplugin.commands
|
||||||
|
|
||||||
import buttondevteam.discordplugin.{DiscordPlayer, DiscordPlugin}
|
import buttondevteam.discordplugin.DiscordPlugin
|
||||||
|
import buttondevteam.discordplugin.mcchat.sender.DiscordPlayer
|
||||||
import buttondevteam.lib.chat.{Command2, CommandClass}
|
import buttondevteam.lib.chat.{Command2, CommandClass}
|
||||||
import buttondevteam.lib.player.ChromaGamerBase
|
import buttondevteam.lib.player.ChromaGamerBase
|
||||||
import buttondevteam.lib.player.ChromaGamerBase.InfoTarget
|
import buttondevteam.lib.player.ChromaGamerBase.InfoTarget
|
||||||
|
|
|
@ -3,7 +3,8 @@ package buttondevteam.discordplugin.listeners
|
||||||
import buttondevteam.discordplugin.commands.ConnectCommand
|
import buttondevteam.discordplugin.commands.ConnectCommand
|
||||||
import buttondevteam.discordplugin.mcchat.MinecraftChatModule
|
import buttondevteam.discordplugin.mcchat.MinecraftChatModule
|
||||||
import buttondevteam.discordplugin.util.DPState
|
import buttondevteam.discordplugin.util.DPState
|
||||||
import buttondevteam.discordplugin.{DiscordPlayer, DiscordPlugin}
|
import buttondevteam.discordplugin.DiscordPlugin
|
||||||
|
import buttondevteam.discordplugin.mcchat.sender.DiscordPlayer
|
||||||
import buttondevteam.lib.ScheduledServerRestartEvent
|
import buttondevteam.lib.ScheduledServerRestartEvent
|
||||||
import buttondevteam.lib.player.TBMCPlayerGetInfoEvent
|
import buttondevteam.lib.player.TBMCPlayerGetInfoEvent
|
||||||
import discord4j.common.util.Snowflake
|
import discord4j.common.util.Snowflake
|
||||||
|
|
|
@ -4,6 +4,7 @@ import buttondevteam.core.component.channel.{Channel, ChatRoom}
|
||||||
import buttondevteam.discordplugin.*
|
import buttondevteam.discordplugin.*
|
||||||
import buttondevteam.discordplugin.ChannelconBroadcast.ChannelconBroadcast
|
import buttondevteam.discordplugin.ChannelconBroadcast.ChannelconBroadcast
|
||||||
import buttondevteam.discordplugin.commands.{Command2DCSender, ICommand2DC}
|
import buttondevteam.discordplugin.commands.{Command2DCSender, ICommand2DC}
|
||||||
|
import buttondevteam.discordplugin.mcchat.sender.{DiscordConnectedPlayer, DiscordPlayer}
|
||||||
import buttondevteam.lib.TBMCSystemChatEvent
|
import buttondevteam.lib.TBMCSystemChatEvent
|
||||||
import buttondevteam.lib.chat.{Command2, CommandClass}
|
import buttondevteam.lib.chat.{Command2, CommandClass}
|
||||||
import buttondevteam.lib.player.{ChromaGamerBase, TBMCPlayer}
|
import buttondevteam.lib.player.{ChromaGamerBase, TBMCPlayer}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package buttondevteam.discordplugin.mcchat
|
package buttondevteam.discordplugin.mcchat
|
||||||
|
|
||||||
import buttondevteam.discordplugin.commands.{Command2DCSender, ICommand2DC}
|
import buttondevteam.discordplugin.commands.{Command2DCSender, ICommand2DC}
|
||||||
import buttondevteam.discordplugin.{DPUtils, DiscordPlayer, DiscordPlugin}
|
import buttondevteam.discordplugin.mcchat.sender.DiscordPlayer
|
||||||
|
import buttondevteam.discordplugin.{DPUtils, DiscordPlugin}
|
||||||
import buttondevteam.lib.chat.{Command2, CommandClass}
|
import buttondevteam.lib.chat.{Command2, CommandClass}
|
||||||
import buttondevteam.lib.player.ChromaGamerBase
|
import buttondevteam.lib.player.ChromaGamerBase
|
||||||
import discord4j.core.`object`.entity.channel.PrivateChannel
|
import discord4j.core.`object`.entity.channel.PrivateChannel
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package buttondevteam.discordplugin.mcchat
|
package buttondevteam.discordplugin.mcchat
|
||||||
|
|
||||||
import buttondevteam.core.component.channel.{Channel, ChatRoom}
|
import buttondevteam.core.component.channel.{Channel, ChatRoom}
|
||||||
import buttondevteam.discordplugin.DiscordConnectedPlayer
|
import buttondevteam.discordplugin.mcchat.sender.DiscordConnectedPlayer
|
||||||
import buttondevteam.lib.TBMCSystemChatEvent
|
import buttondevteam.lib.TBMCSystemChatEvent
|
||||||
import discord4j.common.util.Snowflake
|
import discord4j.common.util.Snowflake
|
||||||
import discord4j.core.`object`.entity.User
|
import discord4j.core.`object`.entity.User
|
||||||
|
|
|
@ -3,7 +3,8 @@ package buttondevteam.discordplugin.mcchat
|
||||||
import buttondevteam.core.ComponentManager
|
import buttondevteam.core.ComponentManager
|
||||||
import buttondevteam.discordplugin.*
|
import buttondevteam.discordplugin.*
|
||||||
import buttondevteam.discordplugin.DPUtils.SpecExtensions
|
import buttondevteam.discordplugin.DPUtils.SpecExtensions
|
||||||
import buttondevteam.discordplugin.playerfaker.{VanillaCommandListener, VanillaCommandListener14, VanillaCommandListener15}
|
import buttondevteam.discordplugin.mcchat.playerfaker.{VanillaCommandListener, VanillaCommandListener14, VanillaCommandListener15}
|
||||||
|
import buttondevteam.discordplugin.mcchat.sender.{DiscordPlayer, DiscordSender, DiscordSenderBase}
|
||||||
import buttondevteam.lib.*
|
import buttondevteam.lib.*
|
||||||
import buttondevteam.lib.chat.{ChatMessage, TBMCChatAPI}
|
import buttondevteam.lib.chat.{ChatMessage, TBMCChatAPI}
|
||||||
import buttondevteam.lib.player.TBMCPlayer
|
import buttondevteam.lib.player.TBMCPlayer
|
||||||
|
|
|
@ -2,7 +2,8 @@ package buttondevteam.discordplugin.mcchat
|
||||||
|
|
||||||
import buttondevteam.core.ComponentManager
|
import buttondevteam.core.ComponentManager
|
||||||
import buttondevteam.discordplugin.mcchat.MCChatUtils.LastMsgData
|
import buttondevteam.discordplugin.mcchat.MCChatUtils.LastMsgData
|
||||||
import buttondevteam.discordplugin.{DiscordConnectedPlayer, DiscordPlayer, DiscordPlugin, DiscordSenderBase}
|
import buttondevteam.discordplugin.mcchat.sender.{DiscordConnectedPlayer, DiscordPlayer, DiscordSenderBase}
|
||||||
|
import buttondevteam.discordplugin.DiscordPlugin
|
||||||
import buttondevteam.lib.player.TBMCPlayer
|
import buttondevteam.lib.player.TBMCPlayer
|
||||||
import discord4j.core.`object`.entity.User
|
import discord4j.core.`object`.entity.User
|
||||||
import discord4j.core.`object`.entity.channel.{MessageChannel, PrivateChannel}
|
import discord4j.core.`object`.entity.channel.{MessageChannel, PrivateChannel}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import buttondevteam.discordplugin.ChannelconBroadcast.ChannelconBroadcast
|
||||||
import buttondevteam.discordplugin.DPUtils.SpecExtensions
|
import buttondevteam.discordplugin.DPUtils.SpecExtensions
|
||||||
import buttondevteam.discordplugin.broadcaster.GeneralEventBroadcasterModule
|
import buttondevteam.discordplugin.broadcaster.GeneralEventBroadcasterModule
|
||||||
import buttondevteam.discordplugin.mcchat.MCChatCustom.CustomLMD
|
import buttondevteam.discordplugin.mcchat.MCChatCustom.CustomLMD
|
||||||
|
import buttondevteam.discordplugin.mcchat.sender.{DiscordConnectedPlayer, DiscordPlayerSender, DiscordSender, DiscordSenderBase}
|
||||||
import buttondevteam.lib.{TBMCCoreAPI, TBMCSystemChatEvent}
|
import buttondevteam.lib.{TBMCCoreAPI, TBMCSystemChatEvent}
|
||||||
import com.google.common.collect.Sets
|
import com.google.common.collect.Sets
|
||||||
import discord4j.common.util.Snowflake
|
import discord4j.common.util.Snowflake
|
||||||
|
|
|
@ -2,6 +2,7 @@ package buttondevteam.discordplugin.mcchat
|
||||||
|
|
||||||
import buttondevteam.discordplugin.*
|
import buttondevteam.discordplugin.*
|
||||||
import buttondevteam.discordplugin.DPUtils.{FluxExtensions, MonoExtensions}
|
import buttondevteam.discordplugin.DPUtils.{FluxExtensions, MonoExtensions}
|
||||||
|
import buttondevteam.discordplugin.mcchat.sender.{DiscordConnectedPlayer, DiscordPlayer, DiscordPlayerSender}
|
||||||
import buttondevteam.lib.TBMCSystemChatEvent
|
import buttondevteam.lib.TBMCSystemChatEvent
|
||||||
import buttondevteam.lib.player.{TBMCPlayer, TBMCPlayerBase, TBMCYEEHAWEvent}
|
import buttondevteam.lib.player.{TBMCPlayer, TBMCPlayerBase, TBMCYEEHAWEvent}
|
||||||
import discord4j.common.util.Snowflake
|
import discord4j.common.util.Snowflake
|
||||||
|
@ -107,8 +108,10 @@ class MCListener(val module: MinecraftChatModule) extends Listener {
|
||||||
@EventHandler def onChatSystemMessage(event: TBMCSystemChatEvent): Unit =
|
@EventHandler def onChatSystemMessage(event: TBMCSystemChatEvent): Unit =
|
||||||
MCChatUtils.forAllowedMCChat(MCChatUtils.send(event.getMessage), event).subscribe()
|
MCChatUtils.forAllowedMCChat(MCChatUtils.send(event.getMessage), event).subscribe()
|
||||||
|
|
||||||
@EventHandler def onBroadcastMessage(event: BroadcastMessageEvent): Unit =
|
@EventHandler def onBroadcastMessage(event: BroadcastMessageEvent): Unit = {
|
||||||
|
module.broadcastedMessages += ((event.getMessage, System.nanoTime()))
|
||||||
MCChatUtils.forCustomAndAllMCChat(MCChatUtils.send(event.getMessage), ChannelconBroadcast.BROADCAST, hookmsg = false).subscribe()
|
MCChatUtils.forCustomAndAllMCChat(MCChatUtils.send(event.getMessage), ChannelconBroadcast.BROADCAST, hookmsg = false).subscribe()
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler def onYEEHAW(event: TBMCYEEHAWEvent): Unit = { //TODO: Inherit from the chat event base to have channel support
|
@EventHandler def onYEEHAW(event: TBMCYEEHAWEvent): Unit = { //TODO: Inherit from the chat event base to have channel support
|
||||||
val name = event.getSender match {
|
val name = event.getSender match {
|
||||||
|
|
|
@ -2,10 +2,11 @@ package buttondevteam.discordplugin.mcchat
|
||||||
|
|
||||||
import buttondevteam.core.component.channel.Channel
|
import buttondevteam.core.component.channel.Channel
|
||||||
import buttondevteam.discordplugin.DPUtils.{MonoExtensions, SpecExtensions}
|
import buttondevteam.discordplugin.DPUtils.{MonoExtensions, SpecExtensions}
|
||||||
import buttondevteam.discordplugin.playerfaker.ServerWatcher
|
import buttondevteam.discordplugin.mcchat.playerfaker.ServerWatcher
|
||||||
import buttondevteam.discordplugin.playerfaker.perm.LPInjector
|
import buttondevteam.discordplugin.mcchat.playerfaker.perm.LPInjector
|
||||||
|
import buttondevteam.discordplugin.mcchat.sender.DiscordConnectedPlayer
|
||||||
import buttondevteam.discordplugin.util.DPState
|
import buttondevteam.discordplugin.util.DPState
|
||||||
import buttondevteam.discordplugin.{ChannelconBroadcast, DPUtils, DiscordConnectedPlayer, DiscordPlugin}
|
import buttondevteam.discordplugin.{ChannelconBroadcast, DPUtils, DiscordPlugin}
|
||||||
import buttondevteam.lib.architecture.{Component, ConfigData, ReadOnlyConfigData}
|
import buttondevteam.lib.architecture.{Component, ConfigData, ReadOnlyConfigData}
|
||||||
import buttondevteam.lib.{TBMCCoreAPI, TBMCSystemChatEvent}
|
import buttondevteam.lib.{TBMCCoreAPI, TBMCSystemChatEvent}
|
||||||
import com.google.common.collect.Lists
|
import com.google.common.collect.Lists
|
||||||
|
@ -18,6 +19,7 @@ import reactor.core.scala.publisher.SMono
|
||||||
import java.util
|
import java.util
|
||||||
import java.util.stream.Collectors
|
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
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,6 +102,8 @@ class MinecraftChatModule extends Component[DiscordPlugin] {
|
||||||
final private val mcChatCommand = new MCChatCommand(this)
|
final private val mcChatCommand = new MCChatCommand(this)
|
||||||
final private val channelconCommand = new ChannelconCommand(this)
|
final private val channelconCommand = new ChannelconCommand(this)
|
||||||
|
|
||||||
|
val broadcastedMessages: mutable.Map[String, Long] = mutable.Map()
|
||||||
|
|
||||||
override protected def enable(): Unit = {
|
override protected def enable(): Unit = {
|
||||||
if (DPUtils.disableIfConfigErrorRes(this, chatChannel, chatChannelMono)) return ()
|
if (DPUtils.disableIfConfigErrorRes(this, chatChannel, chatChannelMono)) return ()
|
||||||
listener = new MCChatListener(this)
|
listener = new MCChatListener(this)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package buttondevteam.discordplugin.playerfaker
|
package buttondevteam.discordplugin.mcchat.playerfaker
|
||||||
|
|
||||||
import org.mockito.MockedConstruction
|
import org.mockito.MockedConstruction
|
||||||
import org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker
|
import org.mockito.internal.creation.bytebuddy.SubclassByteBuddyMockMaker
|
|
@ -1,4 +1,4 @@
|
||||||
package buttondevteam.discordplugin.playerfaker;
|
package buttondevteam.discordplugin.mcchat.playerfaker;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
|
@ -1,7 +1,7 @@
|
||||||
package buttondevteam.discordplugin.playerfaker
|
package buttondevteam.discordplugin.mcchat.playerfaker
|
||||||
|
|
||||||
import buttondevteam.discordplugin.DiscordConnectedPlayer
|
|
||||||
import buttondevteam.discordplugin.mcchat.MCChatUtils
|
import buttondevteam.discordplugin.mcchat.MCChatUtils
|
||||||
|
import buttondevteam.discordplugin.mcchat.sender.DiscordConnectedPlayer
|
||||||
import com.destroystokyo.paper.profile.CraftPlayerProfile
|
import com.destroystokyo.paper.profile.CraftPlayerProfile
|
||||||
import net.bytebuddy.implementation.bind.annotation.IgnoreForBinding
|
import net.bytebuddy.implementation.bind.annotation.IgnoreForBinding
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
|
@ -1,7 +1,7 @@
|
||||||
package buttondevteam.discordplugin.playerfaker
|
package buttondevteam.discordplugin.mcchat.playerfaker
|
||||||
|
|
||||||
import buttondevteam.discordplugin.mcchat.MinecraftChatModule
|
import buttondevteam.discordplugin.mcchat.MinecraftChatModule
|
||||||
import buttondevteam.discordplugin.{DiscordSenderBase, IMCPlayer}
|
import buttondevteam.discordplugin.mcchat.sender.{DiscordSenderBase, IMCPlayer}
|
||||||
import buttondevteam.lib.TBMCCoreAPI
|
import buttondevteam.lib.TBMCCoreAPI
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
|
@ -1,6 +1,6 @@
|
||||||
package buttondevteam.discordplugin.playerfaker
|
package buttondevteam.discordplugin.mcchat.playerfaker
|
||||||
|
|
||||||
import buttondevteam.discordplugin.{DiscordSenderBase, IMCPlayer}
|
import buttondevteam.discordplugin.mcchat.sender.{DiscordSenderBase, IMCPlayer}
|
||||||
import net.minecraft.server.v1_12_R1.*
|
import net.minecraft.server.v1_12_R1.*
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import org.bukkit.craftbukkit.v1_12_R1.command.VanillaCommandWrapper
|
import org.bukkit.craftbukkit.v1_12_R1.command.VanillaCommandWrapper
|
|
@ -1,6 +1,6 @@
|
||||||
package buttondevteam.discordplugin.playerfaker
|
package buttondevteam.discordplugin.mcchat.playerfaker
|
||||||
|
|
||||||
import buttondevteam.discordplugin.{DiscordSenderBase, IMCPlayer}
|
import buttondevteam.discordplugin.mcchat.sender.{DiscordSenderBase, IMCPlayer}
|
||||||
import net.minecraft.server.v1_14_R1.*
|
import net.minecraft.server.v1_14_R1.*
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import org.bukkit.command.CommandSender
|
import org.bukkit.command.CommandSender
|
|
@ -1,6 +1,6 @@
|
||||||
package buttondevteam.discordplugin.playerfaker
|
package buttondevteam.discordplugin.mcchat.playerfaker
|
||||||
|
|
||||||
import buttondevteam.discordplugin.{DiscordSenderBase, IMCPlayer}
|
import buttondevteam.discordplugin.mcchat.sender.{DiscordSenderBase, IMCPlayer}
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import org.bukkit.command.{CommandSender, SimpleCommandMap}
|
import org.bukkit.command.{CommandSender, SimpleCommandMap}
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
|
@ -1,4 +1,4 @@
|
||||||
package buttondevteam.discordplugin.playerfaker.perm;
|
package buttondevteam.discordplugin.mcchat.playerfaker.perm;
|
||||||
|
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package buttondevteam.discordplugin
|
package buttondevteam.discordplugin.mcchat.sender
|
||||||
|
|
||||||
import buttondevteam.discordplugin.mcchat.MinecraftChatModule
|
import buttondevteam.discordplugin.mcchat.MinecraftChatModule
|
||||||
import buttondevteam.discordplugin.playerfaker.{DiscordInventory, VCMDWrapper}
|
import buttondevteam.discordplugin.mcchat.playerfaker.{DiscordInventory, VCMDWrapper}
|
||||||
import discord4j.core.`object`.entity.User
|
import discord4j.core.`object`.entity.User
|
||||||
import discord4j.core.`object`.entity.channel.MessageChannel
|
import discord4j.core.`object`.entity.channel.MessageChannel
|
||||||
import org.bukkit.*
|
import org.bukkit.*
|
|
@ -1,4 +1,4 @@
|
||||||
package buttondevteam.discordplugin
|
package buttondevteam.discordplugin.mcchat.sender
|
||||||
|
|
||||||
import buttondevteam.discordplugin.mcchat.MCChatPrivate
|
import buttondevteam.discordplugin.mcchat.MCChatPrivate
|
||||||
import buttondevteam.lib.player.{ChromaGamerBase, UserClass}
|
import buttondevteam.lib.player.{ChromaGamerBase, UserClass}
|
|
@ -1,7 +1,7 @@
|
||||||
package buttondevteam.discordplugin
|
package buttondevteam.discordplugin.mcchat.sender
|
||||||
|
|
||||||
import buttondevteam.discordplugin.mcchat.MinecraftChatModule
|
import buttondevteam.discordplugin.mcchat.MinecraftChatModule
|
||||||
import buttondevteam.discordplugin.playerfaker.VCMDWrapper
|
import buttondevteam.discordplugin.mcchat.playerfaker.VCMDWrapper
|
||||||
import discord4j.core.`object`.entity.User
|
import discord4j.core.`object`.entity.User
|
||||||
import discord4j.core.`object`.entity.channel.MessageChannel
|
import discord4j.core.`object`.entity.channel.MessageChannel
|
||||||
import org.bukkit.entity.Player
|
import org.bukkit.entity.Player
|
|
@ -1,5 +1,6 @@
|
||||||
package buttondevteam.discordplugin
|
package buttondevteam.discordplugin.mcchat.sender
|
||||||
|
|
||||||
|
import buttondevteam.discordplugin.DiscordPlugin
|
||||||
import discord4j.core.`object`.entity.User
|
import discord4j.core.`object`.entity.User
|
||||||
import discord4j.core.`object`.entity.channel.MessageChannel
|
import discord4j.core.`object`.entity.channel.MessageChannel
|
||||||
import org.bukkit.command.CommandSender
|
import org.bukkit.command.CommandSender
|
|
@ -1,5 +1,6 @@
|
||||||
package buttondevteam.discordplugin
|
package buttondevteam.discordplugin.mcchat.sender
|
||||||
|
|
||||||
|
import buttondevteam.discordplugin.{DPUtils, DiscordPlugin}
|
||||||
import buttondevteam.lib.TBMCCoreAPI
|
import buttondevteam.lib.TBMCCoreAPI
|
||||||
import buttondevteam.lib.player.ChromaGamerBase
|
import buttondevteam.lib.player.ChromaGamerBase
|
||||||
import discord4j.core.`object`.entity.User
|
import discord4j.core.`object`.entity.User
|
|
@ -0,0 +1,8 @@
|
||||||
|
package buttondevteam.discordplugin.mcchat.sender
|
||||||
|
|
||||||
|
import buttondevteam.discordplugin.mcchat.playerfaker.VCMDWrapper
|
||||||
|
import org.bukkit.entity.Player
|
||||||
|
|
||||||
|
trait IMCPlayer[T] extends Player {
|
||||||
|
def getVanillaCmdListener: VCMDWrapper
|
||||||
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
package buttondevteam.discordplugin.mccommands
|
package buttondevteam.discordplugin.mccommands
|
||||||
|
|
||||||
import buttondevteam.discordplugin.commands.{ConnectCommand, VersionCommand}
|
import buttondevteam.discordplugin.commands.{ConnectCommand, VersionCommand}
|
||||||
|
import buttondevteam.discordplugin.mcchat.sender.{DiscordPlayer, DiscordSenderBase}
|
||||||
import buttondevteam.discordplugin.mcchat.{MCChatUtils, MinecraftChatModule}
|
import buttondevteam.discordplugin.mcchat.{MCChatUtils, MinecraftChatModule}
|
||||||
import buttondevteam.discordplugin.util.DPState
|
import buttondevteam.discordplugin.util.DPState
|
||||||
import buttondevteam.discordplugin.{DPUtils, DiscordPlayer, DiscordPlugin, DiscordSenderBase}
|
import buttondevteam.discordplugin.{DPUtils, DiscordPlugin}
|
||||||
import buttondevteam.lib.chat.{Command2, CommandClass, ICommand2MC}
|
import buttondevteam.lib.chat.{Command2, CommandClass, ICommand2MC}
|
||||||
import buttondevteam.lib.player.{ChromaGamerBase, TBMCPlayer, TBMCPlayerBase}
|
import buttondevteam.lib.player.{ChromaGamerBase, TBMCPlayer, TBMCPlayerBase}
|
||||||
import discord4j.core.`object`.ExtendedInvite
|
import discord4j.core.`object`.ExtendedInvite
|
||||||
|
|
Loading…
Reference in a new issue