Search in sources :

Example 1 with CrashReportSystemDetails

use of net.minecraft.server.v1_15_R1.CrashReportSystemDetails 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.bB();
    if (entity1 != null) {
        if ((entity1.dead) || (!entity1.w(entity))) {
            entity.stopRiding();
        }
    } else {
        if (!entity.dead) {
            try {
                entity.world.g(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) {
            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_10_R1.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity) Entity(net.minecraft.server.v1_10_R1.Entity) EntityHuman(net.minecraft.server.v1_10_R1.EntityHuman) CrashReportSystemDetails(net.minecraft.server.v1_10_R1.CrashReportSystemDetails) CrashReport(net.minecraft.server.v1_10_R1.CrashReport) NPCHolder(net.citizensnpcs.npc.ai.NPCHolder) ReportedException(net.minecraft.server.v1_10_R1.ReportedException)

Example 2 with CrashReportSystemDetails

use of net.minecraft.server.v1_15_R1.CrashReportSystemDetails 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 {
                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_13_R2.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity) Entity(net.minecraft.server.v1_13_R2.Entity) EntityHuman(net.minecraft.server.v1_13_R2.EntityHuman) CrashReportSystemDetails(net.minecraft.server.v1_13_R2.CrashReportSystemDetails) CrashReport(net.minecraft.server.v1_13_R2.CrashReport) NPCHolder(net.citizensnpcs.npc.ai.NPCHolder) ReportedException(net.minecraft.server.v1_13_R2.ReportedException)

Example 3 with CrashReportSystemDetails

use of net.minecraft.server.v1_15_R1.CrashReportSystemDetails 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 : Entity(net.minecraft.server.v1_16_R3.Entity) LivingEntity(org.bukkit.entity.LivingEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity) PathEntity(net.minecraft.server.v1_16_R3.PathEntity) CrashReportSystemDetails(net.minecraft.server.v1_16_R3.CrashReportSystemDetails) CrashReport(net.minecraft.server.v1_16_R3.CrashReport) NPCHolder(net.citizensnpcs.npc.ai.NPCHolder) WorldServer(net.minecraft.server.v1_16_R3.WorldServer) ArrayList(java.util.ArrayList) List(java.util.List) ReportedException(net.minecraft.server.v1_16_R3.ReportedException)

Example 4 with CrashReportSystemDetails

use of net.minecraft.server.v1_15_R1.CrashReportSystemDetails 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.bB();
    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_11_R1.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) CraftEntity(org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) Entity(net.minecraft.server.v1_11_R1.Entity) EntityHuman(net.minecraft.server.v1_11_R1.EntityHuman) CrashReportSystemDetails(net.minecraft.server.v1_11_R1.CrashReportSystemDetails) CrashReport(net.minecraft.server.v1_11_R1.CrashReport) NPCHolder(net.citizensnpcs.npc.ai.NPCHolder) ReportedException(net.minecraft.server.v1_11_R1.ReportedException)

Example 5 with CrashReportSystemDetails

use of net.minecraft.server.v1_15_R1.CrashReportSystemDetails in project Citizens2 by CitizensDev.

the class NMSImpl method tick.

@Override
public boolean tick(org.bukkit.entity.Entity next) {
    Entity entity = NMSImpl.getHandle(next);
    if (!entity.dead) {
        try {
            entity.world.g(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) {
        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_8_R3.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) Entity(net.minecraft.server.v1_8_R3.Entity) CraftEntity(org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) EntityHuman(net.minecraft.server.v1_8_R3.EntityHuman) CrashReportSystemDetails(net.minecraft.server.v1_8_R3.CrashReportSystemDetails) CrashReport(net.minecraft.server.v1_8_R3.CrashReport) NPCHolder(net.citizensnpcs.npc.ai.NPCHolder) ReportedException(net.minecraft.server.v1_8_R3.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