Solved Inventory Item move event help

Discussion in 'Plugin Development' started by jthort, Dec 9, 2013.

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

    jthort

    I'm having trouble checking if the player performing this event is in a specific world. I can't find a way to get the player who is performing this event, any help?

    Code:java
    1. @EventHandler(priority = EventPriority.NORMAL)
    2. public void onInventoryMoveItemEvent(final InventoryMoveItemEvent event) {
    3. World world = Bukkit.getWorld("hubworld");
    4. Player p = event.getPlayer();
    5. if (world == p.getWorld()) {
    6. event.setCancelled(true);
    7. }
    8. }
    9.  
     
  2. Offline

    The_Doctor_123

    This should work.
    Code:java
    1. Player p = (Player) event.getSource().getHolder();
     
    jthort likes this.
  3. Offline

    jthort

    Thanks I'll try it when I get the chance.
     
Thread Status:
Not open for further replies.

Share This Page