<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[基于Essentials插件的插件二次开发（第一期）]]></title><description><![CDATA[<p dir="auto"><em>本帖最后由 noname 于 2014-7-24 17:00 编辑</em></p>
<p dir="auto">​    在实际的服务器插件开发中，有时候需要用到Essentials插件的一些接口。如果不想去看Essentials的源码的话，可以参考下这个网站。<br />
<a href="http://wiki.mc-ess.net/wiki/Essentials_Economy/API" rel="nofollow ugc">http://wiki.mc-ess.net/wiki/Essentials_Economy/API</a><br />
​    这一期只是简单的交流一下关于Essentials_Economy的一些接口，和基于这些接口的二次开发。<br />
​    首先你的库必须包含有com.earth2me.essentials.api，就是Essentials的基础插件。<br />
下面是一些基础的方法：<br />
<strong>Checking Information</strong></p>
<p dir="auto">boolean playerExists(String name)<strong>:</strong> Confirms an account exists<br />
double getMoney(String name)<strong>:</strong> Get current balance<br />
boolean hasEnough(String name, double amount)<strong>:</strong> Checks if the balance would be enough to withdraw the amount<br />
boolean hasMore(String name, double amount)<strong>:</strong> Confirms the account has more than the amount<br />
boolean hasLess(String name, double amount)<strong>:</strong> Confirms the account has less than the amount<br />
boolean isNegative(String name)<strong>:</strong> Checks if the account balance is negative<br />
<strong>Altering Information</strong><br />
void setMoney(String name, double bal)<strong>:</strong> Set current balance<br />
void add(String name, double money)<strong>:</strong> Add to balance<br />
void divide(String name, double money)<strong>:</strong> Divide balance<br />
void multiply(String name, double money)<strong>:</strong> Multiply balance<br />
void subtract(String name, double money)<strong>:</strong> Subtract from balance<br />
void resetBalance(String name)<strong>:</strong> Reset balance to 0<br />
​    其次在开发的过程中要注意Essentials插件和你开发的插件之间的加载顺序，即优先级问题。如果你调用了Essentials的方法，而你的插件优先于Essentials插件加载，这服务器就会报错。如果不知道如何进行优先级判断的可以去看Vault的Vault.java文件中的hookEconomy()方法。</p>
]]></description><link>https://www.zuimc.com/topic/3012/基于essentials插件的插件二次开发-第一期</link><generator>RSS for Node</generator><lastBuildDate>Mon, 30 Nov 2026 16:36:03 GMT</lastBuildDate><atom:link href="https://www.zuimc.com/topic/3012.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 24 Jul 2014 08:54:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第一期） on Mon, 16 Nov 2015 11:37:51 GMT]]></title><description><![CDATA[<p dir="auto">不错</p>
]]></description><link>https://www.zuimc.com/post/80121</link><guid isPermaLink="true">https://www.zuimc.com/post/80121</guid><dc:creator><![CDATA[xuan_lv233]]></dc:creator><pubDate>Mon, 16 Nov 2015 11:37:51 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第一期） on Fri, 30 Oct 2015 13:07:53 GMT]]></title><description><![CDATA[<p dir="auto">QAQ</p>
]]></description><link>https://www.zuimc.com/post/80115</link><guid isPermaLink="true">https://www.zuimc.com/post/80115</guid><dc:creator><![CDATA[V6xuan]]></dc:creator><pubDate>Fri, 30 Oct 2015 13:07:53 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第一期） on Sat, 02 Aug 2014 11:22:56 GMT]]></title><description><![CDATA[<p dir="auto">建议弄一个索引贴</p>
]]></description><link>https://www.zuimc.com/post/80109</link><guid isPermaLink="true">https://www.zuimc.com/post/80109</guid><dc:creator><![CDATA[wu2171613]]></dc:creator><pubDate>Sat, 02 Aug 2014 11:22:56 GMT</pubDate></item></channel></rss>