Skip to content

Commit

Permalink
style: fix ktlint
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylvln committed Oct 28, 2023
1 parent 2ae0fe6 commit d9f8a25
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ class ProxyInterfaceBungeeCord(
if (event.isCancelled) return
val result = hook()

if (!result.allowed)
if (!result.allowed) {
event.setCancelReason(*BungeeComponentSerializer.get().serialize(result.rejectComponent!!))
}
}
}
)
Expand Down Expand Up @@ -105,8 +106,9 @@ class ProxyInterfaceBungeeCord(
if (event.isCancelled) return
val result = hook(wrapPlayer(event.player), event.target.name)

if (result.newServerName.isPresent)
if (result.newServerName.isPresent) {
event.target = proxy.servers[result.newServerName.get()]!!
}
}
}
)
Expand All @@ -126,8 +128,10 @@ class ProxyInterfaceBungeeCord(

override fun teleportPlayerOnServer(playerName: String, serverName: String) {
val server = this.proxy.getServerInfo(serverName)
if (server != null)

if (server != null) {
this.proxy.getPlayer(playerName)?.connect(server)
}
}

override fun getPlayerCount(): Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ class ProxyInterfaceVelocity(private val plugin: ShulkerProxyAgentVelocity, priv
if (!event.result.isAllowed) return@register
val result = hook()

if (!result.allowed)
if (!result.allowed) {
event.result = PreLoginEvent.PreLoginComponentResult.denied(result.rejectComponent)
}
}
}

Expand All @@ -74,8 +75,9 @@ class ProxyInterfaceVelocity(private val plugin: ShulkerProxyAgentVelocity, priv
if (!event.result.isAllowed) return@register
val result = hook(this.wrapPlayer(event.player), event.originalServer.serverInfo.name)

if (result.newServerName.isPresent)
if (result.newServerName.isPresent) {
event.result = ServerPreConnectEvent.ServerResult.allowed(this.proxy.getServer(result.newServerName.get()).get())
}
}
}

Expand Down

0 comments on commit d9f8a25

Please sign in to comment.