Minestom/net/minestom/server/command/builder/Command.html

586 lines
48 KiB
HTML

<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (21) -->
<title>Command (minestom dev API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: net.minestom.server.command.builder, class: Command">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var pathtoroot = "../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span></button>
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html#class">Help</a></li>
</ul>
<ul class="sub-nav-list-small">
<li>
<p>Summary:</p>
<ul>
<li>Nested</li>
<li>Field</li>
<li><a href="#constructor-summary">Constr</a></li>
<li><a href="#method-summary">Method</a></li>
</ul>
</li>
<li>
<p>Detail:</p>
<ul>
<li>Field</li>
<li><a href="#constructor-detail">Constr</a></li>
<li><a href="#method-detail">Method</a></li>
</ul>
</li>
</ul>
</div>
<div class="sub-nav">
<div id="navbar-sub-list">
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><a href="../../../../../search.html">SEARCH</a>
<input type="text" id="search-input" disabled placeholder="Search">
<input type="reset" id="reset-button" disabled value="reset">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">net.minestom.server.command.builder</a></div>
<h1 title="Class Command" class="title">Class Command</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance">net.minestom.server.command.builder.Command</div>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>Direct Known Subclasses:</dt>
<dd><code><a href="SimpleCommand.html" title="class in net.minestom.server.command.builder">SimpleCommand</a></code></dd>
</dl>
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">Command</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div>
<div class="block">Represents a command which has suggestion/auto-completion.
<p>
The command works using a list of valid syntaxes.
For instance we could build the command
"/health set Notch 50" into multiple argument types "/health [set/add/remove] [username] [integer]"
<p>
All the default argument types can be found in <a href="arguments/ArgumentType.html" title="class in net.minestom.server.command.builder.arguments"><code>ArgumentType</code></a>
and the syntax be created/registered using <a href="#addSyntax(net.minestom.server.command.builder.CommandExecutor,net.minestom.server.command.builder.arguments.Argument...)"><code>addSyntax(CommandExecutor, Argument[])</code></a>.
<p>
If the command is executed with an incorrect syntax or without any argument, the default <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder"><code>CommandExecutor</code></a> will be called,
you can set it using <a href="#setDefaultExecutor(net.minestom.server.command.builder.CommandExecutor)"><code>setDefaultExecutor(CommandExecutor)</code></a>.
<p>
Before any syntax to be successfully executed the <a href="../CommandSender.html" title="interface in net.minestom.server.command"><code>CommandSender</code></a> needs to validated
the <a href="condition/CommandCondition.html" title="interface in net.minestom.server.command.builder.condition"><code>CommandCondition</code></a> sets with <a href="#setCondition(net.minestom.server.command.builder.condition.CommandCondition)"><code>setCondition(CommandCondition)</code></a> (ignored if null).
<p>
Some <a href="arguments/Argument.html" title="class in net.minestom.server.command.builder.arguments"><code>Argument</code></a> could also require additional condition (eg: a number which need to be between 2 values),
in this case, if the whole syntax is correct but not the argument condition,
you can listen to its error code using <a href="#setArgumentCallback(net.minestom.server.command.builder.ArgumentCallback,net.minestom.server.command.builder.arguments.Argument)"><code>setArgumentCallback(ArgumentCallback, Argument)</code></a> or <a href="arguments/Argument.html#setCallback(net.minestom.server.command.builder.ArgumentCallback)"><code>Argument.setCallback(ArgumentCallback)</code></a>.</div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(java.lang.String)" class="member-name-link">Command</a><wbr>(@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;name)</code></div>
<div class="col-last even-row-color">
<div class="block">Creates a <a href="Command.html" title="class in net.minestom.server.command.builder"><code>Command</code></a> with a name and no alias.</div>
</div>
<div class="col-constructor-name odd-row-color"><code><a href="#%3Cinit%3E(java.lang.String,java.lang.String...)" class="member-name-link">Command</a><wbr>(@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;name,
@Nullable <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>...&nbsp;aliases)</code></div>
<div class="col-last odd-row-color">
<div class="block">Creates a <a href="Command.html" title="class in net.minestom.server.command.builder"><code>Command</code></a> with a name and one or multiple aliases.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab1" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab1', 3)" class="table-tab">Static Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel" aria-labelledby="method-summary-table-tab0">
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><wbr>&lt;<a href="CommandSyntax.html" title="class in net.minestom.server.command.builder">CommandSyntax</a>&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#addConditionalSyntax(net.minestom.server.command.builder.condition.CommandCondition,net.minestom.server.command.builder.CommandExecutor,net.minestom.server.command.builder.arguments.Argument...)" class="member-name-link">addConditionalSyntax</a><wbr>(@Nullable <a href="condition/CommandCondition.html" title="interface in net.minestom.server.command.builder.condition">CommandCondition</a>&nbsp;commandCondition,
@NotNull <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder">CommandExecutor</a>&nbsp;executor,
@NotNull <a href="arguments/Argument.html" title="class in net.minestom.server.command.builder.arguments">Argument</a>&lt;?&gt;...&nbsp;args)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Adds a new syntax in the command.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#addSubcommand(net.minestom.server.command.builder.Command)" class="member-name-link">addSubcommand</a><wbr>(@NotNull <a href="Command.html" title="class in net.minestom.server.command.builder">Command</a>&nbsp;command)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><wbr>&lt;<a href="CommandSyntax.html" title="class in net.minestom.server.command.builder">CommandSyntax</a>&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#addSyntax(net.minestom.server.command.builder.CommandExecutor,java.lang.String)" class="member-name-link">addSyntax</a><wbr>(@NotNull <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder">CommandExecutor</a>&nbsp;executor,
@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;format)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Creates a syntax from a formatted string.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><wbr>&lt;<a href="CommandSyntax.html" title="class in net.minestom.server.command.builder">CommandSyntax</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#addSyntax(net.minestom.server.command.builder.CommandExecutor,net.minestom.server.command.builder.arguments.Argument...)" class="member-name-link">addSyntax</a><wbr>(@NotNull <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder">CommandExecutor</a>&nbsp;executor,
@NotNull <a href="arguments/Argument.html" title="class in net.minestom.server.command.builder.arguments">Argument</a>&lt;?&gt;...&nbsp;args)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Adds a new syntax without condition.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@Nullable <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>[]</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getAliases()" class="member-name-link">getAliases</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Gets the command's aliases.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@Nullable <a href="condition/CommandCondition.html" title="interface in net.minestom.server.command.builder.condition">CommandCondition</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getCondition()" class="member-name-link">getCondition</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Gets the <a href="condition/CommandCondition.html" title="interface in net.minestom.server.command.builder.condition"><code>CommandCondition</code></a>.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@Nullable <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder">CommandExecutor</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getDefaultExecutor()" class="member-name-link">getDefaultExecutor</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Gets the default <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder"><code>CommandExecutor</code></a> which is called when there is no argument
or if no corresponding syntax has been found.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getName()" class="member-name-link">getName</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Gets the main command's name.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>[]</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getNames()" class="member-name-link">getNames</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Gets all the possible names for this command.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a><wbr>&lt;<a href="Command.html" title="class in net.minestom.server.command.builder">Command</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getSubcommands()" class="member-name-link">getSubcommands</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a><wbr>&lt;<a href="CommandSyntax.html" title="class in net.minestom.server.command.builder">CommandSyntax</a>&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getSyntaxes()" class="member-name-link">getSyntaxes</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Gets all the syntaxes of this command.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link">Set</a><wbr>&lt;<a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getSyntaxesStrings()" class="member-name-link">getSyntaxesStrings</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getSyntaxesTree()" class="member-name-link">getSyntaxesTree</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#globalListener(net.minestom.server.command.CommandSender,net.minestom.server.command.builder.CommandContext,java.lang.String)" class="member-name-link">globalListener</a><wbr>(@NotNull <a href="../CommandSender.html" title="interface in net.minestom.server.command">CommandSender</a>&nbsp;sender,
@NotNull <a href="CommandContext.html" title="class in net.minestom.server.command.builder">CommandContext</a>&nbsp;context,
@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;command)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Called when a <a href="../CommandSender.html" title="interface in net.minestom.server.command"><code>CommandSender</code></a> executes this command before any syntax callback.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#isValidName(net.minestom.server.command.builder.Command,java.lang.String)" class="member-name-link">isValidName</a><wbr>(@NotNull <a href="Command.html" title="class in net.minestom.server.command.builder">Command</a>&nbsp;command,
@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;name)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">&nbsp;</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setArgumentCallback(net.minestom.server.command.builder.ArgumentCallback,net.minestom.server.command.builder.arguments.Argument)" class="member-name-link">setArgumentCallback</a><wbr>(@NotNull <a href="ArgumentCallback.html" title="interface in net.minestom.server.command.builder">ArgumentCallback</a>&nbsp;callback,
@NotNull <a href="arguments/Argument.html" title="class in net.minestom.server.command.builder.arguments">Argument</a>&lt;?&gt;&nbsp;argument)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Sets an <a href="ArgumentCallback.html" title="interface in net.minestom.server.command.builder"><code>ArgumentCallback</code></a>.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setCondition(net.minestom.server.command.builder.condition.CommandCondition)" class="member-name-link">setCondition</a><wbr>(@Nullable <a href="condition/CommandCondition.html" title="interface in net.minestom.server.command.builder.condition">CommandCondition</a>&nbsp;commandCondition)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Sets the <a href="condition/CommandCondition.html" title="interface in net.minestom.server.command.builder.condition"><code>CommandCondition</code></a>.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#setDefaultExecutor(net.minestom.server.command.builder.CommandExecutor)" class="member-name-link">setDefaultExecutor</a><wbr>(@Nullable <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder">CommandExecutor</a>&nbsp;executor)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Sets the default <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder"><code>CommandExecutor</code></a>.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;(java.lang.String,java.lang.String...)">
<h3>Command</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">Command</span><wbr><span class="parameters">(@NotNull
@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;name,
@Nullable
@Nullable <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>...&nbsp;aliases)</span></div>
<div class="block">Creates a <a href="Command.html" title="class in net.minestom.server.command.builder"><code>Command</code></a> with a name and one or multiple aliases.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>name</code> - the name of the command</dd>
<dd><code>aliases</code> - the command aliases</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#%3Cinit%3E(java.lang.String)"><code>Command(String)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="&lt;init&gt;(java.lang.String)">
<h3>Command</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">Command</span><wbr><span class="parameters">(@NotNull
@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;name)</span></div>
<div class="block">Creates a <a href="Command.html" title="class in net.minestom.server.command.builder"><code>Command</code></a> with a name and no alias.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>name</code> - the name of the command</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="#%3Cinit%3E(java.lang.String,java.lang.String...)"><code>Command(String, String...)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="getCondition()">
<h3>getCondition</h3>
<div class="member-signature"><span class="annotations">@Nullable
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">@Nullable <a href="condition/CommandCondition.html" title="interface in net.minestom.server.command.builder.condition">CommandCondition</a></span>&nbsp;<span class="element-name">getCondition</span>()</div>
<div class="block">Gets the <a href="condition/CommandCondition.html" title="interface in net.minestom.server.command.builder.condition"><code>CommandCondition</code></a>.
<p>
It is called after the parsing and just before the execution no matter the syntax used and can be used to check permissions or
the <a href="../CommandSender.html" title="interface in net.minestom.server.command"><code>CommandSender</code></a> type.
<p>
Worth mentioning that the condition is also used to know if the command known from a player (at connection).</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the command condition, null if not any</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setCondition(net.minestom.server.command.builder.condition.CommandCondition)">
<h3>setCondition</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setCondition</span><wbr><span class="parameters">(@Nullable
@Nullable <a href="condition/CommandCondition.html" title="interface in net.minestom.server.command.builder.condition">CommandCondition</a>&nbsp;commandCondition)</span></div>
<div class="block">Sets the <a href="condition/CommandCondition.html" title="interface in net.minestom.server.command.builder.condition"><code>CommandCondition</code></a>.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>commandCondition</code> - the new command condition, null to do not call anything</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#getCondition()"><code>getCondition()</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setArgumentCallback(net.minestom.server.command.builder.ArgumentCallback,net.minestom.server.command.builder.arguments.Argument)">
<h3>setArgumentCallback</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setArgumentCallback</span><wbr><span class="parameters">(@NotNull
@NotNull <a href="ArgumentCallback.html" title="interface in net.minestom.server.command.builder">ArgumentCallback</a>&nbsp;callback,
@NotNull
@NotNull <a href="arguments/Argument.html" title="class in net.minestom.server.command.builder.arguments">Argument</a>&lt;?&gt;&nbsp;argument)</span></div>
<div class="block">Sets an <a href="ArgumentCallback.html" title="interface in net.minestom.server.command.builder"><code>ArgumentCallback</code></a>.
<p>
The argument callback is called when there's an error in the argument.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>callback</code> - the callback for the argument</dd>
<dd><code>argument</code> - the argument which get the callback</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="addSubcommand(net.minestom.server.command.builder.Command)">
<h3>addSubcommand</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">addSubcommand</span><wbr><span class="parameters">(@NotNull
@NotNull <a href="Command.html" title="class in net.minestom.server.command.builder">Command</a>&nbsp;command)</span></div>
</section>
</li>
<li>
<section class="detail" id="getSubcommands()">
<h3>getSubcommands</h3>
<div class="member-signature"><span class="annotations">@NotNull
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/List.html" title="class or interface in java.util" class="external-link">List</a>&lt;<a href="Command.html" title="class in net.minestom.server.command.builder">Command</a>&gt;</span>&nbsp;<span class="element-name">getSubcommands</span>()</div>
</section>
</li>
<li>
<section class="detail" id="addConditionalSyntax(net.minestom.server.command.builder.condition.CommandCondition,net.minestom.server.command.builder.CommandExecutor,net.minestom.server.command.builder.arguments.Argument...)">
<h3>addConditionalSyntax</h3>
<div class="member-signature"><span class="annotations">@NotNull
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a>&lt;<a href="CommandSyntax.html" title="class in net.minestom.server.command.builder">CommandSyntax</a>&gt;</span>&nbsp;<span class="element-name">addConditionalSyntax</span><wbr><span class="parameters">(@Nullable
@Nullable <a href="condition/CommandCondition.html" title="interface in net.minestom.server.command.builder.condition">CommandCondition</a>&nbsp;commandCondition,
@NotNull
@NotNull <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder">CommandExecutor</a>&nbsp;executor,
@NotNull
@NotNull <a href="arguments/Argument.html" title="class in net.minestom.server.command.builder.arguments">Argument</a>&lt;?&gt;...&nbsp;args)</span></div>
<div class="block">Adds a new syntax in the command.
<p>
A syntax is simply a list of arguments and an executor called when successfully parsed.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>commandCondition</code> - the condition to use the syntax</dd>
<dd><code>executor</code> - the executor to call when the syntax is successfully received</dd>
<dd><code>args</code> - all the arguments of the syntax, the length needs to be higher than 0</dd>
<dt>Returns:</dt>
<dd>the created <a href="CommandSyntax.html" title="class in net.minestom.server.command.builder"><code>syntaxes</code></a>,
there can be multiple of them when optional arguments are used</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="addSyntax(net.minestom.server.command.builder.CommandExecutor,net.minestom.server.command.builder.arguments.Argument...)">
<h3>addSyntax</h3>
<div class="member-signature"><span class="annotations">@NotNull
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a>&lt;<a href="CommandSyntax.html" title="class in net.minestom.server.command.builder">CommandSyntax</a>&gt;</span>&nbsp;<span class="element-name">addSyntax</span><wbr><span class="parameters">(@NotNull
@NotNull <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder">CommandExecutor</a>&nbsp;executor,
@NotNull
@NotNull <a href="arguments/Argument.html" title="class in net.minestom.server.command.builder.arguments">Argument</a>&lt;?&gt;...&nbsp;args)</span></div>
<div class="block">Adds a new syntax without condition.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="#addConditionalSyntax(net.minestom.server.command.builder.condition.CommandCondition,net.minestom.server.command.builder.CommandExecutor,net.minestom.server.command.builder.arguments.Argument...)"><code>addConditionalSyntax(CommandCondition, CommandExecutor, Argument[])</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="addSyntax(net.minestom.server.command.builder.CommandExecutor,java.lang.String)">
<h3>addSyntax</h3>
<div class="member-signature"><span class="annotations">@Experimental
@NotNull
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a>&lt;<a href="CommandSyntax.html" title="class in net.minestom.server.command.builder">CommandSyntax</a>&gt;</span>&nbsp;<span class="element-name">addSyntax</span><wbr><span class="parameters">(@NotNull
@NotNull <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder">CommandExecutor</a>&nbsp;executor,
@NotNull
@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;format)</span></div>
<div class="block">Creates a syntax from a formatted string.
<p>
Currently in beta as the format is not final.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>executor</code> - the syntax executor</dd>
<dd><code>format</code> - the syntax format</dd>
<dt>Returns:</dt>
<dd>the newly created <a href="CommandSyntax.html" title="class in net.minestom.server.command.builder"><code>syntaxes</code></a>.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getName()">
<h3>getName</h3>
<div class="member-signature"><span class="annotations">@NotNull
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">getName</span>()</div>
<div class="block">Gets the main command's name.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the main command's name</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getAliases()">
<h3>getAliases</h3>
<div class="member-signature"><span class="annotations">@Nullable
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">@Nullable <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>[]</span>&nbsp;<span class="element-name">getAliases</span>()</div>
<div class="block">Gets the command's aliases.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the command aliases, can be null or empty</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getNames()">
<h3>getNames</h3>
<div class="member-signature"><span class="annotations">@NotNull
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>[]</span>&nbsp;<span class="element-name">getNames</span>()</div>
<div class="block">Gets all the possible names for this command.
<p>
Include <a href="#getName()"><code>getName()</code></a> and <a href="#getAliases()"><code>getAliases()</code></a>.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>this command names</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getDefaultExecutor()">
<h3>getDefaultExecutor</h3>
<div class="member-signature"><span class="annotations">@Nullable
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">@Nullable <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder">CommandExecutor</a></span>&nbsp;<span class="element-name">getDefaultExecutor</span>()</div>
<div class="block">Gets the default <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder"><code>CommandExecutor</code></a> which is called when there is no argument
or if no corresponding syntax has been found.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the default executor, null if not any</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="#setDefaultExecutor(net.minestom.server.command.builder.CommandExecutor)"><code>setDefaultExecutor(CommandExecutor)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="setDefaultExecutor(net.minestom.server.command.builder.CommandExecutor)">
<h3>setDefaultExecutor</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">setDefaultExecutor</span><wbr><span class="parameters">(@Nullable
@Nullable <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder">CommandExecutor</a>&nbsp;executor)</span></div>
<div class="block">Sets the default <a href="CommandExecutor.html" title="interface in net.minestom.server.command.builder"><code>CommandExecutor</code></a>.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>executor</code> - the new default executor, null to remove it</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="#getDefaultExecutor()"><code>getDefaultExecutor()</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getSyntaxes()">
<h3>getSyntaxes</h3>
<div class="member-signature"><span class="annotations">@NotNull
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a>&lt;<a href="CommandSyntax.html" title="class in net.minestom.server.command.builder">CommandSyntax</a>&gt;</span>&nbsp;<span class="element-name">getSyntaxes</span>()</div>
<div class="block">Gets all the syntaxes of this command.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>a collection containing all this command syntaxes</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="#addSyntax(net.minestom.server.command.builder.CommandExecutor,net.minestom.server.command.builder.arguments.Argument...)"><code>addSyntax(CommandExecutor, Argument[])</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="globalListener(net.minestom.server.command.CommandSender,net.minestom.server.command.builder.CommandContext,java.lang.String)">
<h3>globalListener</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">globalListener</span><wbr><span class="parameters">(@NotNull
@NotNull <a href="../CommandSender.html" title="interface in net.minestom.server.command">CommandSender</a>&nbsp;sender,
@NotNull
@NotNull <a href="CommandContext.html" title="class in net.minestom.server.command.builder">CommandContext</a>&nbsp;context,
@NotNull
@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;command)</span></div>
<div class="block">Called when a <a href="../CommandSender.html" title="interface in net.minestom.server.command"><code>CommandSender</code></a> executes this command before any syntax callback.
<p>
WARNING: the <a href="condition/CommandCondition.html" title="interface in net.minestom.server.command.builder.condition"><code>CommandCondition</code></a> is not executed, and all the <a href="CommandSyntax.html" title="class in net.minestom.server.command.builder"><code>CommandSyntax</code></a> are not checked,
this is called every time a <a href="../CommandSender.html" title="interface in net.minestom.server.command"><code>CommandSender</code></a> send a command which start by <a href="#getName()"><code>getName()</code></a> or <a href="#getAliases()"><code>getAliases()</code></a>.
<p>
Can be used if you wish to still suggest the player syntaxes but want to parse things mostly by yourself.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>sender</code> - the <a href="../CommandSender.html" title="interface in net.minestom.server.command"><code>CommandSender</code></a></dd>
<dd><code>context</code> - the UNCHECKED context of the command, some can be null even when unexpected</dd>
<dd><code>command</code> - the raw UNCHECKED received command</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="getSyntaxesStrings()">
<h3>getSyntaxesStrings</h3>
<div class="member-signature"><span class="annotations">@Experimental
@NotNull
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link">Set</a>&lt;<a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;</span>&nbsp;<span class="element-name">getSyntaxesStrings</span>()</div>
</section>
</li>
<li>
<section class="detail" id="getSyntaxesTree()">
<h3>getSyntaxesTree</h3>
<div class="member-signature"><span class="annotations">@Experimental
@NotNull
</span><span class="modifiers">public</span>&nbsp;<span class="return-type">@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">getSyntaxesTree</span>()</div>
</section>
</li>
<li>
<section class="detail" id="isValidName(net.minestom.server.command.builder.Command,java.lang.String)">
<h3>isValidName</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">isValidName</span><wbr><span class="parameters">(@NotNull
@NotNull <a href="Command.html" title="class in net.minestom.server.command.builder">Command</a>&nbsp;command,
@NotNull
@NotNull <a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;name)</span></div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
</div>
</div>
</body>
</html>