Skip to content

Commit

Permalink
🛫 Seperated Stracciatella start
Browse files Browse the repository at this point in the history
  • Loading branch information
DasLixou committed May 8, 2022
1 parent 1d2d4bb commit 195a944
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/main/kotlin/cc/lixou/stracciatella/Stracciatella.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,33 @@ import net.minestom.server.instance.block.Block

class Stracciatella {

fun start() {
val server = MinecraftServer.init()
private val server = MinecraftServer.init()

init {
val eventHandler = MinecraftServer.getGlobalEventHandler()
eventHandler.addListener(PlayerDisconnectEvent::class.java) { event ->
GameManager.unregisterPlayer(event.player)
}

// region [Test World Debug Stuff - REMOVE]
val instanceManager = MinecraftServer.getInstanceManager()

val instanceContainer = instanceManager.createInstanceContainer()

instanceContainer.setGenerator { unit ->
unit.modifier().fillHeight(0, 40, Block.GRASS_BLOCK)
}

val eventHandler = MinecraftServer.getGlobalEventHandler()
eventHandler.addListener(PlayerDisconnectEvent::class.java) { event ->
GameManager.unregisterPlayer(event.player)
}
eventHandler.addListener(PlayerLoginEvent::class.java) { event ->
val player = event.player
event.setSpawningInstance(instanceContainer)
player.respawnPoint = Pos(0.0, 42.0, 0.0)
}
// endregion

MinecraftServer.setBrandName("Stracciatella (Minestom powered)")
}

fun start() {
server.start("0.0.0.0", 25565)
}

Expand Down

0 comments on commit 195a944

Please sign in to comment.