Sending Messages Twice!!

Discussion in 'Plugin Development' started by AmirKing, Feb 26, 2020.

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

    AmirKing

    Hello, I'm trying to make a comp shareit appvn
    Spray brake clean around the lines and if there's a leak the idle will change due to the cleaner being sucked in also you can squeeze the lines at the intake and see if your miss fire goes away normally if there is a large leak you will hear a hissing sound.


    ass that can track the n s


    import java.util.List;

    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerInteractEvent;

    public class Compass implements Listener
    {
    private Main plugin;

    public Compass(Main plugin)
    {
    this.plugin = plugin;
    plugin.getServer().getPluginManager().registerEvents(this, plugin);
    }

    @EventHandler
    public void onPlayerRightClic(PlayerInteractEvent event)
    {
    Player p = event.getPlayer();
    List<String> fPlayersList = plugin.getConfig().getStringList("freezing");
    if(!(fPlayersList.contains(p.getName())))
    {
    if(p.getInventory().getItemInMainHand().getType() == Material.COMPASS)
    {
    Player nPlayer = null;
    Location pLoc = p.getLocation();
    double dist = 0.0D;
    double nDist = 0.0D;
    for (Player t : p.getWorld().getPlayers())
    {
    if(fPlayersList.contains(t.getName()))
    {
    Location tLoc = t.getLocation();
    dist = pLoc.distance(tLoc);
    if(nDist == 0.0D || dist < nDist)
    {
    nDist = dist;
    nPlayer = t;
    }
    }
    }
    if (nPlayer == null)
    {
    p.sendMessage("There are no trackable players online!");
    }
    else
    {
    p.setCompassTarget(nPlayer.getLocation());
    p.sendMessage("You are now tracking " + nPlayer.getName());
    }
    }
    }
    }
    }

    The Main code:
    Code:
    package me.juan.freezing;
    import java.util.List;

    import org.bukkit.Bukkit;
    import org.bukkit.Location;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.util.Vector;

    import me.juan.freezing.commands.FreezingCommand;



    public class Main extends JavaPlugin
    {
    @Override
    public void onEnable()
    {
    new FreezingCommand(this);
    new PlayerAttack(this);
    new Compass(this);
    Bukkit.getScheduler().runTaskTimer(this, new Runnable()
    {

    @Override
    public void run()
    {
    freeze();
    }

    }, 0, 1L);[/code]
     
    Last edited: Feb 27, 2020
  2. Offline

    timtower Administrator Administrator Moderator

    @AmirKing You are not checking which hand is being used, the event fires for both.
     
Thread Status:
Not open for further replies.

Share This Page