找回密码
 加入最MC
搜索
热搜: 活动 交友 discuz
查看: 2575|回复: 3

[联机] 基于Essentials插件的插件二次开发(第一期)

[复制链接]
发表于 2014-7-24 16:54:01 | 显示全部楼层 |阅读模式
本帖最后由 noname 于 2014-7-24 17:00 编辑

    在实际的服务器插件开发中,有时候需要用到Essentials插件的一些接口。如果不想去看Essentials的源码的话,可以参考下这个网站。
http://wiki.mc-ess.net/wiki/Essentials_Economy/API
    这一期只是简单的交流一下关于Essentials_Economy的一些接口,和基于这些接口的二次开发。
    首先你的库必须包含有com.earth2me.essentials.api,就是Essentials的基础插件。

下面是一些基础的方法:
Checking Information
  • boolean playerExists(String name) : Confirms an account exists
  • double getMoney(String name) : Get current balance
  • boolean hasEnough(String name, double amount) : Checks if the balance would be enough to withdraw the amount
  • boolean hasMore(String name, double amount) : Confirms the account has more than the amount
  • boolean hasLess(String name, double amount) : Confirms the account has less than the amount
  • boolean isNegative(String name) : Checks if the account balance is negative
Altering Information
  • void setMoney(String name, double bal) : Set current balance
  • void add(String name, double money) : Add to balance
  • void divide(String name, double money) : Divide balance
  • void multiply(String name, double money) : Multiply balance
  • void subtract(String name, double money) : Subtract from balance
  • void resetBalance(String name) : Reset balance to 0
    其次在开发的过程中要注意Essentials插件和你开发的插件之间的加载顺序,即优先级问题。如果你调用了Essentials的方法,而你的插件优先于Essentials插件加载,这服务器就会报错。如果不知道如何进行优先级判断的可以去看Vault的Vault.java文件中的hookEconomy()方法。

发表于 2014-8-2 19:22:56 | 显示全部楼层
建议弄一个索引贴
发表于 2015-10-30 21:07:53 | 显示全部楼层
QAQ
发表于 2015-11-16 19:37:51 | 显示全部楼层
不错
您需要登录后才可以回帖 登录 | 加入最MC

本版积分规则

Archiver|手机版|小黑屋|最MC论坛 ( 粤ICP备12035413号 )

GMT+8, 2026-12-1 04:25 , Processed in 0.023122 second(s), 18 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表