Deluxe_Studios

Make a Minecraft plugin which lets us change size By /small this command will run /attribute @s minecraft:scale base set 0.5 And want to become big use this command /Big This will run /attribute @s minecraft:scale base set 1 Software Paper Version 1.21.4

Kodari AI
KodariNov 1 at 5:30 pm 1
PlayerSizeChanger
A Paper 1.21.4 Minecraft plugin that lets players change their in-game size via commands. The /small command sets the player's scale attribute to 0.5, making them appear half their normal size. The /big command resets the scale attribute to 1.0, returning the player to full size. Both commands use the vanilla attribute system to modify the player's scale, ensuring compatibility with client-side rendering. The plugin registers two simple commands with no permissions required, making it easy for any player to toggle between small and big sizes instantly.
  1. Create the Paper 1.21.4 Gradle project and plugin descriptor.

  2. Add /small and /big to set the player’s scale attribute to 0.5 and 1.0.

Created the Paper 1.21.4 plugin. /small sets your scale to 0.5; /big resets it to 1.0. It applies the scale attribute directly, equivalent to the commands you described.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
3 81
src/main/java/com/kodari/playersize/PlayerSizePlugin.java
package com.kodari.playersize;

import com.cryptomorin.xseries.XAttribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class PlayerSizePlugin extends JavaPlugin {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!(sender instanceof Player player)) {
            sender.sendMessage("Only players can change their size.");
            return true;
        }

        if (command.getName().equalsIgnoreCase("small")) {
            setScale(player, 0.5, "You are now small.");
            return true;
        }

        if (command.getName().equalsIgnoreCase("big")) {
            setScale(player, 1.0, "Your size is now normal.");
            return true;
        }

        return false;
    }

    private void setScale(Player player, double scale, String successMessage) {
        XAttribute.of("scale").ifPresentOrElse(xAttribute -> {
            AttributeInstance attribute = player.getAttribute(xAttribute.get());
            if (attribute == null) {
                player.sendMessage("Your server does not support the scale attribute.");
                return;
            }

            attribute.setBaseValue(scale);
            player.sendMessage(successMessage);
        }, () -> player.sendMessage("The scale attribute is not available."));
    }
}