Xp Help

Discussion in 'Plugin Development' started by njb_said, Sep 21, 2012.

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

    njb_said

    Im trying to make a small plugin that when a player dies 1 xp level drops there regardless of wether they player who died had any xp
    I have looked at the jd and its not too easy to understand :p

    If someone could post some way of doing this?

    EDIT: I got this:
    Code:
     
          @EventHandler(priority=EventPriority.HIGH)
          public void onEntityDeath(EntityDeathEvent event) { if ((event.getEntity() instanceof Player)) {
              Player player = (Player)event.getEntity();
              player.giveExp(17);
          }
          }
    }
    But how do I make the orbs drop at the player death point
     
  2. Offline

    Maxel

  3. Offline

    ThatBox

    Might want to check if it is a player first. Or you get an error when an entity that is not a player dies.
     
  4. Offline

    Maxel

    if ((event.getEntity() instanceof Player))
     
  5. Offline

    Infamous Jeezy

    Code:
                ExperienceOrb orb = player.getWorld().spawn(Location, ExperienceOrb.class);
                orb.setExperience(1);
    
    Kinda an inconvenient way to do it if the other methods don't work as intended.
     
Thread Status:
Not open for further replies.

Share This Page