Skip to content

Commit

Permalink
Add option for enchantments levels in Hastey Boys (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
BelKed authored Feb 28, 2021
1 parent 9e81b04 commit ad9c750
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gmail.val59000mc.scenarios.scenariolisteners;

import com.gmail.val59000mc.scenarios.Option;
import com.gmail.val59000mc.customitems.CraftsManager;
import com.gmail.val59000mc.scenarios.ScenarioListener;
import org.bukkit.enchantments.Enchantment;
Expand All @@ -9,6 +10,12 @@

public class HasteyBoysListener extends ScenarioListener{

@Option(key = "efficiency")
private int efficiency = 3;

@Option(key = "durability")
private int durability = 1;

@EventHandler
public void onPlayerCraft(CraftItemEvent e){
ItemStack item = e.getCurrentItem();
Expand All @@ -19,8 +26,8 @@ public void onPlayerCraft(CraftItemEvent e){
}

try {
item.addEnchantment(Enchantment.DIG_SPEED,3);
item.addEnchantment(Enchantment.DURABILITY,1);
item.addEnchantment(Enchantment.DIG_SPEED,efficiency);
item.addEnchantment(Enchantment.DURABILITY,durability);
}catch (IllegalArgumentException ex){
// Nothing
}
Expand Down
7 changes: 6 additions & 1 deletion src/main/resources/scenarios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ achievementhunter:
# Amount of health players start with. (1 heart = 2 health)
health-at-start: 10
# Amount of health added per achievement.
health-added: 1
health-added: 1
hastey_boys:
# Level of Efficiency enchantment.
efficiency: 3
# Level of Durability enchantment.
durability: 1

0 comments on commit ad9c750

Please sign in to comment.