diff --git a/src/main/java/net/thenextlvl/character/plugin/command/CharacterAttributeCommand.java b/src/main/java/net/thenextlvl/character/plugin/command/CharacterAttributeCommand.java index a263e4b..26fe77c 100644 --- a/src/main/java/net/thenextlvl/character/plugin/command/CharacterAttributeCommand.java +++ b/src/main/java/net/thenextlvl/character/plugin/command/CharacterAttributeCommand.java @@ -11,6 +11,7 @@ import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.character.Character; +import net.thenextlvl.character.PlayerCharacter; import net.thenextlvl.character.plugin.CharacterPlugin; import net.thenextlvl.character.plugin.command.argument.NamedTextColorArgument; import org.jspecify.annotations.NullMarked; @@ -33,6 +34,7 @@ private static LiteralArgumentBuilder reset(CharacterPlugin .then(resetColliding(plugin)) .then(resetGlowing(plugin)) .then(resetGravity(plugin)) + .then(resetListed(plugin)) .then(resetPathfinding(plugin)) .then(resetScale(plugin)) .then(resetTeamColor(plugin)) @@ -45,6 +47,7 @@ private static LiteralArgumentBuilder set(CharacterPlugin pl .then(setColliding(plugin)) .then(setGlowing(plugin)) .then(setGravity(plugin)) + .then(setListed(plugin)) .then(setPathfinding(plugin)) .then(setScale(plugin)) .then(setTeamColor(plugin)) @@ -95,6 +98,10 @@ private static boolean set(CommandContext context, String at return reset("gravity", character -> character.setGravity(false), Character::hasGravity, plugin); } + private static ArgumentBuilder resetListed(CharacterPlugin plugin) { + return reset("listed", c -> c instanceof PlayerCharacter p && p.setListed(false), Character::hasGravity, plugin); + } + private static ArgumentBuilder resetPathfinding(CharacterPlugin plugin) { return reset("pathfinding", character -> character.setPathfinding(false), Character::isPathfinding, plugin); } @@ -127,6 +134,10 @@ private static boolean set(CommandContext context, String at return attribute("gravity", Character::setGravity, plugin); } + private static ArgumentBuilder setListed(CharacterPlugin plugin) { + return attribute("listed", (c, b) -> c instanceof PlayerCharacter p && p.setListed(b), plugin); + } + private static ArgumentBuilder setPathfinding(CharacterPlugin plugin) { return attribute("pathfinding", Character::setPathfinding, plugin); }