Ir para conteúdo
  • 0

[Resolvido] Ajuda delay


LuizB

Pergunta

Tipo porque o Codigo abaixo n funfa ?

tipo vc continua clicando e as bolas saindo

e o tempo nunca Acaba, fica só mandando as mensagem de aguarde, Quando clica

 

  @EventHandler
    public void interact(PlayerInteractEvent e){
        Action eventAction = e.getAction();
        final Player player = e.getPlayer();
        if (pyro.contains(player.getName())) {
        	if (eventAction == Action.RIGHT_CLICK_AIR || eventAction == Action.RIGHT_CLICK_BLOCK){
        		if (player.getItemInHand().getType().equals(Material.STONE_HOE)){
            	player.launchProjectile(Fireball.class).setVelocity(player.getLocation().getDirection().multiply(0.5));
            	if (!dly.contains(player)) {
                	dly.add(player);
                	Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) this, new Runnable() {
        				
        				public void run() {
        					dly.remove(player);
        					
        				}
        			}, Principal.cf.getConfig().getInt("Delay") * 20L);
                }else{
                	player.sendMessage(Principal.cf.getConfig().getString("MensagemDelay"));
                }
             }
            }
            }
        }
}  

OBS: o Delay que ta na config é 3

 



 

Link para o comentário
Compartilhar em outros sites

Posts Recomendados

 

dd


@EventHandler
    public void interact(PlayerInteractEvent e){
        Action eventAction = e.getAction();
        final Player player = e.getPlayer();
        if (pyro.contains(player.getName())) {
        if (eventAction == Action.RIGHT_CLICK_AIR || eventAction == Action.RIGHT_CLICK_BLOCK){
        if (player.getItemInHand().getType().equals(Material.STONE_HOE)) 
        if ((!dly.contains(player))) {
        dly.add(player);
            player.launchProjectile(Fireball.class).setVelocity(player.getLocation().getDirection().multiply(0.5));
                Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) this, new Runnable() {
       
        public void run() {
        dly.remove(player);
       
        }
        }, Principal.cf.getConfig().getInt("Delay") * 20L);
        }
        } else {
            player.sendMessage(Principal.cf.getConfig().getString("MensagemDelay"));
        }
      }
}
}
 

vlw tiu ai teste

 

mesma coisa  :(

Link para o comentário
Compartilhar em outros sites

@EventHandler
public void interact(PlayerInteractEvent e){
Action eventAction = e.getAction();
final Player player = e.getPlayer();
if (pyro.contains(player.getName())) {
    if (eventAction == Action.RIGHT_CLICK_AIR || eventAction == Action.RIGHT_CLICK_BLOCK){
        if (player.getItemInHand().getType().equals(Material.STONE_HOE)){
    if (!dly.contains(player)) {
    dly.add(player);
    player.launchProjectile(Fireball.class).setVelocity(player.getLocation().getDirection().multiply(0.5));
    Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) this, new Runnable() {
                
                public void run() {
                    dly.remove(player);
                    
                }
            }, Principal.cf.getConfig().getInt("Delay") * 20L);
}else{
    player.sendMessage(Principal.cf.getConfig().getString("MensagemDelay"));
}
}
}
}
}
} 

Resolvido, vlw flw.

Link para o comentário
Compartilhar em outros sites

@EventHandler
public void interact(PlayerInteractEvent e){
Action eventAction = e.getAction();
final Player player = e.getPlayer();
if (pyro.contains(player.getName())) {
    if (eventAction == Action.RIGHT_CLICK_AIR || eventAction == Action.RIGHT_CLICK_BLOCK){
        if (player.getItemInHand().getType().equals(Material.STONE_HOE)){
    if (!dly.contains(player)) {
    dly.add(player);
    player.launchProjectile(Fireball.class).setVelocity(player.getLocation().getDirection().multiply(0.5));
    Bukkit.getScheduler().scheduleSyncDelayedTask((Plugin) this, new Runnable() {
                
                public void run() {
                    dly.remove(player);
                    
                }
            }, Principal.cf.getConfig().getInt("Delay") * 20L);
}else{
    player.sendMessage(Principal.cf.getConfig().getString("MensagemDelay"));
}
}
}
}
}
} 

Resolvido, vlw flw.

 

tipo n sei pq ele n ta removendo o player da arrayList

Link para o comentário
Compartilhar em outros sites

Tá sim, ele remove após 20 * número que você colocou na config.

Eu coloquei 3 

 

o cara disse que 20L = 1 segundo, passei + de 1 minuto tentando clicar e n vai

 

Config:

 

#### Delay para Usar A Bola De Fogo (Obs Use Em Segundos) ####
 
Delay: 3
Editado por Cuthmf
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...