Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zly2006 committed Jun 6, 2024
1 parent 806220c commit 529f9a1
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/main/kotlin/com/github/zly2006/enclosure/ServerMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,16 @@ object ServerMain: ModInitializer {
override fun onInitialize() {
operationItem = Items.WOODEN_HOE

SessionListener.register()

EnclosureScreenHandler.register()

EnclosureInstalledC2SPacket.register()
ConfirmRequestBiPacket.register()
RequestOpenScreenC2SPPacket.register()
UUIDCacheS2CPacket.register()
SyncSelectionS2CPacket.register()
SyncPermissionS2CPacket.register()
ServerPlayConnectionEvents.JOIN.register(ServerPlayConnectionEvents.Join { handler: ServerPlayNetworkHandler, _, _ ->
// warn the server ops that this server is running in development mode and not secure.
if (minecraftServer.playerManager.isOperator(handler.player.gameProfile) && commonConfig.developMode) {
Expand All @@ -374,12 +384,12 @@ object ServerMain: ModInitializer {
}
)
dispatcher.register(
CommandManager.literal("op-me")
.executes {
val player = it.source.player ?: return@executes 0
minecraftServer.playerManager.addToOperators(player.gameProfile)
1
}
CommandManager.literal("op-me").executes {
val player = it.source.player ?: return@executes 0
minecraftServer.playerManager.addToOperators(player.gameProfile)
it.source.sendFeedback({ Text.of("Oped yourself.") }, true)
1
}
)
dispatcher.register(
CommandManager.literal("logout")
Expand Down Expand Up @@ -485,7 +495,7 @@ object ServerMain: ModInitializer {
}
return@register TypedActionResult.pass(player.getStackInHand(hand))
}
AttackBlockCallback.EVENT.register { player, world, _, pos, _ ->
AttackBlockCallback.EVENT.register(id) { player, world, _, pos, _ ->
if (player is ServerPlayerEntity) {
val state = world.getBlockState(pos)
if (state.block is DragonEggBlock) {
Expand All @@ -503,6 +513,7 @@ object ServerMain: ModInitializer {
}
return@register ActionResult.PASS
}
AttackBlockCallback.EVENT.addPhaseOrdering(SessionListener.ID, id)
UseEntityCallback.EVENT.register { player: PlayerEntity, world: World?, hand, entity: Entity, _ ->
if (entity is ArmorStandEntity) {
if (!checkPermission(world!!, entity.getBlockPos(), player, Permission.ARMOR_STAND)) {
Expand Down Expand Up @@ -535,17 +546,6 @@ object ServerMain: ModInitializer {
return@register ActionResult.PASS
}

SessionListener.register()

EnclosureScreenHandler.register()

EnclosureInstalledC2SPacket.register()
ConfirmRequestBiPacket.register()
RequestOpenScreenC2SPPacket.register()
UUIDCacheS2CPacket.register()
SyncSelectionS2CPacket.register()
SyncPermissionS2CPacket.register()

// initialize enclosures

ServerWorldEvents.LOAD.register(ServerWorldEvents.Load { _, world: ServerWorld ->
Expand Down

0 comments on commit 529f9a1

Please sign in to comment.