Commits

Lukas A authored and md_5 committed 1603bcf4676
Add EnchantmentOffer to PrepareItemEnchantEvent
No tags

src/main/java/org/bukkit/enchantments/EnchantmentOffer.java

Added
1 +package org.bukkit.enchantments;
2 +
3 +import org.apache.commons.lang.Validate;
4 +
5 +/**
6 + * A class for the available enchantment offers in the enchantment table.
7 + */
8 +public class EnchantmentOffer {
9 +
10 + private Enchantment enchantment;
11 + private int enchantmentLevel;
12 + private int cost;
13 +
14 + public EnchantmentOffer(Enchantment enchantment, int enchantmentLevel, int cost) {
15 + this.enchantment = enchantment;
16 + this.enchantmentLevel = enchantmentLevel;
17 + this.cost = cost;
18 + }
19 +
20 + /**
21 + * Get the type of the enchantment.
22 + *
23 + * @return type of enchantment
24 + */
25 + public Enchantment getEnchantment() {
26 + return enchantment;
27 + }
28 +
29 + /**
30 + * Sets the type of the enchantment.
31 + *
32 + * @param enchantment type of the enchantment
33 + */
34 + public void setEnchantment(Enchantment enchantment) {
35 + Validate.notNull(enchantment, "The enchantment may not be null!");
36 +
37 + this.enchantment = enchantment;
38 + }
39 +
40 + /**
41 + * Gets the level of the enchantment.
42 + *
43 + * @return level of the enchantment
44 + */
45 + public int getEnchantmentLevel() {
46 + return enchantmentLevel;
47 + }
48 +
49 + /**
50 + * Sets the level of the enchantment.
51 + *
52 + * @param enchantmentLevel level of the enchantment
53 + */
54 + public void setEnchantmentLevel(int enchantmentLevel) {
55 + Validate.isTrue(enchantmentLevel > 0, "The enchantment level must be greater than 0!");
56 +
57 + this.enchantmentLevel = enchantmentLevel;
58 + }
59 +
60 + /**
61 + * Gets the cost in experience levels the player has to pay to enchant his
62 + * item with this enchantment.
63 + *
64 + * @return cost for this enchantment
65 + */
66 + public int getCost() {
67 + return cost;
68 + }
69 +
70 + /**
71 + * Sets the cost in experience levels the player has to pay to enchant his
72 + * item with this enchantment
73 + *
74 + * @param cost cost for this enchantment
75 + */
76 + public void setCost(int cost) {
77 + Validate.isTrue(cost > 0, "The cost must be greater than 0!");
78 +
79 + this.cost = cost;
80 + }
81 +}

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut