I need help :/

Discussion in 'Plugin Development' started by Lucas325, Jul 26, 2018.

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

    Lucas325

    I'm trying to make that when a player dies, the console writes this command
    /rp removeall (name of the guy who died), but i am getting
    (For example, my name in minecraft is Lucas325)
    rp removeallLucas325

    (and i think the console is getting this like a STRING not like a cmd)

    Code:
    public class RpDelete implements Listener {
    
        @EventHandler
        public void quandoMorrer(PlayerDeathEvent e) {
          Player p = e.getEntity();
          if(p.isDead()) {
              Bukkit.getConsoleSender().sendMessage("rp removeall" + p.getName());
          }
      
        }
    
    }
    
     
    Last edited: Jul 26, 2018
  2. Offline

    Sploon

    Add a space between removeall and the ":
    "rp removeall " + p.getName()

    also why are you checking p.isDead()? The PlyerDeathEvent only fires when the player dies.
     
  3. Offline

    Lucas325

    ahhh thank you
     
  4. Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "rp removeall " + p.getName());
    I think, idk
     
    Lucas325 likes this.
  5. @Lucas325
    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "rp removeall " + p.getName());
     
    Lucas325 likes this.
  6. Offline

    TheKingElessar

    @Lucas325

    I assume that you can use e.getPlayer() instead of e.getEntity, since the PlayerDeathEvent will always be a player dying.

    Code:
    Player p = e.getPlayer();
    
     
    Lucas325 likes this.
Thread Status:
Not open for further replies.

Share This Page