InventoryClickEvent getAction

Discussion in 'Plugin Development' started by knokko, Jan 12, 2019 at 1:10 PM.

  1. Offline

    knokko

    I was writing a plug-in, and it appeared that a function broke that requires the getAction method of the InventoryClickEvent. The problem is that the getAction method always returns PLACE_ALL, no matter what I do in my inventory.

    To test this, I created a very small test plug-in:
    Code:
    import org.bukkit.Bukkit;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.inventory.InventoryClickEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class TestPlugin extends JavaPlugin implements Listener {
      
        @Override
        public void onEnable() {
            Bukkit.getPluginManager().registerEvents(this, this);
        }
      
        @EventHandler
        public void onInvClick(InventoryClickEvent event) {
            System.out.println("action is " + event.getAction() + " and slot type is " + event.getSlotType());
        }
    }
    I ran my craftbukkit server with only this plug-in, and according to the console output from the onInvClick, the action of every fired event is still always PLACE_ALL.
    Does anyone know more about this? Is this method deprecated or something?

    EDIT: I forgot to mention I use the latest build of 1.12.2
     
    Last edited: Jan 13, 2019 at 1:15 AM
  2. Offline

    knokko

    Allright, since nobody seems to know anything about this and the getAction() used to work, I assume this is some kind of bug. If so, what would be the best place to report it?

    And I remember that this worked fine in the past, so is it possible to obtain an old craftbukkit build?
     
  3. Offline

    KarimAKL

    @knokko What version are you using?
     
  4. Offline

    knokko

    @KarimAKL

    I use the latest build of 1.12.2 (I also tried 1.12 and 1.12.1, the same happens in those versions).
     
  5. Offline

    DutchJellyV2

    Have you tried shiftclicking items or ctrlclicking them?
     
  6. Offline

    knokko

    @DutchJellyV2

    For control clicking, the result is also PLACE_ALL (just like all other actions).
    Shift clicking first 2 events, where both actions are PLACE_ALL.
     

Share This Page