最MC论坛
标题:
基于Essentials插件的插件二次开发(第一期)
[打印本页]
作者:
noname
时间:
2014-7-24 16:54
标题:
基于Essentials插件的插件二次开发(第一期)
本帖最后由 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()方法。
作者:
wu2171613
时间:
2014-8-2 19:22
建议弄一个索引贴
作者:
V6xuan
时间:
2015-10-30 21:07
QAQ
作者:
xuan_lv233
时间:
2015-11-16 19:37
不错
欢迎光临 最MC论坛 (http://www.zuimc.com/)
Powered by Discuz! X3.2