Solved Doubled Message

Discussion in 'Plugin Development' started by EliteGuy, Jul 18, 2016.

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

    EliteGuy

    I've coded a plugin which tells you the cordinates after throwing an enderpearl.
    My Problem is: I receive the Message with the cordinates twice every time.

    There are no Errors.

    Here's my code:

    @EventHandler
    public void onHit(ProjectileHitEvent e) {
    if(e.getEntity() instanceof EnderPearl) {
    Player p = (Player) e.getEntity().getShooter();
    Location loc = e.getEntity().getLocation();

    int x = (int) loc.getX();
    int y = (int) loc.getY();
    int z = (int) loc.getZ();

    p.sendMessage("§Your cordinates: §cX: §b" + x + " §cY: §b" + y + " §cZ: §b" + z);

    }

    }
     
  2. Offline

    Tecno_Wizard

    @EliteGuy, you've probably registered the listener twice then.

    Btw, use the ChatColor enum instead of the color symbols. It will make your life a lot easier.
     
    MCMastery likes this.
Thread Status:
Not open for further replies.

Share This Page