Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

NullPointerException in ProjectileHitEvent #284

Open
VideoGameSmash12 opened this issue Oct 2, 2020 · 4 comments
Open

NullPointerException in ProjectileHitEvent #284

VideoGameSmash12 opened this issue Oct 2, 2020 · 4 comments

Comments

@VideoGameSmash12
Copy link

Appears to be related to ItemFun.

Stacktrace:
:[12:51:39 ERROR]: Could not pass event ProjectileHitEvent to TotalFreedomMod v2020.1java.lang.NullPointerException
at net.minecraft.server.v1_16_R2.Explosion.a(Explosion.java:141)
at net.minecraft.server.v1_16_R2.World.createExplosion(World.java:916)
at net.minecraft.server.v1_16_R2.WorldServer.createExplosion(WorldServer.java:1603)
at net.minecraft.server.v1_16_R2.World.createExplosion(World.java:910)
at org.bukkit.craftbukkit.v1_16_R2.CraftWorld.createExplosion(CraftWorld.java:988)
at org.bukkit.craftbukkit.v1_16_R2.CraftWorld.createExplosion(CraftWorld.java:983)
at me.totalfreedom.totalfreedommod.fun.ItemFun.onProjectileHit(ItemFun.java:340)
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor673.execute(Unknown Source)
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69)
at org.bukkit.plugin.EventExecutor$$Lambda$4195/00000000DD36D360.execute(Unknown Source)
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80)
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70)
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607)
at org.bukkit.craftbukkit.v1_16_R2.event.CraftEventFactory.callProjectileHitEvent(CraftEventFactory.java:1310)
at net.minecraft.server.v1_16_R2.IProjectile.a(IProjectile.java:121)
at net.minecraft.server.v1_16_R2.EntityArrow.tick(EntityArrow.java:176)
at net.minecraft.server.v1_16_R2.EntityTippedArrow.tick(EntityTippedArrow.java:92)
at net.minecraft.server.v1_16_R2.WorldServer.entityJoinedWorld(WorldServer.java:841)
at net.minecraft.server.v1_16_R2.WorldServer$$Lambda$5956/00000000DFE662E0.accept(Unknown Source)
at net.minecraft.server.v1_16_R2.World.a(World.java:884)
at net.minecraft.server.v1_16_R2.WorldServer.doTick(WorldServer.java:526)
at net.minecraft.server.v1_16_R2.MinecraftServer.b(MinecraftServer.java:1358)
at net.minecraft.server.v1_16_R2.DedicatedServer.b(DedicatedServer.java:371)
at net.minecraft.server.v1_16_R2.MinecraftServer.a(MinecraftServer.java:1211)
at net.minecraft.server.v1_16_R2.MinecraftServer.w(MinecraftServer.java:999)
at net.minecraft.server.v1_16_R2.MinecraftServer.lambda$a$0(MinecraftServer.java:177)
at net.minecraft.server.v1_16_R2.MinecraftServer$$Lambda$3111/0000000090196280.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)

@DragonSlayer2189
Copy link

DragonSlayer2189 commented Oct 10, 2020

Looks like its related to this bit of code which i think relates to the fireball item

    @EventHandler
    public void onProjectileHit(ProjectileHitEvent event)
    {
        Entity entity = event.getEntity();
        Arrow arrow = null;
        if (entity instanceof Arrow)
        {
            arrow = (Arrow)entity;
        }
        if (arrow != null && (arrow.getShooter() instanceof Player))
        {
            if (explosivePlayers.contains((Player)arrow.getShooter()))
            {
                arrow.getLocation().getWorld().createExplosion(arrow.getLocation().getX(), arrow.getLocation().getY(), arrow.getLocation().getZ(), ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue(), false, ConfigEntry.ALLOW_EXPLOSIONS.getBoolean());
                arrow.remove();
            }
        }

        if (entity instanceof Fireball)
        {
            if (FIRE_BALL_UUIDS.contains(entity.getUniqueId()))
            {
                FIRE_BALL_UUIDS.remove(entity.getUniqueId());
                Firework firework = (Firework)entity.getWorld().spawnEntity(entity.getLocation(), EntityType.FIREWORK);
                firework.setSilent(true);
                FireworkMeta meta = firework.getFireworkMeta();
                FireworkEffect explosionEffect = FireworkEffect.builder().withColor(Color.ORANGE).withFade(Color.YELLOW).with(FireworkEffect.Type.BALL_LARGE).trail(true).build();
                meta.addEffect(explosionEffect);
                meta.setPower(0);
                firework.setFireworkMeta(meta);
                entity.remove();
                firework.detonate();
                entity.getWorld().playSound(firework.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, SoundCategory.PLAYERS, 10f, 1f);
            }
        }
    }```

@Focusvity
Copy link

@DragonSlayer2189 The problem is with the arrow part, the explosion is returning null for some reason when it shouldn't.

@DragonSlayer2189
Copy link

@DragonSlayer2189 The problem is with the arrow part, the explosion is returning null for some reason when it shouldn't.

mabye its checking to see if /explosivearrows is on, and thus returns null if its not?

@Focusvity
Copy link

@VideoGameSmash12 is the error persistent?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants