Commits
coll1234567 authored and md_5 committed fde5602a24e
1 + | package org.bukkit.event.player; |
2 + | |
3 + | import org.bukkit.entity.Player; |
4 + | import org.bukkit.event.HandlerList; |
5 + | import org.jetbrains.annotations.NotNull; |
6 + | |
7 + | /** |
8 + | * Called when a player changes recipe book settings. |
9 + | */ |
10 + | public class PlayerRecipeBookSettingsChangeEvent extends PlayerEvent { |
11 + | |
12 + | private static final HandlerList handlers = new HandlerList(); |
13 + | private final RecipeBookType recipeBookType; |
14 + | private final boolean open; |
15 + | private final boolean filtering; |
16 + | |
17 + | public PlayerRecipeBookSettingsChangeEvent( final Player player, final RecipeBookType recipeBookType, final boolean open, final boolean filtering) { |
18 + | super(player); |
19 + | this.recipeBookType = recipeBookType; |
20 + | this.open = open; |
21 + | this.filtering = filtering; |
22 + | } |
23 + | |
24 + | /** |
25 + | * Gets the type of recipe book the player is changing the settings for. |
26 + | * |
27 + | * @return the type of recipe book |
28 + | */ |
29 + | |
30 + | public RecipeBookType getRecipeBookType() { |
31 + | return recipeBookType; |
32 + | } |
33 + | |
34 + | /** |
35 + | * Checks if the recipe book is being opened or closed. |
36 + | * |
37 + | * @return true if opening |
38 + | */ |
39 + | public boolean isOpen() { |
40 + | return open; |
41 + | } |
42 + | |
43 + | /** |
44 + | * Checks if the recipe book filter is being enabled or disabled. |
45 + | * |
46 + | * @return true if enabling |
47 + | */ |
48 + | public boolean isFiltering() { |
49 + | return filtering; |
50 + | } |
51 + | |
52 + | |
53 + | |
54 + | public HandlerList getHandlers() { |
55 + | return handlers; |
56 + | } |
57 + | |
58 + | |
59 + | public static HandlerList getHandlerList() { |
60 + | return handlers; |
61 + | } |
62 + | |
63 + | /** |
64 + | * Enum representing the various types of recipe book. |
65 + | * <br> |
66 + | * Different types of recipe book are shown in different GUIs. |
67 + | */ |
68 + | public enum RecipeBookType { |
69 + | |
70 + | /** |
71 + | * Recipe book seen in crafting table and player inventory. |
72 + | */ |
73 + | CRAFTING, |
74 + | /** |
75 + | * Recipe book seen in furnace. |
76 + | */ |
77 + | FURNACE, |
78 + | /** |
79 + | * Recipe book seen in blast furnace. |
80 + | */ |
81 + | BLAST_FURNACE, |
82 + | /** |
83 + | * Recipe book seen in smoker. |
84 + | */ |
85 + | SMOKER; |
86 + | } |
87 + | } |