Skip to content

/feed

This plugin adds a /feed command that fills your hunger bar.

main.lua
plugin.addCommand({
    name = "feed",
    description = "Fill your hunger bar",
    usage = "/feed"
}, function(event)
    local player = event.getSender()
    player:setFoodLevel(20)
    player:sendMessage("Fed!")
end)

How it works

This is almost a copy of /heal, and that's the point. A lot of plugins are the same pattern with a different method: get the player, do something to them, and send a message. Here the method is setFoodLevel(20), where 20 is a full hunger bar. Once you notice the pattern, you'll start seeing it everywhere.

Try it

Wait until your hunger bar drops a bit, then type /feed. Like /heal, it needs a player to run it.

Next: /fly.