Ir para conteúdo
  • 0

[Resolvido] [Ajuda] O que tem de errado no meu codigo?


mabazi

Pergunta

O que a de errado no meu codigo?

 

package me.mabazi.powercookie;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;


public class Cookie extends JavaPlugin implements Listener {
	
	@Override
	public void onEnable() {
		getServer().getPluginManager().registerEvents(this, this);
	}
	@Override
	public void onDisable() {
		HandlerList.unregisterAll();
	}
	public void comer(PlayerItemConsumeEvent e){
		Bukkit.broadcastMessage("Parte1");
		Player p = e.getPlayer();
		if(e.getItem().getType() == Material.COOKIE){
			Bukkit.broadcastMessage("Parte2");
			ItemStack cookie = new ItemStack(Material.COOKIE, 1);
			p.getInventory().remove(cookie);
			p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, 2));
			p.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 60, 5));
			p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, 3));
			int x = p.getPlayer().getLocation().getBlockX();
			int y = p.getPlayer().getLocation().getBlockY();
			int z = p.getPlayer().getLocation().getBlockZ();
			Location l1 = new Location(p.getWorld(), x-1, y, z-1);
			Location l2 = new Location(p.getWorld(), x-1, y, z);
			Location l3 = new Location(p.getWorld(), x-1, y, z+1);
			Location l4 = new Location(p.getWorld(), x, y, z-1);
			Location l5 = new Location(p.getWorld(), x, y, z);
			Location l6 = new Location(p.getWorld(), x, y, z+1);
			Location l7 = new Location(p.getWorld(), x+1, y, z-1);
			Location l8 = new Location(p.getWorld(), x+1, y, z);
			Location l9 = new Location(p.getWorld(), x+1, y, z+1);
			p.setHealth(20.0);
			p.getWorld().strikeLightning(l1);
			p.getWorld().strikeLightning(l2);
			p.getWorld().strikeLightning(l3);
			p.getWorld().strikeLightning(l4);
			p.getWorld().strikeLightning(l5);
			p.getWorld().strikeLightning(l6);
			p.getWorld().strikeLightning(l7);
			p.getWorld().strikeLightning(l8);
			p.getWorld().strikeLightning(l9);
			p.setHealth(20.0);
			p.setFireTicks(0);
		}
		return;
	}
}

Ele nao esta rodando! Nem envia a msg "Parte 1"

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

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