o7revan

make a plugin that disables leaf decay

Kodari AI
KodariOct 15 at 5:41 pm 1,445 (v2)

I’ll create a simple plugin that disables leaf decay in Minecraft.

LeafDecayDisabler
A lightweight plugin that prevents leaves from naturally decaying when trees are cut down. Keeps your world looking green and natural without the need to manually place leaves. Features automatic event handling with minimal performance impact. Perfect for creative servers or maintaining natural-looking builds.

Done! This plugin will prevent all leaf decay in your Minecraft server. Simply compile it with gradle build and place the resulting JAR file in your server’s plugins folder.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
4 58
src/main/java/com/leafdecay/LeafDecayDisabler.java
package com.leafdecay;

import org.bukkit.plugin.java.JavaPlugin;

public class LeafDecayDisabler extends JavaPlugin {
    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new LeafDecayListener(), this);
        getLogger().info("LeafDecayDisabler has been enabled!");
    }

    @Override
    public void onDisable() {
        getLogger().info("LeafDecayDisabler has been disabled!");
    }
}