Solved PlayerPickUpEvent problem

Discussion in 'Plugin Development' started by nastasescu, Sep 7, 2014.

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

    nastasescu

    Hello again, i have a problem with my pickupevent...
    Code:java
    1. @EventHandler
    2. public void onPlayerPickUp(PlayerPickupItemEvent e) {
    3. if (e.getItem() == new ItemStack(Material.EMERALD_BLOCK)) {
    4. Block block = Bukkit.getWorld("world").getBlockAt(
    5. new Location(Bukkit.getWorld("world"), 508.5, 3.0, -72.5));
    6. block.setType(Material.GOLD_BLOCK);
    7. dropped = false;
    8. } else {
    9. e.setCancelled(true);
    10. }
    11. }

    That's what i want but when i try to pick up an emerald block, i can't pick up the block...
     
  2. Did you register the event?
     
  3. Offline

    nastasescu

    Of course, i have like 5 events in the script :D

    Another question is, how can i make a dropItem to do not jump? I tried and dont works...
    Code:java
    1. Item drop = Bukkit.getWorld("world").dropItem(
    2. new Location(Bukkit.getWorld("world"),
    3. 508.5, 4.0, -72.5),
    4. new ItemStack(Material.EMERALD_BLOCK));
    5. drop.setVelocity(new Vector(0, 0, 0));


    nastasescu resolved the question
    BUMP

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  4. Offline

    nastasescu

  5. Offline

    SmooshCakez

    Items are rendered client side, 99% sure you can't change that.
    Don't check if it's the specific ItemStack. It can't just be emerald, it has to match that ItemStack. Check if e.getItem().getType() == Material.EMERALD_BLOCK instead.
     
  6. Offline

    nastasescu

    Thanks!
     
Thread Status:
Not open for further replies.

Share This Page