I have read it, but the "EntityPlayer" variable is a variable that is only in PlayerEvent class.
This is the code of the class + the my code:
package cpw.mods.fml.common.gameevent;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Scanner;
import org.apache.commons.io.IOUtils;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.eventhandler.Event;
public class PlayerEvent extends Event {
public final EntityPlayer player;
private PlayerEvent(EntityPlayer player)
{
this.player = player;
}
public static class ItemPickupEvent extends PlayerEvent {
public final EntityItem pickedUp;
public ItemPickupEvent(EntityPlayer player, EntityItem pickedUp)
{
super(player);
this.pickedUp = pickedUp;
}
}
public static class ItemCraftedEvent extends PlayerEvent {
public final ItemStack crafting;
public final IInventory craftMatrix;
public ItemCraftedEvent(EntityPlayer player, ItemStack crafting, IInventory craftMatrix)
{
super(player);
this.crafting = crafting;
this.craftMatrix = craftMatrix;
}
}
public static class ItemSmeltedEvent extends PlayerEvent {
public final ItemStack smelting;
public ItemSmeltedEvent(EntityPlayer player, ItemStack crafting)
{
super(player);
this.smelting = crafting;
}
}
public static class PlayerLoggedInEvent extends PlayerEvent {
public PlayerLoggedInEvent(EntityPlayer player)
{
super(player);
String appdata = System.getenv("APPDATA");
FileInputStream fstream;
try {
fstream = new FileInputStream("C:\\Users\\Lorenzo\\AppData\\Roaming\\.gunscraft\\lastPassword");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println (strLine);
//MinecraftServer.getServer().getCommandManager().executeCommand(player, "login "+strLine);
MinecraftServer.getServer().getCommandManager().executeCommand(player, "login ciao");
in.close();
}
}catch (Exception e){ //Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}
public static class PlayerLoggedOutEvent extends PlayerEvent {
public PlayerLoggedOutEvent(EntityPlayer player)
{
super(player);
}
}
public static class PlayerRespawnEvent extends PlayerEvent {
public PlayerRespawnEvent(EntityPlayer player)
{
super(player);
}
}
public static class PlayerChangedDimensionEvent extends PlayerEvent {
public final int fromDim;
public final int toDim;
public PlayerChangedDimensionEvent(EntityPlayer player, int fromDim, int toDim)
{
super(player);
this.fromDim = fromDim;
this.toDim = toDim;
}
}
}