geographyboss

create a Minecraft plugin, where eating any type of meat will damage the player. this includes of eating tropical fish , rotten flesh , Raw and cooked porkchop , Raw and cooked mutton , Raw and cooked rabbit , Raw and cooked chicken , Raw and cooked beef/steak , Raw and cooked salmon , Raw and cooked cod , pufferfish , rabbit stew , spider eye will cause the player to get 10 hearts of damage out of 20 hearts.

Kodari AI
KodariApr 22 at 7:02 pm 7,314 (v2)

I’ll create a plugin that damages players when they eat meat items, promoting a vegetarian diet in your server.

VeganEnforcer
A unique survival plugin that enforces vegetarian gameplay by damaging players when they consume meat products. When players eat any meat item (porkchop, beef, chicken, fish, rabbit, mutton, spider eyes, or related items), they receive configurable damage. Features include customizable damage amounts, per-item configuration, optional warning messages, and full cross-version compatibility. Perfect for vegetarian-themed servers or adding challenge to survival gameplay.

Wait, I made errors in the listener class. Let me fix it:

✅

VeganEnforcer plugin created successfully!

The plugin damages players 10 hearts (20 HP) when they eat meat items. Features include:

  • Full cross-version compatibility using XMaterial

  • All meat types covered (porkchop, beef, chicken, fish varieties, rabbit, mutton, spider eye, rotten flesh, pufferfish, rabbit stew, tropical fish)

  • Config

urable damage amount, message, and meat item list

  • Permission bypass (veganenforcer.bypass) for exempt players

  • /veganenforcer reload command to reload configuration

  • Clean architecture with separation of concerns

The config.yml is pre-populated with all meat items, and admins can customize everything including adding or removing items from the meat list.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
5 191
src/main/java/com/veganenforcer/VeganEnforcer.java
package com.veganenforcer;

import com.veganenforcer.listener.MeatConsumptionListener;
import lombok.Getter;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public final class VeganEnforcer extends JavaPlugin {

    private MeatConsumptionListener meatListener;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.meatListener = new MeatConsumptionListener(this);
        getServer().getPluginManager().registerEvents(meatListener, this);
        
        getLogger().info("VeganEnforcer has been enabled!");
    }

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

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("veganenforcer")) {
            if (!sender.hasPermission("veganenforcer.admin")) {
                sender.sendMessage("§cYou don't have permission to use this command!");
                return true;
            }
            
            if (args.length > 0 && args[0].equalsIgnoreCase("reload")) {
                reloadConfig();
                meatListener.reloadMeatList();
                sender.sendMessage("§aVeganEnforcer configuration reloaded!");
                return true;
            }
            
            sender.sendMessage("§aVeganEnforcer v" + getDescription().getVersion());
            sender.sendMessage("§7Use /veganenforcer reload to reload the config");
            return true;
        }
        return false;
    }
}