- 1,964 views, 0 today
- 4
- 2
- 4
33
Welcome here dear PMC'ers,
Today I'm going to learn you how you can disable the recipes you want. This can come in very handy if you are making your own role-play servers or some of that kind. These can be used to stop people from crafting specified things. I hope you learn something from this tutorial and please check out my website below aswel as the Bukkit docs and the medieval-craft website.
Medieval-Craft
My Website
Bukkit Docs
1) The project of last lesson or a new one.
2) A bunch of papers if you want to take some notes.
3) A big portion of patience
And now once again you have finished your plugin. With this you can disabled every recipe you want. Make sure to check out the links at the top of this page and I hope to see you all soon again.
peace out!
Today I'm going to learn you how you can disable the recipes you want. This can come in very handy if you are making your own role-play servers or some of that kind. These can be used to stop people from crafting specified things. I hope you learn something from this tutorial and please check out my website below aswel as the Bukkit docs and the medieval-craft website.
Medieval-Craft
My Website
Bukkit Docs
Things you will need this lesson :
1) The project of last lesson or a new one.
2) A bunch of papers if you want to take some notes.
3) A big portion of patience
Getting Started
Click to reveal
Now we are going to start with the Iterator, an Iterator can be compared with ArrrayLists and that kind of stuff. But Iterators are way more easy to use with Recipes. So we start off with Iterator <---- this declares what will be in the Iterator. Then we give it the name in this case recipes. Then it's followed by = and then Bukkit.getServer().recipeIterator(); This gets all the Recipes of the server.
Click to reveal
Now we are going to start with a while, that's just like an if statement. so while(recipes.hasNext()){ } There we are going to put the code for executing the removing of the recipe.
Now we are going to make it so the plugin keeps scrolling through all the recipes until it has found the right one. You do that with recipe = recipes.next(); You really can't forget this part.
Now we are going to add an if statement that blocks out the not wanted recipes. This involves a lot of code. We are first going to check if the recipe isn't null and if the result of the recipe is wood. and only if the result has a durability of one, then the recipe will be disabled. You can find the code in the picture down here.
And now once again you have finished your plugin. With this you can disabled every recipe you want. Make sure to check out the links at the top of this page and I hope to see you all soon again.
peace out!
Tags |
1 Update Logs
Update #1 : by evilguy4000 11/14/2013 4:33:03 pmNov 14th, 2013
Awesome Tutorial :o
2548590
6
Create an account or sign in to comment.