Search in sources :

Example 1 with World

use of net.minecraft.server.v1_9_R1.World in project SpaciousLib by anhcraft.

the class Title_1_9_R1 method sendTitle.

@Override
public void sendTitle(World world, String text, int fadeIn, int stay, int fadeOut) {
    for (Player player : world.getPlayers()) {
        PacketPlayOutTitle title = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', text) + "\"}"));
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
        PacketPlayOutTitle length = new PacketPlayOutTitle(fadeIn, stay, fadeOut);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(length);
    }
}
Also used : PacketPlayOutTitle(net.minecraft.server.v1_9_R1.PacketPlayOutTitle) CraftPlayer(org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer) Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer)

Example 2 with World

use of net.minecraft.server.v1_9_R1.World in project SpaciousLib by anhcraft.

the class Title_1_9_R1 method sendTitle.

//-----------------------------------------------------------
@Override
public void sendTitle(World world, String text) {
    for (Player player : world.getPlayers()) {
        PacketPlayOutTitle title = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', text) + "\"}"));
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
    }
}
Also used : PacketPlayOutTitle(net.minecraft.server.v1_9_R1.PacketPlayOutTitle) CraftPlayer(org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer) Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer)

Example 3 with World

use of net.minecraft.server.v1_9_R1.World in project SpaciousLib by anhcraft.

the class Title_1_9_R1 method sendSubTitle.

@Override
public void sendSubTitle(World world, String text, int fadeIn, int stay, int fadeOut) {
    for (Player player : world.getPlayers()) {
        PacketPlayOutTitle title = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', text) + "\"}"));
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
        PacketPlayOutTitle length = new PacketPlayOutTitle(fadeIn, stay, fadeOut);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(length);
    }
}
Also used : PacketPlayOutTitle(net.minecraft.server.v1_9_R1.PacketPlayOutTitle) CraftPlayer(org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer) Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer)

Example 4 with World

use of net.minecraft.server.v1_9_R1.World in project MyPet by xXKeyleXx.

the class EntityRegistry method createMinecraftEntity.

@Override
public MyPetMinecraftEntity createMinecraftEntity(MyPet pet, org.bukkit.World bukkitWorld) {
    EntityMyPet petEntity = null;
    Class<? extends MyPetMinecraftEntity> entityClass = entityClasses.get(pet.getPetType());
    World world = ((CraftWorld) bukkitWorld).getHandle();
    try {
        Constructor<?> ctor = entityClass.getConstructor(World.class, MyPet.class);
        Object obj = ctor.newInstance(world, pet);
        if (obj instanceof EntityMyPet) {
            petEntity = (EntityMyPet) obj;
        }
    } catch (Exception e) {
        MyPetApi.getLogger().info(ChatColor.RED + entityClass.getName() + " is no valid MyPet(Entity)!");
        e.printStackTrace();
    }
    return petEntity;
}
Also used : World(net.minecraft.server.v1_8_R1.World) CraftWorld(org.bukkit.craftbukkit.v1_8_R1.CraftWorld) CraftWorld(org.bukkit.craftbukkit.v1_8_R1.CraftWorld)

Example 5 with World

use of net.minecraft.server.v1_9_R1.World in project MyPet by xXKeyleXx.

the class EntityRegistry method createMinecraftEntity.

@Override
public MyPetMinecraftEntity createMinecraftEntity(MyPet pet, org.bukkit.World bukkitWorld) {
    EntityMyPet petEntity = null;
    Class<? extends MyPetMinecraftEntity> entityClass = entityClasses.get(pet.getPetType());
    World world = ((CraftWorld) bukkitWorld).getHandle();
    try {
        Constructor<?> ctor = entityClass.getConstructor(World.class, MyPet.class);
        Object obj = ctor.newInstance(world, pet);
        if (obj instanceof EntityMyPet) {
            petEntity = (EntityMyPet) obj;
        }
    } catch (Exception e) {
        MyPetApi.getLogger().info(ChatColor.RED + entityClass.getName() + " is no valid MyPet(Entity)!");
        e.printStackTrace();
    }
    return petEntity;
}
Also used : CraftWorld(org.bukkit.craftbukkit.v1_8_R2.CraftWorld) World(net.minecraft.server.v1_8_R2.World) CraftWorld(org.bukkit.craftbukkit.v1_8_R2.CraftWorld)

Aggregations

CraftPlayer (org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer)5 Player (org.bukkit.entity.Player)5 PacketPlayOutTitle (net.minecraft.server.v1_9_R1.PacketPlayOutTitle)4 BlockPosition (net.minecraft.server.v1_9_R1.BlockPosition)3 CraftWorld (org.bukkit.craftbukkit.v1_9_R1.CraftWorld)3 World (net.minecraft.server.v1_7_R4.World)2 IBlockData (net.minecraft.server.v1_9_R1.IBlockData)2 World (net.minecraft.server.v1_10_R1.World)1 World (net.minecraft.server.v1_11_R1.World)1 World (net.minecraft.server.v1_12_R1.World)1 World (net.minecraft.server.v1_16_R3.World)1 EntityArrow (net.minecraft.server.v1_7_R4.EntityArrow)1 World (net.minecraft.server.v1_8_R1.World)1 World (net.minecraft.server.v1_8_R2.World)1 World (net.minecraft.server.v1_8_R3.World)1 AxisAlignedBB (net.minecraft.server.v1_9_R1.AxisAlignedBB)1 PacketPlayOutChat (net.minecraft.server.v1_9_R1.PacketPlayOutChat)1 World (net.minecraft.server.v1_9_R1.World)1 World (net.minecraft.server.v1_9_R2.World)1 CraftWorld (org.bukkit.craftbukkit.v1_10_R1.CraftWorld)1