Check when a player equips armor

Discussion in 'Plugin Development' started by wwzt, Nov 19, 2021.

  1. Offline


    I know this has been discussed before but I couldnt find an answer that helps me. I want to give a player invisibilty when he equips boots but i dont know how to do that. I already tried various things but nothing worked. I just need a simple solution on how to do this.

    Please excuse my bad spelling and grammar im not very good at english.
  2. Offline


    You have to handle InventoryClickEvent and PlayerInteractEvent for equipping through clicking the inventory and right clicking boots in the hotbar respectively.
    Since this is slightly complex, i'll spoonfeed you this to get you started.
    List<MaterialbootsMaterialList = new ArrayList<>();
    // ^ fill this with all Materials for every type of boots

    public void onEquipEvent(InventoryClickEvent event) {
        if (!(
    event.getWhoClicked() instanceof Player))

    Player player = (Playerevent.getWhoClicked();

    ItemStack eventItem event.getCurrentItem();
        if (
    eventItem == null || !bootsMaterialList.contains(eventItem.getType())

    Runnable task = new Runnable() {
    public void run() {
    ItemStack boots player.getInventory().getBoots();
                if (
    boots == eventItem) {
    // player successfully equipped boots
    It comes from one of my plugins, with slight changes. I did not test this.
    Good luck.
  3. Offline


Share This Page