<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>sk89q</title>
	
	<link>http://www.sk89q.com</link>
	<description />
	<lastBuildDate>Sun, 18 Mar 2012 01:09:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/sk89q" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="sk89q" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Open sourced Minecraft launcher</title>
		<link>http://www.sk89q.com/2012/03/open-sourced-minecraft-launcher/</link>
		<comments>http://www.sk89q.com/2012/03/open-sourced-minecraft-launcher/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 01:09:28 +0000</pubDate>
		<dc:creator>sk89q</dc:creator>
				<category><![CDATA[Minecraft]]></category>

		<guid isPermaLink="false">http://www.sk89q.com/?p=1802</guid>
		<description><![CDATA[I&#8217;ve opened sourced my Minecraft launcher. The past versions weren&#8217;t open sourced, nor were they really released to the world. You can find compiled versions (and a link to the source) on the MC forums.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve opened sourced my Minecraft launcher. The past versions weren&#8217;t open sourced, nor were they really released to the world.</p>
<div style="text-align: center"><a href="http://www.sk89q.com/content/2012/03/SKs_Minecraft_Launcher-2012-03-17_16.27.51.png"><img src="http://www.sk89q.com/content/2012/03/SKs_Minecraft_Launcher-2012-03-17_16.27.51-187x300.png" alt="" title="SKs_Minecraft_Launcher-2012-03-17_16.27.51" width="187" height="300" class="aligncenter size-medium wp-image-1805" /></a></p>
<p><a href="http://www.sk89q.com/content/2012/03/Manage_Addons_for_configuration_Default-2012-03-17_16.44.07.png"><img src="http://www.sk89q.com/content/2012/03/Manage_Addons_for_configuration_Default-2012-03-17_16.44.07-300x196.png" alt="" title="Manage_Addons_for_configuration_Default-2012-03-17_16.44.07" width="300" height="196" class="aligncenter size-medium wp-image-1803" /></a></p>
<p><a href="http://www.sk89q.com/content/2012/03/Edit_Configuration-2012-03-17_16.28.05.png"><img src="http://www.sk89q.com/content/2012/03/Edit_Configuration-2012-03-17_16.28.05-244x300.png" alt="" title="Edit_Configuration-2012-03-17_16.28.05" width="244" height="300" class="aligncenter size-medium wp-image-1804" /></a></div>
<p>You can find compiled versions (and a link to the source) <a href="http://www.minecraftforum.net/topic/1104030-launcher-sks-launcher-v310-easily-install-addons-update-mc-open-source/">on the MC forums</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sk89q.com/2012/03/open-sourced-minecraft-launcher/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>On the Future of WorldEdit and friends</title>
		<link>http://www.sk89q.com/2012/03/on-the-future-of-worldedit-and-friends/</link>
		<comments>http://www.sk89q.com/2012/03/on-the-future-of-worldedit-and-friends/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 05:47:00 +0000</pubDate>
		<dc:creator>sk89q</dc:creator>
				<category><![CDATA[Minecraft]]></category>

		<guid isPermaLink="false">http://www.sk89q.com/?p=1787</guid>
		<description><![CDATA[If you are looking for WorldEdit, WorldGuard, or CommandBook for MC 1.2, please see this post. But it&#8217;s never bad to think ahead! With the recent news that the core Bukkit team has been absorbed by Mojang and that Bukkit &#8230; <a href="http://www.sk89q.com/2012/03/on-the-future-of-worldedit-and-friends/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are looking for WorldEdit, WorldGuard, or CommandBook for MC 1.2, please <a href="http://www.sk89q.com/2012/03/further-updates-on-wewgcmdbook/">see this post</a>.</p>
<p>But it&#8217;s never bad to think ahead! With the recent news that the core Bukkit team has been absorbed by Mojang and that Bukkit in its current form is going away, that presents a number of issues for people who currently depend on this ecosystem. Fortunately, in regards to WorldEdit or WorldGuard, the news is mostly positive. We&#8217;re hoping to keep everything that you depend on the same as you&#8217;ve always been used to, even if mod APIs come and go, freeing up time so you can tend to better things. To us, a deprecation of time of &#8220;3 months&#8221; is nothing when you&#8217;ve got other things on your plate.</p>
<p>We&#8217;ve been able to do this because of a few decisions that were made from the beginning. I made a few assumptions going forward in late 2010:</p>
<ol>
<li>One day, the server mod APIs that I were depending on were going to die.</li>
<li>It wasn&#8217;t really within my means to start my own server mod, due to my future time constraints, and the project would be in a particular crossroads if the project ever needed to enter into a more official capacity.</li>
</ol>
<p>For better or worse, these assumptions have held uncannily true. It was within a few months that hMod effectively folded, and it is now true Bukkit will be ceasing to exist within a few months&#8217; time. Already, you can find WorldEdit for several platforms, including officially for single player, Bukkit, Spout, unofficially for Canary, at at one time officially for hMod. This means WorldEdit will continue to exist in its current form, for the most part, in whichever new fangled API gains popularity. The process of porting WorldEdit only requires writing a few files of code, a task that takes one or two hours, and it is the reason that WorldEdit was the first mod ported to Bukkit.</p>
<p>Better news is ahead, however. Within the next one or two major versions of WorldEdit, we should have far superior support for custom blocks and entities, allowing you to copy your complex RedPower contraptions or your extremely detailed BuildCraft operation between chunks or worlds. We will also hopefully allow WorldEdit to better handle large operations, performing them in smaller chunks (which currently presents a number of technical difficulties) rather than freezing the game. Scripting support should be improved, and we plan to add better support for better API interaction with WorldEdit, allowing you to more easily modify WorldEdit with new commands or functions that tap into WorldEdit&#8217;s vast library and cross-platform support.</p>
<p>As for WorldGuard, many of the ideas were applied. The core potions of WorldGuard are written to be easily ported, though due to the nature of WorldGuard, parts do have to be rewritten for it to be ported.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sk89q.com/2012/03/on-the-future-of-worldedit-and-friends/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Further updates on WE/WG/CmdBook</title>
		<link>http://www.sk89q.com/2012/03/further-updates-on-wewgcmdbook/</link>
		<comments>http://www.sk89q.com/2012/03/further-updates-on-wewgcmdbook/#comments</comments>
		<pubDate>Sun, 04 Mar 2012 20:02:25 +0000</pubDate>
		<dc:creator>sk89q</dc:creator>
				<category><![CDATA[Minecraft]]></category>
		<category><![CDATA[CommandBook]]></category>
		<category><![CDATA[WorldEdit]]></category>
		<category><![CDATA[WorldGuard]]></category>

		<guid isPermaLink="false">http://www.sk89q.com/?p=1780</guid>
		<description><![CDATA[If you are looking for versions of WorldEdit, WorldGuard, or CommandBook for Minecraft 1.2, please download a developer &#8220;nightly&#8221; version from build.sk89q.com. While there are no major known world-breaking issues, please be mindful that these are not yet stable versions &#8230; <a href="http://www.sk89q.com/2012/03/further-updates-on-wewgcmdbook/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you are looking for versions of WorldEdit, WorldGuard, or CommandBook for Minecraft 1.2, please download a developer &#8220;nightly&#8221; version from <a href="http://build.sk89q.com/">build.sk89q.com</a>. While there are no major known world-breaking issues, please be mindful that these are not yet stable versions and you should make backups of your world (and WorldGuard regions) beforehand. Be sure to update WorldEdit as well whenever updating CommandBook or WorldGuard.</p>
<p>You do not have to make any changes to your configuration, except in the case of CommandBook if you are moving from an old version of CommandBook (from the days of the customizer).</p>
<p><ins>EDIT:</ins> If you have free time, please help test WorldGuard by updating this spreadsheet: <a href="https://docs.google.com/spreadsheet/ccc?key=0AocVHzayvfjAdHRhcmV4QU5LYjBpdjdJTWNCSlJqRnc#gid=0">https://docs.google.com/spreadsheet/ccc?key=0AocVHzayvfjAdHRhcmV4QU5LYjBpdjdJTWNCSlJqRnc#gid=0</a></p>
<ol>
<li>If you are getting a ton of errors in Minecraft 1.2 for WorldGuard, it is because you need to update WorldGuard (and WorldEdit) to the nightly version linked above.</li>
<li>If you are still on MC 1.1, note that we do not currently immediately support MC 1.1 as our hands are currently tied in regards to time.</li>
<li>If operators automatically get put into god mode on join, please disable the feature in CommandBook and WorldGuard in config.yml. Future versions should have this setting disabled by default, as it was before.</li>
<li><strong>If some things are acting odd</strong> (monsters don&#8217;t spawn properly, leaves don&#8217;t dissipate, crops don&#8217;t grow, etc.), make sure you update CraftBukkit.</li>
</ol>
<p>There are some issues that have been reported but are presently unconfirmed. Please see the <a href="http://www.sk89q.com/2012/03/alpha-builds-of-worldedit-and-worldguard/">previous post for a list</a>. </p>
<p>Unfortunately this update has had possibly the worst timing for us ever, and much of the work is going to waste as Bukkit will be obsoleted within a few months. Nevertheless, we will be hopefully be releasing a stable version this week.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sk89q.com/2012/03/further-updates-on-wewgcmdbook/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Alpha builds of WorldEdit and WorldGuard</title>
		<link>http://www.sk89q.com/2012/03/alpha-builds-of-worldedit-and-worldguard/</link>
		<comments>http://www.sk89q.com/2012/03/alpha-builds-of-worldedit-and-worldguard/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 21:45:14 +0000</pubDate>
		<dc:creator>sk89q</dc:creator>
				<category><![CDATA[Minecraft]]></category>

		<guid isPermaLink="false">http://www.sk89q.com/?p=1762</guid>
		<description><![CDATA[With the release of Minecraft 1.2, WorldEdit and WorldGuard should be updated as a number of issues are present in their respective versions for Minecraft 1.1. The following are alpha builds of WorldEdit and WorldGuard that are compatible with Minecraft &#8230; <a href="http://www.sk89q.com/2012/03/alpha-builds-of-worldedit-and-worldguard/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>With the release of Minecraft 1.2, WorldEdit and WorldGuard should be updated as a number of issues are present in their respective versions for Minecraft 1.1.</p>
<p>The following are alpha builds of WorldEdit and WorldGuard that are compatible with Minecraft 1.2. While there have been no major issues reported with the releases below, THESE VERSIONS ARE NOT GUARANTEED TO BE STABLE. If possible, please test all features that you depend on, preferably on a test server on your local computer or elsewhere, and remember to <em>check back</em> when an official stable version is released for MC 1.2.</p>
<p><ins>EDIT:</ins> New versions are available. See the <a href="http://www.sk89q.com">new blog post</a>.</p>
<p>Recently fixed issues or issues fixed since versions for MC1.1:</p>
<ul>
<li>FIXED: WorldGuard: NullPointerException errors when pumpkin scuba is on</li>
<li>FIXED: WorldGuard: NullPointerException errors when infinite item stack removal is on</li>
<li>FIXED: WorldGuard: Region flags not working at all</li>
<li>FIXED: WorldGuard: Chest access being blocked completely</li>
<li>FIXED: WorldGuard: Becoming invincible on join by default (you must now turn this off manually in the configuration as well)</li>
<li>FIXED: WorldEdit: World height limitations</li>
<li>FIXED: WorldEdit: Missing 1.2 blocks and items</li>
<li>FIXED: WorldEdit: Errors when pasting schematics in some cases</li>
</ul>
<p>Reported, but unconfirmed, issues:</p>
<ul>
<li>WorldGuard: PvP flag does not work</li>
<li>WorldGuard: Entry/exit member groups flag does not work</li>
<li>WorldGuard: Invincible flag may not work</li>
<li>WorldGuard: Block break notification in the blacklist only prints to console</li>
<li>WorldGuard: Minecarts can&#8217;t be broken</li>
<li>WorldEdit: Jungle trees are not properly regenerated with //regen</li>
<li>WorldEdit: While the height limit was abolished, it always goes up to 256 even if set at a height limit below 256</li>
</ul>
<p>If you find any errors, please report them by commenting on this post.</p>
<p>You can <a href="https://twitter.com/sk89q">follow me on Twitter</a> if you want more up-to-the-minute news. In addition, you are invited to visit us on IRC by joining <a href="http://skq.me/irc/irc.esper.net/worldedit">#worldedit</a> or <a href="http://skq.me/irc/irc.esper.net/worldguard">#worldguard</a> on irc.esper.net.</p>
<p>Please note that we generally do not commit to stable builds until CraftBukkit releases its own stable build.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sk89q.com/2012/03/alpha-builds-of-worldedit-and-worldguard/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>Minecraft 1.2 and WorldEdit/WorldGuard</title>
		<link>http://www.sk89q.com/2012/03/minecraft-1-2-and-worldeditworldguard/</link>
		<comments>http://www.sk89q.com/2012/03/minecraft-1-2-and-worldeditworldguard/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 05:31:35 +0000</pubDate>
		<dc:creator>sk89q</dc:creator>
				<category><![CDATA[Minecraft]]></category>

		<guid isPermaLink="false">http://www.sk89q.com/?p=1759</guid>
		<description><![CDATA[Stable releases of WorldEdit and WorldGuard are not yet available, but the latest stable version of CommandBook should work. If you can&#8217;t wait, you can get developmental versions of WorldEdit and WorldGuard here: http://build.sk89q.com We&#8217;ve squashed a number of issues, &#8230; <a href="http://www.sk89q.com/2012/03/minecraft-1-2-and-worldeditworldguard/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Stable releases of WorldEdit and WorldGuard are not yet available, but the latest stable version of CommandBook should work. If you can&#8217;t wait, you can get developmental versions of WorldEdit and WorldGuard here:</p>
<p><a href="http://build.sk89q.com">http://build.sk89q.com</a></p>
<p>We&#8217;ve squashed a number of issues, particular with WorldGuard, just in the past few hours.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sk89q.com/2012/03/minecraft-1-2-and-worldeditworldguard/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>On the framework I previously posted about</title>
		<link>http://www.sk89q.com/2012/01/on-the-framework-i-previously-posted-about/</link>
		<comments>http://www.sk89q.com/2012/01/on-the-framework-i-previously-posted-about/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 22:13:33 +0000</pubDate>
		<dc:creator>sk89q</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.sk89q.com/?p=1751</guid>
		<description><![CDATA[The plugin framework I wrote about probably isn&#8217;t going to be released, as I&#8217;ve never really had the time to set out to do that (not to mention writing documentation and what not). However, a lot of my ideas have &#8230; <a href="http://www.sk89q.com/2012/01/on-the-framework-i-previously-posted-about/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.sk89q.com/2011/10/how-i-stay-sane-while-updating-my-minecraft-server/">plugin framework I wrote about</a> probably isn&#8217;t going to be released, as I&#8217;ve never really had the time to set out to do that (not to mention writing documentation and what not). However, a lot of my ideas have already inspired other people&#8217;s work, so you can find:</p>
<ol>
<li>For my <strong>component loading</strong> framework, quite a few people have contacted me about their attempts at re-implementing it. zml2008 has implemented one version in <a href="https://github.com/sk89q/commandbook">CommandBook</a>. I don&#8217;t know the details of it, but I assume it&#8217;s fairly similar to mine.</li>
<li>For my <strong>event handling</strong> framework, a number of people also told me about their work, but you can find a relatively new implementation of my event system in Bukkit, written by zml2008. It uses annotations as described in my system.</li>
<li>For my <strong>command handling</strong> framework, that can be found in <a href="https://github.com/sk89q/worldedit">WorldEdit</a>. I have to admit that this code is around a year old, but it performs fairly well, and it&#8217;s the exact same one I use in my framework.</li>
<li>For my <strong>permissions</strong> framework, which I didn&#8217;t really touch on in the post, at least it lives in the form of perm.issions.nodes, which is something I proposed in January 2011 (Nijiko-kun then wrote the Permissions plugin after he read what I wrote on IRC, many other people wrote later similar versions, and now Bukkit has a different built-in framework). However, if you want to link commands and permissions, you can do that either via WorldEdit&#8217;s command handler or via Bukkit&#8217;s plugin.yml.</li>
<li>For my <strong>configuration system</strong>, which I don&#8217;t think I really mentioned, I am not aware of any implementation of that (then again, I didn&#8217;t go deep into it). The configuration in Bukkit is also based off of my previous work, but it&#8217;s not as streamlined as in my framework.</li>
</ol>
<p>So while I definitely haven&#8217;t posted a lot of my code, many other people have already implemented a lot of my ideas, so it&#8217;s possible to gather the above work into one single framework if you&#8217;re willing to put in a little work. The idea of my framework, as with any framework, was to make rapid development both quick and as bug-free as possible. Java can be a real pain to work with, but these frameworks have made development much easier.</p>
<p>I&#8217;d also like to make a note about avoiding HashMaps in event systems. HashMaps have a definite purpose, but they can be slow, even with proper hash functions, so if you plan to have a high volume of events, you may want to avoid them. The framework I described in my post used HashMaps simply because it&#8217;s a non-issue in the environment I use it in (I recommend profiling instead of prematurely optimizing). &#8220;Fast events&#8221; were discussed by lahwran and I back when we were working on a project together, and although I (unsurprisingly) never posted my code, <a href="https://github.com/lahwran/fastevents">her work can be found on GitHub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sk89q.com/2012/01/on-the-framework-i-previously-posted-about/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Minecraft modding, then and now</title>
		<link>http://www.sk89q.com/2011/12/minecraft-modding-then-and-now/</link>
		<comments>http://www.sk89q.com/2011/12/minecraft-modding-then-and-now/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 11:16:51 +0000</pubDate>
		<dc:creator>sk89q</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Minecraft]]></category>

		<guid isPermaLink="false">http://www.sk89q.com/?p=1738</guid>
		<description><![CDATA[tl;dr: Potentially upcoming crapfest &#38; drama for MC modding! Whooo. Added 12/16: Last paragraph I started making mods not long after the SMP server mod &#8220;hMod&#8221; came out around September 2010. Before hMod, you had either regular hard-coded mods similar &#8230; <a href="http://www.sk89q.com/2011/12/minecraft-modding-then-and-now/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>tl;dr: Potentially upcoming crapfest &amp; drama for MC modding! Whooo.</p>
<p><ins>Added 12/16: Last paragraph</ins></p>
<p>I started making mods not long after the SMP server mod &#8220;hMod&#8221; came out around September 2010. Before hMod, you had either regular hard-coded mods similar to how you have it on single player or simplistic “server wrappers” that didn’t let you do much to the game itself. hMod was different: it was the first time that you could write “plugins” for the server so that you could easily extend it, and because your plugin would mostly access hMod’s code, you wouldn’t have to update your plugin so much whenever Minecraft got updated. With this fantastic new development, I made WorldEdit, WorldGuard, CraftBook, and CommandHelper over the last quarter of the year. Unfortunately, not only was hMod on shaky legal ground, the code was a complete mess. If you wanted to adjust an event and add new features to it, you’d single-handedly break all the plugins that used that event. I felt uneasy about hMod’s future and wrote WorldEdit and WorldGuard in a way where I could easily port it to some new mod in case hMod died.</p>
<p>Well die it did. Only a few months later, towards the end of December 2010, a few guys secretly started up a project called Bukkit as a replacement. It was to borrow its predecessor’s best ideas while fixing its worst faults. The community for hMod was sizable, and Bukkit needed momentum in order to get adopted, especially as most server owners wouldn’t want to completely dump everything to switch to something completely brand new. With that transition, for better or worse, I helped by declaring that all future releases of my plugins would only be for Bukkit. As my plugins were pretty popular (least to say), especially CraftBook, that pretty much put the nail in the coffin for hMod and gave Bukkit life. I had good reasons to back my decision, however. The author of hMod had completely become unreachable for several weeks, and while Minecraft was still getting updated with new versions, no one left had the ability to post new versions of hMod. That wasn’t good, and it was put the future of hMod in deep question. Giving Bukkit a chance seemed like the best idea. This was around the beginning of January 2011.</p>
<p>I was enthusiastic about Bukkit at the time, and I got WorldEdit and WorldGuard ported pretty quickly (CraftBook wasn’t written to be ported easily, and those who are familiar with CraftBook are probably familiar with its fate).  I helped Bukkit by designing the permissions system that everyone uses (with.the.nodes), as well by writing the original configuration classes and vehicle events. For the first month or so, things were rosy, but the frequency of commits to my own projects had started to fall sharply. While I was definitely busier that part of the year, the magic had faded away, and my hope that Bukkit would be the bastion of extensibility had disappeared. While there were technical issues to blame for that, there were also (and arguable still are) very strong opinions among the core team’s members about what people should be able to do and what they shouldn’t be able to do. Politics became an important fact of life suddenly. My frequency of commits to Bukkit fell even sharper. A few months later, unsurprisingly, someone started writing a mod to Bukkit itself to allow you to do things that Bukkit wouldn’t let you do. It was originally named BukkitDev, but later it changed its name to Spout.  The community also changed. Everything had become cutthroat, and everyone wanted to be famous and popular (or small-time rich, as the case may be). People would write plugins to do exactly the same thing as another person’s plugins, and often times these copy-cats would even be inferior. I wouldn’t be surprised if 50% of the Bukkit plugins available right now solely exist to block fire and TNT usage. </p>
<p>Throughout this time, While Notch has been fairly indecisive on several occasions, he did have an opinion that Mojang shouldn’t give any preference to any particular user-made mod, and never really endorsed Bukkit, hMod, or anything else. Bukkit entered in discussions with Mojang in early 2011 in hope that Mojang would embrace Bukkit with official support, but these exchanges did not progress at all. This impartiality was a good thing, but it had its downsides. There was always some fragmentation in the community – not everything was happy with what Bukkit did, and others were definitely not a fan of the person who led Bukkit. Canary was born out of hMod as its direct successor (sometime in early 2011), with several original hMod fans as a part of the team, but it never gained traction against Bukkit. I personally never ported any of my mods to Canary after that split happened (mostly due to a matter of time constraints). However, while Canary had really little traction, it always had the chance at becoming the top server mod through hard work and ingenuity, largely due to Notch’s impartiality.</p>
<p>Sometime earlier this year though, Bukkit gained a corporate partner: Curse.com. They’d host the website and also fund the project, but Curse.com also was the owner of the Minecraft forums, which they had purchased previously from a bunch of Minecraft fans who started it a long time back. This obviously gave them an enormous amount of power to move the community in certain directions, and with them behind Bukkit, that meant that Bukkit had resources that no other project could dream of (recently Bukkit got front page attention on the Minecraft forums <a href="http://www.youtube.com/watch?v=uXhTasEzUmQ">with a video</a> that reeked favoritism for the server, surprise, that Bukkit’s project leader is an administrator on). About this time, I had started to scale back my contributions to Minecraft, as I figure I’d be in for more doom and gloom again. Those who watched me on GitHub closely may have noticed that my contributions to my own plugins and completely evaporated since summer of this year and I’ve been thankful to all the other people who have picked up the slack.</p>
<p>The news now is that, with Notch having moved on and jeb having taken the reins of the project, Bukkit will be responsible for the client modding API. I can’t confirm that particular fact (I’ve been pretty disconnected for the past few months), but I’ve heard that a lot of modders are not happy. Notch is no longer the lead for Minecraft, and so it would not be unreasonable for this decision to have been made. The problem that some modders have with this is that Bukkit has been exceptionally limiting (especially evident by the need for BukkitDev/Spout) and so a number of modders fear that they won’t be able to do all the great and cool mods used to be able to do. The opinions of the core Bukkit team have always been strong in allowing some mods and disallowing others. If this is so, the multiplayer and single player modding communities will finally merge in an official capacity.</p>
<p>When you’ve got two sides with grossly different opinions, there’s a minor chance that the community will fragment. I’ve heard wind of a few plans from various people myself, and we may have a modding community split brewing for the future. If that does happen, it’d be interesting as to whether the other side would be able to muster the clout, as Mojang will control the client and the forums will not be in impartial hands. As for me, I have to say that I have enjoyed Minecraft a lot, a lot more than any other game that I have played. Notch and the Mojang team have done a great job at making such a fantastic game, and I’ve met a lot of great and creative people throughout my time in the community. I’m not disappearing by any means, and I’ll probably be popping in still to manage my plugins, but I’m officially going to watch things settle down, hopefully this time for good, whenever that may be.</p>
<p>I’m not advocating for any option here. I’ve tried to keep politics away from my contributions, as most of us here, including myself, are here to have fun. However, if anyone wanted to see a server-client modding framework that has worked especially well though, you only need to look to the fabulous work in Garry’s Mod. Servers can (safely) send entirely self-contained client mods (written in Lua) to connecting players, which would work wonderfully in tandem with mods on the server. There are completely brand new gamemodes on plenty of servers. Minecraft modding, on the other hand, has been grossly inferior – full of politics and filled with the great rise and fall of many mods.</p>
<p>On another note, I actually worked on a server-client modding framework with lahwran and some other folk many months back (<a href="http://whois.domaintools.com/craftengine.net">we even registered a domain name in June 2011</a>). The idea was that servers would be able to send client mods to clients, and these mods would access a completely abstracted sandbox API. However, when that failed, it was still possible to also load separate client .class mods (not auto-downloaded, however), so you&#8217;d basically have the best of both worlds. Single player mods could also be written under the API. The main issues of the time were that Java is exceptionally un-dynamic, so giving mods the expressive power they needed was difficult. Sandboxing was a difficult matter, and we weren&#8217;t even sure if we should let mods access OpenGL, as there are already webpages that can crash your graphics drivers, simply because they have limited access to OpenGL (though no worse exploits exist, as far as I know). A lot of code and planning got done, but we abandoned it because of both time constraints and the uphill climb that we were facing to achieve adoption (it would require both server and client interaction)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sk89q.com/2011/12/minecraft-modding-then-and-now/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>State of WorldEdit and friends</title>
		<link>http://www.sk89q.com/2011/12/state-of-worldedit-and-friends/</link>
		<comments>http://www.sk89q.com/2011/12/state-of-worldedit-and-friends/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 16:46:02 +0000</pubDate>
		<dc:creator>sk89q</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[CommandBook]]></category>
		<category><![CDATA[Minecraft]]></category>
		<category><![CDATA[WorldEdit]]></category>
		<category><![CDATA[WorldGuard]]></category>

		<guid isPermaLink="false">http://www.sk89q.com/?p=1728</guid>
		<description><![CDATA[Currently everything is still maintained (except perhaps CraftBook, but that&#8217;s not new news), but a lot of it has been passed on to a few others: zml2008 will be managing release for the most part for CommandBook, WorldGuard, and perhaps &#8230; <a href="http://www.sk89q.com/2011/12/state-of-worldedit-and-friends/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Currently everything is still maintained (except perhaps CraftBook, but that&#8217;s not new news), but a lot of it has been passed on to a few others:</p>
<ul>
<li>zml2008 will be managing release for the most part for CommandBook, WorldGuard, and perhaps WorldEdit.</li>
<li>TomyLobo is currently a lead developer on WorldEdit and handles a lot of the cool new features. (He also <a href="https://twitter.com/tomylobo2">has a Twitter account</a>.)</li>
<li>famerdave will be helping on/off with CommandBook.</li>
<li>I will still be around, but sometimes I won&#8217;t know the answers to all your questions :)</li>
</ul>
<p>If you are interested in helping, pop in #sk-dev on irc.esper.net and idle. You may want to get in touch with zml2008 or sk89q to get you started. Please note that you need to be somewhat experienced with Java (or rather programming in general) as I tend to be a pretty strong advocate of <a href="http://en.wikipedia.org/wiki/Abstraction">abstraction</a>. On the other hand, I wrote WorldEdit when my experience with Java was pretty minimal, so you can do it too (just read up on generics and annotations).</p>
<p>We&#8217;re hopefully going to support these projects for as long as possible because I know a lot of people depend on it. Thanks to everyone for supporting us! If you are ever looking for a release and not finding one, you can check out <a href="http://build.sk89q.com">build.sk89q.com</a> for developer builds.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sk89q.com/2011/12/state-of-worldedit-and-friends/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Brand new ICs on the Minecraft server</title>
		<link>http://www.sk89q.com/2011/11/brand-new-ics-on-the-minecraft-server/</link>
		<comments>http://www.sk89q.com/2011/11/brand-new-ics-on-the-minecraft-server/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 18:28:54 +0000</pubDate>
		<dc:creator>sk89q</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Minecraft]]></category>
		<category><![CDATA[SKCraft]]></category>

		<guid isPermaLink="false">http://www.sk89q.com/?p=1706</guid>
		<description><![CDATA[I added some new integrated circuits to the Minecraft server over the past few days. They work like CraftBook but have a number of new features over CraftBook, a lot of them longstanding ideas that never came to fruition. All &#8230; <a href="http://www.sk89q.com/2011/11/brand-new-ics-on-the-minecraft-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I added some new integrated circuits to the Minecraft server over the past few days. They work like CraftBook but have a number of new features over CraftBook, a lot of them longstanding ideas that never came to fruition. All old CraftBook ICs will still work (and for eternity if possible)!</p>
<p>To make an IC, use &#8221; =icname&#8221; (with the space in front). The ID numbers are no longer used &#8212; just type the IC name. The text goes on the first line of the wall sign.</p>
<div id="attachment_1707" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.sk89q.com/content/2011/11/2011-11-13_09.59.01.png"><img src="http://www.sk89q.com/content/2011/11/2011-11-13_09.59.01-300x223.png" alt="" title="Creating the IC" width="300" height="223" class="size-medium wp-image-1707" /></a><p class="wp-caption-text">Creating the IC</p></div>
<p>Some helpful information is shown once you&#8217;ve created the IC:</p>
<div id="attachment_1708" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.sk89q.com/content/2011/11/2011-11-13_09.59.12.png"><img src="http://www.sk89q.com/content/2011/11/2011-11-13_09.59.12-300x223.png" alt="" title="After the IC is created" width="300" height="223" class="size-medium wp-image-1708" /></a><p class="wp-caption-text">After the IC is created</p></div>
<p>Setup is like CraftBook. You have your families (SISO, 3ISO, etc.).</p>
<div id="attachment_1709" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.sk89q.com/content/2011/11/2011-11-13_10.00.08.png"><img src="http://www.sk89q.com/content/2011/11/2011-11-13_10.00.08-300x223.png" alt="" title="Setup is like CraftBook" width="300" height="223" class="size-medium wp-image-1709" /></a><p class="wp-caption-text">Setup is like CraftBook</p></div>
<p>However, unlike CraftBook, diodes are detected properly.</p>
<div id="attachment_1710" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.sk89q.com/content/2011/11/2011-11-13_10.00.38.png"><img src="http://www.sk89q.com/content/2011/11/2011-11-13_10.00.38-300x223.png" alt="" title="Unlike CraftBook, diodes work properly" width="300" height="223" class="size-medium wp-image-1710" /></a><p class="wp-caption-text">Unlike CraftBook, diodes work properly</p></div>
<p>Sneaking and right clicking the sign provides debugging information:</p>
<div id="attachment_1711" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.sk89q.com/content/2011/11/2011-11-13_10.01.57.png"><img src="http://www.sk89q.com/content/2011/11/2011-11-13_10.01.57-300x223.png" alt="" title="ICs can have extra debugging information shown when clicked" width="300" height="223" class="size-medium wp-image-1711" /></a><p class="wp-caption-text">ICs can have extra debugging information shown when clicked</p></div>
<p>Access the in-game documentation with: <strong>/reic list</strong>, although you can also right click signs (while not sneaking) to see help.</p>
<div id="attachment_1712" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.sk89q.com/content/2011/11/2011-11-13_10.02.31.png"><img src="http://www.sk89q.com/content/2011/11/2011-11-13_10.02.31-300x223.png" alt="" title="In-game documentation means you don&#039;t have to remember it all" width="300" height="223" class="size-medium wp-image-1712" /></a><p class="wp-caption-text">In-game documentation means you don't have to remember it all</p></div>
<p>For everyone else, you can <a href="https://github.com/sk89q/reic">find the code on GitHub</a>. It&#8217;s not standalone yet so you can&#8217;t use it, but <a href="https://github.com/nevercast">NeverCast</a> is working on fixing that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sk89q.com/2011/11/brand-new-ics-on-the-minecraft-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How I stay sane while updating my Minecraft server</title>
		<link>http://www.sk89q.com/2011/10/how-i-stay-sane-while-updating-my-minecraft-server/</link>
		<comments>http://www.sk89q.com/2011/10/how-i-stay-sane-while-updating-my-minecraft-server/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 21:02:49 +0000</pubDate>
		<dc:creator>sk89q</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Bukkit]]></category>
		<category><![CDATA[Minecraft]]></category>
		<category><![CDATA[Rebar]]></category>
		<category><![CDATA[SKCraft]]></category>

		<guid isPermaLink="false">http://www.sk89q.com/?p=1659</guid>
		<description><![CDATA[For my Minecraft server, I often find myself wanting to add a little feature here and there, additions that don&#8217;t yet exist or are too minor to bother with searching for a pre-existing plugin. For covering the &#8220;last of the mile&#8221; &#8230; <a href="http://www.sk89q.com/2011/10/how-i-stay-sane-while-updating-my-minecraft-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For my Minecraft server, I often find myself wanting to add a little feature here and there, additions that don&#8217;t yet exist or are too minor to bother with searching for a pre-existing plugin. For covering the &#8220;last of the mile&#8221; and sometimes a little more, I use a plugin specific for my server, but because it&#8217;s a little of &#8220;everything,&#8221; I can&#8217;t write it like one big plugin &#8212; that makes it difficult for me to maintain it. On the other hand, I don&#8217;t want to create a new Bukkit plugin for every little feature because that requires a lot of work to maintain all of them. To fix this problem, my plugin, Rebar (previously gone by with other names), is a little framework within itself that it helps me add new things very quickly, with little overhead and little effort. This is similar to some Python plugin frameworks that I wrote a long time ago, except Python provides you with much more freedom ;)</p>
<h2>Components</h2>
<p>Pretty much everything is a component. Components know how to initialize themselves as well as shutdown their tasks. They are very light &#8212; most components are confined to only one class. When components are loaded, &#8220;loader helpers&#8221; help initialize the component by automatically linking resources within the class (loader helpers themselves are extensible!). For example, say I want to store sessions in this one component &#8212; I want to remember where the last person performed a command, but I only want to keep the data while the user is still logged in. There&#8217;s a component for that, and selecting it for this new component is easy with the @InjectComponent helper:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MySessionTest <span style="color: #000000; font-weight: bold;">extends</span> AbstractComponent <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; @InjectComponent <span style="color: #000000; font-weight: bold;">private</span> Sessions sessionsManager<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// ...</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>What if I need to access another plugin?</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> WorldGuardTest <span style="color: #000000; font-weight: bold;">extends</span> AbstractComponent <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; @InjectPlugin<span style="color: #009900;">&#40;</span>WorldGuardPlugin.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> LazyPluginReference<span style="color: #339933;">&lt;</span>WorldGuardPlugin<span style="color: #339933;">&gt;</span> worldguard<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// ...</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Because plugins can possibly be unloaded or be made unavailable any time (as opposed to components, which are not outside the world of Rebar), they are accessed through a proxy LazyPluginReference class. We have to specify the class of the plugin in the annotation, sadly, because generics are only known at compile time in Java.</p>
<p>Enabling components is a matter of placing a line in a configuration file. I run two separate servers, a survival and a creative, so often I do not use the same components on both servers.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">components:<br />
- com.sk89q.skcraft.users.UserManager<br />
- com.sk89q.skcraft.FancyName<br />
- com.sk89q.skcraft.GameMechanics<br />
- com.sk89q.skcraft.BetterVehicles<br />
# ...</div></div>
<h2>Events</h2>
<p>Handling events is the bread and butter of most of the features. Those familiar with the event API in Bukkit know that it&#8217;s not a particularly spectacular piece of code though. There&#8217;s a lot of code duplicated <em>everywhere</em>, it takes a lot of code to even initiate an event, registering an event handler is a pain, and custom events are a complete joke. I get around some of the issues by using annotations:</p>
<p><code>@BukkitEvent(type = Event.Type.BLOCK_BREAK)</code></p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> BuildProtection <span style="color: #000000; font-weight: bold;">extends</span> AbstractComponent <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> postInitialize<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Rebar.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">registerEvents</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> BlockListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// ...</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">class</span> BlockListener <span style="color: #000000; font-weight: bold;">extends</span> org.<span style="color: #006633;">bukkit</span>.<span style="color: #006633;">event</span>.<span style="color: #006633;">block</span>.<span style="color: #006633;">BlockListener</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @BukkitEvent<span style="color: #009900;">&#40;</span>type <span style="color: #339933;">=</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aevent+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Event</span></a>.<span style="color: #006633;">Type</span>.<span style="color: #006633;">BLOCK_BREAK</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onBlockBreak<span style="color: #009900;">&#40;</span>BlockBreakEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Process event</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Priorities are optionally specified, but it defaults to &#8220;normal.&#8221;</p>
<h2>Custom Events</h2>
<p>Rebar has its own improved and fast event system for custom events, and registering event handlers is even the same as the code above. (Java reflection is not at all used except during initialization.) Below is an example of a custom event to check whether a block can be modified. Because the build protection event dispatcher is only active if the build protection component is running, the requirement has to be stated (that&#8217;s noted by the @RequiresComponent annotation).</p>
<p><code>@RegisteredEvent(type = BlockProtectedEvent.class)</code></p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">@RequiresComponent<span style="color: #009900;">&#40;</span>BuildProtection.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleProtectionTest <span style="color: #000000; font-weight: bold;">extends</span> AbstractComponent <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> postInitialize<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Rebar.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">registerEvents</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ProtectionListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// ...</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ProtectionListener <span style="color: #000000; font-weight: bold;">extends</span> com.<span style="color: #006633;">sk89q</span>.<span style="color: #006633;">rebar</span>.<span style="color: #006633;">components</span>.<span style="color: #006633;">ProtectionListener</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @RegisteredEvent<span style="color: #009900;">&#40;</span>type <span style="color: #339933;">=</span> BlockProtectedEvent.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onEvent<span style="color: #009900;">&#40;</span>BlockProtectedEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Process code here</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Creating an event is easy:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> BlockProtectedEvent <span style="color: #000000; font-weight: bold;">extends</span> AbstractEvent<span style="color: #339933;">&lt;</span>ProtectionListener<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Code for the event</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> call<span style="color: #009900;">&#40;</span>ProtectionListener listener<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; listener.<span style="color: #006633;">onEvent</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>By design, a listener can contain multiple events.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">abstract</span> <span style="color: #000000; font-weight: bold;">class</span> ProtectionListener <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onEvent<span style="color: #009900;">&#40;</span>BlockProtectedEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onEvent<span style="color: #009900;">&#40;</span>GuestProtectedEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Event priorities are integers, with certain default ones set at certain numbers. This allows for some leeway when setting priority.</p>
<h2>Making Events Work</h2>
<p>Often times multiple events need to be consolidated into one, or made more specific. For example, say you wanted to protect all signs with the text &#8220;[Lock]&#8221; on it from being destroyed. If you had to copy the same protection code to each component, you&#8217;d find it to be a nightmare! Instead in my plugin, the build protection is handled by a <em>event</em> that is raised by a build protection component. It allows other components to not at all worry about how to protect blocks, just which blocks to protect. It handles dependent blocks as well (e.g. wall signs on a back wall) all in one place.</p>
<p>I pass off a BlockProtectedEvent and whichever component feels like protecting another block can easily handle the event. The code for the actual component that fires the event is shown partially below:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> BuildProtection <span style="color: #000000; font-weight: bold;">extends</span> AbstractComponent <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> postInitialize<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Rebar rebar <span style="color: #339933;">=</span> Rebar.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; rebar.<span style="color: #006633;">registerEvents</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> BlockListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; rebar.<span style="color: #006633;">registerEvents</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> EntityListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// ...</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> canModifyAttached<span style="color: #009900;">&#40;</span>Block from, BlockFace face, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aentity+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Entity</span></a> entity<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// This checks to see if you can modify attached blocks (signs on wall, etc.)</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> canModify<span style="color: #009900;">&#40;</span>Block block, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aentity+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Entity</span></a> entity<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>Rebar.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getEventManager</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">dispatch</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> BlockProtectedEvent<span style="color: #009900;">&#40;</span>block, entity<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">isCancelled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>block.<span style="color: #006633;">getType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> Material.<span style="color: #006633;">AIR</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>canModifyAttached<span style="color: #009900;">&#40;</span>block, BlockFace.<span style="color: #006633;">NORTH</span>, entity<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>canModifyAttached<span style="color: #009900;">&#40;</span>block, BlockFace.<span style="color: #006633;">WEST</span>, entity<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>canModifyAttached<span style="color: #009900;">&#40;</span>block, BlockFace.<span style="color: #006633;">EAST</span>, entity<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>canModifyAttached<span style="color: #009900;">&#40;</span>block, BlockFace.<span style="color: #006633;">SOUTH</span>, entity<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>canModifyAttached<span style="color: #009900;">&#40;</span>block, BlockFace.<span style="color: #006633;">UP</span>, entity<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> canModify<span style="color: #009900;">&#40;</span>Block block<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> canModify<span style="color: #009900;">&#40;</span>block, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">class</span> EntityListener <span style="color: #000000; font-weight: bold;">extends</span> org.<span style="color: #006633;">bukkit</span>.<span style="color: #006633;">event</span>.<span style="color: #006633;">entity</span>.<span style="color: #006633;">EntityListener</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; @BukkitEvent<span style="color: #009900;">&#40;</span>type <span style="color: #339933;">=</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aevent+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Event</span></a>.<span style="color: #006633;">Type</span>.<span style="color: #006633;">ENTITY_EXPLODE</span>, priority <span style="color: #339933;">=</span> Priority.<span style="color: #006633;">Lowest</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onEntityExplode<span style="color: #009900;">&#40;</span>EntityExplodeEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">isCancelled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Block block <span style="color: #339933;">:</span> event.<span style="color: #006633;">blockList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>canModify<span style="color: #009900;">&#40;</span>block, event.<span style="color: #006633;">getEntity</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event.<span style="color: #006633;">setCancelled</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; @BukkitEvent<span style="color: #009900;">&#40;</span>type <span style="color: #339933;">=</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aevent+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Event</span></a>.<span style="color: #006633;">Type</span>.<span style="color: #006633;">ENDERMAN_PICKUP</span>, priority <span style="color: #339933;">=</span> Priority.<span style="color: #006633;">Lowest</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onEndermanPickup<span style="color: #009900;">&#40;</span>EndermanPickupEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">isCancelled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>canModify<span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">getBlock</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, event.<span style="color: #006633;">getEntity</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; event.<span style="color: #006633;">setCancelled</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// ...</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// ...</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<h2>Services</h2>
<p>Services actually exist in Bukkit (I wrote it), but not many people are familiar with it, and the code is a bit generics-happy, so it tends to scare off people. However, in Rebar, I use them in order to provide a way to plug and play different parts of code and provide a little interop. </p>
<p>An example of a wallet service is:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> WalletService <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">void</span> beginTransaction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">void</span> commitTransaction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; Wallet getWallet<span style="color: #009900;">&#40;</span>OfflinePlayer player<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">void</span> saveWallet<span style="color: #009900;">&#40;</span>OfflinePlayer player<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>The transaction methods are to ensure the possibility of atomic transactions when dealing with a player&#8217;s currency, which allows threading within the plugin as well as access from outside the server entirely.</p>
<p>Registering and working with services is pretty much the code I wrote in Bukkit, so I won&#8217;t go deeply into that. However, naturally, I have a loader helper for that:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> WalletTest <span style="color: #000000; font-weight: bold;">extends</span> AbstractComponent <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; @InjectService<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> WalletService wallets<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// ...</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Now I can support currency in any component and I don&#8217;t have to care as to what is providing the implementation!</p>
<h2>Commands</h2>
<p>Commands are handled by the command handling code inside of WorldEdit. It features boolean flags as well as flags of other data types (many thanks to TomyLobo), allowing you to do some pretty cool things. Annotations are also used heavily here, with an emphasis on as a little code needed as possible.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> UserManagerCommands <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// ...</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; @Command<span style="color: #009900;">&#40;</span>aliases <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;update-users&quot;</span> <span style="color: #009900;">&#125;</span>, desc <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Reload the list of users and their permissions&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; @CommandPermissions<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;skcraft.reload-users&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> reloadUsers<span style="color: #009900;">&#40;</span>CommandContext context, CommandSender sender<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; userManager.<span style="color: #006633;">reload</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ChatUtil.<span style="color: #006633;">msg</span><span style="color: #009900;">&#40;</span>sender, ChatColor.<span style="color: #006633;">YELLOW</span>, <span style="color: #0000ff;">&quot;Users and groups have been reloaded.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>It was this instead of creating a class for each component. I purposely chose not to do that instead back then because WorldEdit had over 100 commands, which would have meant over 100 classes (something I didn&#8217;t want to deal with).</p>
<h2>Permissions</h2>
<p>Permissions are actually handled by <a href="http://wiki.sk89q.com/wiki/WEPIF">WEPIF</a>, which was improved with thanks from zml2008. WEPIF abstracts a lot of the frustrating parts of handling permissions, especially for users of Bukkit&#8217;s convoluted permissions system.</p>
<h2>Example</h2>
<p>Here&#8217;s an example of a component that changes your name color to a random one. I don&#8217;t designate group colors on my server &#8212; everyone gets a random name color so it&#8217;s easy to read chat and it&#8217;s not cluttered.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FancyName <span style="color: #000000; font-weight: bold;">extends</span> AbstractComponent <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Arandom+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Random</span></a> random <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Arandom+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Random</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">static</span> ChatColor<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> NAME_COLORS <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ChatColor<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ChatColor.<span style="color: #006633;">GOLD</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; ChatColor.<span style="color: #006633;">GRAY</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; ChatColor.<span style="color: #006633;">BLUE</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; ChatColor.<span style="color: #006633;">GREEN</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; ChatColor.<span style="color: #006633;">AQUA</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; ChatColor.<span style="color: #006633;">RED</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; ChatColor.<span style="color: #006633;">LIGHT_PURPLE</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; ChatColor.<span style="color: #006633;">YELLOW</span>,<br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> postInitialize<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Rebar.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">registerEvents</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> PlayerListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Player player <span style="color: #339933;">:</span> Rebar.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getServer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getOnlinePlayers</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fancifyPlayer<span style="color: #009900;">&#40;</span>player<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> shutdown<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> fancifyPlayer<span style="color: #009900;">&#40;</span>Player player<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; player.<span style="color: #006633;">setDisplayName</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NAME_COLORS<span style="color: #009900;">&#91;</span>random.<span style="color: #006633;">nextInt</span><span style="color: #009900;">&#40;</span>NAME_COLORS.<span style="color: #006633;">length</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">+</span> player.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> ChatColor.<span style="color: #006633;">WHITE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PlayerListener <span style="color: #000000; font-weight: bold;">extends</span> org.<span style="color: #006633;">bukkit</span>.<span style="color: #006633;">event</span>.<span style="color: #006633;">player</span>.<span style="color: #006633;">PlayerListener</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; @BukkitEvent<span style="color: #009900;">&#40;</span>type <span style="color: #339933;">=</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aevent+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Event</span></a>.<span style="color: #006633;">Type</span>.<span style="color: #006633;">PLAYER_JOIN</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onPlayerJoin<span style="color: #009900;">&#40;</span>PlayerJoinEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fancifyPlayer<span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">getPlayer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<h2>Source</h2>
<p>Anyway, I actually hope to release some of this framework in the matter of a few weeks, so be on the look out! I&#8217;ve been slowly cleaning up things, and figuring out how to make some things less hardcoded (there are some limitations on Bukkit I&#8217;ll have to either fix or work around). You can <a href="https://github.com/sk89q">watch me on GitHub</a> if you want. If this article was mostly foreign to you, then you should read up on <a href="http://download.oracle.com/javase/tutorial/java/javaOO/annotations.html">Java annotations</a> and <a href="http://download.oracle.com/javase/tutorial/java/generics/index.html">generics</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sk89q.com/2011/10/how-i-stay-sane-while-updating-my-minecraft-server/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 2.469 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-05-04 02:39:28 --><!-- Compression = gzip -->

