Stopping exp orb pickup

Discussion in 'Plugin Development' started by Spartan_V23, Jun 3, 2012.

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

    Spartan_V23

    I was trying to add a config feature to a plugin and what I thought would work didnt.

    I tryed using an event like. . .
    Code:
    @EventHandler(priority=EventPriority.HIGHEST)
    public void onPlayerInteractionEntity(PlayerInteractEntityEvent e){
    if(getConfig().getBoolean("configs.no_player_interaction_entity")){
    e.setCancelled(true);
    return;
    }
    }
    
    But this doesnt seem to detect exp orb. I also have a ItemPickupEvent in my code and that as well does not stop the pickup of exp orbs (I know it works though because it stops the pickup of other items). So I am at a loss of what to try...

    So to sum it up. I need the code used to stop the pickup of exp orbs (The event method that is used). Thanks in advance for any help given :D
     
  2. You might want to try PlayerExpChangeEvent, but i am not sure:/
    greetz blackwolf12333
     
  3. Offline

    Spartan_V23


    Ill try it right now and let you know what happens.

    EDIT: Does not work. This is only for when the player has "recieved" exp. Not the event leading up too it. Thanks for the try though :D
     
  4. Try the entitydeath event and get the dropped exp,
    Code:
    event.getdrops.clear();
    something like that im on phone so may be wrong
     
  5. Offline

    Spartan_V23

    Ill give this a try. Ill reply with how it goes.

    Didn't work. Thanks for the try. Any others?

    Does anyone know how to do this..? I am at a loss lol..

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  6. There are plugins that make players not pick up items, did you look into those plugins' source code ?

    EDIT: It seems they listen to PlayerPickupItemEvent and cancel it to prevent pickup, so if it doesn't trigger for exp orbs I dunno, suggest it to bukkit at the Bugs tab :p
     
  7. Offline

    jamietech

    There's currently no event for Experience Orb Pickup but I believe it has been suggested before. The only thing you could do is remove the experience drops from an EntityDeath with event.setExpDrops(0);

    EDIT: The correct method is setDroppedExp(int amount);
     
  8. Offline

    Spartan_V23


    Unfortunatly this wont work completely. This wont stop the exp pickup from lets say a poition of enchanting. Ahh well... Ill just work with what ive got. Thanks for the help everyone.
     
  9. Spartan_V23
    But you can prevent the potion from beeing used in the first place tough.

    However, it really depends on the goal of the plugin... if nobody is meant to pickup orbs then you shouldn't allow the orbs to spawn in the first place rather than preventing pickup.
     
  10. Offline

    Spartan_V23

    This is a config add-on for my plugin SimpleConceal. I am adding a config file for all "events' server owners might want to avoid. I.E> item pickup. This is why I wanted to stop the pickup of exp orbs. Stopping the spawn of the orbs completely doesn't achieve the goal.
     
  11. Offline

    jamietech

    If no-one can pick the drops up why should they be in the world in the first place?
     
  12. Offline

    Spartan_V23

    But thats not up to me as the plugin dev. Thats up to the person who operates the server :\
     
  13. And how is the "preventing exp orb spawning" option diferent from the "preventing pickup of exp orbs" option ? Apart from the obvious lag reduction since there won't be any pointless exp orbs around... and the fact that it works, since there seems to not be a way to prevent exp orbs from beeing picked up.

    Still, you didn't quite explain your plugin purpose, these replies are from what we understand your plugin does, which is not much.
     
  14. Offline

    Spartan_V23


    I had mentioned it above in a reply. This is for a configurable event "configs.no_pickup" inside my plugin SimpleConceal. SimpleConceals function is to provide lightweight and simple invisibility. That being said Completely stopping exp spawn just seems like its a bit beyond the scope of this project.
     
  15. Offline

    jamietech

    Yes, for a player invisibility plugin, removing drops seems stupid.
    You're going to have to wait for someone to make a PR.
     
Thread Status:
Not open for further replies.

Share This Page