Commits
md_5 authored f47abd8878a
1 - | package org.bukkit.event.player; |
2 - | |
3 - | import org.bukkit.entity.ArmorStand; |
4 - | import org.bukkit.entity.Player; |
5 - | import org.bukkit.event.HandlerList; |
6 - | import org.bukkit.inventory.EquipmentSlot; |
7 - | import org.bukkit.inventory.ItemStack; |
8 - | import org.jetbrains.annotations.NotNull; |
9 - | |
10 - | /** |
11 - | * Called when a player interacts with an armor stand and will either swap, retrieve or place an item. |
12 - | */ |
13 - | public class PlayerArmorStandManipulateEvent extends PlayerInteractEntityEvent { |
14 - | |
15 - | private static final HandlerList handlers = new HandlerList(); |
16 - | |
17 - | private final ItemStack playerItem; |
18 - | private final ItemStack armorStandItem; |
19 - | private final EquipmentSlot slot; |
20 - | |
21 - | public PlayerArmorStandManipulateEvent( final Player who, final ArmorStand clickedEntity, final ItemStack playerItem, final ItemStack armorStandItem, final EquipmentSlot slot) { |
22 - | super(who, clickedEntity); |
23 - | this.playerItem = playerItem; |
24 - | this.armorStandItem = armorStandItem; |
25 - | this.slot = slot; |
26 - | } |
27 - | |
28 - | /** |
29 - | * Returns the item held by the player. If this Item is null and the armor stand Item is also null, |
30 - | * there will be no transaction between the player and the armor stand. |
31 - | * If the Player's item is null, but the armor stand item is not then the player will obtain the armor stand item. |
32 - | * In the case that the Player's item is not null, but the armor stand item is null, the players item will be placed on the armor stand. |
33 - | * If both items are not null, the items will be swapped. |
34 - | * In the case that the event is cancelled the original items will remain the same. |
35 - | * @return the item held by the player. |
36 - | */ |
37 - | |
38 - | public ItemStack getPlayerItem() { |
39 - | return this.playerItem; |
40 - | } |
41 - | |
42 - | /** |
43 - | * Returns the item held by the armor stand. |
44 - | * If this Item is null and the player's Item is also null, there will be no transaction between the player and the armor stand. |
45 - | * If the Player's item is null, but the armor stand item is not then the player will obtain the armor stand item. |
46 - | * In the case that the Player's item is not null, but the armor stand item is null, the players item will be placed on the armor stand. |
47 - | * If both items are not null, the items will be swapped. |
48 - | * In the case that the event is cancelled the original items will remain the same. |
49 - | * @return the item held by the armor stand. |
50 - | */ |
51 - | |
52 - | public ItemStack getArmorStandItem() { |
53 - | return this.armorStandItem; |
54 - | } |
55 - | |
56 - | /** |
57 - | * Returns the raw item slot of the armor stand in this event. |
58 - | * |
59 - | * @return the index of the item obtained or placed of the armor stand. |
60 - | */ |
61 - | |
62 - | public EquipmentSlot getSlot() { |
63 - | return this.slot; |
64 - | } |
65 - | |
66 - | |
67 - | |
68 - | public ArmorStand getRightClicked() { |
69 - | return (ArmorStand) this.clickedEntity; |
70 - | } |
71 - | |
72 - | |
73 - | |
74 - | public HandlerList getHandlers() { |
75 - | return handlers; |
76 - | } |
77 - | |
78 - | |
79 - | public static HandlerList getHandlerList() { |
80 - | return handlers; |
81 - | } |
82 - | } |
1 + | package org.bukkit.event.player; |
2 + | |
3 + | import org.bukkit.entity.ArmorStand; |
4 + | import org.bukkit.entity.Player; |
5 + | import org.bukkit.event.HandlerList; |
6 + | import org.bukkit.inventory.EquipmentSlot; |
7 + | import org.bukkit.inventory.ItemStack; |
8 + | import org.jetbrains.annotations.NotNull; |
9 + | |
10 + | /** |
11 + | * Called when a player interacts with an armor stand and will either swap, retrieve or place an item. |
12 + | */ |
13 + | public class PlayerArmorStandManipulateEvent extends PlayerInteractEntityEvent { |
14 + | |
15 + | private static final HandlerList handlers = new HandlerList(); |
16 + | |
17 + | private final ItemStack playerItem; |
18 + | private final ItemStack armorStandItem; |
19 + | private final EquipmentSlot slot; |
20 + | |
21 + | public PlayerArmorStandManipulateEvent( final Player who, final ArmorStand clickedEntity, final ItemStack playerItem, final ItemStack armorStandItem, final EquipmentSlot slot) { |
22 + | super(who, clickedEntity); |
23 + | this.playerItem = playerItem; |
24 + | this.armorStandItem = armorStandItem; |
25 + | this.slot = slot; |
26 + | } |
27 + | |
28 + | /** |
29 + | * Returns the item held by the player. If this Item is null and the armor stand Item is also null, |
30 + | * there will be no transaction between the player and the armor stand. |
31 + | * If the Player's item is null, but the armor stand item is not then the player will obtain the armor stand item. |
32 + | * In the case that the Player's item is not null, but the armor stand item is null, the players item will be placed on the armor stand. |
33 + | * If both items are not null, the items will be swapped. |
34 + | * In the case that the event is cancelled the original items will remain the same. |
35 + | * @return the item held by the player. |
36 + | */ |
37 + | |
38 + | public ItemStack getPlayerItem() { |
39 + | return this.playerItem; |
40 + | } |
41 + | |
42 + | /** |
43 + | * Returns the item held by the armor stand. |
44 + | * If this Item is null and the player's Item is also null, there will be no transaction between the player and the armor stand. |
45 + | * If the Player's item is null, but the armor stand item is not then the player will obtain the armor stand item. |
46 + | * In the case that the Player's item is not null, but the armor stand item is null, the players item will be placed on the armor stand. |
47 + | * If both items are not null, the items will be swapped. |
48 + | * In the case that the event is cancelled the original items will remain the same. |
49 + | * @return the item held by the armor stand. |
50 + | */ |
51 + | |
52 + | public ItemStack getArmorStandItem() { |
53 + | return this.armorStandItem; |
54 + | } |
55 + | |
56 + | /** |
57 + | * Returns the raw item slot of the armor stand in this event. |
58 + | * |
59 + | * @return the index of the item obtained or placed of the armor stand. |
60 + | */ |
61 + | |
62 + | public EquipmentSlot getSlot() { |
63 + | return this.slot; |
64 + | } |
65 + | |
66 + | |
67 + | |
68 + | public ArmorStand getRightClicked() { |
69 + | return (ArmorStand) this.clickedEntity; |
70 + | } |
71 + | |
72 + | |
73 + | |
74 + | public HandlerList getHandlers() { |
75 + | return handlers; |
76 + | } |
77 + | |
78 + | |
79 + | public static HandlerList getHandlerList() { |
80 + | return handlers; |
81 + | } |
82 + | } |