InventoryClickEvent | isShiftClick() Is Not Working?

Discussion in 'Spigot Plugin Development' started by GodzillaCodes, Jun 3, 2016.

  1. For Some Reason it returns false even when I'm holding shift?

    My Code:

    if(event.isShiftClick()) {
    //do Stuff Here

    I am using 1.9.4 spigot.
  2. send more of your code, that little code will do nothing.
  3. Sorry, I can't at the moment, I'm away from my computer... Does it have something to do with me being in creative while testing?
  4. If you are holding shift when you click, that code should run. There must be some other line of code interfering here. Can you post more code when you are back at your computer.
  5. Once I'm back would you like my entire inventoryclickevent class?
  6. Sure, it'll gives us the most information to work with. Just be sure to format your code before you paste it so that all the spacing and indentation is uniform :)
  7. Here you go!

    Sorry if my code is messy.

    the isShiftClick() is near the bottom.
  8. Welp, there goes all my hope for huemins.
  9. Good god, my first suggestion is going to be to separate your code a bit. Use methods inside your if-statements. Will make everything much, much cleaner. As for your issue, the if-statement before the shift click if-statement checks to see if the clicked inventory has the same name as the player's inventory. Try two messages to the player; the first message being the name of the clicked inventory and the second being the name of the players inventory. Then you can see for your self if they actually are the same.
    • Like Like x 1
  10. I have already made sure its being run, I checked by printing something to the console if it was true, and it was... So I'm not sure..
  11. Please post all code, meaby another line have the error.
  12. All Code in the class? If so i have already posted it further up in the replys
  13. Hello what do you mean by not working e.isShiftClicking() ? how do you use it ?
  14. yup.. and tell me if u are other classes
  15. Heres the class

    I am using it near the bottom of the inventory click event, Check in pastbin
  16. I know you're using it in your class ofc you've posted it here, I exactly mean where is the error ? and what's wrong with.
  17. Even when im holding shift and clicking in my inventory, it still returns false...
  18. Code (Java):
    if(event.isShiftClick()) {
                        if(event.getCurrentItem().getData().getItemType().getMaxStackSize() == 1) {
    it has no else statement what do you mean by returning to false ?
  19. Code (Text):
    is returning false, i tested this by printing it to the console... Not sure why its false though, im holding shift while clicking in my inv?