2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SpigotAPI-1.13.1における私の備忘録(随時更新)

Last updated at Posted at 2018-11-17

概要

また同じことをした時に忘れないように調べたことをメモしました。
参考になれば幸いです。

環境

SpigotAPI-1.13.1-R0.1-SNAPSHOT
kotlin 1.3.10

芝生の増殖を抑止

    @EventHandler
    fun cancelSpreadGrass(event: BlockSpreadEvent) {
        if (event.isCancelled) return
        if (event.newState.type != Material.GRASS_BLOCK) return
        event.isCancelled = true
    }

砂等落下ブロックの落下キャンセル

    @EventHandler
    fun cancelFallBlock(event: EntityChangeBlockEvent) {
        val block = event.block ?: return
        val fallingBlock = event.entity as? FallingBlock ?: return
        val material = fallingBlock.blockData.material
        if (block.type == material) {
            event.isCancelled = true
        }
    }

液体が流れ出さないようにする

提供:@unicroak

    @EventHandler
    fun cancelFlowLiquid(event: BlockFromToEvent) {
        event.block ?: return
        event.isCancelled = true
    }
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?