Ir para conteúdo
  • 0

[Resolvido] Potion...


TequilAxBr

Pergunta

13 respostass a esta questão

Posts Recomendados

Guest ~iNotLinduh.

Assim Meu Querido :S

 

ItemStack Potion = new ItemStack(Material.POTION);
PotionMeta PotionM = (PotionMeta) Potion.getItemMeta(); 
PotionM.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 200 * 100, 1), true); 
PotionM.addCustomEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 200 * 200, 1), true); 
PotionM.addCustomEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 200 * 200, 1), true); 
PotionM.addCustomEffect(new PotionEffect(PotionEffectType.REGENERATION, 200 * 200, 1), true); 
	    PotionM.setDisplayName("§cPoção Modinha");
	    Potion.setItemMeta(PotionM);

//Não Tenho Certeza Mas O Tempo É Em "Tickets", 200 = 10 Segundos, *(Multiplicado) Por 100 "Tickets",
//Eu Fiz 200 * 200, Deu Quase 30min. De Efeitos '-'
Editado por ~iNotLinduh.
Link para o comentário
Compartilhar em outros sites

PotionMeta

 

 
 
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffectType;
 
 
public static void p(Player p, PotionEffectType pte) {
ItemStack pt = new ItemStack(Material.POTION);
PotionMeta ptm = (PotionMeta)pt.getItemMeta();
ptm.setMainEffect(pte);
ptm.setDisplayName("§cPoçaum");
pt.setItemMeta(ptm);
p.getInventory().addItem(pt);
}
 
 
p(p, PotionEffectType.CONFUSION);
Editado por stalker112
Link para o comentário
Compartilhar em outros sites

Guest ~iNotLinduh.

Simples:

 

Potion Slow = new Potion(PotionType.SLOWNESS);
	ItemStack Slow2 = new ItemStack(Material.POTION); 
		Slow.setSplash(true); //Seta Se Vai Ser Arremessável Ou Não.
		Slow.setLevel(1); //Seta O Level Da Poção.
		Slow.apply(Slow2); //Aplica O Efeito Da Poção, Da Pra Criar Poções Editadas Assim :)

Depois Você Adiciona No Inventory Do Player Assim:

p.getInventory().addItem(Slow2);
Editado por ~iNotLinduh.
Link para o comentário
Compartilhar em outros sites

 

Simples:

 

 

Potion Slow = new Potion(PotionType.SLOWNESS);
	ItemStack Slow2 = new ItemStack(Material.POTION); 
		Slow.setSplash(true); //Seta Se Vai Ser Arremessável Ou Não.
		Slow.setLevel(1); //Seta O Level Da Poção.
		Slow.apply(Slow2); //Aplica O Efeito Da Poção, Da Pra Criar Poções Editadas Assim :)

Depois Você Adiciona No Inventory Do Player Assim:

p.getInventory().addItem(Slow2);

Ok, e como defino o tempo que vai durar?

Link para o comentário
Compartilhar em outros sites

Guest ~iNotLinduh.

Ok, e como defino o tempo que vai durar?

Daquele Modo Não Dá, Teria Que Ser Assim:

 

 

ItemStack Potion = new ItemStack(Material.POTION, 1 (short)16384); //Com O ID Da Poção :x
  PotionMeta PotionM = (PotionMeta) Potion.getItemMeta(); 
    PotionM.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1), true); 
                                         //200 = Duração, 1 = Aplificação Da Poção.
    Potion.setItemMeta(PotionM);

Para Dar O Player A Poção:

p.getInventory().addItem(Potion);
Editado por ~iNotLinduh.
Link para o comentário
Compartilhar em outros sites

 

Daquele Modo Não Dá, Teria Que Ser Assim:

 

 

ItemStack Potion = new ItemStack(Material.POTION, 1 (short)16384); //Com O ID Da Poção :x
  PotionMeta PotionM = (PotionMeta) Potion.getItemMeta(); 
    PotionM.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1), true); 
                                         //200 = Duração, 1 = Aplificação Da Poção.
    Potion.setItemMeta(PotionM);

Para Dar O Player A Poção:

p.getInventory().addItem(Potion);

E pra dar varios efeitos ne uma pot só tipo na de regenração vir força speed e etc

Link para o comentário
Compartilhar em outros sites

E pra dar varios efeitos ne uma pot só tipo na de regenração vir força speed e etc

 

Eu faria assim

usando o evento de interação com o item

	@EventHandler
	public void onPlayerInteract(PlayerInteractEvent e)
	{
		ItemStack Potion = new ItemStack(Material.POTION, 1 ,(short)16384); 
		PotionMeta PotionM = (PotionMeta) Potion.getItemMeta(); 
		PotionM.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1), true); 
		PotionM.setDisplayName("sla");
		if(e.getItem() == Potion && e.getItem().getItemMeta().getDisplayName().equalsIgnoreCase(PotionM.getDisplayName())
		{	
			if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK)
			{
				Player p = e.getPlayer();
				p.playEffect(/*Ai voce termina usando varios desses*/);
				p.playEffect(/*...*/);
				p.playEffect(/*...*/);
			}
		}
		
	} 
Link para o comentário
Compartilhar em outros sites

 

 

Daquele Modo Não Dá, Teria Que Ser Assim:

 

ItemStack Potion = new ItemStack(Material.POTION, 1 (short)16384); //Com O ID Da Poção :x
  PotionMeta PotionM = (PotionMeta) Potion.getItemMeta(); 
    PotionM.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1), true); 
                                         //200 = Duração, 1 = Aplificação Da Poção.
    Potion.setItemMeta(PotionM);

Para Dar O Player A Poção:

p.getInventory().addItem(Potion);

 

 

Tento esse?

Link para o comentário
Compartilhar em outros sites

Sim funcionou, só queria saber como fazer pra dar vários efeitos em um só potion .-.

O do Karamujo não pego direito aq =/

Repete isso

PotionM.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1), true);

Só que com efeito diferente --'

Link para o comentário
Compartilhar em outros sites

Repete isso

PotionM.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1), true);

Só que com efeito diferente --'

Não tipo, eu já fiz isso porem quero isso em um só frasco tipo na de regenração vir speed,força e etc

Link para o comentário
Compartilhar em outros sites

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