stranger_sparky

i want to make a plugin that make zombified piglins catch fire and die when comes to overworld

Kodari AI
KodariMay 5 at 6:00 pm 3,912 (v2)

I’ll create a plugin that makes zombified piglins burn in sunlight when in the overworld, similar to how zombies burn.

BurningPiglins
Makes zombified piglins catch fire and burn in sunlight when they enter the overworld, similar to zombie burning mechanics. The plugin continuously monitors zombified piglins in the overworld and sets them on fire when exposed to daylight. Features configurable burn checks, fire duration, and the ability to toggle the burning effect. Lightweight and performance-optimized for servers of any size.

Now I’ll create the plugin structure:

Plugin created! BurningPiglins will make zombified piglins catch fire in the overworld just like zombies. The plugin checks piglins every second by default, applying fire when they’re exposed to sunlight. Features include configurable burn intervals, fire duration, daylight requirements, and world filtering.

stranger_sparky

also they needs to die instantly

Kodari AI
KodariMay 5 at 6:01 pm 2,347 (v2)

Done! Now zombified piglins will die instantly when they enter the overworld (or daylight if require-daylight: true). Changed setFireTicks() to setHealth(0) for instant death, and removed the now-unused fire-duration config option.

stranger_sparky

not working

Kodari AI
KodariMay 5 at 6:03 pm 1,742 (v2)

Let me check the current code to diagnose the issue:

I see the issue - the daylight check logic is reversed. The time check world.getTime() < 23460 || world.getTime() > 12540 is checking for night time, not day time. Let me fix it:

Fixed! The time check was inverted - now piglins will properly die during daytime (time 0-13000 and 23000-24000) and be safe at night (13000-23000).

stranger_sparky

make it disable piglin comes throgh portal

Kodari AI
KodariMay 5 at 6:08 pm 1,565 (v2)

Done! Added a portal listener that cancels zombified piglins from teleporting through nether portals to the overworld. They’ll be blocked from coming through entirely.

stranger_sparky

i need to see the debug also in the server console to confirm that the plugin is working

Kodari AI
KodariMay 5 at 6:09 pm 5,225 (v2)

Done! Added debug logging to the console:

  • Piglin deaths: Shows location and reason (daylight exposure or instant kill mode)

  • Portal blocks: Shows when a piglin is prevented from using a portal

  • Scan summary: Reports how many piglins were found and killed each check

You’ll now see [DEBUG] messages in your server console confirming the plugin is working.

stranger_sparky

also disable zombified piglins completely in overworld

Kodari AI
KodariMay 5 at 6:10 pm 3,403 (v2)

Done! Now zombified piglins are completely disabled in the overworld:

  • Portal travel blocked: Can’t come through portals

  • All spawning blocked: Natural spawns, eggs, commands, mob spawners, breeding, chunk generation - all cancelled in the overworld

  • Debug logging: Shows exactly why and where each spawn attempt was blocked

stranger_sparky

its finding piglins but its not killing it please make it kill them or delete them

📎 1 file 1,651 chars
📄
pasted-code-1778004810831.txt
txt 19 lines
▶
[18:11:41 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 6 piglins, Killed: 0
[18:11:43 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 6 piglins, Killed: 0
[18:11:43 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 6 piglins, Killed: 0
[18:11:44 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 6 piglins, Killed: 0
[18:11:45 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 6 piglins, Killed: 0
[18:11:46 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 6 piglins, Killed: 0
[18:11:47 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 6 piglins, Killed: 0
[18:11:48 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 6 piglins, Killed: 0
[18:11:49 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 6 piglins, Killed: 0
[18:11:50 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 6 piglins, Killed: 0
[18:11:51 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 6 piglins, Killed: 0
[18:11:52 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 6 piglins, Killed: 0
[18:11:53 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 5 piglins, Killed: 0
[18:11:54 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 5 piglins, Killed: 0
[18:11:55 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 5 piglins, Killed: 0
[18:11:56 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 4 piglins, Killed: 0
[18:11:57 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 4 piglins, Killed: 0
[18:11:58 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 4 piglins, Killed: 0
[18:11:59 INFO]: [BurningPiglins] [DEBUG] Scan complete - Found: 4 piglins, Killed: 0
Kodari AI
KodariMay 5 at 6:13 pm 8,458 (v2)

I see the issue! The piglins are being found but not killed because either:

  1. require-daylight: true and they’re not in sunlight (they might be in shade, wearing helmets, or it’s not daytime)

  2. The time check might still be wrong

Let me simplify this - I’ll just kill ALL zombified piglins in the overworld instantly, no conditions:

Done! Simplified the plugin to immediately remove ALL zombified piglins in the overworld with no conditions. Changed from setHealth(0) to remove() for instant deletion. Now it will kill them regardless of daylight, helmets, or location. The debug logs will show exactly when and where each piglin is removed.

stranger_sparky

[08:34:25 INFO]: [BurningPiglins] [DEBUG] Prevented zombified piglin from spawning in overworld at world (938, 99, -859) - Reason: NETHER_PORTAL

remove this spamming debug since the plugin is working

Kodari AI
KodariMay 11 at 8:35 am 3,092 (v2)

Done! Removed the debug spam. The plugin will still block zombified piglins from portals and spawning in the overworld, but won’t flood the console with messages.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 243
src/main/java/com/burningpiglins/BurningPiglins.java
package com.burningpiglins;

import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;

@Getter
public class BurningPiglins extends JavaPlugin {
    
    private BukkitTask burnTask;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        if (getConfig().getBoolean("enabled", true)) {
            startBurnTask();
        }
        
        getServer().getPluginManager().registerEvents(new PortalListener(this), this);
        getCommand("burningpiglins").setExecutor(new BurningPiglinsCommand(this));
        
        getLogger().info("BurningPiglins has been enabled!");
    }
    
    @Override
    public void onDisable() {
        stopBurnTask();
        getLogger().info("BurningPiglins has been disabled!");
    }
    
    public void startBurnTask() {
        stopBurnTask();
        
        int interval = getConfig().getInt("check-interval", 20);
        burnTask = new PiglinBurnTask(this).runTaskTimer(this, 0L, interval);
        
        getLogger().info("Piglin burn task started (checking every " + interval + " ticks)");
    }
    
    public void stopBurnTask() {
        if (burnTask != null) {
            burnTask.cancel();
            burnTask = null;
        }
    }
    
    public void reload() {
        reloadConfig();
        
        if (getConfig().getBoolean("enabled", true)) {
            startBurnTask();
        } else {
            stopBurnTask();
        }
    }
}