Search in sources :

Example 1 with FakeEntity

use of net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity in project FunnyGuilds by FunnyGuilds.

the class V1_13R2EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity, ObjectType.getIdFor(entityType));
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) Entity(net.minecraft.server.v1_13_R2.Entity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_13_R2.EntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_13_R2.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_13_R2.CraftWorld)

Example 2 with FakeEntity

use of net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity in project FunnyGuilds by FunnyGuilds.

the class V1_9R2EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity, ObjectType.getIdFor(entityType));
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) Entity(net.minecraft.server.v1_9_R2.Entity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_9_R2.EntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_9_R2.CraftWorld)

Example 3 with FakeEntity

use of net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity in project FunnyGuilds by FunnyGuilds.

the class V1_11R1EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity, ObjectType.getIdFor(entityType));
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) Entity(net.minecraft.server.v1_11_R1.Entity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_11_R1.EntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_11_R1.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_11_R1.CraftWorld)

Example 4 with FakeEntity

use of net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity in project FunnyGuilds by FunnyGuilds.

the class V1_12R1EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity, ObjectType.getIdFor(entityType));
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) Entity(net.minecraft.server.v1_12_R1.Entity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_12_R1.EntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_12_R1.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld)

Example 5 with FakeEntity

use of net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity in project FunnyGuilds by FunnyGuilds.

the class V1_16R3EntityAccessor method createFakeEntity.

@Override
public FakeEntity createFakeEntity(EntityType entityType, Location location) {
    Preconditions.checkNotNull(entityType, "entity type can't be null!");
    Preconditions.checkNotNull(location, "location can't be null!");
    Preconditions.checkArgument(entityType.isSpawnable(), "entity type is not spawnable!");
    CraftWorld world = ((CraftWorld) location.getWorld());
    if (world == null) {
        throw new IllegalStateException("location's world is null!");
    }
    Entity entity = world.createEntity(location, entityType.getEntityClass());
    Packet<?> spawnEntityPacket;
    if (entity instanceof EntityLiving) {
        spawnEntityPacket = new PacketPlayOutSpawnEntityLiving((EntityLiving) entity);
    } else {
        spawnEntityPacket = new PacketPlayOutSpawnEntity(entity);
    }
    return new FakeEntity(entity.getId(), spawnEntityPacket);
}
Also used : FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) Entity(net.minecraft.server.v1_16_R3.Entity) PacketPlayOutSpawnEntity(net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntity) FakeEntity(net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntityLiving) EntityLiving(net.minecraft.server.v1_16_R3.EntityLiving) PacketPlayOutSpawnEntityLiving(net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntityLiving) PacketPlayOutSpawnEntity(net.minecraft.server.v1_16_R3.PacketPlayOutSpawnEntity) CraftWorld(org.bukkit.craftbukkit.v1_16_R3.CraftWorld)

Aggregations

FakeEntity (net.dzikoysk.funnyguilds.nms.api.entity.FakeEntity)16 Player (org.bukkit.entity.Player)3 Map (java.util.Map)2 FunnyGuilds (net.dzikoysk.funnyguilds.FunnyGuilds)2 Guild (net.dzikoysk.funnyguilds.guild.Guild)2 PacketPlayOutSpawnEntity (net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity)2 PacketPlayOutSpawnEntityLiving (net.minecraft.network.protocol.game.PacketPlayOutSpawnEntityLiving)2 EntityLiving (net.minecraft.world.entity.EntityLiving)2 TimeUnit (java.util.concurrent.TimeUnit)1 ValidationException (net.dzikoysk.funnycommands.resources.ValidationException)1 DefaultConcurrencyRequest (net.dzikoysk.funnyguilds.concurrency.util.DefaultConcurrencyRequest)1 MessageConfiguration (net.dzikoysk.funnyguilds.config.MessageConfiguration)1 PluginConfiguration (net.dzikoysk.funnyguilds.config.PluginConfiguration)1 GuildHeartAttackEvent (net.dzikoysk.funnyguilds.event.guild.GuildHeartAttackEvent)1 InfoCommand (net.dzikoysk.funnyguilds.feature.command.user.InfoCommand)1 SecuritySystem (net.dzikoysk.funnyguilds.feature.security.SecuritySystem)1 GuildEntityHelper (net.dzikoysk.funnyguilds.nms.GuildEntityHelper)1 ChatUtils (net.dzikoysk.funnyguilds.shared.bukkit.ChatUtils)1 User (net.dzikoysk.funnyguilds.user.User)1 Entity (net.minecraft.server.v1_10_R1.Entity)1