Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SubscribeEvent
- public void onItemCraftedByPlayer(ItemCraftedEvent event)
- {
- CraftingRequirement requirement = CraftingRequirement.getCraftingRequirement(event.crafting);
- if(requirement != null)
- {
- ItemStack stack = event.crafting;
- //ExperienceReward is acquired from the amount made and the experience reward multiplied
- int experienceReward = stack.stackSize * requirement.getExperienceReward();
- //Gives experience to the player
- SuperSkill.get(event.player, SkillDB.SKILL_NAMES.Crafting.toString()).giveXp(experienceReward);
- if(requirement.isCollectable())
- {
- //Get the index of the stack being created
- int indexOfCollection = CollectionWrapper.getIndexOfCollection(Item.getIdFromItem(stack.getItem()), stack.getMetadata());
- if(indexOfCollection != -1)
- {
- //Increase the collection stat by the stack size
- ((Collection)SuperSkill.get(event.player, SkillDB.SKILL_NAMES.Collection.toString())).incrementCollectionStatByAmount(indexOfCollection, stack.stackSize);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement