mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 20:05:02 -04:00
replace ascii-tables with jiibles, connection list command
This commit is contained in:
parent
f3dc3219a0
commit
8bdb7b37e9
15
pom.xml
15
pom.xml
@ -267,11 +267,6 @@
|
||||
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
@ -340,9 +335,9 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.Bixilon</groupId>
|
||||
<artifactId>ascii-table</artifactId>
|
||||
<version>5375a4f</version>
|
||||
<groupId>de.bixilon</groupId>
|
||||
<artifactId>jiibles</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.lwjgl</groupId>
|
||||
@ -426,9 +421,9 @@
|
||||
<classifier>${zstd.natives}</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.bixilon.bixilon</groupId>
|
||||
<groupId>de.bixilon</groupId>
|
||||
<artifactId>mbf-kotlin</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>0.2.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.github.luben</groupId>
|
||||
|
@ -24,7 +24,6 @@ class CommandStack {
|
||||
var executor: Entity? = null
|
||||
lateinit var connection: PlayConnection
|
||||
|
||||
@Suppress("NON_PUBLIC_CALL_FROM_PUBLIC_INLINE")
|
||||
inline operator fun <reified T> get(name: String): T? {
|
||||
return getAny(name).nullCast()
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import de.bixilon.minosoft.ShutdownReasons
|
||||
import de.bixilon.minosoft.commands.nodes.RootNode
|
||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
import de.bixilon.minosoft.terminal.commands.Commands
|
||||
import de.bixilon.minosoft.terminal.commands.ConnectionCommand
|
||||
import de.bixilon.minosoft.terminal.commands.connection.ConnectionCommand
|
||||
import de.bixilon.minosoft.util.ShutdownManager
|
||||
import org.jline.reader.*
|
||||
import org.jline.terminal.Terminal
|
||||
|
@ -13,9 +13,12 @@
|
||||
|
||||
package de.bixilon.minosoft.terminal.commands
|
||||
|
||||
import de.bixilon.minosoft.terminal.commands.connection.SayCommand
|
||||
|
||||
object Commands {
|
||||
val COMMANDS: List<Command> = listOf(
|
||||
HelpCommand,
|
||||
SayCommand,
|
||||
ConnectionManageCommand,
|
||||
)
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2020-2022 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.terminal.commands
|
||||
|
||||
import de.bixilon.jiibles.Table
|
||||
import de.bixilon.kutil.collections.CollectionUtil.toSynchronizedList
|
||||
import de.bixilon.minosoft.commands.nodes.LiteralNode
|
||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
|
||||
object ConnectionManageCommand : Command {
|
||||
override var node = LiteralNode("connection")
|
||||
.addChild(LiteralNode("list", executor = {
|
||||
val table = Table(arrayOf("Id", "State", "Address"))
|
||||
for (connection in PlayConnection.ACTIVE_CONNECTIONS.toSynchronizedList()) {
|
||||
table += arrayOf(connection.connectionId, connection.state, connection.address)
|
||||
}
|
||||
println(table)
|
||||
}))
|
||||
}
|
@ -11,6 +11,8 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.terminal.commands
|
||||
package de.bixilon.minosoft.terminal.commands.connection
|
||||
|
||||
import de.bixilon.minosoft.terminal.commands.Command
|
||||
|
||||
interface ConnectionCommand : Command
|
@ -11,7 +11,7 @@
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.terminal.commands
|
||||
package de.bixilon.minosoft.terminal.commands.connection
|
||||
|
||||
import de.bixilon.minosoft.commands.nodes.ArgumentNode
|
||||
import de.bixilon.minosoft.commands.nodes.LiteralNode
|
Loading…
x
Reference in New Issue
Block a user