Commits

TheCreeperCow authored and md_5 committed 0e11bc1faa7
#522: Add piglin bartering API
No tags

src/main/java/org/bukkit/entity/Piglin.java

Modified
1 1 package org.bukkit.entity;
2 2
3 +import java.util.Set;
4 +import org.bukkit.Material;
5 +import org.bukkit.inventory.InventoryHolder;
6 +import org.jetbrains.annotations.NotNull;
7 +
3 8 /**
4 9 * Represents a Piglin.
5 10 */
6 -public interface Piglin extends PiglinAbstract {
11 +public interface Piglin extends PiglinAbstract, InventoryHolder {
7 12
8 13 /**
9 14 * Get whether the piglin is able to hunt hoglins.
10 15 *
11 16 * @return Whether the piglin is able to hunt hoglins
12 17 */
13 18 public boolean isAbleToHunt();
14 19
15 20 /**
16 21 * Sets whether the piglin is able to hunt hoglins.
17 22 *
18 23 * @param flag Whether the piglin is able to hunt hoglins.
19 24 */
20 25 public void setIsAbleToHunt(boolean flag);
26 +
27 + /**
28 + * Adds a material to the allowed list of materials to barter with.
29 + *
30 + * @param material The material to add
31 + *
32 + * @return true if the item has been added successfully, false otherwise
33 + */
34 + public boolean addBarterMaterial(@NotNull Material material);
35 +
36 + /**
37 + * Removes a material from the allowed list of materials to barter with.
38 + *
39 + * <strong>Note:</strong> It's not possible to override the default
40 + * bartering item gold_ingots as payment. To block gold_ingots see
41 + * {@link org.bukkit.event.entity.PiglinBarterEvent}.
42 + *
43 + * @param material The material to remove
44 + *
45 + * @return true if the item has been removed successfully, false otherwise
46 + */
47 + public boolean removeBarterMaterial(@NotNull Material material);
48 +
49 + /**
50 + * Adds a material the piglin will pickup and store in his inventory.
51 + *
52 + * @param material The material you want the piglin to be interested in
53 + *
54 + * @return true if the item has been added successfully, false otherwise
55 + */
56 + public boolean addMaterialOfInterest(@NotNull Material material);
57 +
58 + /**
59 + * Removes a material from the list of materials the piglin will pickup.
60 + *
61 + * <strong>Note:</strong> It's not possible to override the default list of
62 + * item the piglin will pickup. To cancel pickup see
63 + * {@link org.bukkit.event.entity.EntityPickupItemEvent}.
64 + *
65 + * @param material The material you want removed from the interest list
66 + * @return true if the item has been removed successfully, false otherwise
67 + */
68 + public boolean removeMaterialOfInterest(@NotNull Material material);
69 +
70 + /**
71 + * Returns a immutable set of materials the piglins will pickup.
72 + * <br>
73 + * <strong>Note:</strong> This set will not include the items that are set
74 + * by default. To interact with those items see
75 + * {@link org.bukkit.event.entity.EntityPickupItemEvent}.
76 + *
77 + * @return An immutable materials set
78 + */
79 + @NotNull
80 + public Set<Material> getInterestList();
81 +
82 + /**
83 + * Returns a immutable set of materials the piglins will barter with.
84 + *
85 + * <strong>Note:</strong> This set will not include the items that are set
86 + * by default. To interact with those items see
87 + * {@link org.bukkit.event.entity.PiglinBarterEvent}.
88 + *
89 + * @return An immutable materials set
90 + */
91 + @NotNull
92 + public Set<Material> getBarterList();
21 93 }

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

Add shortcut