Checking if player clicking a enderchest inv

Discussion in 'Spigot Plugin Development' started by FroZenKeyboard, Apr 20, 2017.

  1. How can i check if a player is clicking in a ender chest inv and a player is creative, without perform any issues? Like can't drop items to his own inventory and so?
  2. 1. Do a PlayerInteractEvent
    2. Check if the e.getClickedBlock or whatever is an instanceof EnderChest
    3. With the 2# do an && or another if statement and check if e.getPlayer()#GameMode is equal to creative.
    4. Do whatever! :D
    P.S: Make sure to check if it isn't a block so you don't get a NullPointer!
  3. I want do it in clickevent, you can bypass it..
  4. Are you talking about the inventory? The player inventory? Or an enderchest inventory?
  5. Actually you can run a check on the type of chest, which would be useful if you don't have any type of customer enderchest or anything like that -

    Code (Text):
           //do stuff
  6. Beat me to it >.<
    • Friendly Friendly x 1