Whats wrong with this code ???

Discussion in 'Bukkit Help' started by LeSyrQx, Aug 10, 2019.

  1. Offline

    LeSyrQx

    @EventHandler
    public void onMove(PlayerMoveEvent e) {
    Player p = e.getPlayer();
    Cshop.onshop(p);
    if(p.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.BARRIER) {

    if(p.getLastDamageCause().getEntityType() == null) {
    p.performCommand("s1p2362a62w52n43");
    Bukkit.broadcastMessage(Data.prefix + "Der Spieler§8 " + p.getName() + "§7 ist gestorben!");
    } else if(p.getLastDamageCause().getEntityType() == EntityType.PLAYER) {
    p.performCommand("s1p2362a62w52n43");
    Bukkit.broadcastMessage(Data.prefix + "Der Spieler§8 " + p.getName() + "§7 wurde von§8 " + p.getLastDamageCause().getEntityType().getName() + "§7 getötet!");
    }
    }
    }

    //I wanna make a plugin wehn a player is mooving on a barrier that the player is going to teleport him to the spawn and bukkit have to broadcast a death Message! But every time bukkit broadcast when The player wasn't hit by another Player that is null. I just wanna check if there was no player who hit the Player who walked on the barriers
     

Share This Page