<?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-8-1 11:55 编辑</em></p>
<p dir="auto">这期主要讲的就是Essentials插件和你开发的插件之间的加载顺序，在调用ESS的接口的时候，如果在没有加载ESS插件前调用的话，服务端是会报错的。而且这就是关于优先级的问题了。<br />
​     <a href="http://this.sm" rel="nofollow ugc">this.sm</a> = getServer().getServicesManager();<br />
this.sm.register(Economy.class, perms, this, priority);<br />
上面2段代码为注册类， Economy econ = (Economy) hookClass.getConstructor(new Class[]{Plugin.class}).newInstance(new Object[]{this});Economy.class是一个自己写的一个抽象类。而hookClass是一个继承了Economy的类。perms为优先级。其中有ServicePriority.Low，ServicePriority.High， ServicePriority.Highest，ServicePriority.Normal，ServicePriority.Lowest。剩下的就是注册监听器来实现加载了。<br />
可以参考下面的代码:<br />
​    public class EconomyServerListener<br />
​            implements Listener<br />
​    {<br />
​        Economy_Essentials economy = null;<br />
​        public EconomyServerListener(Economy_Essentials economy) {<br />
​            this.economy = economy;<br />
​        }<br />
​        @EventHandler(priority=EventPriority.MONITOR)<br />
​        public void onPluginEnable(PluginEnableEvent event) {<br />
​            if (this.economy.ess == null) {<br />
​                Plugin essentials = event.getPlugin();</p>
<p dir="auto">​                if (essentials.getDescription().getName().equals("Essentials")) {<br />
​                    this.economy.ess = ((Essentials)essentials);<br />
​                    Economy_Essentials.log.info(String.format("[%s] %s hooked.", new Object[] { Economy_Essentials.this.plugin.getDescription().getName(), "Essentials Economy" }));<br />
​                }<br />
​            }<br />
​        }</p>
<p dir="auto">​        @EventHandler(priority=EventPriority.MONITOR)<br />
​        public void onPluginDisable(PluginDisableEvent event) {<br />
​            if ((this.economy.ess != null) &amp;&amp;<br />
​                    (event.getPlugin().getDescription().getName().equals("Essentials"))) {<br />
​                this.economy.ess = null;<br />
​                Economy_Essentials.log.info(String.format("[%s] %s unhooked.", new Object[] { Economy_Essentials.this.plugin.getDescription().getName(), "Essentials Economy" }));<br />
​            }<br />
​        }<br />
​    }</p>
]]></description><link>https://www.zuimc.com/topic/3011/基于essentials插件的插件二次开发-第二期</link><generator>RSS for Node</generator><lastBuildDate>Mon, 30 Nov 2026 17:14:20 GMT</lastBuildDate><atom:link href="https://www.zuimc.com/topic/3011.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 01 Aug 2014 03:47:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Tue, 20 Feb 2018 15:38:07 GMT]]></title><description><![CDATA[<p dir="auto">2</p>
]]></description><link>https://www.zuimc.com/post/80094</link><guid isPermaLink="true">https://www.zuimc.com/post/80094</guid><dc:creator><![CDATA[兔兔]]></dc:creator><pubDate>Tue, 20 Feb 2018 15:38:07 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Sun, 28 Jan 2018 08:14:47 GMT]]></title><description><![CDATA[<p dir="auto">56464556661651</p>
]]></description><link>https://www.zuimc.com/post/80088</link><guid isPermaLink="true">https://www.zuimc.com/post/80088</guid><dc:creator><![CDATA[3111478359]]></dc:creator><pubDate>Sun, 28 Jan 2018 08:14:47 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Sat, 16 Dec 2017 07:50:40 GMT]]></title><description><![CDATA[<p dir="auto">回复看源码，先顶一个</p>
]]></description><link>https://www.zuimc.com/post/80084</link><guid isPermaLink="true">https://www.zuimc.com/post/80084</guid><dc:creator><![CDATA[zzs123]]></dc:creator><pubDate>Sat, 16 Dec 2017 07:50:40 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Tue, 25 Jul 2017 09:57:20 GMT]]></title><description><![CDATA[<p dir="auto">123</p>
]]></description><link>https://www.zuimc.com/post/80080</link><guid isPermaLink="true">https://www.zuimc.com/post/80080</guid><dc:creator><![CDATA[c1055912175]]></dc:creator><pubDate>Tue, 25 Jul 2017 09:57:20 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Thu, 16 Jun 2016 08:11:51 GMT]]></title><description><![CDATA[<p dir="auto">看不懂</p>
]]></description><link>https://www.zuimc.com/post/80074</link><guid isPermaLink="true">https://www.zuimc.com/post/80074</guid><dc:creator><![CDATA[XM_APXiaoMa]]></dc:creator><pubDate>Thu, 16 Jun 2016 08:11:51 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Tue, 14 Jun 2016 02:22:55 GMT]]></title><description><![CDATA[<p dir="auto">1</p>
]]></description><link>https://www.zuimc.com/post/80067</link><guid isPermaLink="true">https://www.zuimc.com/post/80067</guid><dc:creator><![CDATA[a2811352932]]></dc:creator><pubDate>Tue, 14 Jun 2016 02:22:55 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Thu, 19 May 2016 05:54:45 GMT]]></title><description><![CDATA[<p dir="auto"><img src="/assets/smiley/qq/080.gif" alt="图片" class="img-markdown  img-fluid" /></p>
]]></description><link>https://www.zuimc.com/post/80061</link><guid isPermaLink="true">https://www.zuimc.com/post/80061</guid><dc:creator><![CDATA[hanchan]]></dc:creator><pubDate>Thu, 19 May 2016 05:54:45 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Sun, 31 Jan 2016 15:11:06 GMT]]></title><description><![CDATA[<p dir="auto">好人~</p>
]]></description><link>https://www.zuimc.com/post/80054</link><guid isPermaLink="true">https://www.zuimc.com/post/80054</guid><dc:creator><![CDATA[Z1RE4W56G1ER]]></dc:creator><pubDate>Sun, 31 Jan 2016 15:11:06 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Sat, 23 Jan 2016 12:21:25 GMT]]></title><description><![CDATA[<p dir="auto">这什么玩意，看不懂</p>
]]></description><link>https://www.zuimc.com/post/80048</link><guid isPermaLink="true">https://www.zuimc.com/post/80048</guid><dc:creator><![CDATA[1356726241]]></dc:creator><pubDate>Sat, 23 Jan 2016 12:21:25 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Sat, 23 Jan 2016 10:22:19 GMT]]></title><description><![CDATA[<p dir="auto">/ LZ你想说什么，看到了一串英文字母，我都晕了~ /</p>
]]></description><link>https://www.zuimc.com/post/80042</link><guid isPermaLink="true">https://www.zuimc.com/post/80042</guid><dc:creator><![CDATA[超级机器]]></dc:creator><pubDate>Sat, 23 Jan 2016 10:22:19 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Sat, 16 Jan 2016 08:01:45 GMT]]></title><description><![CDATA[<p dir="auto">看看隐藏</p>
]]></description><link>https://www.zuimc.com/post/80036</link><guid isPermaLink="true">https://www.zuimc.com/post/80036</guid><dc:creator><![CDATA[星恒]]></dc:creator><pubDate>Sat, 16 Jan 2016 08:01:45 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Tue, 05 Jan 2016 10:40:42 GMT]]></title><description><![CDATA[<p dir="auto">感谢你</p>
]]></description><link>https://www.zuimc.com/post/80030</link><guid isPermaLink="true">https://www.zuimc.com/post/80030</guid><dc:creator><![CDATA[1356726241]]></dc:creator><pubDate>Tue, 05 Jan 2016 10:40:42 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Tue, 05 Jan 2016 06:52:53 GMT]]></title><description><![CDATA[<p dir="auto">近期可能用得到</p>
]]></description><link>https://www.zuimc.com/post/80024</link><guid isPermaLink="true">https://www.zuimc.com/post/80024</guid><dc:creator><![CDATA[zx70106710000]]></dc:creator><pubDate>Tue, 05 Jan 2016 06:52:53 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Mon, 21 Sep 2015 07:09:43 GMT]]></title><description><![CDATA[<p dir="auto">gggggjfdsa</p>
]]></description><link>https://www.zuimc.com/post/80019</link><guid isPermaLink="true">https://www.zuimc.com/post/80019</guid><dc:creator><![CDATA[tencent_njs]]></dc:creator><pubDate>Mon, 21 Sep 2015 07:09:43 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Thu, 06 Aug 2015 10:12:51 GMT]]></title><description><![CDATA[<p dir="auto">隐藏内容</p>
]]></description><link>https://www.zuimc.com/post/80013</link><guid isPermaLink="true">https://www.zuimc.com/post/80013</guid><dc:creator><![CDATA[gc2517984]]></dc:creator><pubDate>Thu, 06 Aug 2015 10:12:51 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Sun, 17 May 2015 03:10:36 GMT]]></title><description><![CDATA[<p dir="auto">0.0  不懂  看不懂0.0  还是看不懂</p>
]]></description><link>https://www.zuimc.com/post/80008</link><guid isPermaLink="true">https://www.zuimc.com/post/80008</guid><dc:creator><![CDATA[houm]]></dc:creator><pubDate>Sun, 17 May 2015 03:10:36 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Sat, 16 May 2015 07:31:50 GMT]]></title><description><![CDATA[<p dir="auto">看看0.0 貌似很吊</p>
]]></description><link>https://www.zuimc.com/post/80002</link><guid isPermaLink="true">https://www.zuimc.com/post/80002</guid><dc:creator><![CDATA[914554688]]></dc:creator><pubDate>Sat, 16 May 2015 07:31:50 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Wed, 13 May 2015 14:04:43 GMT]]></title><description><![CDATA[<p dir="auto">666666666666666</p>
]]></description><link>https://www.zuimc.com/post/79996</link><guid isPermaLink="true">https://www.zuimc.com/post/79996</guid><dc:creator><![CDATA[waqjn1314]]></dc:creator><pubDate>Wed, 13 May 2015 14:04:43 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Sun, 26 Apr 2015 02:11:21 GMT]]></title><description><![CDATA[<p dir="auto">不明觉厉</p>
]]></description><link>https://www.zuimc.com/post/79989</link><guid isPermaLink="true">https://www.zuimc.com/post/79989</guid><dc:creator><![CDATA[hgc_sama]]></dc:creator><pubDate>Sun, 26 Apr 2015 02:11:21 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Sat, 25 Apr 2015 00:38:27 GMT]]></title><description><![CDATA[<p dir="auto">GFJARTJAERJ</p>
]]></description><link>https://www.zuimc.com/post/79983</link><guid isPermaLink="true">https://www.zuimc.com/post/79983</guid><dc:creator><![CDATA[XCXCJJ]]></dc:creator><pubDate>Sat, 25 Apr 2015 00:38:27 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Mon, 20 Apr 2015 08:20:37 GMT]]></title><description><![CDATA[<p dir="auto">这   怎么这么多  大触了！</p>
]]></description><link>https://www.zuimc.com/post/79975</link><guid isPermaLink="true">https://www.zuimc.com/post/79975</guid><dc:creator><![CDATA[grim_fly]]></dc:creator><pubDate>Mon, 20 Apr 2015 08:20:37 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Thu, 09 Apr 2015 21:25:37 GMT]]></title><description><![CDATA[<p dir="auto">这种技术贴居然没人...</p>
]]></description><link>https://www.zuimc.com/post/79970</link><guid isPermaLink="true">https://www.zuimc.com/post/79970</guid><dc:creator><![CDATA[擦拭]]></dc:creator><pubDate>Thu, 09 Apr 2015 21:25:37 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Sat, 27 Dec 2014 20:09:21 GMT]]></title><description><![CDATA[<p dir="auto">楼主写的略混乱</p>
]]></description><link>https://www.zuimc.com/post/79964</link><guid isPermaLink="true">https://www.zuimc.com/post/79964</guid><dc:creator><![CDATA[Wolverine]]></dc:creator><pubDate>Sat, 27 Dec 2014 20:09:21 GMT</pubDate></item><item><title><![CDATA[Reply to 基于Essentials插件的插件二次开发（第二期） on Sat, 27 Dec 2014 14:49:57 GMT]]></title><description><![CDATA[<p dir="auto">不明觉厉<br />
求第一期地址</p>
]]></description><link>https://www.zuimc.com/post/79958</link><guid isPermaLink="true">https://www.zuimc.com/post/79958</guid><dc:creator><![CDATA[木工]]></dc:creator><pubDate>Sat, 27 Dec 2014 14:49:57 GMT</pubDate></item></channel></rss>