Skip to content

Commit

Permalink
Merge pull request #477 from Ling556/dev/6.2.0
Browse files Browse the repository at this point in the history
更新为AfyBroker 2.1
  • Loading branch information
Bkm016 authored Oct 13, 2024
2 parents cccb52f + b8b6170 commit ad787da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
4 changes: 2 additions & 2 deletions platform/platform-afybroker/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dependencies {
compileOnly(project(":common-util"))
compileOnly(project(":common-env"))
compileOnly(project(":common-platform-api"))
compileOnly("net.afyer:afybroker-server:1.5")
compileOnly("net.afyer:afybroker-core:1.5")
compileOnly("com.github.AfyerDev.AfyBroker:afybroker-server:38ec0b7fad")
compileOnly("com.github.AfyerDev.AfyBroker:afybroker-core:38ec0b7fad")
compileOnly("org.slf4j:slf4j-api:1.7.32")
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AfyBrokerAdapter : PlatformAdapter {
}

override fun onlinePlayers(): List<ProxyPlayer> {
return Broker.getBrokerPlayerManager().players.map { adaptPlayer(it) }
return Broker.getPlayerManager().players.map { adaptPlayer(it) }
}

override fun adaptPlayer(any: Any): ProxyPlayer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package taboolib.platform.type
import net.afyer.afybroker.core.message.KickPlayerMessage
import net.afyer.afybroker.core.message.SendPlayerMessageMessage
import net.afyer.afybroker.core.message.SendPlayerTitleMessage
import net.afyer.afybroker.core.message.SudoMessage
import net.afyer.afybroker.server.proxy.BrokerPlayer
import taboolib.common.platform.ProxyGameMode
import taboolib.common.platform.ProxyParticle
Expand Down Expand Up @@ -35,7 +34,7 @@ class AfyBrokerPlayer(val player: BrokerPlayer) : ProxyPlayer {
get() = error("Unsupported")

override val uniqueId: UUID
get() = player.uid
get() = player.uniqueId

override val ping: Int
get() = error("Unsupported")
Expand Down Expand Up @@ -263,7 +262,7 @@ class AfyBrokerPlayer(val player: BrokerPlayer) : ProxyPlayer {
override fun kick(message: String?) {
val msg = KickPlayerMessage().setPlayer(player.name).setMessage(message)
try {
player.bungeeClientProxy.oneway(msg)
player.proxy.oneway(msg)
} catch (ex: Exception) {
warning(ex)
}
Expand All @@ -284,13 +283,13 @@ class AfyBrokerPlayer(val player: BrokerPlayer) : ProxyPlayer {

override fun sendTitle(title: String?, subtitle: String?, fadein: Int, stay: Int, fadeout: Int) {
val msg = SendPlayerTitleMessage()
.setPlayer(player.name)
.setName(player.name)
.setTitle(title)
.setSubtitle(subtitle)
.setFadein(fadein)
.setStay(stay).setFadeout(fadeout)
try {
player.bukkitClientProxy?.oneway(msg)
player.server?.oneway(msg)
} catch (ex: Exception) {
warning(ex)
}
Expand All @@ -301,9 +300,9 @@ class AfyBrokerPlayer(val player: BrokerPlayer) : ProxyPlayer {
}

override fun sendMessage(message: String) {
val msg = SendPlayerMessageMessage().setUniqueId(player.uid).setMessage(message)
val msg = SendPlayerMessageMessage().setUniqueId(player.uniqueId).setMessage(message)
try {
player.bukkitClientProxy?.oneway(msg)
player.server?.oneway(msg)
} catch (ex: Exception) {
warning(ex)
}
Expand All @@ -325,15 +324,7 @@ class AfyBrokerPlayer(val player: BrokerPlayer) : ProxyPlayer {
}

override fun performCommand(command: String): Boolean {
val msg = SudoMessage().setPlayer(player.name).setCommand(command)
val client = player.bukkitClientProxy ?: return false
try {
client.oneway(msg)
return true
} catch (ex: Exception) {
warning(ex)
return false
}
error("Unsupported")
}

override fun hasPermission(permission: String): Boolean {
Expand Down

0 comments on commit ad787da

Please sign in to comment.