Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
ClickType.java
1 package org.bukkit.event.inventory;
2 
3 /**
4  * What the client did to trigger this action (not the result).
5  */
6 public enum ClickType {
7 
8  /**
9  * The left (or primary) mouse button.
10  */
12  /**
13  * Holding shift while pressing the left mouse button.
14  */
16  /**
17  * The right mouse button.
18  */
20  /**
21  * Holding shift while pressing the right mouse button.
22  */
24  /**
25  * Clicking the left mouse button on the grey area around the inventory.
26  */
28  /**
29  * Clicking the right mouse button on the grey area around the inventory.
30  */
32  /**
33  * The middle mouse button, or a "scrollwheel click".
34  */
36  /**
37  * One of the number keys 1-9, correspond to slots on the hotbar.
38  */
40  /**
41  * Pressing the left mouse button twice in quick succession.
42  */
44  /**
45  * The "Drop" key (defaults to Q).
46  */
48  /**
49  * Holding Ctrl while pressing the "Drop" key (defaults to Q).
50  */
52  /**
53  * Any action done with the Creative inventory open.
54  */
56  /**
57  * A type of inventory manipulation not yet recognized by Bukkit.
58  * <p>
59  * This is only for transitional purposes on a new Minecraft update, and
60  * should never be relied upon.
61  * <p>
62  * Any ClickType.UNKNOWN is called on a best-effort basis.
63  */
65  ;
66 
67  /**
68  * Gets whether this ClickType represents the pressing of a key on a
69  * keyboard.
70  *
71  * @return true if this ClickType represents the pressing of a key
72  */
73  public boolean isKeyboardClick() {
74  return (this == ClickType.NUMBER_KEY) || (this == ClickType.DROP) || (this == ClickType.CONTROL_DROP);
75  }
76 
77  /**
78  * Gets whether this ClickType represents an action that can only be
79  * performed by a Player in creative mode.
80  *
81  * @return true if this action requires Creative mode
82  */
83  public boolean isCreativeAction() {
84  // Why use middle click?
85  return (this == ClickType.MIDDLE) || (this == ClickType.CREATIVE);
86  }
87 
88  /**
89  * Gets whether this ClickType represents a right click.
90  *
91  * @return true if this ClickType represents a right click
92  */
93  public boolean isRightClick() {
94  return (this == ClickType.RIGHT) || (this == ClickType.SHIFT_RIGHT);
95  }
96 
97  /**
98  * Gets whether this ClickType represents a left click.
99  *
100  * @return true if this ClickType represents a left click
101  */
102  public boolean isLeftClick() {
103  return (this == ClickType.LEFT) || (this == ClickType.SHIFT_LEFT) || (this == ClickType.DOUBLE_CLICK) || (this == ClickType.CREATIVE);
104  }
105 
106  /**
107  * Gets whether this ClickType indicates that the shift key was pressed
108  * down when the click was made.
109  *
110  * @return true if the action uses Shift.
111  */
112  public boolean isShiftClick() {
113  return (this == ClickType.SHIFT_LEFT) || (this == ClickType.SHIFT_RIGHT) || (this == ClickType.CONTROL_DROP);
114  }
115 }