package com.bebehp.mc.eewreciever;

import java.util.List;
import java.util.Map;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.bebehp.mc.eewreciever.ping.QuakeMain;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkCheckHandler;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.item.EntityFireworkRocket;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ServerChatEvent;

@Mod(modid="EEWReciever", name="EEWReciever", version="1.0")
public class EEWRecieverMod
{
	public static final String owner = "EEWReciever";
	public static final Logger logger = LogManager.getLogger();

	@EventHandler
	public void init(FMLInitializationEvent event)
	{
		logger.info("EEW is setting up.");
		FMLCommonHandler.instance().bus().register(new QuakeMain());
		MinecraftForge.EVENT_BUS.register(this);
	}

	@SubscribeEvent
	public void onServerChat(ServerChatEvent event)
	{
		if (event.message.contains("fuck"))
		{
			fireworksAllPlayer();
			EEWRecieverMod.sendServerChat("fuck you too");
		}

		if (event.message.contains("bubu"))
		{
			EntityPlayerMP player = event.player;
			player.worldObj.createExplosion(
					player,
					player.getPlayerCoordinates().posX,
					player.getPlayerCoordinates().posY,
					player.getPlayerCoordinates().posZ,
					2F,
					false
			);

//			player.worldObj.spawnEntityInWorld(new EntityTNTPrimed(
//					player.worldObj,
//					player.getPlayerCoordinates().posX,
//					player.getPlayerCoordinates().posY,
//					player.getPlayerCoordinates().posZ,
//					player
//			));

		}
	}

	@NetworkCheckHandler
	public boolean netCheckHandler(Map<String, String> mods, Side side)
	{
		return true;
	}

	public static void sendServerChat(String msg)
	{
		FMLCommonHandler.instance().getMinecraftServerInstance()
			.getConfigurationManager().sendChatMsg(new ChatComponentText(msg));
	}

	public static void fireworksAllPlayer()
	{
		World world = Minecraft.getMinecraft().getIntegratedServer().getEntityWorld();

		List<?> players = world.playerEntities;
		for (Object playerobj : players)
		{
			EntityPlayerMP player = (EntityPlayerMP) playerobj;
//			player.moveEntity(5, 0, 0);
//			player.setPosition(0, 5, 0);
//			player.setPositionAndUpdate(0, 5, 0);
			fireworksPlayer(player);
		}
	}

	public static void fireworksPlayer(EntityPlayerMP player)
	{
		player.worldObj.spawnEntityInWorld(new EntityFireworkRocket(
				player.worldObj,
				player.getPlayerCoordinates().posX,
				player.getPlayerCoordinates().posY,
				player.getPlayerCoordinates().posZ,
				makeFireworks()
		));
	}

	public static ItemStack makeFireworks()
	{
		final NBTTagCompound explosion = new NBTTagCompound() {{
			setByte("Type", (byte)2);
			setByte("Trail", (byte)1);
			setIntArray("Colors", ItemDye.field_150922_c);
		}};
		final NBTTagList nbttaglist = new NBTTagList() {{
			appendTag(explosion);
			appendTag(explosion);
			appendTag(explosion);
		}};
        final NBTTagCompound nbt = new NBTTagCompound() {{
        	setTag("Fireworks", new NBTTagCompound() {{
            	setTag("Explosions", nbttaglist);
                setByte("Flight", (byte)1);
			}});
        }};
		ItemStack itemstack = new ItemStack(Items.firework_charge);
        itemstack.setTagCompound(nbt);
        return itemstack;
	}
}
@@ -33,31 +33,8 @@
 r;%0A%0A
-import java.util.List;%0A
 impo
@@ -51,16 +51,16 @@
 il.Map;%0A
+
 %0Aimport 
@@ -370,64 +370,8 @@
 nt;%0A
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;%0A
 impo
@@ -463,336 +463,8 @@
 de;%0A
-import net.minecraft.client.Minecraft;%0Aimport net.minecraft.entity.item.EntityFireworkRocket;%0Aimport net.minecraft.entity.player.EntityPlayerMP;%0Aimport net.minecraft.init.Items;%0Aimport net.minecraft.item.ItemDye;%0Aimport net.minecraft.item.ItemStack;%0Aimport net.minecraft.nbt.NBTTagCompound;%0Aimport net.minecraft.nbt.NBTTagList;%0A
 impo
@@ -508,42 +508,8 @@
 xt;%0A
-import net.minecraft.world.World;%0A
 impo
@@ -556,57 +556,8 @@
 rge;
-%0Aimport net.minecraftforge.event.ServerChatEvent;
 %0A%0A@M
@@ -971,16 +971,18 @@
 s);%0A%09%7D%0A%0A
+/*
 %09@Subscr
@@ -990,16 +990,16 @@
 beEvent%0A
-
 %09public 
@@ -1692,16 +1692,18 @@
 %09%09%7D%0A%09%7D%0A%0A
+*/
 %09@Networ
@@ -1708,32 +1708,32 @@
 orkCheckHandler%0A
-
 %09public boolean 
@@ -1986,25 +1986,27 @@
 t(msg));%0A%09%7D%0A
+/*
 %0A
-
 %09public stat
@@ -3401,9 +3401,11 @@
 ack;%0A%09%7D%0A
+*/
 %7D

Delete few method