Plugin won't work

Discussion in 'Plugin Development' started by BlueCraftMC, Dec 29, 2015.

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

    BlueCraftMC

    So i already disabling item pickup, but i want it to remove that item when the player tries to drop it (press q).
    This is my code:
    @EventHandler

    public void onPickUpItem(PlayerPickupItemEvent event){

    Player player = event.getPlayer();

    if(!player.hasPermission("playerAbilities.allowed")){

    event.setCancelled(true);

    }



    }


    And i also tried to disable exp pickup but it seem to not work, this is the code:
    @EventHandler

    public void onExppickup(EntityTargetEvent event){

    Entity e = event.getEntity();

    if(e instanceof ExperienceOrb){

    event.setCancelled(true);

    event.setTarget(null);

    }

    }
     
    Last edited: Dec 29, 2015
  2. Offline

    Zombie_Striker

    @BlueCraftMC
    Please use the Insert>Code tags around your code. It's easier to see formatting that way.
     
  3. Offline

    Xerox262

    For the removing of "q" to drop just cancel and remove items on ItemDropEvent then for the exp changing use PlayerExpChangeEvent. (Or stop mobs from dropping the exp all together)
     
  4. Offline

    Areoace

    Make sure youve registered events in your main class and that your plugin.yml is set up correctly. Is the code giving any errors?
     
Thread Status:
Not open for further replies.

Share This Page