Welcome to the second Minecraft Spotlight of this week! Today we will cover "CookieMonster" a plugin that was originally created by Coelho and later taken over by jascotty2, who still manages the project.
CookieMonster's main feature is letting server owners customize the item drops of any mob. But that's not all, it has much more to offer!
With this plugin it is possible to reward players for killing certain mobs, or even other players! Upon each kill they will receive a notification showing how much money they just earned, this sum will then get transferred to their balance immediately. This feature requires an economy plugin to work properly; a list of supported economies can be found on the plugin's main page.
In addition to rewarding players, CookieMonster also enables you to change the item drops of each monster. The default configuration of the plugin is identical to the original game, you can replace these items, change the amount and droprate of each item or even add other items to the list!
The example above shows the item list of the Creeper, including the original items and an additional Iron Sword which will get dropped one at a time with a drop rate of 100%.
If you would like to discourage the use of a weapon against a specific monster, this is also within reach. For example: the default configuration does not offer the player a reward for killing a Creeper with a bow and shows a message upon doing so anyway. The opposite can be done as well.
Besides rewarding players the plugin also lets you punish them for killing mobs, a very useful feature for keeping certain monsters and animals alive. This works pretty much the same as the rewards, the only difference is that a negative value has to be filled in in the configuration file.
All in all, CookieMonster provides a versatile solution for both rewarding and punishing players. On top of that it offers complete customization of item drops from monsters, animals and even players.
Finally, we also had the opportunity to interview jascotty2, the current developer of CookieMonster. Be sure to continue reading to learn more about the development process behind this plugin!
What inspired you to start this project?
CookieMonster Itself was first started by another author, "Coelho". Initially, I did maintenance coding on it for my server (to keep it working with bukkit updates), then I got permission from the original author to take over development
How was your plugin received by the community at its first public release?
The reception was pretty good, since the majority of users using it at first needed the updates like me. There was one time when I was slow to an update, and several were talking about switching to an alternative plugin that did the same. If it improves your server, then go for it - that's the whole point of these plugins. I get suggestions occasionally, and I try to go through and determine if they are feasible. Of late, I've only had time for maintenance work, however.
Roughly how long did it take to complete the first usable version of CookieMonster?
I usually have fixes done in about an hour, depending on how reproducible the problem is. For feature additions, typically about 5 hours, I think. If I were to re-write the code from the ground-up (as I'm tempted to to - I'm not partial to the original coding style), it would likely take about 10 hours.
Did you come across any challenges during development and, if any, how did you handle them?
No challenges really stick out in my mind.. to me, the whole project is its own challenge, with smaller obstacles that aren't usually worth mention in comparison to the whole. An older problem (don't know if this has been fixed) was that the death event would fire twice. I solved this by adding a pre-death listener (onEntityDamage) to track who is killing what, then reward once if the entity died from a user. One of the bigger obstacles was when bukkit changed their event handlers, but only because it took me a while to figure out the new methods
What was your favourite development tool for this project?
For me, I use NetBeans. Mostly because that's the first Java IDE I used and didn't understand Eclipse when I tried it out, but also for the neat features I use, like automatic code formatting and code browsing (for when I want to see what that internal method or bukkit api actually does).
Have you learned anything new from this project?
In any project I work on, I always make an effort to do something I've never done before. One of those things in this project was the camping tracker: every time a creature dies, a point is written to a 3-dimensional map with the time of the death. It then counts the number of deaths in the nearby area within a time period, and a high value means that there is some form of spawn camping going on there (all these values are fully configurable)
What stage of CookieMonster’s development process did you enjoy most?
Feature additions - when I'm working on something fresh, new. It's nice to step back from it and see something useful that wasn't there before.
And what is your favourite feature of the plugin itself?
That would have to go to the aforementioned spawn camping tracker - that was fun to code.
Are you working on any other plugins or updates at the moment?
Not at the moment - right now, I'm working on answering these questions.
In all seriousness, though: when I get to it, I'll have another go to see if i can block/change exp drops (couldn't last I tried), add options for dropping enchanted items (I about have that one figured out), and options for permissions groups to modify drops/rewards.
As far as other plugins: I'm working on a full-rewrite of my BetterShop plugin, which is another that I acquired from another dev. That was the first I really worked on, and added more and more features on top without trying to streamline the flow, so it isn't as efficient as it could be. I'll be throwing out nonessential, odd features that might not naturally go with a shop, and adding new features, along with some methods that should (hopefully) make adding new features easier.
Also three others I wrote for my server.. I'll release those eventually, but I plan on adding some customizable options first. Not anytime soon, though: I'll be taking the CCNA cert exam soon, and spending spare time reviewing (never be too prepared, right?).
In addition to Minecraft plugins, have you ever released any custom content for other games?
Not publicly - Some games I've changed sounds and music for fun, and others I've modified mods to suit what I like, but nothing as in-depth or involved as Bukkit plugins.
Besides your own creations, what are some of your favourite plugins from other developers and why?
World Edit - need I say more? (although I have helped a few times with that one)
OpenInv - really nice to be able to grab something from a player that they shouldn't have without having to kill them. (I've also taken inspiration from this in other plugins)
DisguiseCraft - very fun to walk into a player's house as a creeper
RepairRecipe - probably don't need anymore, with anvils having been added, but i like the ability to repair tools on-the-go
ChessCraft - Chess! In Minecraft! (Ok, I may be a bit biased on this one, but it was a great idea, and I loved being able to work on it with the original dev)
Do you have any advice for other potential plugin developers?
Learn to use git, and commit changes regularly. Looking back at previous file changes can help should you mistakenly change something that you didn't mean to change.
If some other dev (or aspiring dev) likes your plugin, they may suggest code improvements that you can add directly (don't forget to pull any changes made on git before starting to edit again).
Also, as a dev myself, I don't add a plugin to my server unless the code is open-source and i read through it (or some of it) to see what it does and how it does it.
If a problem has you beat, get up, take a walk (maybe get a glass of water), then write down/sketch on paper what you are trying to solve. You can sometimes solve a problem faster with a new perspective than you may by just bashing your head against the keyboard.
Keep a pad of paper and writing utensil near your bed - sometimes my best revelations for solving a particular problem, or adding a nice feature, or even a bug I hadn't realized was there, come to me as I'm falling asleep
If you're unsure what to do for a problem, you can sometimes look at other plugins' code (don't forget about the bukkit code, either).
don't copy-paste code from another plugin, though - you should be looking for how to solve a problem, not the steps someone else took to do so - you may be able to find a better way of solving it than they. (not to mention it's rude to steal someone's work without their permission or credit).
If you do take a class from another plugin, you may want to change the package name by a bit - java only allows for one package-class at a time, and if they change their code and you don't make the same change, your plugin may break theirs, or theirs may break yours.
Also don't forget about licensing - some code licensing require your code to be released under their license if you use it in your plugin.
Thanks to jascotty2 for participating in our interview and for creating this plugin.
Thanks to MadPixel for the Minecrafter font.