• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

DevSrSouza/KotlinBukkitAPI: KotlinBukkitAPI is an API for Bukkit/SpigotAPI using ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

DevSrSouza/KotlinBukkitAPI

开源软件地址(OpenSource Url):

https://github.com/DevSrSouza/KotlinBukkitAPI

开源编程语言(OpenSource Language):

Kotlin 100.0%

开源软件介绍(OpenSource Introduction):

KotlinBukkitAPI

KotlinBukkitAPI

Kotlin version GitHub stars Github Issues GitHub last commit Discord Minecraft Server Running with KotlinBukkitAPI MIT License Build Status

KotlinBukkitAPI is an API for Bukkit/SpigotAPI using the cool and nifty features Kotlin has to make your life more easier.

Contents:

Samples

KotlinBukkitAPI goes beyond this samples, and you can find all of it in the wiki/documentation.

Event DSL sample

plugin.events {
  event<PlayerJoinEvent> {
    player.msg("&3Welcome ${player.name}".translateColor()) 
  }
  
  event<PlayerQuitEvent> {
    broadcast("&eThe player &c${player.name} &eleft :(".translateColor())
  }
}

Simple Command DSL example

plugin.simpleCommand("twitter") {
  sender.msg("&eFollow me on Twitter :D &ahttps://twitter.com/DevSrSouza".translateColor())
}

Item meta DSL and other stuff

val gem = item(Material.DIAMOND).apply {
  amount = 5
  meta<ItemMeta> {
    displayName = "&bGem".translateColor()
  }
}
val encbook = item(Material.ENCHANTED_BOOK).meta<EnchantmentStorageMeta> {
  displayName = "&4&lThe powerful BOOK".translateColor()
  addStoredEnchant(Enchantment.DAMAGE_ALL, 10, true) // putting sharpness 10 to the book
}

Another approach:

val gem = item(Material.DIAMOND, amount = 5).displayName("&bGem".translateColor())

val encbook = metadataItem<EnchantmentStorageMeta>(Material.ENCHANTED_BOOK) {
  displayName = "&4&lThe powerful BOOK".translateColor()
    addStoredEnchant(Enchantment.DAMAGE_ALL, 10, true) // putting sharpness 10 to the book
}

Menu creator DSL

val myMenu = menu(+"&cWarps", 3, true) {

  val arenaPvP = item(Material.DIAMOND_SWORD) {
      addEnchant(Enchantment.DAMAGE_ALL, 5, true)
      displayName = "&4Arena PvP".translateColor()
  }

  slot(2, 4, arenaPvP) { // Line, Slot
    onClick {
      player.teleport(Location(player.world, 250, 70, -355))
      close() // close the menu
    }
  }

  slot(2, 6, item(Material.GOLD).displayName("&6Shop".translateColor())) {
    onClick {
      player.teleport(Location(player.world, 2399, 70, -1234))
      close() // close the menu
    }
  }

  // when the menu renders to a player, will show the Paper item with their name.
  slot(3, 9, item(Material.PAPER).displayName("Hello {player}")) {
    onRender {
      showingItem?.meta<ItemMeta> {
         displayName = displayName.replace("{player}", player.name)
      } 
    }
  }
}

// open to player
myMenu.openToPlayer(player)

You can find more examples in the Documentation

Project

Dependencies

Name Version
Spigot API 1.8.8+

Dependencies Embed

If you shade your plugin or use PDM, this dependencies should not be loaded be your plugin, you should let the KotlinBukkitAPI provide it at runtime to prevent conflicts.

More about how to setup a project with KotlinBukkitAPI here.

Name Version
Kotlin STD + JDK8 1.5.0
Kotlin Reflect 1.5.0
Kotlinx-coroutines 1.5.0-RC
Skedule 1.2.6
Kotlinx.serialization 1.2.0
KAML 0.31.0
Exposed 0.32.1
HikariCP 4.0.3

Modules

Module Description
Core The heart of the project containing the important API and extensions
Plugins Extensions for others plugins like Vault, PlaceholderAPI and others
Exposed Extensions for SQL framework Exposed
Serialization Extensions for Kotlinx.serialization

Consider donate

Buy Me A Coffee




logo




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap