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

joshcough/MinecraftPlugins: Minecraft plugins implemented in Scala

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

开源软件名称(OpenSource Name):

joshcough/MinecraftPlugins

开源软件地址(OpenSource Url):

https://github.com/joshcough/MinecraftPlugins

开源编程语言(OpenSource Language):

Scala 86.6%

开源软件介绍(OpenSource Introduction):

Build Status Join the chat at https://gitter.im/joshcough/MinecraftPlugins

Overview

This project contains an API for building Minecraft Plugins in Scala. It is currently made up of several sub-projects, but the most important ones to know about are:

  • core - The core API
  • microexample - A first example of how to create a plugin in Scala.
  • examples - Several more example plugins using the core API
  • scala-lib-plugin - Provides a Bukkit plugin that provides the Scala API to other plugins at runtime.

Why?

There are several reasons for building this API, but the three that pop to mind immediately are:

  • To show how easy it is to put better/cleaner APIs on top of existing Java APIs.
  • To make command and argument parsing vastly easier using parser combinators.
  • To hopefully spark some interest in Scala among the Minecraft community.

Note: The core API is built on Bukkit version 1.7.2-R0.2 (http://bukkit.org/), which works with Minecraft 1.7.2.

Examples

Listener example: LightningArrows

The following example demonstrates how to use listeners in Scala. This plugin strikes an entity (any player or mob) with lightning if that entity is hit with an arrow:

import com.joshcough.minecraft.Listeners._
import org.bukkit.entity.EntityType.ARROW

class LightningArrows extends ListeningFor(OnEntityDamageByEntity { e =>
  if (e.getDamager isAn ARROW) e.world.strikeLightning(e.loc)
})

Commands example: Shock

The following example demonstrates how to write commands in Scala. It has one command called "shock" which takes a player as input, and shocks that player with lightning.

import com.joshcough.minecraft.CommandPlugin

class Shock extends CommandPlugin {
  val command = Command("shock", "shock a player", player){ case (you, them) =>
    them.shock
  }
}

Other Stuff

Other subprojects

There are a few other sub projects and I'll mention them just very briefly here.

  • netlogo - A plugin that enables running NetLogo models in Minecraft servers. More info here: NetLogo Plugin
  • minelang - An ongoing attempt at writing my own language (very much like Clojure, but not as good) that allows users to write their own minecraft plugins without having to know anything about IDE's and Jar files and stuff like that. I don't have any other information to give on this just yet, though.

Links




鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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