Cancelling dismount and remounting player if matches

Discussion in 'Plugin Development' started by Dr.Tsuragu, May 27, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    Dr.Tsuragu

    I am trying to cancel a armorstand dismount if it matches a name and the player is in a hashset:


    Code:
    @EventHandler
    public void onDismountEvent(EntityDismountEvent event) {
       if (event.getDismounted() instanceof ArmorStand) {
          Player p = (Player) event.getEntity();
          Entity x = event.getDismounted();
          if (x.getName().contains("foobar")) {
              if (standset1.contains(p.getName().toLowerCase())){
                 x.setPassenger(p);
                 event.setCancelled(true);
                 return;
              } else {
                 //allow dismount
              }
         }
      }
    }

    But this makes it the client side you do dismount but serverside your still on the armorstand, its been mindnumbing me for 3 days now and I've tried everything and searched high and low to find something to help me understand how to correct this issue.

    (Server info: V-1.16.5)
     
  2. Offline

    darthvader1925

    What do you mean disabling armorstand dismount?
     
Thread Status:
Not open for further replies.

Share This Page