use of net.minecraft.server.v1_8_R1.World in project SpaciousLib by anhcraft.
the class ActionBar_1_8_R1 method send.
@Override
public void send(World world, String text) {
for (Player player : world.getPlayers()) {
PacketPlayOutChat title = new PacketPlayOutChat(ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', text) + "\"}"), (byte) 2);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
}
}
use of net.minecraft.server.v1_8_R1.World in project SpaciousLib by anhcraft.
the class Title_1_8_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(EnumTitleAction.TITLE, 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);
}
}
use of net.minecraft.server.v1_8_R1.World in project SpaciousLib by anhcraft.
the class Title_1_8_R1 method sendTitle.
//-----------------------------------------------------------
@Override
public void sendTitle(World world, String text) {
for (Player player : world.getPlayers()) {
PacketPlayOutTitle title = new PacketPlayOutTitle(EnumTitleAction.TITLE, ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', text) + "\"}"));
((CraftPlayer) player).getHandle().playerConnection.sendPacket(title);
}
}
use of net.minecraft.server.v1_8_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;
}
use of net.minecraft.server.v1_8_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;
}
Aggregations