Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.Style;
import net.kyori.adventure.text.format.TextColor;
import org.bukkit.GameMode;
import org.bukkit.HeightMap;
import org.bukkit.NamespacedKey;
Expand Down Expand Up @@ -167,6 +168,15 @@ public static ArgumentType<NamedTextColor> namedColor() {
return provider().namedColor();
}

/**
* A hex color argument.
*
* @return argument
*/
public static ArgumentType<TextColor> hexColor() {
return provider().hexColor();
}

/**
* A component argument.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.Style;
import net.kyori.adventure.text.format.TextColor;
import org.bukkit.GameMode;
import org.bukkit.HeightMap;
import org.bukkit.NamespacedKey;
Expand Down Expand Up @@ -65,6 +66,8 @@ static VanillaArgumentProvider provider() {

ArgumentType<NamedTextColor> namedColor();

ArgumentType<TextColor> hexColor();

ArgumentType<Component> component();

ArgumentType<Style> style();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.Style;
import net.kyori.adventure.text.format.TextColor;
import net.minecraft.advancements.critereon.MinMaxBounds;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.arguments.ColorArgument;
Expand All @@ -49,6 +50,7 @@
import net.minecraft.commands.arguments.GameModeArgument;
import net.minecraft.commands.arguments.GameProfileArgument;
import net.minecraft.commands.arguments.HeightmapTypeArgument;
import net.minecraft.commands.arguments.HexColorArgument;
import net.minecraft.commands.arguments.MessageArgument;
import net.minecraft.commands.arguments.ObjectiveCriteriaArgument;
import net.minecraft.commands.arguments.RangeArgument;
Expand Down Expand Up @@ -205,6 +207,11 @@ public ArgumentType<NamedTextColor> namedColor() {
);
}

@Override
public ArgumentType<TextColor> hexColor() {
return this.wrap(HexColorArgument.hexColor(), TextColor::color);
}

@Override
public ArgumentType<Component> component() {
return this.wrap(ComponentArgument.textComponent(PaperCommands.INSTANCE.getBuildContext()), PaperAdventure::asAdventure);
Expand Down
Loading