@@ -54,28 +54,30 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @N
5454 }
5555
5656 if ((!Objects .equals (target .getMetadata ("sit" ).toString (), "[]" ) && target .getMetadata ("sit" ).getFirst ().asInt () == 0 ) || Objects .equals (target .getMetadata ("sit" ).toString (), "[]" )) {
57- if (target .isOnGround ()) {
58- Location loc = new Location (target .getWorld (), target .getLocation ().getBlockX () + 0.5 , target .getLocation ().getBlockY () - 0.96 + target .getLocation ().getY () % 1 , target .getLocation ().getBlockZ () + 0.5 );
59- loc .setYaw (target .getLocation ().getYaw ());
60- ArmorStand as = loc .getWorld ().spawn (loc , ArmorStand .class );
61- as .setBasePlate (false );
62- as .setArms (false );
63- as .setVisible (false );
64- as .setCanPickupItems (false );
65- as .setGravity (false );
66- as .setSmall (true );
67- as .setPassenger (target );
68- target .setMetadata ("sit" , new FixedMetadataValue (plugin , as .getEntityId ()));
57+ target .getScheduler ().execute (plugin , () -> {
58+ if (target .isOnGround ()) {
59+ Location loc = new Location (target .getWorld (), target .getLocation ().getBlockX () + 0.5 , target .getLocation ().getBlockY () - 0.96 + target .getLocation ().getY () % 1 , target .getLocation ().getBlockZ () + 0.5 );
60+ loc .setYaw (target .getLocation ().getYaw ());
61+ ArmorStand as = loc .getWorld ().spawn (loc , ArmorStand .class );
62+ as .setBasePlate (false );
63+ as .setArms (false );
64+ as .setVisible (false );
65+ as .setCanPickupItems (false );
66+ as .setGravity (false );
67+ as .setSmall (true );
68+ as .setPassenger (target );
69+ target .setMetadata ("sit" , new FixedMetadataValue (plugin , as .getEntityId ()));
6970
70- String msgOn = Other .Tools .chat (b + "[" + n + "SIT" + b + "]" + t + " Sit mode has been turned &aON" + t + "!" );
71- target .sendMessage (msgOn );
71+ String msgOn = Other .Tools .chat (b + "[" + n + "SIT" + b + "]" + t + " Sit mode has been turned &aON" + t + "!" );
72+ target .sendMessage (msgOn );
7273
73- if (!target .getName ().equals (sender .getName ())) {
74- sender .sendMessage (msgOn );
74+ if (!target .getName ().equals (sender .getName ())) {
75+ sender .sendMessage (msgOn );
76+ }
77+ } else {
78+ sender .sendMessage (Other .Tools .chat (b + "[" + n + "SIT" + b + "]" + t + " " + who + " must stand on a block!" ));
7579 }
76- } else {
77- sender .sendMessage (Other .Tools .chat (b + "[" + n + "SIT" + b + "]" + t + " " + who + " must stand on a block!" ));
78- }
80+ }, null , 0 );
7981 } else {
8082 Other .sCheck (target );
8183
0 commit comments