Search in sources :

Example 6 with CrashReport

use of net.minecraft.server.v1_13_R2.CrashReport in project Citizens2 by CitizensDev.

the class NMSImpl method tick.

@Override
public boolean tick(org.bukkit.entity.Entity next) {
    Entity entity = NMSImpl.getHandle(next);
    Entity entity1 = entity.getVehicle();
    if (entity1 != null) {
        if ((entity1.dead) || (!entity1.w(entity))) {
            entity.stopRiding();
        }
    } else {
        if (!entity.dead) {
            try {
                ((WorldServer) entity.world).entityJoinedWorld(entity);
            } catch (Throwable throwable) {
                CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
                CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
                entity.appendEntityCrashDetails(crashreportsystemdetails);
                throw new ReportedException(crashreport);
            }
        }
        boolean removeFromPlayerList = ((NPCHolder) entity).getNPC().data().get("removefromplayerlist", Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
        if (entity.dead) {
            ((WorldServer) entity.world).removeEntity(entity);
            return true;
        } else if (!removeFromPlayerList) {
            if (!entity.world.getPlayers().contains(entity)) {
                List list = entity.world.getPlayers();
                list.add(entity);
            }
            return true;
        } else {
            entity.world.getPlayers().remove(entity);
        }
    }
    return false;
}
Also used : CraftEntity(org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity) LivingEntity(org.bukkit.entity.LivingEntity) Entity(net.minecraft.server.v1_15_R1.Entity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) PathEntity(net.minecraft.server.v1_15_R1.PathEntity) CrashReportSystemDetails(net.minecraft.server.v1_15_R1.CrashReportSystemDetails) CrashReport(net.minecraft.server.v1_15_R1.CrashReport) NPCHolder(net.citizensnpcs.npc.ai.NPCHolder) WorldServer(net.minecraft.server.v1_15_R1.WorldServer) ArrayList(java.util.ArrayList) List(java.util.List) ReportedException(net.minecraft.server.v1_15_R1.ReportedException)

Example 7 with CrashReport

use of net.minecraft.server.v1_13_R2.CrashReport in project Citizens2 by CitizensDev.

the class NMSImpl method tick.

@Override
public boolean tick(org.bukkit.entity.Entity next) {
    Entity entity = NMSImpl.getHandle(next);
    Entity entity1 = entity.getVehicle();
    if (entity1 != null) {
        if ((entity1.dead) || (!entity1.w(entity))) {
            entity.stopRiding();
        }
    } else {
        if (!entity.dead) {
            try {
                ((WorldServer) entity.world).entityJoinedWorld(entity);
            } catch (Throwable throwable) {
                CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
                CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
                entity.appendEntityCrashDetails(crashreportsystemdetails);
                throw new ReportedException(crashreport);
            }
        }
        boolean removeFromPlayerList = ((NPCHolder) entity).getNPC().data().get("removefromplayerlist", Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
        if (entity.dead) {
            ((WorldServer) entity.world).removeEntity(entity);
            return true;
        } else if (!removeFromPlayerList) {
            if (!entity.world.getPlayers().contains(entity)) {
                List list = entity.world.getPlayers();
                list.add(entity);
            }
            return true;
        } else {
            entity.world.getPlayers().remove(entity);
        }
    }
    return false;
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) Entity(net.minecraft.server.v1_14_R1.Entity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) PathEntity(net.minecraft.server.v1_14_R1.PathEntity) CraftEntity(org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity) CrashReportSystemDetails(net.minecraft.server.v1_14_R1.CrashReportSystemDetails) CrashReport(net.minecraft.server.v1_14_R1.CrashReport) NPCHolder(net.citizensnpcs.npc.ai.NPCHolder) WorldServer(net.minecraft.server.v1_14_R1.WorldServer) ArrayList(java.util.ArrayList) List(java.util.List) ReportedException(net.minecraft.server.v1_14_R1.ReportedException)

Example 8 with CrashReport

use of net.minecraft.server.v1_13_R2.CrashReport in project Citizens2 by CitizensDev.

the class NMSImpl method tick.

@Override
public boolean tick(org.bukkit.entity.Entity next) {
    Entity entity = NMSImpl.getHandle(next);
    Entity entity1 = entity.bJ();
    if (entity1 != null) {
        if ((entity1.dead) || (!entity1.w(entity))) {
            entity.stopRiding();
        }
    } else {
        if (!entity.dead) {
            try {
                entity.world.entityJoinedWorld(entity, true);
            } catch (Throwable throwable) {
                CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
                CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
                entity.appendEntityCrashDetails(crashreportsystemdetails);
                throw new ReportedException(crashreport);
            }
        }
        boolean removeFromPlayerList = ((NPCHolder) entity).getNPC().data().get("removefromplayerlist", Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
        if (entity.dead) {
            entity.world.removeEntity(entity);
            return true;
        } else if (!removeFromPlayerList) {
            if (!entity.world.players.contains(entity)) {
                entity.world.players.add((EntityHuman) entity);
            }
            return true;
        } else {
            entity.world.players.remove(entity);
        }
    }
    return false;
}
Also used : PathEntity(net.minecraft.server.v1_12_R1.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity) Entity(net.minecraft.server.v1_12_R1.Entity) EntityHuman(net.minecraft.server.v1_12_R1.EntityHuman) CrashReportSystemDetails(net.minecraft.server.v1_12_R1.CrashReportSystemDetails) CrashReport(net.minecraft.server.v1_12_R1.CrashReport) NPCHolder(net.citizensnpcs.npc.ai.NPCHolder) ReportedException(net.minecraft.server.v1_12_R1.ReportedException)

Aggregations

NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)8 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)8 LivingEntity (org.bukkit.entity.LivingEntity)8 ArrayList (java.util.ArrayList)3 List (java.util.List)3 CrashReport (net.minecraft.server.v1_10_R1.CrashReport)1 CrashReportSystemDetails (net.minecraft.server.v1_10_R1.CrashReportSystemDetails)1 Entity (net.minecraft.server.v1_10_R1.Entity)1 EntityHuman (net.minecraft.server.v1_10_R1.EntityHuman)1 PathEntity (net.minecraft.server.v1_10_R1.PathEntity)1 ReportedException (net.minecraft.server.v1_10_R1.ReportedException)1 CrashReport (net.minecraft.server.v1_11_R1.CrashReport)1 CrashReportSystemDetails (net.minecraft.server.v1_11_R1.CrashReportSystemDetails)1 Entity (net.minecraft.server.v1_11_R1.Entity)1 EntityHuman (net.minecraft.server.v1_11_R1.EntityHuman)1 PathEntity (net.minecraft.server.v1_11_R1.PathEntity)1 ReportedException (net.minecraft.server.v1_11_R1.ReportedException)1 CrashReport (net.minecraft.server.v1_12_R1.CrashReport)1 CrashReportSystemDetails (net.minecraft.server.v1_12_R1.CrashReportSystemDetails)1 Entity (net.minecraft.server.v1_12_R1.Entity)1