4
4
import me .Fupery .StandsPlus .Recipe .StandKey ;
5
5
import me .Fupery .StandsPlus .StandsPlus ;
6
6
import me .Fupery .StandsPlus .Utils .SoundCompat ;
7
+ import org .bukkit .Sound ;
7
8
import org .bukkit .entity .ArmorStand ;
8
9
import org .bukkit .entity .Entity ;
9
10
import org .bukkit .entity .EntityType ;
@@ -31,7 +32,7 @@ public PlayerInteractListener(StandsPlus plugin) {
31
32
32
33
@ EventHandler
33
34
public void onPlayerInteract (PlayerInteractEvent event ) {
34
- if (StandKey .isValidMaterial (event .getPlayer ().getItemInHand ())) {
35
+ if (StandKey .isValidMaterial (event .getPlayer ().getInventory (). getItemInMainHand ())) {
35
36
if (event .getAction () == Action .RIGHT_CLICK_BLOCK ) {
36
37
event .setCancelled (true );
37
38
}
@@ -43,7 +44,7 @@ public void onPlayerDamageEntity(EntityDamageByEntityEvent event) {
43
44
if (event .getDamager () instanceof Player && checkValidStand (event .getEntity ())) {
44
45
Player player = ((Player ) event .getDamager ());
45
46
ArmorStand stand = ((ArmorStand ) event .getEntity ());
46
- if (StandKey .isValidMaterial (player .getItemInHand ())) {
47
+ if (StandKey .isValidMaterial (player .getInventory (). getItemInMainHand ())) {
47
48
event .setCancelled (true );
48
49
Vector vecDiff = stand .getLocation ().toVector ().subtract (player .getLocation ().toVector ());
49
50
Vector vector = vecDiff .normalize ().multiply (.1 );
@@ -72,10 +73,10 @@ private boolean checkValidStand(Entity entity) {
72
73
73
74
private void handleClick (Cancellable event , Player player , Entity clicked ) {
74
75
if (!event .isCancelled () && checkValidStand (clicked )
75
- && StandKey .isValidMaterial (player .getItemInHand ())) {
76
+ && StandKey .isValidMaterial (player .getInventory (). getItemInMainHand ())) {
76
77
event .setCancelled (true );
77
78
new StandMenu (plugin , ((ArmorStand ) clicked )).open (plugin , player );
78
- SoundCompat . BLOCK_WOOD_BUTTON_CLICK_ON .play (player );
79
+ new SoundCompat ( Sound . BLOCK_WOODEN_BUTTON_CLICK_ON ) .play (player );
79
80
}
80
81
}
81
82
}
0 commit comments