mirror of
https://github.com/aikar/commands.git
synced 2026-05-31 14:21:56 +00:00
Updated JavaDocs
This commit is contained in:
@@ -108,7 +108,7 @@ var activeTableTab = "activeTableTab";
|
||||
<li class="blockList">
|
||||
<hr>
|
||||
<br>
|
||||
<pre>public abstract class <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.42">CommandManager</a><I,AI extends <a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a>,FT,F extends <a href="../../../co/aikar/commands/MessageFormatter.html" title="class in co.aikar.commands">MessageFormatter</a><FT>>
|
||||
<pre>public abstract class <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.43">CommandManager</a><I,AI extends <a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a>,FT,F extends <a href="../../../co/aikar/commands/MessageFormatter.html" title="class in co.aikar.commands">MessageFormatter</a><FT>>
|
||||
extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -493,7 +493,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>rootCommands</h4>
|
||||
<pre>protected <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,co.aikar.commands.RootCommand> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.55">rootCommands</a></pre>
|
||||
<pre>protected <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,co.aikar.commands.RootCommand> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.56">rootCommands</a></pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="replacements">
|
||||
@@ -502,7 +502,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>replacements</h4>
|
||||
<pre>protected final <a href="../../../co/aikar/commands/CommandReplacements.html" title="class in co.aikar.commands">CommandReplacements</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.56">replacements</a></pre>
|
||||
<pre>protected final <a href="../../../co/aikar/commands/CommandReplacements.html" title="class in co.aikar.commands">CommandReplacements</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.57">replacements</a></pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="defaultExceptionHandler">
|
||||
@@ -511,7 +511,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>defaultExceptionHandler</h4>
|
||||
<pre>protected <a href="../../../co/aikar/commands/ExceptionHandler.html" title="interface in co.aikar.commands">ExceptionHandler</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.57">defaultExceptionHandler</a></pre>
|
||||
<pre>protected <a href="../../../co/aikar/commands/ExceptionHandler.html" title="interface in co.aikar.commands">ExceptionHandler</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.58">defaultExceptionHandler</a></pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="usePerIssuerLocale">
|
||||
@@ -520,7 +520,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>usePerIssuerLocale</h4>
|
||||
<pre>protected boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.59">usePerIssuerLocale</a></pre>
|
||||
<pre>protected boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.60">usePerIssuerLocale</a></pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="localeChangedCallbacks">
|
||||
@@ -529,7 +529,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>localeChangedCallbacks</h4>
|
||||
<pre>protected <a href="http://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../co/aikar/commands/IssuerLocaleChangedCallback.html" title="interface in co.aikar.commands">IssuerLocaleChangedCallback</a><<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">AI</a> extends <a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a>>> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.60">localeChangedCallbacks</a></pre>
|
||||
<pre>protected <a href="http://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="../../../co/aikar/commands/IssuerLocaleChangedCallback.html" title="interface in co.aikar.commands">IssuerLocaleChangedCallback</a><<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">AI</a> extends <a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a>>> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.61">localeChangedCallbacks</a></pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="supportedLanguages">
|
||||
@@ -538,7 +538,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>supportedLanguages</h4>
|
||||
<pre>protected <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a><<a href="http://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a>> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.61">supportedLanguages</a></pre>
|
||||
<pre>protected <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a><<a href="http://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a>> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.62">supportedLanguages</a></pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="formatters">
|
||||
@@ -547,7 +547,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>formatters</h4>
|
||||
<pre>protected <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a>,<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> extends <a href="../../../co/aikar/commands/MessageFormatter.html" title="class in co.aikar.commands">MessageFormatter</a><<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">FT</a>>> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.62">formatters</a></pre>
|
||||
<pre>protected <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a>,<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> extends <a href="../../../co/aikar/commands/MessageFormatter.html" title="class in co.aikar.commands">MessageFormatter</a><<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">FT</a>>> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.63">formatters</a></pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="defaultFormatter">
|
||||
@@ -556,7 +556,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>defaultFormatter</h4>
|
||||
<pre>protected <a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> extends <a href="../../../co/aikar/commands/MessageFormatter.html" title="class in co.aikar.commands">MessageFormatter</a><<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">FT</a>> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.63">defaultFormatter</a></pre>
|
||||
<pre>protected <a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> extends <a href="../../../co/aikar/commands/MessageFormatter.html" title="class in co.aikar.commands">MessageFormatter</a><<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">FT</a>> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.64">defaultFormatter</a></pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="defaultHelpPerPage">
|
||||
@@ -565,7 +565,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockListLast">
|
||||
<li class="blockList">
|
||||
<h4>defaultHelpPerPage</h4>
|
||||
<pre>protected int <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.64">defaultHelpPerPage</a></pre>
|
||||
<pre>protected int <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.65">defaultHelpPerPage</a></pre>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -582,7 +582,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockListLast">
|
||||
<li class="blockList">
|
||||
<h4>CommandManager</h4>
|
||||
<pre>public <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.42">CommandManager</a>()</pre>
|
||||
<pre>public <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.43">CommandManager</a>()</pre>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -599,7 +599,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getCurrentCommandOperationContext</h4>
|
||||
<pre>public static <a href="../../../co/aikar/commands/CommandOperationContext.html" title="class in co.aikar.commands">CommandOperationContext</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.68">getCurrentCommandOperationContext</a>()</pre>
|
||||
<pre>public static <a href="../../../co/aikar/commands/CommandOperationContext.html" title="class in co.aikar.commands">CommandOperationContext</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.69">getCurrentCommandOperationContext</a>()</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getCurrentCommandIssuer--">
|
||||
@@ -608,7 +608,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getCurrentCommandIssuer</h4>
|
||||
<pre>public static <a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.72">getCurrentCommandIssuer</a>()</pre>
|
||||
<pre>public static <a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.73">getCurrentCommandIssuer</a>()</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getCurrentCommandManager--">
|
||||
@@ -617,7 +617,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getCurrentCommandManager</h4>
|
||||
<pre>public static <a href="../../../co/aikar/commands/CommandManager.html" title="class in co.aikar.commands">CommandManager</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.77">getCurrentCommandManager</a>()</pre>
|
||||
<pre>public static <a href="../../../co/aikar/commands/CommandManager.html" title="class in co.aikar.commands">CommandManager</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.78">getCurrentCommandManager</a>()</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="setFormat-co.aikar.commands.MessageType-co.aikar.commands.MessageFormatter-">
|
||||
@@ -628,7 +628,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>setFormat</h4>
|
||||
<pre>public <a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.82">setFormat</a>(<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a> type,
|
||||
<pre>public <a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.83">setFormat</a>(<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a> type,
|
||||
<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> formatter)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -638,7 +638,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getFormat</h4>
|
||||
<pre>public <a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.86">getFormat</a>(<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a> type)</pre>
|
||||
<pre>public <a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.87">getFormat</a>(<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a> type)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="setFormat-co.aikar.commands.MessageType-java.lang.Object:A-">
|
||||
@@ -649,7 +649,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>setFormat</h4>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.90">setFormat</a>(<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a> type,
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.91">setFormat</a>(<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a> type,
|
||||
<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">FT</a>... colors)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -661,7 +661,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>setFormat</h4>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.97">setFormat</a>(<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a> type,
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.98">setFormat</a>(<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a> type,
|
||||
int i,
|
||||
<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">FT</a> color)</pre>
|
||||
</li>
|
||||
@@ -672,7 +672,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getDefaultFormatter</h4>
|
||||
<pre>public <a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.102">getDefaultFormatter</a>()</pre>
|
||||
<pre>public <a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.103">getDefaultFormatter</a>()</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="setDefaultFormatter-co.aikar.commands.MessageFormatter-">
|
||||
@@ -683,7 +683,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>setDefaultFormatter</h4>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.106">setDefaultFormatter</a>(<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> defaultFormatter)</pre>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.107">setDefaultFormatter</a>(<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">F</a> defaultFormatter)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getCommandContexts--">
|
||||
@@ -692,7 +692,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getCommandContexts</h4>
|
||||
<pre>public abstract <a href="../../../co/aikar/commands/CommandContexts.html" title="class in co.aikar.commands">CommandContexts</a><?> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.114">getCommandContexts</a>()</pre>
|
||||
<pre>public abstract <a href="../../../co/aikar/commands/CommandContexts.html" title="class in co.aikar.commands">CommandContexts</a><?> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.115">getCommandContexts</a>()</pre>
|
||||
<div class="block">Gets the command contexts manager</div>
|
||||
<dl>
|
||||
<dt><span class="returnLabel">Returns:</span></dt>
|
||||
@@ -706,7 +706,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getCommandCompletions</h4>
|
||||
<pre>public abstract <a href="../../../co/aikar/commands/CommandCompletions.html" title="class in co.aikar.commands">CommandCompletions</a><?> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.120">getCommandCompletions</a>()</pre>
|
||||
<pre>public abstract <a href="../../../co/aikar/commands/CommandCompletions.html" title="class in co.aikar.commands">CommandCompletions</a><?> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.121">getCommandCompletions</a>()</pre>
|
||||
<div class="block">Gets the command completions manager</div>
|
||||
<dl>
|
||||
<dt><span class="returnLabel">Returns:</span></dt>
|
||||
@@ -721,7 +721,7 @@ extends <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?
|
||||
<li class="blockList">
|
||||
<h4>generateCommandHelp</h4>
|
||||
<pre><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
|
||||
public <a href="../../../co/aikar/commands/CommandHelp.html" title="class in co.aikar.commands">CommandHelp</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.123">generateCommandHelp</a>(@NotNull
|
||||
public <a href="../../../co/aikar/commands/CommandHelp.html" title="class in co.aikar.commands">CommandHelp</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.124">generateCommandHelp</a>(@NotNull
|
||||
@NotNull <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> command)</pre>
|
||||
<div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Unstable API</span></div>
|
||||
</li>
|
||||
@@ -733,7 +733,7 @@ public <a href="../../../co/aikar/commands/CommandHelp.html" title="class i
|
||||
<li class="blockList">
|
||||
<h4>generateCommandHelp</h4>
|
||||
<pre><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
|
||||
public <a href="../../../co/aikar/commands/CommandHelp.html" title="class in co.aikar.commands">CommandHelp</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.133">generateCommandHelp</a>(<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> issuer,
|
||||
public <a href="../../../co/aikar/commands/CommandHelp.html" title="class in co.aikar.commands">CommandHelp</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.134">generateCommandHelp</a>(<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> issuer,
|
||||
@NotNull
|
||||
@NotNull <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> command)</pre>
|
||||
<div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Unstable API</span></div>
|
||||
@@ -746,7 +746,7 @@ public <a href="../../../co/aikar/commands/CommandHelp.html" title="class i
|
||||
<li class="blockList">
|
||||
<h4>generateCommandHelp</h4>
|
||||
<pre><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
|
||||
public <a href="../../../co/aikar/commands/CommandHelp.html" title="class in co.aikar.commands">CommandHelp</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.139">generateCommandHelp</a>()</pre>
|
||||
public <a href="../../../co/aikar/commands/CommandHelp.html" title="class in co.aikar.commands">CommandHelp</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.140">generateCommandHelp</a>()</pre>
|
||||
<div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Unstable API</span></div>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -757,7 +757,7 @@ public <a href="../../../co/aikar/commands/CommandHelp.html" title="class i
|
||||
<li class="blockList">
|
||||
<h4>generateCommandHelp</h4>
|
||||
<pre><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
|
||||
public <a href="../../../co/aikar/commands/CommandHelp.html" title="class in co.aikar.commands">CommandHelp</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.150">generateCommandHelp</a>(<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> issuer,
|
||||
public <a href="../../../co/aikar/commands/CommandHelp.html" title="class in co.aikar.commands">CommandHelp</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.151">generateCommandHelp</a>(<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> issuer,
|
||||
co.aikar.commands.RootCommand rootCommand)</pre>
|
||||
<div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Unstable API</span></div>
|
||||
</li>
|
||||
@@ -769,7 +769,7 @@ public <a href="../../../co/aikar/commands/CommandHelp.html" title="class i
|
||||
<li class="blockList">
|
||||
<h4>getDefaultHelpPerPage</h4>
|
||||
<pre><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
|
||||
public int <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.156">getDefaultHelpPerPage</a>()</pre>
|
||||
public int <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.157">getDefaultHelpPerPage</a>()</pre>
|
||||
<div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Unstable API</span></div>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -780,7 +780,7 @@ public int <a href="../../../src-html/co/aikar/commands/CommandManager
|
||||
<li class="blockList">
|
||||
<h4>setDefaultHelpPerPage</h4>
|
||||
<pre><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
|
||||
public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.162">setDefaultHelpPerPage</a>(int defaultHelpPerPage)</pre>
|
||||
public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.163">setDefaultHelpPerPage</a>(int defaultHelpPerPage)</pre>
|
||||
<div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Unstable API</span></div>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -790,7 +790,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>registerCommand</h4>
|
||||
<pre>public abstract void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.173">registerCommand</a>(<a href="../../../co/aikar/commands/BaseCommand.html" title="class in co.aikar.commands">BaseCommand</a> command)</pre>
|
||||
<pre>public abstract void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.174">registerCommand</a>(<a href="../../../co/aikar/commands/BaseCommand.html" title="class in co.aikar.commands">BaseCommand</a> command)</pre>
|
||||
<div class="block">Registers a command with ACF</div>
|
||||
<dl>
|
||||
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||
@@ -804,7 +804,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>hasRegisteredCommands</h4>
|
||||
<pre>public abstract boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.174">hasRegisteredCommands</a>()</pre>
|
||||
<pre>public abstract boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.175">hasRegisteredCommands</a>()</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="isCommandIssuer-java.lang.Class-">
|
||||
@@ -813,7 +813,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>isCommandIssuer</h4>
|
||||
<pre>public abstract boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.175">isCommandIssuer</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><?> type)</pre>
|
||||
<pre>public abstract boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.176">isCommandIssuer</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><?> type)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getCommandIssuer-java.lang.Object-">
|
||||
@@ -822,7 +822,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getCommandIssuer</h4>
|
||||
<pre>public abstract <a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">AI</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.178">getCommandIssuer</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> issuer)</pre>
|
||||
<pre>public abstract <a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">AI</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.179">getCommandIssuer</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> issuer)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="createRootCommand-java.lang.String-">
|
||||
@@ -831,7 +831,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>createRootCommand</h4>
|
||||
<pre>public abstract co.aikar.commands.RootCommand <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.180">createRootCommand</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> cmd)</pre>
|
||||
<pre>public abstract co.aikar.commands.RootCommand <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.181">createRootCommand</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> cmd)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getLocales--">
|
||||
@@ -840,7 +840,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getLocales</h4>
|
||||
<pre>public abstract <a href="../../../co/aikar/commands/Locales.html" title="class in co.aikar.commands">Locales</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.186">getLocales</a>()</pre>
|
||||
<pre>public abstract <a href="../../../co/aikar/commands/Locales.html" title="class in co.aikar.commands">Locales</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.187">getLocales</a>()</pre>
|
||||
<div class="block">Returns a Locales Manager to add and modify language tables for your commands.</div>
|
||||
<dl>
|
||||
<dt><span class="returnLabel">Returns:</span></dt>
|
||||
@@ -853,7 +853,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>usingPerIssuerLocale</h4>
|
||||
<pre>public boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.188">usingPerIssuerLocale</a>()</pre>
|
||||
<pre>public boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.189">usingPerIssuerLocale</a>()</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="usePerIssuerLocale-boolean-">
|
||||
@@ -862,7 +862,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>usePerIssuerLocale</h4>
|
||||
<pre>public boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.192">usePerIssuerLocale</a>(boolean setting)</pre>
|
||||
<pre>public boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.193">usePerIssuerLocale</a>(boolean setting)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="createCommandContext-co.aikar.commands.RegisteredCommand-java.lang.reflect.Parameter-co.aikar.commands.CommandIssuer-java.util.List-int-java.util.Map-">
|
||||
@@ -871,7 +871,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>createCommandContext</h4>
|
||||
<pre>public abstract <R extends <a href="../../../co/aikar/commands/CommandExecutionContext.html" title="class in co.aikar.commands">CommandExecutionContext</a>> R <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.198">createCommandContext</a>(<a href="../../../co/aikar/commands/RegisteredCommand.html" title="class in co.aikar.commands">RegisteredCommand</a> command,
|
||||
<pre>public abstract <R extends <a href="../../../co/aikar/commands/CommandExecutionContext.html" title="class in co.aikar.commands">CommandExecutionContext</a>> R <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.199">createCommandContext</a>(<a href="../../../co/aikar/commands/RegisteredCommand.html" title="class in co.aikar.commands">RegisteredCommand</a> command,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Parameter.html?is-external=true" title="class or interface in java.lang.reflect">Parameter</a> parameter,
|
||||
<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> sender,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>> args,
|
||||
@@ -885,7 +885,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>createCompletionContext</h4>
|
||||
<pre>public abstract <a href="../../../co/aikar/commands/CommandCompletionContext.html" title="class in co.aikar.commands">CommandCompletionContext</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.200">createCompletionContext</a>(<a href="../../../co/aikar/commands/RegisteredCommand.html" title="class in co.aikar.commands">RegisteredCommand</a> command,
|
||||
<pre>public abstract <a href="../../../co/aikar/commands/CommandCompletionContext.html" title="class in co.aikar.commands">CommandCompletionContext</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.201">createCompletionContext</a>(<a href="../../../co/aikar/commands/RegisteredCommand.html" title="class in co.aikar.commands">RegisteredCommand</a> command,
|
||||
<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> sender,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> input,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> config,
|
||||
@@ -898,7 +898,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>log</h4>
|
||||
<pre>public abstract void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.202">log</a>(co.aikar.commands.LogLevel level,
|
||||
<pre>public abstract void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.203">log</a>(co.aikar.commands.LogLevel level,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> message,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</a> throwable)</pre>
|
||||
</li>
|
||||
@@ -909,7 +909,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>log</h4>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.204">log</a>(co.aikar.commands.LogLevel level,
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.205">log</a>(co.aikar.commands.LogLevel level,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> message)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -919,7 +919,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getCommandReplacements</h4>
|
||||
<pre>public <a href="../../../co/aikar/commands/CommandReplacements.html" title="class in co.aikar.commands">CommandReplacements</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.217">getCommandReplacements</a>()</pre>
|
||||
<pre>public <a href="../../../co/aikar/commands/CommandReplacements.html" title="class in co.aikar.commands">CommandReplacements</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.218">getCommandReplacements</a>()</pre>
|
||||
<div class="block">Lets you add custom string replacements that can be applied to annotation values,
|
||||
to reduce duplication/repetition of common values such as permission nodes and command prefixes.
|
||||
|
||||
@@ -938,7 +938,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>hasPermission</h4>
|
||||
<pre>public boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.221">hasPermission</a>(<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> issuer,
|
||||
<pre>public boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.222">hasPermission</a>(<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> issuer,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> permission)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -948,7 +948,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getRootCommand</h4>
|
||||
<pre>public co.aikar.commands.RootCommand <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.241">getRootCommand</a>(@NotNull
|
||||
<pre>public co.aikar.commands.RootCommand <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.242">getRootCommand</a>(@NotNull
|
||||
@NotNull <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> cmd)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -958,7 +958,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>obtainRootCommand</h4>
|
||||
<pre>public co.aikar.commands.RootCommand <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.245">obtainRootCommand</a>(@NotNull
|
||||
<pre>public co.aikar.commands.RootCommand <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.246">obtainRootCommand</a>(@NotNull
|
||||
@NotNull <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> cmd)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -968,7 +968,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>createRegisteredCommand</h4>
|
||||
<pre>public <a href="../../../co/aikar/commands/RegisteredCommand.html" title="class in co.aikar.commands">RegisteredCommand</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.249">createRegisteredCommand</a>(<a href="../../../co/aikar/commands/BaseCommand.html" title="class in co.aikar.commands">BaseCommand</a> command,
|
||||
<pre>public <a href="../../../co/aikar/commands/RegisteredCommand.html" title="class in co.aikar.commands">RegisteredCommand</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.250">createRegisteredCommand</a>(<a href="../../../co/aikar/commands/BaseCommand.html" title="class in co.aikar.commands">BaseCommand</a> command,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> cmdName,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Method.html?is-external=true" title="class or interface in java.lang.reflect">Method</a> method,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> prefSubCommand)</pre>
|
||||
@@ -980,7 +980,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>setDefaultExceptionHandler</h4>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.258">setDefaultExceptionHandler</a>(<a href="../../../co/aikar/commands/ExceptionHandler.html" title="interface in co.aikar.commands">ExceptionHandler</a> exceptionHandler)</pre>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.259">setDefaultExceptionHandler</a>(<a href="../../../co/aikar/commands/ExceptionHandler.html" title="interface in co.aikar.commands">ExceptionHandler</a> exceptionHandler)</pre>
|
||||
<div class="block">Sets the default <a href="../../../co/aikar/commands/ExceptionHandler.html" title="interface in co.aikar.commands"><code>ExceptionHandler</code></a> that is called when an exception occurs while executing a command, if the command doesn't have it's own exception handler registered.</div>
|
||||
<dl>
|
||||
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||
@@ -994,7 +994,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getDefaultExceptionHandler</h4>
|
||||
<pre>public <a href="../../../co/aikar/commands/ExceptionHandler.html" title="interface in co.aikar.commands">ExceptionHandler</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.267">getDefaultExceptionHandler</a>()</pre>
|
||||
<pre>public <a href="../../../co/aikar/commands/ExceptionHandler.html" title="interface in co.aikar.commands">ExceptionHandler</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.268">getDefaultExceptionHandler</a>()</pre>
|
||||
<div class="block">Gets the current default exception handler, might be null.</div>
|
||||
<dl>
|
||||
<dt><span class="returnLabel">Returns:</span></dt>
|
||||
@@ -1008,7 +1008,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>handleUncaughtException</h4>
|
||||
<pre>protected boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.271">handleUncaughtException</a>(<a href="../../../co/aikar/commands/BaseCommand.html" title="class in co.aikar.commands">BaseCommand</a> scope,
|
||||
<pre>protected boolean <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.272">handleUncaughtException</a>(<a href="../../../co/aikar/commands/BaseCommand.html" title="class in co.aikar.commands">BaseCommand</a> scope,
|
||||
<a href="../../../co/aikar/commands/RegisteredCommand.html" title="class in co.aikar.commands">RegisteredCommand</a> registeredCommand,
|
||||
<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> sender,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a><<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>> args,
|
||||
@@ -1023,7 +1023,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>sendMessage</h4>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.281">sendMessage</a>(<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">I</a> issuerArg,
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.285">sendMessage</a>(<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">I</a> issuerArg,
|
||||
<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a> type,
|
||||
co.aikar.locales.MessageKeyProvider key,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... replacements)</pre>
|
||||
@@ -1035,7 +1035,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>sendMessage</h4>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.285">sendMessage</a>(<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> issuer,
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.289">sendMessage</a>(<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> issuer,
|
||||
<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a> type,
|
||||
co.aikar.locales.MessageKeyProvider key,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... replacements)</pre>
|
||||
@@ -1047,7 +1047,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>formatMessage</h4>
|
||||
<pre>public <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.293">formatMessage</a>(<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> issuer,
|
||||
<pre>public <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.297">formatMessage</a>(<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> issuer,
|
||||
<a href="../../../co/aikar/commands/MessageType.html" title="class in co.aikar.commands">MessageType</a> type,
|
||||
co.aikar.locales.MessageKeyProvider key,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... replacements)</pre>
|
||||
@@ -1059,7 +1059,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>onLocaleChange</h4>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.308">onLocaleChange</a>(<a href="../../../co/aikar/commands/IssuerLocaleChangedCallback.html" title="interface in co.aikar.commands">IssuerLocaleChangedCallback</a><<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">AI</a>> onChange)</pre>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.312">onLocaleChange</a>(<a href="../../../co/aikar/commands/IssuerLocaleChangedCallback.html" title="interface in co.aikar.commands">IssuerLocaleChangedCallback</a><<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">AI</a>> onChange)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="notifyLocaleChange-co.aikar.commands.CommandIssuer-java.util.Locale-java.util.Locale-">
|
||||
@@ -1070,7 +1070,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>notifyLocaleChange</h4>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.312">notifyLocaleChange</a>(<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">AI</a> issuer,
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.316">notifyLocaleChange</a>(<a href="../../../co/aikar/commands/CommandManager.html" title="type parameter in CommandManager">AI</a> issuer,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a> oldLocale,
|
||||
<a href="http://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a> newLocale)</pre>
|
||||
</li>
|
||||
@@ -1081,7 +1081,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getIssuerLocale</h4>
|
||||
<pre>public <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.322">getIssuerLocale</a>(<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> issuer)</pre>
|
||||
<pre>public <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.326">getIssuerLocale</a>(<a href="../../../co/aikar/commands/CommandIssuer.html" title="interface in co.aikar.commands">CommandIssuer</a> issuer)</pre>
|
||||
</li>
|
||||
</ul>
|
||||
<a name="getSupportedLanguages--">
|
||||
@@ -1090,7 +1090,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>getSupportedLanguages</h4>
|
||||
<pre>public <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a><<a href="http://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a>> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.342">getSupportedLanguages</a>()</pre>
|
||||
<pre>public <a href="http://docs.oracle.com/javase/8/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a><<a href="http://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a>> <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.346">getSupportedLanguages</a>()</pre>
|
||||
<div class="block">Gets a list of all currently supported languages for this manager.
|
||||
These locales will be automatically loaded from</div>
|
||||
<dl>
|
||||
@@ -1104,7 +1104,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h4>addSupportedLanguage</h4>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.352">addSupportedLanguage</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a> locale)</pre>
|
||||
<pre>public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.356">addSupportedLanguage</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a> locale)</pre>
|
||||
<div class="block">Adds a new locale to the list of automatic Locales to load Message Bundles for.
|
||||
All bundles loaded under the previous supported languages will now automatically load for this new locale too.</div>
|
||||
<dl>
|
||||
@@ -1120,7 +1120,7 @@ public void <a href="../../../src-html/co/aikar/commands/CommandManage
|
||||
<li class="blockList">
|
||||
<h4>enableUnstableAPI</h4>
|
||||
<pre><a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
|
||||
public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.362">enableUnstableAPI</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> api)</pre>
|
||||
public void <a href="../../../src-html/co/aikar/commands/CommandManager.html#line.366">enableUnstableAPI</a>(<a href="http://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> api)</pre>
|
||||
<div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">Use this with caution! If you enable and use Unstable API's, your next compile using ACF
|
||||
may require you to update your implementation to those unstable API's</span></div>
|
||||
</li>
|
||||
|
||||
@@ -36,346 +36,350 @@
|
||||
<span class="sourceLineNo">028</span>import com.google.common.collect.Sets;<a name="line.28"></a>
|
||||
<span class="sourceLineNo">029</span>import org.jetbrains.annotations.NotNull;<a name="line.29"></a>
|
||||
<span class="sourceLineNo">030</span><a name="line.30"></a>
|
||||
<span class="sourceLineNo">031</span>import java.lang.reflect.Method;<a name="line.31"></a>
|
||||
<span class="sourceLineNo">032</span>import java.lang.reflect.Parameter;<a name="line.32"></a>
|
||||
<span class="sourceLineNo">033</span>import java.util.HashMap;<a name="line.33"></a>
|
||||
<span class="sourceLineNo">034</span>import java.util.IdentityHashMap;<a name="line.34"></a>
|
||||
<span class="sourceLineNo">035</span>import java.util.List;<a name="line.35"></a>
|
||||
<span class="sourceLineNo">036</span>import java.util.Locale;<a name="line.36"></a>
|
||||
<span class="sourceLineNo">037</span>import java.util.Map;<a name="line.37"></a>
|
||||
<span class="sourceLineNo">038</span>import java.util.Set;<a name="line.38"></a>
|
||||
<span class="sourceLineNo">039</span>import java.util.Stack;<a name="line.39"></a>
|
||||
<span class="sourceLineNo">040</span><a name="line.40"></a>
|
||||
<span class="sourceLineNo">041</span>@SuppressWarnings("WeakerAccess")<a name="line.41"></a>
|
||||
<span class="sourceLineNo">042</span>public abstract class CommandManager <I, AI extends CommandIssuer, FT, F extends MessageFormatter<FT>> {<a name="line.42"></a>
|
||||
<span class="sourceLineNo">043</span><a name="line.43"></a>
|
||||
<span class="sourceLineNo">044</span> /**<a name="line.44"></a>
|
||||
<span class="sourceLineNo">045</span> * This is a stack incase a command calls a command<a name="line.45"></a>
|
||||
<span class="sourceLineNo">046</span> */<a name="line.46"></a>
|
||||
<span class="sourceLineNo">047</span> static ThreadLocal<Stack<CommandOperationContext>> commandOperationContext = ThreadLocal.withInitial(() -> {<a name="line.47"></a>
|
||||
<span class="sourceLineNo">048</span> return new Stack<CommandOperationContext>() {<a name="line.48"></a>
|
||||
<span class="sourceLineNo">049</span> @Override<a name="line.49"></a>
|
||||
<span class="sourceLineNo">050</span> public synchronized CommandOperationContext peek() {<a name="line.50"></a>
|
||||
<span class="sourceLineNo">051</span> return super.size() == 0 ? null : super.peek();<a name="line.51"></a>
|
||||
<span class="sourceLineNo">052</span> }<a name="line.52"></a>
|
||||
<span class="sourceLineNo">053</span> };<a name="line.53"></a>
|
||||
<span class="sourceLineNo">054</span> });<a name="line.54"></a>
|
||||
<span class="sourceLineNo">055</span> protected Map<String, RootCommand> rootCommands = new HashMap<>();<a name="line.55"></a>
|
||||
<span class="sourceLineNo">056</span> protected final CommandReplacements replacements = new CommandReplacements(this);<a name="line.56"></a>
|
||||
<span class="sourceLineNo">057</span> protected ExceptionHandler defaultExceptionHandler = null;<a name="line.57"></a>
|
||||
<span class="sourceLineNo">058</span><a name="line.58"></a>
|
||||
<span class="sourceLineNo">059</span> protected boolean usePerIssuerLocale = false;<a name="line.59"></a>
|
||||
<span class="sourceLineNo">060</span> protected List<IssuerLocaleChangedCallback<AI>> localeChangedCallbacks = Lists.newArrayList();<a name="line.60"></a>
|
||||
<span class="sourceLineNo">061</span> protected Set<Locale> supportedLanguages = Sets.newHashSet(Locales.ENGLISH, Locales.GERMAN, Locales.SPANISH, Locales.CZECH);<a name="line.61"></a>
|
||||
<span class="sourceLineNo">062</span> protected Map<MessageType, F> formatters = new IdentityHashMap<>();<a name="line.62"></a>
|
||||
<span class="sourceLineNo">063</span> protected F defaultFormatter;<a name="line.63"></a>
|
||||
<span class="sourceLineNo">064</span> protected int defaultHelpPerPage = 10;<a name="line.64"></a>
|
||||
<span class="sourceLineNo">065</span><a name="line.65"></a>
|
||||
<span class="sourceLineNo">066</span> private Set<String> unstableAPIs = Sets.newHashSet();<a name="line.66"></a>
|
||||
<span class="sourceLineNo">067</span><a name="line.67"></a>
|
||||
<span class="sourceLineNo">068</span> public static CommandOperationContext getCurrentCommandOperationContext() {<a name="line.68"></a>
|
||||
<span class="sourceLineNo">069</span> return commandOperationContext.get().peek();<a name="line.69"></a>
|
||||
<span class="sourceLineNo">070</span> }<a name="line.70"></a>
|
||||
<span class="sourceLineNo">071</span><a name="line.71"></a>
|
||||
<span class="sourceLineNo">072</span> public static CommandIssuer getCurrentCommandIssuer() {<a name="line.72"></a>
|
||||
<span class="sourceLineNo">073</span> CommandOperationContext context = commandOperationContext.get().peek();<a name="line.73"></a>
|
||||
<span class="sourceLineNo">074</span> return context != null ? context.getCommandIssuer() : null;<a name="line.74"></a>
|
||||
<span class="sourceLineNo">075</span> }<a name="line.75"></a>
|
||||
<span class="sourceLineNo">076</span><a name="line.76"></a>
|
||||
<span class="sourceLineNo">077</span> public static CommandManager getCurrentCommandManager() {<a name="line.77"></a>
|
||||
<span class="sourceLineNo">078</span> CommandOperationContext context = commandOperationContext.get().peek();<a name="line.78"></a>
|
||||
<span class="sourceLineNo">079</span> return context != null ? context.getCommandManager() : null;<a name="line.79"></a>
|
||||
<span class="sourceLineNo">080</span> }<a name="line.80"></a>
|
||||
<span class="sourceLineNo">081</span><a name="line.81"></a>
|
||||
<span class="sourceLineNo">082</span> public F setFormat(MessageType type, F formatter) {<a name="line.82"></a>
|
||||
<span class="sourceLineNo">083</span> return formatters.put(type, formatter);<a name="line.83"></a>
|
||||
<span class="sourceLineNo">084</span> }<a name="line.84"></a>
|
||||
<span class="sourceLineNo">085</span><a name="line.85"></a>
|
||||
<span class="sourceLineNo">086</span> public F getFormat(MessageType type) {<a name="line.86"></a>
|
||||
<span class="sourceLineNo">087</span> return formatters.getOrDefault(type, defaultFormatter);<a name="line.87"></a>
|
||||
<span class="sourceLineNo">088</span> }<a name="line.88"></a>
|
||||
<span class="sourceLineNo">089</span><a name="line.89"></a>
|
||||
<span class="sourceLineNo">090</span> public void setFormat(MessageType type, FT... colors) {<a name="line.90"></a>
|
||||
<span class="sourceLineNo">091</span> F format = getFormat(type);<a name="line.91"></a>
|
||||
<span class="sourceLineNo">092</span> for (int i = 0; i < colors.length; i++) {<a name="line.92"></a>
|
||||
<span class="sourceLineNo">093</span> format.setColor(i, colors[i]);<a name="line.93"></a>
|
||||
<span class="sourceLineNo">094</span> }<a name="line.94"></a>
|
||||
<span class="sourceLineNo">095</span> }<a name="line.95"></a>
|
||||
<span class="sourceLineNo">096</span><a name="line.96"></a>
|
||||
<span class="sourceLineNo">097</span> public void setFormat(MessageType type, int i, FT color) {<a name="line.97"></a>
|
||||
<span class="sourceLineNo">098</span> F format = getFormat(type);<a name="line.98"></a>
|
||||
<span class="sourceLineNo">099</span> format.setColor(i, color);<a name="line.99"></a>
|
||||
<span class="sourceLineNo">100</span> }<a name="line.100"></a>
|
||||
<span class="sourceLineNo">101</span><a name="line.101"></a>
|
||||
<span class="sourceLineNo">102</span> public F getDefaultFormatter() {<a name="line.102"></a>
|
||||
<span class="sourceLineNo">103</span> return defaultFormatter;<a name="line.103"></a>
|
||||
<span class="sourceLineNo">104</span> }<a name="line.104"></a>
|
||||
<span class="sourceLineNo">105</span><a name="line.105"></a>
|
||||
<span class="sourceLineNo">106</span> public void setDefaultFormatter(F defaultFormatter) {<a name="line.106"></a>
|
||||
<span class="sourceLineNo">107</span> this.defaultFormatter = defaultFormatter;<a name="line.107"></a>
|
||||
<span class="sourceLineNo">108</span> }<a name="line.108"></a>
|
||||
<span class="sourceLineNo">109</span><a name="line.109"></a>
|
||||
<span class="sourceLineNo">110</span> /**<a name="line.110"></a>
|
||||
<span class="sourceLineNo">111</span> * Gets the command contexts manager<a name="line.111"></a>
|
||||
<span class="sourceLineNo">112</span> * @return Command Contexts<a name="line.112"></a>
|
||||
<span class="sourceLineNo">113</span> */<a name="line.113"></a>
|
||||
<span class="sourceLineNo">114</span> public abstract CommandContexts<?> getCommandContexts();<a name="line.114"></a>
|
||||
<span class="sourceLineNo">115</span><a name="line.115"></a>
|
||||
<span class="sourceLineNo">116</span> /**<a name="line.116"></a>
|
||||
<span class="sourceLineNo">117</span> * Gets the command completions manager<a name="line.117"></a>
|
||||
<span class="sourceLineNo">118</span> * @return Command Completions<a name="line.118"></a>
|
||||
<span class="sourceLineNo">119</span> */<a name="line.119"></a>
|
||||
<span class="sourceLineNo">120</span> public abstract CommandCompletions<?> getCommandCompletions();<a name="line.120"></a>
|
||||
<span class="sourceLineNo">121</span><a name="line.121"></a>
|
||||
<span class="sourceLineNo">122</span> /** @deprecated Unstable API */ @Deprecated @UnstableAPI<a name="line.122"></a>
|
||||
<span class="sourceLineNo">123</span> public CommandHelp generateCommandHelp(@NotNull String command) {<a name="line.123"></a>
|
||||
<span class="sourceLineNo">124</span> verifyUnstableAPI("help");<a name="line.124"></a>
|
||||
<span class="sourceLineNo">125</span> CommandOperationContext context = getCurrentCommandOperationContext();<a name="line.125"></a>
|
||||
<span class="sourceLineNo">126</span> if (context == null) {<a name="line.126"></a>
|
||||
<span class="sourceLineNo">127</span> throw new IllegalStateException("This method can only be called as part of a command execution.");<a name="line.127"></a>
|
||||
<span class="sourceLineNo">128</span> }<a name="line.128"></a>
|
||||
<span class="sourceLineNo">129</span> return generateCommandHelp(context.getCommandIssuer(), command);<a name="line.129"></a>
|
||||
<span class="sourceLineNo">130</span> }<a name="line.130"></a>
|
||||
<span class="sourceLineNo">131</span><a name="line.131"></a>
|
||||
<span class="sourceLineNo">132</span> /** @deprecated Unstable API */ @Deprecated @UnstableAPI<a name="line.132"></a>
|
||||
<span class="sourceLineNo">133</span> public CommandHelp generateCommandHelp(CommandIssuer issuer, @NotNull String command) {<a name="line.133"></a>
|
||||
<span class="sourceLineNo">134</span> verifyUnstableAPI("help");<a name="line.134"></a>
|
||||
<span class="sourceLineNo">135</span> return generateCommandHelp(issuer, obtainRootCommand(command));<a name="line.135"></a>
|
||||
<span class="sourceLineNo">136</span> }<a name="line.136"></a>
|
||||
<span class="sourceLineNo">137</span><a name="line.137"></a>
|
||||
<span class="sourceLineNo">138</span> /** @deprecated Unstable API */ @Deprecated @UnstableAPI<a name="line.138"></a>
|
||||
<span class="sourceLineNo">139</span> public CommandHelp generateCommandHelp() {<a name="line.139"></a>
|
||||
<span class="sourceLineNo">140</span> verifyUnstableAPI("help");<a name="line.140"></a>
|
||||
<span class="sourceLineNo">141</span> CommandOperationContext context = getCurrentCommandOperationContext();<a name="line.141"></a>
|
||||
<span class="sourceLineNo">142</span> if (context == null) {<a name="line.142"></a>
|
||||
<span class="sourceLineNo">143</span> throw new IllegalStateException("This method can only be called as part of a command execution.");<a name="line.143"></a>
|
||||
<span class="sourceLineNo">144</span> }<a name="line.144"></a>
|
||||
<span class="sourceLineNo">145</span> String commandLabel = context.getCommandLabel();<a name="line.145"></a>
|
||||
<span class="sourceLineNo">146</span> return generateCommandHelp(context.getCommandIssuer(), this.obtainRootCommand(commandLabel));<a name="line.146"></a>
|
||||
<span class="sourceLineNo">147</span> }<a name="line.147"></a>
|
||||
<span class="sourceLineNo">148</span><a name="line.148"></a>
|
||||
<span class="sourceLineNo">149</span> /** @deprecated Unstable API */ @Deprecated @UnstableAPI<a name="line.149"></a>
|
||||
<span class="sourceLineNo">150</span> public CommandHelp generateCommandHelp(CommandIssuer issuer, RootCommand rootCommand) {<a name="line.150"></a>
|
||||
<span class="sourceLineNo">151</span> verifyUnstableAPI("help");<a name="line.151"></a>
|
||||
<span class="sourceLineNo">152</span> return new CommandHelp(this, rootCommand, issuer);<a name="line.152"></a>
|
||||
<span class="sourceLineNo">153</span> }<a name="line.153"></a>
|
||||
<span class="sourceLineNo">154</span><a name="line.154"></a>
|
||||
<span class="sourceLineNo">155</span> /** @deprecated Unstable API */ @Deprecated @UnstableAPI<a name="line.155"></a>
|
||||
<span class="sourceLineNo">156</span> public int getDefaultHelpPerPage() {<a name="line.156"></a>
|
||||
<span class="sourceLineNo">157</span> verifyUnstableAPI("help");<a name="line.157"></a>
|
||||
<span class="sourceLineNo">158</span> return defaultHelpPerPage;<a name="line.158"></a>
|
||||
<span class="sourceLineNo">159</span> }<a name="line.159"></a>
|
||||
<span class="sourceLineNo">160</span><a name="line.160"></a>
|
||||
<span class="sourceLineNo">161</span> /** @deprecated Unstable API */ @Deprecated @UnstableAPI<a name="line.161"></a>
|
||||
<span class="sourceLineNo">162</span> public void setDefaultHelpPerPage(int defaultHelpPerPage) {<a name="line.162"></a>
|
||||
<span class="sourceLineNo">163</span> verifyUnstableAPI("help");<a name="line.163"></a>
|
||||
<span class="sourceLineNo">164</span> this.defaultHelpPerPage = defaultHelpPerPage;<a name="line.164"></a>
|
||||
<span class="sourceLineNo">165</span> }<a name="line.165"></a>
|
||||
<span class="sourceLineNo">166</span><a name="line.166"></a>
|
||||
<span class="sourceLineNo">167</span> /**<a name="line.167"></a>
|
||||
<span class="sourceLineNo">168</span> * Registers a command with ACF<a name="line.168"></a>
|
||||
<span class="sourceLineNo">169</span> *<a name="line.169"></a>
|
||||
<span class="sourceLineNo">170</span> * @param command The command to register<a name="line.170"></a>
|
||||
<span class="sourceLineNo">171</span> * @return boolean<a name="line.171"></a>
|
||||
<span class="sourceLineNo">172</span> */<a name="line.172"></a>
|
||||
<span class="sourceLineNo">173</span> public abstract void registerCommand(BaseCommand command);<a name="line.173"></a>
|
||||
<span class="sourceLineNo">174</span> public abstract boolean hasRegisteredCommands();<a name="line.174"></a>
|
||||
<span class="sourceLineNo">175</span> public abstract boolean isCommandIssuer(Class<?> type);<a name="line.175"></a>
|
||||
<span class="sourceLineNo">176</span><a name="line.176"></a>
|
||||
<span class="sourceLineNo">177</span> // TODO: Change this to I if we make a breaking change<a name="line.177"></a>
|
||||
<span class="sourceLineNo">178</span> public abstract AI getCommandIssuer(Object issuer);<a name="line.178"></a>
|
||||
<span class="sourceLineNo">179</span><a name="line.179"></a>
|
||||
<span class="sourceLineNo">180</span> public abstract RootCommand createRootCommand(String cmd);<a name="line.180"></a>
|
||||
<span class="sourceLineNo">181</span><a name="line.181"></a>
|
||||
<span class="sourceLineNo">182</span> /**<a name="line.182"></a>
|
||||
<span class="sourceLineNo">183</span> * Returns a Locales Manager to add and modify language tables for your commands.<a name="line.183"></a>
|
||||
<span class="sourceLineNo">184</span> * @return<a name="line.184"></a>
|
||||
<span class="sourceLineNo">185</span> */<a name="line.185"></a>
|
||||
<span class="sourceLineNo">186</span> public abstract Locales getLocales();<a name="line.186"></a>
|
||||
<span class="sourceLineNo">187</span><a name="line.187"></a>
|
||||
<span class="sourceLineNo">188</span> public boolean usingPerIssuerLocale() {<a name="line.188"></a>
|
||||
<span class="sourceLineNo">189</span> return usePerIssuerLocale;<a name="line.189"></a>
|
||||
<span class="sourceLineNo">190</span> }<a name="line.190"></a>
|
||||
<span class="sourceLineNo">191</span><a name="line.191"></a>
|
||||
<span class="sourceLineNo">192</span> public boolean usePerIssuerLocale(boolean setting) {<a name="line.192"></a>
|
||||
<span class="sourceLineNo">193</span> boolean old = usePerIssuerLocale;<a name="line.193"></a>
|
||||
<span class="sourceLineNo">194</span> usePerIssuerLocale = setting;<a name="line.194"></a>
|
||||
<span class="sourceLineNo">195</span> return old;<a name="line.195"></a>
|
||||
<span class="sourceLineNo">196</span> }<a name="line.196"></a>
|
||||
<span class="sourceLineNo">197</span><a name="line.197"></a>
|
||||
<span class="sourceLineNo">198</span> public abstract <R extends CommandExecutionContext> R createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs);<a name="line.198"></a>
|
||||
<span class="sourceLineNo">199</span><a name="line.199"></a>
|
||||
<span class="sourceLineNo">200</span> public abstract CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args);<a name="line.200"></a>
|
||||
<span class="sourceLineNo">201</span><a name="line.201"></a>
|
||||
<span class="sourceLineNo">202</span> public abstract void log(final LogLevel level, final String message, final Throwable throwable);<a name="line.202"></a>
|
||||
<span class="sourceLineNo">203</span><a name="line.203"></a>
|
||||
<span class="sourceLineNo">204</span> public void log(final LogLevel level, final String message) {<a name="line.204"></a>
|
||||
<span class="sourceLineNo">205</span> log(level, message, null);<a name="line.205"></a>
|
||||
<span class="sourceLineNo">206</span> }<a name="line.206"></a>
|
||||
<span class="sourceLineNo">207</span><a name="line.207"></a>
|
||||
<span class="sourceLineNo">208</span> /**<a name="line.208"></a>
|
||||
<span class="sourceLineNo">209</span> * Lets you add custom string replacements that can be applied to annotation values,<a name="line.209"></a>
|
||||
<span class="sourceLineNo">210</span> * to reduce duplication/repetition of common values such as permission nodes and command prefixes.<a name="line.210"></a>
|
||||
<span class="sourceLineNo">211</span> *<a name="line.211"></a>
|
||||
<span class="sourceLineNo">212</span> * Any replacement registered starts with a %<a name="line.212"></a>
|
||||
<span class="sourceLineNo">213</span> *<a name="line.213"></a>
|
||||
<span class="sourceLineNo">214</span> * So for ex @CommandPermission("%staff")<a name="line.214"></a>
|
||||
<span class="sourceLineNo">215</span> * @return Replacements Manager<a name="line.215"></a>
|
||||
<span class="sourceLineNo">216</span> */<a name="line.216"></a>
|
||||
<span class="sourceLineNo">217</span> public CommandReplacements getCommandReplacements() {<a name="line.217"></a>
|
||||
<span class="sourceLineNo">218</span> return replacements;<a name="line.218"></a>
|
||||
<span class="sourceLineNo">219</span> }<a name="line.219"></a>
|
||||
<span class="sourceLineNo">220</span><a name="line.220"></a>
|
||||
<span class="sourceLineNo">221</span> public boolean hasPermission(CommandIssuer issuer, String permission) {<a name="line.221"></a>
|
||||
<span class="sourceLineNo">222</span> if (permission == null || permission.isEmpty()) {<a name="line.222"></a>
|
||||
<span class="sourceLineNo">223</span> return true;<a name="line.223"></a>
|
||||
<span class="sourceLineNo">224</span> }<a name="line.224"></a>
|
||||
<span class="sourceLineNo">225</span> for (String perm : ACFPatterns.COMMA.split(permission)) {<a name="line.225"></a>
|
||||
<span class="sourceLineNo">226</span> if (!perm.isEmpty() && !issuer.hasPermission(perm)) {<a name="line.226"></a>
|
||||
<span class="sourceLineNo">227</span> return false;<a name="line.227"></a>
|
||||
<span class="sourceLineNo">228</span> }<a name="line.228"></a>
|
||||
<span class="sourceLineNo">229</span> }<a name="line.229"></a>
|
||||
<span class="sourceLineNo">230</span> return true;<a name="line.230"></a>
|
||||
<span class="sourceLineNo">231</span> }<a name="line.231"></a>
|
||||
<span class="sourceLineNo">232</span><a name="line.232"></a>
|
||||
<span class="sourceLineNo">233</span> BaseCommand getBaseCommand(String commandLabel, @NotNull String[] args) {<a name="line.233"></a>
|
||||
<span class="sourceLineNo">234</span> RootCommand rootCommand = obtainRootCommand(commandLabel);<a name="line.234"></a>
|
||||
<span class="sourceLineNo">235</span> if (rootCommand == null) {<a name="line.235"></a>
|
||||
<span class="sourceLineNo">236</span> return null;<a name="line.236"></a>
|
||||
<span class="sourceLineNo">237</span> }<a name="line.237"></a>
|
||||
<span class="sourceLineNo">238</span> return rootCommand.getBaseCommand(args);<a name="line.238"></a>
|
||||
<span class="sourceLineNo">239</span> }<a name="line.239"></a>
|
||||
<span class="sourceLineNo">240</span><a name="line.240"></a>
|
||||
<span class="sourceLineNo">241</span> public synchronized RootCommand getRootCommand(@NotNull String cmd) {<a name="line.241"></a>
|
||||
<span class="sourceLineNo">242</span> return rootCommands.get(ACFPatterns.SPACE.split(cmd.toLowerCase(), 2)[0]);<a name="line.242"></a>
|
||||
<span class="sourceLineNo">243</span> }<a name="line.243"></a>
|
||||
<span class="sourceLineNo">244</span><a name="line.244"></a>
|
||||
<span class="sourceLineNo">245</span> public synchronized RootCommand obtainRootCommand(@NotNull String cmd) {<a name="line.245"></a>
|
||||
<span class="sourceLineNo">246</span> return rootCommands.computeIfAbsent(ACFPatterns.SPACE.split(cmd.toLowerCase(), 2)[0], this::createRootCommand);<a name="line.246"></a>
|
||||
<span class="sourceLineNo">247</span> }<a name="line.247"></a>
|
||||
<span class="sourceLineNo">248</span><a name="line.248"></a>
|
||||
<span class="sourceLineNo">249</span> public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {<a name="line.249"></a>
|
||||
<span class="sourceLineNo">250</span> return new RegisteredCommand(command, cmdName, method, prefSubCommand);<a name="line.250"></a>
|
||||
<span class="sourceLineNo">251</span> }<a name="line.251"></a>
|
||||
<span class="sourceLineNo">252</span><a name="line.252"></a>
|
||||
<span class="sourceLineNo">253</span> /**<a name="line.253"></a>
|
||||
<span class="sourceLineNo">254</span> * Sets the default {@link ExceptionHandler} that is called when an exception occurs while executing a command, if the command doesn't have it's own exception handler registered.<a name="line.254"></a>
|
||||
<span class="sourceLineNo">255</span> *<a name="line.255"></a>
|
||||
<span class="sourceLineNo">256</span> * @param exceptionHandler the handler that should handle uncaught exceptions<a name="line.256"></a>
|
||||
<span class="sourceLineNo">257</span> */<a name="line.257"></a>
|
||||
<span class="sourceLineNo">258</span> public void setDefaultExceptionHandler(ExceptionHandler exceptionHandler) {<a name="line.258"></a>
|
||||
<span class="sourceLineNo">259</span> defaultExceptionHandler = exceptionHandler;<a name="line.259"></a>
|
||||
<span class="sourceLineNo">260</span> }<a name="line.260"></a>
|
||||
<span class="sourceLineNo">261</span><a name="line.261"></a>
|
||||
<span class="sourceLineNo">262</span> /**<a name="line.262"></a>
|
||||
<span class="sourceLineNo">263</span> * Gets the current default exception handler, might be null.<a name="line.263"></a>
|
||||
<span class="sourceLineNo">264</span> *<a name="line.264"></a>
|
||||
<span class="sourceLineNo">265</span> * @return the default exception handler<a name="line.265"></a>
|
||||
<span class="sourceLineNo">266</span> */<a name="line.266"></a>
|
||||
<span class="sourceLineNo">267</span> public ExceptionHandler getDefaultExceptionHandler() {<a name="line.267"></a>
|
||||
<span class="sourceLineNo">268</span> return defaultExceptionHandler;<a name="line.268"></a>
|
||||
<span class="sourceLineNo">269</span> }<a name="line.269"></a>
|
||||
<span class="sourceLineNo">270</span><a name="line.270"></a>
|
||||
<span class="sourceLineNo">271</span> protected boolean handleUncaughtException(BaseCommand scope, RegisteredCommand registeredCommand, CommandIssuer sender, List<String> args, Throwable t) {<a name="line.271"></a>
|
||||
<span class="sourceLineNo">272</span> boolean result = false;<a name="line.272"></a>
|
||||
<span class="sourceLineNo">273</span> if (scope.getExceptionHandler() != null) {<a name="line.273"></a>
|
||||
<span class="sourceLineNo">274</span> result = scope.getExceptionHandler().execute(scope, registeredCommand, sender, args, t);<a name="line.274"></a>
|
||||
<span class="sourceLineNo">275</span> } else if (defaultExceptionHandler != null) {<a name="line.275"></a>
|
||||
<span class="sourceLineNo">276</span> result = defaultExceptionHandler.execute(scope, registeredCommand, sender, args, t);<a name="line.276"></a>
|
||||
<span class="sourceLineNo">277</span> }<a name="line.277"></a>
|
||||
<span class="sourceLineNo">278</span> return result;<a name="line.278"></a>
|
||||
<span class="sourceLineNo">279</span> }<a name="line.279"></a>
|
||||
<span class="sourceLineNo">280</span><a name="line.280"></a>
|
||||
<span class="sourceLineNo">281</span> public void sendMessage(I issuerArg, MessageType type, MessageKeyProvider key, String... replacements) {<a name="line.281"></a>
|
||||
<span class="sourceLineNo">282</span> sendMessage(getCommandIssuer(issuerArg), type, key, replacements);<a name="line.282"></a>
|
||||
<span class="sourceLineNo">031</span>import java.lang.reflect.InvocationTargetException;<a name="line.31"></a>
|
||||
<span class="sourceLineNo">032</span>import java.lang.reflect.Method;<a name="line.32"></a>
|
||||
<span class="sourceLineNo">033</span>import java.lang.reflect.Parameter;<a name="line.33"></a>
|
||||
<span class="sourceLineNo">034</span>import java.util.HashMap;<a name="line.34"></a>
|
||||
<span class="sourceLineNo">035</span>import java.util.IdentityHashMap;<a name="line.35"></a>
|
||||
<span class="sourceLineNo">036</span>import java.util.List;<a name="line.36"></a>
|
||||
<span class="sourceLineNo">037</span>import java.util.Locale;<a name="line.37"></a>
|
||||
<span class="sourceLineNo">038</span>import java.util.Map;<a name="line.38"></a>
|
||||
<span class="sourceLineNo">039</span>import java.util.Set;<a name="line.39"></a>
|
||||
<span class="sourceLineNo">040</span>import java.util.Stack;<a name="line.40"></a>
|
||||
<span class="sourceLineNo">041</span><a name="line.41"></a>
|
||||
<span class="sourceLineNo">042</span>@SuppressWarnings("WeakerAccess")<a name="line.42"></a>
|
||||
<span class="sourceLineNo">043</span>public abstract class CommandManager <I, AI extends CommandIssuer, FT, F extends MessageFormatter<FT>> {<a name="line.43"></a>
|
||||
<span class="sourceLineNo">044</span><a name="line.44"></a>
|
||||
<span class="sourceLineNo">045</span> /**<a name="line.45"></a>
|
||||
<span class="sourceLineNo">046</span> * This is a stack incase a command calls a command<a name="line.46"></a>
|
||||
<span class="sourceLineNo">047</span> */<a name="line.47"></a>
|
||||
<span class="sourceLineNo">048</span> static ThreadLocal<Stack<CommandOperationContext>> commandOperationContext = ThreadLocal.withInitial(() -> {<a name="line.48"></a>
|
||||
<span class="sourceLineNo">049</span> return new Stack<CommandOperationContext>() {<a name="line.49"></a>
|
||||
<span class="sourceLineNo">050</span> @Override<a name="line.50"></a>
|
||||
<span class="sourceLineNo">051</span> public synchronized CommandOperationContext peek() {<a name="line.51"></a>
|
||||
<span class="sourceLineNo">052</span> return super.size() == 0 ? null : super.peek();<a name="line.52"></a>
|
||||
<span class="sourceLineNo">053</span> }<a name="line.53"></a>
|
||||
<span class="sourceLineNo">054</span> };<a name="line.54"></a>
|
||||
<span class="sourceLineNo">055</span> });<a name="line.55"></a>
|
||||
<span class="sourceLineNo">056</span> protected Map<String, RootCommand> rootCommands = new HashMap<>();<a name="line.56"></a>
|
||||
<span class="sourceLineNo">057</span> protected final CommandReplacements replacements = new CommandReplacements(this);<a name="line.57"></a>
|
||||
<span class="sourceLineNo">058</span> protected ExceptionHandler defaultExceptionHandler = null;<a name="line.58"></a>
|
||||
<span class="sourceLineNo">059</span><a name="line.59"></a>
|
||||
<span class="sourceLineNo">060</span> protected boolean usePerIssuerLocale = false;<a name="line.60"></a>
|
||||
<span class="sourceLineNo">061</span> protected List<IssuerLocaleChangedCallback<AI>> localeChangedCallbacks = Lists.newArrayList();<a name="line.61"></a>
|
||||
<span class="sourceLineNo">062</span> protected Set<Locale> supportedLanguages = Sets.newHashSet(Locales.ENGLISH, Locales.GERMAN, Locales.SPANISH, Locales.CZECH);<a name="line.62"></a>
|
||||
<span class="sourceLineNo">063</span> protected Map<MessageType, F> formatters = new IdentityHashMap<>();<a name="line.63"></a>
|
||||
<span class="sourceLineNo">064</span> protected F defaultFormatter;<a name="line.64"></a>
|
||||
<span class="sourceLineNo">065</span> protected int defaultHelpPerPage = 10;<a name="line.65"></a>
|
||||
<span class="sourceLineNo">066</span><a name="line.66"></a>
|
||||
<span class="sourceLineNo">067</span> private Set<String> unstableAPIs = Sets.newHashSet();<a name="line.67"></a>
|
||||
<span class="sourceLineNo">068</span><a name="line.68"></a>
|
||||
<span class="sourceLineNo">069</span> public static CommandOperationContext getCurrentCommandOperationContext() {<a name="line.69"></a>
|
||||
<span class="sourceLineNo">070</span> return commandOperationContext.get().peek();<a name="line.70"></a>
|
||||
<span class="sourceLineNo">071</span> }<a name="line.71"></a>
|
||||
<span class="sourceLineNo">072</span><a name="line.72"></a>
|
||||
<span class="sourceLineNo">073</span> public static CommandIssuer getCurrentCommandIssuer() {<a name="line.73"></a>
|
||||
<span class="sourceLineNo">074</span> CommandOperationContext context = commandOperationContext.get().peek();<a name="line.74"></a>
|
||||
<span class="sourceLineNo">075</span> return context != null ? context.getCommandIssuer() : null;<a name="line.75"></a>
|
||||
<span class="sourceLineNo">076</span> }<a name="line.76"></a>
|
||||
<span class="sourceLineNo">077</span><a name="line.77"></a>
|
||||
<span class="sourceLineNo">078</span> public static CommandManager getCurrentCommandManager() {<a name="line.78"></a>
|
||||
<span class="sourceLineNo">079</span> CommandOperationContext context = commandOperationContext.get().peek();<a name="line.79"></a>
|
||||
<span class="sourceLineNo">080</span> return context != null ? context.getCommandManager() : null;<a name="line.80"></a>
|
||||
<span class="sourceLineNo">081</span> }<a name="line.81"></a>
|
||||
<span class="sourceLineNo">082</span><a name="line.82"></a>
|
||||
<span class="sourceLineNo">083</span> public F setFormat(MessageType type, F formatter) {<a name="line.83"></a>
|
||||
<span class="sourceLineNo">084</span> return formatters.put(type, formatter);<a name="line.84"></a>
|
||||
<span class="sourceLineNo">085</span> }<a name="line.85"></a>
|
||||
<span class="sourceLineNo">086</span><a name="line.86"></a>
|
||||
<span class="sourceLineNo">087</span> public F getFormat(MessageType type) {<a name="line.87"></a>
|
||||
<span class="sourceLineNo">088</span> return formatters.getOrDefault(type, defaultFormatter);<a name="line.88"></a>
|
||||
<span class="sourceLineNo">089</span> }<a name="line.89"></a>
|
||||
<span class="sourceLineNo">090</span><a name="line.90"></a>
|
||||
<span class="sourceLineNo">091</span> public void setFormat(MessageType type, FT... colors) {<a name="line.91"></a>
|
||||
<span class="sourceLineNo">092</span> F format = getFormat(type);<a name="line.92"></a>
|
||||
<span class="sourceLineNo">093</span> for (int i = 0; i < colors.length; i++) {<a name="line.93"></a>
|
||||
<span class="sourceLineNo">094</span> format.setColor(i, colors[i]);<a name="line.94"></a>
|
||||
<span class="sourceLineNo">095</span> }<a name="line.95"></a>
|
||||
<span class="sourceLineNo">096</span> }<a name="line.96"></a>
|
||||
<span class="sourceLineNo">097</span><a name="line.97"></a>
|
||||
<span class="sourceLineNo">098</span> public void setFormat(MessageType type, int i, FT color) {<a name="line.98"></a>
|
||||
<span class="sourceLineNo">099</span> F format = getFormat(type);<a name="line.99"></a>
|
||||
<span class="sourceLineNo">100</span> format.setColor(i, color);<a name="line.100"></a>
|
||||
<span class="sourceLineNo">101</span> }<a name="line.101"></a>
|
||||
<span class="sourceLineNo">102</span><a name="line.102"></a>
|
||||
<span class="sourceLineNo">103</span> public F getDefaultFormatter() {<a name="line.103"></a>
|
||||
<span class="sourceLineNo">104</span> return defaultFormatter;<a name="line.104"></a>
|
||||
<span class="sourceLineNo">105</span> }<a name="line.105"></a>
|
||||
<span class="sourceLineNo">106</span><a name="line.106"></a>
|
||||
<span class="sourceLineNo">107</span> public void setDefaultFormatter(F defaultFormatter) {<a name="line.107"></a>
|
||||
<span class="sourceLineNo">108</span> this.defaultFormatter = defaultFormatter;<a name="line.108"></a>
|
||||
<span class="sourceLineNo">109</span> }<a name="line.109"></a>
|
||||
<span class="sourceLineNo">110</span><a name="line.110"></a>
|
||||
<span class="sourceLineNo">111</span> /**<a name="line.111"></a>
|
||||
<span class="sourceLineNo">112</span> * Gets the command contexts manager<a name="line.112"></a>
|
||||
<span class="sourceLineNo">113</span> * @return Command Contexts<a name="line.113"></a>
|
||||
<span class="sourceLineNo">114</span> */<a name="line.114"></a>
|
||||
<span class="sourceLineNo">115</span> public abstract CommandContexts<?> getCommandContexts();<a name="line.115"></a>
|
||||
<span class="sourceLineNo">116</span><a name="line.116"></a>
|
||||
<span class="sourceLineNo">117</span> /**<a name="line.117"></a>
|
||||
<span class="sourceLineNo">118</span> * Gets the command completions manager<a name="line.118"></a>
|
||||
<span class="sourceLineNo">119</span> * @return Command Completions<a name="line.119"></a>
|
||||
<span class="sourceLineNo">120</span> */<a name="line.120"></a>
|
||||
<span class="sourceLineNo">121</span> public abstract CommandCompletions<?> getCommandCompletions();<a name="line.121"></a>
|
||||
<span class="sourceLineNo">122</span><a name="line.122"></a>
|
||||
<span class="sourceLineNo">123</span> /** @deprecated Unstable API */ @Deprecated @UnstableAPI<a name="line.123"></a>
|
||||
<span class="sourceLineNo">124</span> public CommandHelp generateCommandHelp(@NotNull String command) {<a name="line.124"></a>
|
||||
<span class="sourceLineNo">125</span> verifyUnstableAPI("help");<a name="line.125"></a>
|
||||
<span class="sourceLineNo">126</span> CommandOperationContext context = getCurrentCommandOperationContext();<a name="line.126"></a>
|
||||
<span class="sourceLineNo">127</span> if (context == null) {<a name="line.127"></a>
|
||||
<span class="sourceLineNo">128</span> throw new IllegalStateException("This method can only be called as part of a command execution.");<a name="line.128"></a>
|
||||
<span class="sourceLineNo">129</span> }<a name="line.129"></a>
|
||||
<span class="sourceLineNo">130</span> return generateCommandHelp(context.getCommandIssuer(), command);<a name="line.130"></a>
|
||||
<span class="sourceLineNo">131</span> }<a name="line.131"></a>
|
||||
<span class="sourceLineNo">132</span><a name="line.132"></a>
|
||||
<span class="sourceLineNo">133</span> /** @deprecated Unstable API */ @Deprecated @UnstableAPI<a name="line.133"></a>
|
||||
<span class="sourceLineNo">134</span> public CommandHelp generateCommandHelp(CommandIssuer issuer, @NotNull String command) {<a name="line.134"></a>
|
||||
<span class="sourceLineNo">135</span> verifyUnstableAPI("help");<a name="line.135"></a>
|
||||
<span class="sourceLineNo">136</span> return generateCommandHelp(issuer, obtainRootCommand(command));<a name="line.136"></a>
|
||||
<span class="sourceLineNo">137</span> }<a name="line.137"></a>
|
||||
<span class="sourceLineNo">138</span><a name="line.138"></a>
|
||||
<span class="sourceLineNo">139</span> /** @deprecated Unstable API */ @Deprecated @UnstableAPI<a name="line.139"></a>
|
||||
<span class="sourceLineNo">140</span> public CommandHelp generateCommandHelp() {<a name="line.140"></a>
|
||||
<span class="sourceLineNo">141</span> verifyUnstableAPI("help");<a name="line.141"></a>
|
||||
<span class="sourceLineNo">142</span> CommandOperationContext context = getCurrentCommandOperationContext();<a name="line.142"></a>
|
||||
<span class="sourceLineNo">143</span> if (context == null) {<a name="line.143"></a>
|
||||
<span class="sourceLineNo">144</span> throw new IllegalStateException("This method can only be called as part of a command execution.");<a name="line.144"></a>
|
||||
<span class="sourceLineNo">145</span> }<a name="line.145"></a>
|
||||
<span class="sourceLineNo">146</span> String commandLabel = context.getCommandLabel();<a name="line.146"></a>
|
||||
<span class="sourceLineNo">147</span> return generateCommandHelp(context.getCommandIssuer(), this.obtainRootCommand(commandLabel));<a name="line.147"></a>
|
||||
<span class="sourceLineNo">148</span> }<a name="line.148"></a>
|
||||
<span class="sourceLineNo">149</span><a name="line.149"></a>
|
||||
<span class="sourceLineNo">150</span> /** @deprecated Unstable API */ @Deprecated @UnstableAPI<a name="line.150"></a>
|
||||
<span class="sourceLineNo">151</span> public CommandHelp generateCommandHelp(CommandIssuer issuer, RootCommand rootCommand) {<a name="line.151"></a>
|
||||
<span class="sourceLineNo">152</span> verifyUnstableAPI("help");<a name="line.152"></a>
|
||||
<span class="sourceLineNo">153</span> return new CommandHelp(this, rootCommand, issuer);<a name="line.153"></a>
|
||||
<span class="sourceLineNo">154</span> }<a name="line.154"></a>
|
||||
<span class="sourceLineNo">155</span><a name="line.155"></a>
|
||||
<span class="sourceLineNo">156</span> /** @deprecated Unstable API */ @Deprecated @UnstableAPI<a name="line.156"></a>
|
||||
<span class="sourceLineNo">157</span> public int getDefaultHelpPerPage() {<a name="line.157"></a>
|
||||
<span class="sourceLineNo">158</span> verifyUnstableAPI("help");<a name="line.158"></a>
|
||||
<span class="sourceLineNo">159</span> return defaultHelpPerPage;<a name="line.159"></a>
|
||||
<span class="sourceLineNo">160</span> }<a name="line.160"></a>
|
||||
<span class="sourceLineNo">161</span><a name="line.161"></a>
|
||||
<span class="sourceLineNo">162</span> /** @deprecated Unstable API */ @Deprecated @UnstableAPI<a name="line.162"></a>
|
||||
<span class="sourceLineNo">163</span> public void setDefaultHelpPerPage(int defaultHelpPerPage) {<a name="line.163"></a>
|
||||
<span class="sourceLineNo">164</span> verifyUnstableAPI("help");<a name="line.164"></a>
|
||||
<span class="sourceLineNo">165</span> this.defaultHelpPerPage = defaultHelpPerPage;<a name="line.165"></a>
|
||||
<span class="sourceLineNo">166</span> }<a name="line.166"></a>
|
||||
<span class="sourceLineNo">167</span><a name="line.167"></a>
|
||||
<span class="sourceLineNo">168</span> /**<a name="line.168"></a>
|
||||
<span class="sourceLineNo">169</span> * Registers a command with ACF<a name="line.169"></a>
|
||||
<span class="sourceLineNo">170</span> *<a name="line.170"></a>
|
||||
<span class="sourceLineNo">171</span> * @param command The command to register<a name="line.171"></a>
|
||||
<span class="sourceLineNo">172</span> * @return boolean<a name="line.172"></a>
|
||||
<span class="sourceLineNo">173</span> */<a name="line.173"></a>
|
||||
<span class="sourceLineNo">174</span> public abstract void registerCommand(BaseCommand command);<a name="line.174"></a>
|
||||
<span class="sourceLineNo">175</span> public abstract boolean hasRegisteredCommands();<a name="line.175"></a>
|
||||
<span class="sourceLineNo">176</span> public abstract boolean isCommandIssuer(Class<?> type);<a name="line.176"></a>
|
||||
<span class="sourceLineNo">177</span><a name="line.177"></a>
|
||||
<span class="sourceLineNo">178</span> // TODO: Change this to I if we make a breaking change<a name="line.178"></a>
|
||||
<span class="sourceLineNo">179</span> public abstract AI getCommandIssuer(Object issuer);<a name="line.179"></a>
|
||||
<span class="sourceLineNo">180</span><a name="line.180"></a>
|
||||
<span class="sourceLineNo">181</span> public abstract RootCommand createRootCommand(String cmd);<a name="line.181"></a>
|
||||
<span class="sourceLineNo">182</span><a name="line.182"></a>
|
||||
<span class="sourceLineNo">183</span> /**<a name="line.183"></a>
|
||||
<span class="sourceLineNo">184</span> * Returns a Locales Manager to add and modify language tables for your commands.<a name="line.184"></a>
|
||||
<span class="sourceLineNo">185</span> * @return<a name="line.185"></a>
|
||||
<span class="sourceLineNo">186</span> */<a name="line.186"></a>
|
||||
<span class="sourceLineNo">187</span> public abstract Locales getLocales();<a name="line.187"></a>
|
||||
<span class="sourceLineNo">188</span><a name="line.188"></a>
|
||||
<span class="sourceLineNo">189</span> public boolean usingPerIssuerLocale() {<a name="line.189"></a>
|
||||
<span class="sourceLineNo">190</span> return usePerIssuerLocale;<a name="line.190"></a>
|
||||
<span class="sourceLineNo">191</span> }<a name="line.191"></a>
|
||||
<span class="sourceLineNo">192</span><a name="line.192"></a>
|
||||
<span class="sourceLineNo">193</span> public boolean usePerIssuerLocale(boolean setting) {<a name="line.193"></a>
|
||||
<span class="sourceLineNo">194</span> boolean old = usePerIssuerLocale;<a name="line.194"></a>
|
||||
<span class="sourceLineNo">195</span> usePerIssuerLocale = setting;<a name="line.195"></a>
|
||||
<span class="sourceLineNo">196</span> return old;<a name="line.196"></a>
|
||||
<span class="sourceLineNo">197</span> }<a name="line.197"></a>
|
||||
<span class="sourceLineNo">198</span><a name="line.198"></a>
|
||||
<span class="sourceLineNo">199</span> public abstract <R extends CommandExecutionContext> R createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String, Object> passedArgs);<a name="line.199"></a>
|
||||
<span class="sourceLineNo">200</span><a name="line.200"></a>
|
||||
<span class="sourceLineNo">201</span> public abstract CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args);<a name="line.201"></a>
|
||||
<span class="sourceLineNo">202</span><a name="line.202"></a>
|
||||
<span class="sourceLineNo">203</span> public abstract void log(final LogLevel level, final String message, final Throwable throwable);<a name="line.203"></a>
|
||||
<span class="sourceLineNo">204</span><a name="line.204"></a>
|
||||
<span class="sourceLineNo">205</span> public void log(final LogLevel level, final String message) {<a name="line.205"></a>
|
||||
<span class="sourceLineNo">206</span> log(level, message, null);<a name="line.206"></a>
|
||||
<span class="sourceLineNo">207</span> }<a name="line.207"></a>
|
||||
<span class="sourceLineNo">208</span><a name="line.208"></a>
|
||||
<span class="sourceLineNo">209</span> /**<a name="line.209"></a>
|
||||
<span class="sourceLineNo">210</span> * Lets you add custom string replacements that can be applied to annotation values,<a name="line.210"></a>
|
||||
<span class="sourceLineNo">211</span> * to reduce duplication/repetition of common values such as permission nodes and command prefixes.<a name="line.211"></a>
|
||||
<span class="sourceLineNo">212</span> *<a name="line.212"></a>
|
||||
<span class="sourceLineNo">213</span> * Any replacement registered starts with a %<a name="line.213"></a>
|
||||
<span class="sourceLineNo">214</span> *<a name="line.214"></a>
|
||||
<span class="sourceLineNo">215</span> * So for ex @CommandPermission("%staff")<a name="line.215"></a>
|
||||
<span class="sourceLineNo">216</span> * @return Replacements Manager<a name="line.216"></a>
|
||||
<span class="sourceLineNo">217</span> */<a name="line.217"></a>
|
||||
<span class="sourceLineNo">218</span> public CommandReplacements getCommandReplacements() {<a name="line.218"></a>
|
||||
<span class="sourceLineNo">219</span> return replacements;<a name="line.219"></a>
|
||||
<span class="sourceLineNo">220</span> }<a name="line.220"></a>
|
||||
<span class="sourceLineNo">221</span><a name="line.221"></a>
|
||||
<span class="sourceLineNo">222</span> public boolean hasPermission(CommandIssuer issuer, String permission) {<a name="line.222"></a>
|
||||
<span class="sourceLineNo">223</span> if (permission == null || permission.isEmpty()) {<a name="line.223"></a>
|
||||
<span class="sourceLineNo">224</span> return true;<a name="line.224"></a>
|
||||
<span class="sourceLineNo">225</span> }<a name="line.225"></a>
|
||||
<span class="sourceLineNo">226</span> for (String perm : ACFPatterns.COMMA.split(permission)) {<a name="line.226"></a>
|
||||
<span class="sourceLineNo">227</span> if (!perm.isEmpty() && !issuer.hasPermission(perm)) {<a name="line.227"></a>
|
||||
<span class="sourceLineNo">228</span> return false;<a name="line.228"></a>
|
||||
<span class="sourceLineNo">229</span> }<a name="line.229"></a>
|
||||
<span class="sourceLineNo">230</span> }<a name="line.230"></a>
|
||||
<span class="sourceLineNo">231</span> return true;<a name="line.231"></a>
|
||||
<span class="sourceLineNo">232</span> }<a name="line.232"></a>
|
||||
<span class="sourceLineNo">233</span><a name="line.233"></a>
|
||||
<span class="sourceLineNo">234</span> BaseCommand getBaseCommand(String commandLabel, @NotNull String[] args) {<a name="line.234"></a>
|
||||
<span class="sourceLineNo">235</span> RootCommand rootCommand = obtainRootCommand(commandLabel);<a name="line.235"></a>
|
||||
<span class="sourceLineNo">236</span> if (rootCommand == null) {<a name="line.236"></a>
|
||||
<span class="sourceLineNo">237</span> return null;<a name="line.237"></a>
|
||||
<span class="sourceLineNo">238</span> }<a name="line.238"></a>
|
||||
<span class="sourceLineNo">239</span> return rootCommand.getBaseCommand(args);<a name="line.239"></a>
|
||||
<span class="sourceLineNo">240</span> }<a name="line.240"></a>
|
||||
<span class="sourceLineNo">241</span><a name="line.241"></a>
|
||||
<span class="sourceLineNo">242</span> public synchronized RootCommand getRootCommand(@NotNull String cmd) {<a name="line.242"></a>
|
||||
<span class="sourceLineNo">243</span> return rootCommands.get(ACFPatterns.SPACE.split(cmd.toLowerCase(), 2)[0]);<a name="line.243"></a>
|
||||
<span class="sourceLineNo">244</span> }<a name="line.244"></a>
|
||||
<span class="sourceLineNo">245</span><a name="line.245"></a>
|
||||
<span class="sourceLineNo">246</span> public synchronized RootCommand obtainRootCommand(@NotNull String cmd) {<a name="line.246"></a>
|
||||
<span class="sourceLineNo">247</span> return rootCommands.computeIfAbsent(ACFPatterns.SPACE.split(cmd.toLowerCase(), 2)[0], this::createRootCommand);<a name="line.247"></a>
|
||||
<span class="sourceLineNo">248</span> }<a name="line.248"></a>
|
||||
<span class="sourceLineNo">249</span><a name="line.249"></a>
|
||||
<span class="sourceLineNo">250</span> public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {<a name="line.250"></a>
|
||||
<span class="sourceLineNo">251</span> return new RegisteredCommand(command, cmdName, method, prefSubCommand);<a name="line.251"></a>
|
||||
<span class="sourceLineNo">252</span> }<a name="line.252"></a>
|
||||
<span class="sourceLineNo">253</span><a name="line.253"></a>
|
||||
<span class="sourceLineNo">254</span> /**<a name="line.254"></a>
|
||||
<span class="sourceLineNo">255</span> * Sets the default {@link ExceptionHandler} that is called when an exception occurs while executing a command, if the command doesn't have it's own exception handler registered.<a name="line.255"></a>
|
||||
<span class="sourceLineNo">256</span> *<a name="line.256"></a>
|
||||
<span class="sourceLineNo">257</span> * @param exceptionHandler the handler that should handle uncaught exceptions<a name="line.257"></a>
|
||||
<span class="sourceLineNo">258</span> */<a name="line.258"></a>
|
||||
<span class="sourceLineNo">259</span> public void setDefaultExceptionHandler(ExceptionHandler exceptionHandler) {<a name="line.259"></a>
|
||||
<span class="sourceLineNo">260</span> defaultExceptionHandler = exceptionHandler;<a name="line.260"></a>
|
||||
<span class="sourceLineNo">261</span> }<a name="line.261"></a>
|
||||
<span class="sourceLineNo">262</span><a name="line.262"></a>
|
||||
<span class="sourceLineNo">263</span> /**<a name="line.263"></a>
|
||||
<span class="sourceLineNo">264</span> * Gets the current default exception handler, might be null.<a name="line.264"></a>
|
||||
<span class="sourceLineNo">265</span> *<a name="line.265"></a>
|
||||
<span class="sourceLineNo">266</span> * @return the default exception handler<a name="line.266"></a>
|
||||
<span class="sourceLineNo">267</span> */<a name="line.267"></a>
|
||||
<span class="sourceLineNo">268</span> public ExceptionHandler getDefaultExceptionHandler() {<a name="line.268"></a>
|
||||
<span class="sourceLineNo">269</span> return defaultExceptionHandler;<a name="line.269"></a>
|
||||
<span class="sourceLineNo">270</span> }<a name="line.270"></a>
|
||||
<span class="sourceLineNo">271</span><a name="line.271"></a>
|
||||
<span class="sourceLineNo">272</span> protected boolean handleUncaughtException(BaseCommand scope, RegisteredCommand registeredCommand, CommandIssuer sender, List<String> args, Throwable t) {<a name="line.272"></a>
|
||||
<span class="sourceLineNo">273</span> if (t instanceof InvocationTargetException && t.getCause() != null) {<a name="line.273"></a>
|
||||
<span class="sourceLineNo">274</span> t = t.getCause();<a name="line.274"></a>
|
||||
<span class="sourceLineNo">275</span> }<a name="line.275"></a>
|
||||
<span class="sourceLineNo">276</span> boolean result = false;<a name="line.276"></a>
|
||||
<span class="sourceLineNo">277</span> if (scope.getExceptionHandler() != null) {<a name="line.277"></a>
|
||||
<span class="sourceLineNo">278</span> result = scope.getExceptionHandler().execute(scope, registeredCommand, sender, args, t);<a name="line.278"></a>
|
||||
<span class="sourceLineNo">279</span> } else if (defaultExceptionHandler != null) {<a name="line.279"></a>
|
||||
<span class="sourceLineNo">280</span> result = defaultExceptionHandler.execute(scope, registeredCommand, sender, args, t);<a name="line.280"></a>
|
||||
<span class="sourceLineNo">281</span> }<a name="line.281"></a>
|
||||
<span class="sourceLineNo">282</span> return result;<a name="line.282"></a>
|
||||
<span class="sourceLineNo">283</span> }<a name="line.283"></a>
|
||||
<span class="sourceLineNo">284</span><a name="line.284"></a>
|
||||
<span class="sourceLineNo">285</span> public void sendMessage(CommandIssuer issuer, MessageType type, MessageKeyProvider key, String... replacements) {<a name="line.285"></a>
|
||||
<span class="sourceLineNo">286</span> String message = formatMessage(issuer, type, key, replacements);<a name="line.286"></a>
|
||||
<span class="sourceLineNo">287</span><a name="line.287"></a>
|
||||
<span class="sourceLineNo">288</span> for (String msg : ACFPatterns.NEWLINE.split(message)) {<a name="line.288"></a>
|
||||
<span class="sourceLineNo">289</span> issuer.sendMessageInternal(ACFUtil.rtrim(msg));<a name="line.289"></a>
|
||||
<span class="sourceLineNo">290</span> }<a name="line.290"></a>
|
||||
<span class="sourceLineNo">291</span> }<a name="line.291"></a>
|
||||
<span class="sourceLineNo">292</span><a name="line.292"></a>
|
||||
<span class="sourceLineNo">293</span> public String formatMessage(CommandIssuer issuer, MessageType type, MessageKeyProvider key, String... replacements) {<a name="line.293"></a>
|
||||
<span class="sourceLineNo">294</span> String message = getLocales().getMessage(issuer, key.getMessageKey());<a name="line.294"></a>
|
||||
<span class="sourceLineNo">295</span> if (replacements.length > 0) {<a name="line.295"></a>
|
||||
<span class="sourceLineNo">296</span> message = ACFUtil.replaceStrings(message, replacements);<a name="line.296"></a>
|
||||
<span class="sourceLineNo">297</span> }<a name="line.297"></a>
|
||||
<span class="sourceLineNo">298</span><a name="line.298"></a>
|
||||
<span class="sourceLineNo">299</span> message = getCommandReplacements().replace(message);<a name="line.299"></a>
|
||||
<span class="sourceLineNo">300</span><a name="line.300"></a>
|
||||
<span class="sourceLineNo">301</span> MessageFormatter formatter = formatters.getOrDefault(type, defaultFormatter);<a name="line.301"></a>
|
||||
<span class="sourceLineNo">302</span> if (formatter != null) {<a name="line.302"></a>
|
||||
<span class="sourceLineNo">303</span> message = formatter.format(message);<a name="line.303"></a>
|
||||
<span class="sourceLineNo">304</span> }<a name="line.304"></a>
|
||||
<span class="sourceLineNo">305</span> return message;<a name="line.305"></a>
|
||||
<span class="sourceLineNo">306</span> }<a name="line.306"></a>
|
||||
<span class="sourceLineNo">307</span><a name="line.307"></a>
|
||||
<span class="sourceLineNo">308</span> public void onLocaleChange(IssuerLocaleChangedCallback<AI> onChange) {<a name="line.308"></a>
|
||||
<span class="sourceLineNo">309</span> localeChangedCallbacks.add(onChange);<a name="line.309"></a>
|
||||
<span class="sourceLineNo">285</span> public void sendMessage(I issuerArg, MessageType type, MessageKeyProvider key, String... replacements) {<a name="line.285"></a>
|
||||
<span class="sourceLineNo">286</span> sendMessage(getCommandIssuer(issuerArg), type, key, replacements);<a name="line.286"></a>
|
||||
<span class="sourceLineNo">287</span> }<a name="line.287"></a>
|
||||
<span class="sourceLineNo">288</span><a name="line.288"></a>
|
||||
<span class="sourceLineNo">289</span> public void sendMessage(CommandIssuer issuer, MessageType type, MessageKeyProvider key, String... replacements) {<a name="line.289"></a>
|
||||
<span class="sourceLineNo">290</span> String message = formatMessage(issuer, type, key, replacements);<a name="line.290"></a>
|
||||
<span class="sourceLineNo">291</span><a name="line.291"></a>
|
||||
<span class="sourceLineNo">292</span> for (String msg : ACFPatterns.NEWLINE.split(message)) {<a name="line.292"></a>
|
||||
<span class="sourceLineNo">293</span> issuer.sendMessageInternal(ACFUtil.rtrim(msg));<a name="line.293"></a>
|
||||
<span class="sourceLineNo">294</span> }<a name="line.294"></a>
|
||||
<span class="sourceLineNo">295</span> }<a name="line.295"></a>
|
||||
<span class="sourceLineNo">296</span><a name="line.296"></a>
|
||||
<span class="sourceLineNo">297</span> public String formatMessage(CommandIssuer issuer, MessageType type, MessageKeyProvider key, String... replacements) {<a name="line.297"></a>
|
||||
<span class="sourceLineNo">298</span> String message = getLocales().getMessage(issuer, key.getMessageKey());<a name="line.298"></a>
|
||||
<span class="sourceLineNo">299</span> if (replacements.length > 0) {<a name="line.299"></a>
|
||||
<span class="sourceLineNo">300</span> message = ACFUtil.replaceStrings(message, replacements);<a name="line.300"></a>
|
||||
<span class="sourceLineNo">301</span> }<a name="line.301"></a>
|
||||
<span class="sourceLineNo">302</span><a name="line.302"></a>
|
||||
<span class="sourceLineNo">303</span> message = getCommandReplacements().replace(message);<a name="line.303"></a>
|
||||
<span class="sourceLineNo">304</span><a name="line.304"></a>
|
||||
<span class="sourceLineNo">305</span> MessageFormatter formatter = formatters.getOrDefault(type, defaultFormatter);<a name="line.305"></a>
|
||||
<span class="sourceLineNo">306</span> if (formatter != null) {<a name="line.306"></a>
|
||||
<span class="sourceLineNo">307</span> message = formatter.format(message);<a name="line.307"></a>
|
||||
<span class="sourceLineNo">308</span> }<a name="line.308"></a>
|
||||
<span class="sourceLineNo">309</span> return message;<a name="line.309"></a>
|
||||
<span class="sourceLineNo">310</span> }<a name="line.310"></a>
|
||||
<span class="sourceLineNo">311</span><a name="line.311"></a>
|
||||
<span class="sourceLineNo">312</span> public void notifyLocaleChange(AI issuer, Locale oldLocale, Locale newLocale) {<a name="line.312"></a>
|
||||
<span class="sourceLineNo">313</span> localeChangedCallbacks.forEach(cb -> {<a name="line.313"></a>
|
||||
<span class="sourceLineNo">314</span> try {<a name="line.314"></a>
|
||||
<span class="sourceLineNo">315</span> cb.onIssuerLocaleChange(issuer, oldLocale, newLocale);<a name="line.315"></a>
|
||||
<span class="sourceLineNo">316</span> } catch (Exception e) {<a name="line.316"></a>
|
||||
<span class="sourceLineNo">317</span> this.log(LogLevel.ERROR, "Error in notifyLocaleChange", e);<a name="line.317"></a>
|
||||
<span class="sourceLineNo">318</span> }<a name="line.318"></a>
|
||||
<span class="sourceLineNo">319</span> });<a name="line.319"></a>
|
||||
<span class="sourceLineNo">320</span> }<a name="line.320"></a>
|
||||
<span class="sourceLineNo">321</span><a name="line.321"></a>
|
||||
<span class="sourceLineNo">322</span> public Locale getIssuerLocale(CommandIssuer issuer) {<a name="line.322"></a>
|
||||
<span class="sourceLineNo">323</span> return getLocales().getDefaultLocale();<a name="line.323"></a>
|
||||
<span class="sourceLineNo">312</span> public void onLocaleChange(IssuerLocaleChangedCallback<AI> onChange) {<a name="line.312"></a>
|
||||
<span class="sourceLineNo">313</span> localeChangedCallbacks.add(onChange);<a name="line.313"></a>
|
||||
<span class="sourceLineNo">314</span> }<a name="line.314"></a>
|
||||
<span class="sourceLineNo">315</span><a name="line.315"></a>
|
||||
<span class="sourceLineNo">316</span> public void notifyLocaleChange(AI issuer, Locale oldLocale, Locale newLocale) {<a name="line.316"></a>
|
||||
<span class="sourceLineNo">317</span> localeChangedCallbacks.forEach(cb -> {<a name="line.317"></a>
|
||||
<span class="sourceLineNo">318</span> try {<a name="line.318"></a>
|
||||
<span class="sourceLineNo">319</span> cb.onIssuerLocaleChange(issuer, oldLocale, newLocale);<a name="line.319"></a>
|
||||
<span class="sourceLineNo">320</span> } catch (Exception e) {<a name="line.320"></a>
|
||||
<span class="sourceLineNo">321</span> this.log(LogLevel.ERROR, "Error in notifyLocaleChange", e);<a name="line.321"></a>
|
||||
<span class="sourceLineNo">322</span> }<a name="line.322"></a>
|
||||
<span class="sourceLineNo">323</span> });<a name="line.323"></a>
|
||||
<span class="sourceLineNo">324</span> }<a name="line.324"></a>
|
||||
<span class="sourceLineNo">325</span><a name="line.325"></a>
|
||||
<span class="sourceLineNo">326</span> CommandOperationContext createCommandOperationContext(BaseCommand command, CommandIssuer issuer, String commandLabel, String[] args, boolean isAsync) {<a name="line.326"></a>
|
||||
<span class="sourceLineNo">327</span> return new CommandOperationContext(<a name="line.327"></a>
|
||||
<span class="sourceLineNo">328</span> this,<a name="line.328"></a>
|
||||
<span class="sourceLineNo">329</span> issuer,<a name="line.329"></a>
|
||||
<span class="sourceLineNo">330</span> command,<a name="line.330"></a>
|
||||
<span class="sourceLineNo">331</span> commandLabel,<a name="line.331"></a>
|
||||
<span class="sourceLineNo">332</span> args,<a name="line.332"></a>
|
||||
<span class="sourceLineNo">333</span> isAsync<a name="line.333"></a>
|
||||
<span class="sourceLineNo">334</span> );<a name="line.334"></a>
|
||||
<span class="sourceLineNo">335</span> }<a name="line.335"></a>
|
||||
<span class="sourceLineNo">336</span><a name="line.336"></a>
|
||||
<span class="sourceLineNo">337</span> /**<a name="line.337"></a>
|
||||
<span class="sourceLineNo">338</span> * Gets a list of all currently supported languages for this manager.<a name="line.338"></a>
|
||||
<span class="sourceLineNo">339</span> * These locales will be automatically loaded from<a name="line.339"></a>
|
||||
<span class="sourceLineNo">340</span> * @return<a name="line.340"></a>
|
||||
<span class="sourceLineNo">341</span> */<a name="line.341"></a>
|
||||
<span class="sourceLineNo">342</span> public Set<Locale> getSupportedLanguages() {<a name="line.342"></a>
|
||||
<span class="sourceLineNo">343</span> return supportedLanguages;<a name="line.343"></a>
|
||||
<span class="sourceLineNo">344</span> }<a name="line.344"></a>
|
||||
<span class="sourceLineNo">345</span><a name="line.345"></a>
|
||||
<span class="sourceLineNo">346</span> /**<a name="line.346"></a>
|
||||
<span class="sourceLineNo">347</span> * Adds a new locale to the list of automatic Locales to load Message Bundles for.<a name="line.347"></a>
|
||||
<span class="sourceLineNo">348</span> * All bundles loaded under the previous supported languages will now automatically load for this new locale too.<a name="line.348"></a>
|
||||
<span class="sourceLineNo">349</span> *<a name="line.349"></a>
|
||||
<span class="sourceLineNo">350</span> * @param locale<a name="line.350"></a>
|
||||
<span class="sourceLineNo">351</span> */<a name="line.351"></a>
|
||||
<span class="sourceLineNo">352</span> public void addSupportedLanguage(Locale locale) {<a name="line.352"></a>
|
||||
<span class="sourceLineNo">353</span> supportedLanguages.add(locale);<a name="line.353"></a>
|
||||
<span class="sourceLineNo">354</span> getLocales().loadMissingBundles();<a name="line.354"></a>
|
||||
<span class="sourceLineNo">355</span> }<a name="line.355"></a>
|
||||
<span class="sourceLineNo">356</span><a name="line.356"></a>
|
||||
<span class="sourceLineNo">357</span> /**<a name="line.357"></a>
|
||||
<span class="sourceLineNo">358</span> * @deprecated Use this with caution! If you enable and use Unstable API's, your next compile using ACF<a name="line.358"></a>
|
||||
<span class="sourceLineNo">359</span> * may require you to update your implementation to those unstable API's<a name="line.359"></a>
|
||||
<span class="sourceLineNo">360</span> */<a name="line.360"></a>
|
||||
<span class="sourceLineNo">361</span> @Deprecated<a name="line.361"></a>
|
||||
<span class="sourceLineNo">362</span> public void enableUnstableAPI(String api) {<a name="line.362"></a>
|
||||
<span class="sourceLineNo">363</span> unstableAPIs.add(api);<a name="line.363"></a>
|
||||
<span class="sourceLineNo">364</span> }<a name="line.364"></a>
|
||||
<span class="sourceLineNo">365</span> void verifyUnstableAPI(String api) {<a name="line.365"></a>
|
||||
<span class="sourceLineNo">366</span> if (!unstableAPIs.contains(api)) {<a name="line.366"></a>
|
||||
<span class="sourceLineNo">367</span> throw new IllegalStateException("Using an unstable API that has not been enabled ( " + api + "). See https://acfunstable.emc.gs");<a name="line.367"></a>
|
||||
<span class="sourceLineNo">368</span> }<a name="line.368"></a>
|
||||
<span class="sourceLineNo">369</span> }<a name="line.369"></a>
|
||||
<span class="sourceLineNo">370</span>}<a name="line.370"></a>
|
||||
<span class="sourceLineNo">326</span> public Locale getIssuerLocale(CommandIssuer issuer) {<a name="line.326"></a>
|
||||
<span class="sourceLineNo">327</span> return getLocales().getDefaultLocale();<a name="line.327"></a>
|
||||
<span class="sourceLineNo">328</span> }<a name="line.328"></a>
|
||||
<span class="sourceLineNo">329</span><a name="line.329"></a>
|
||||
<span class="sourceLineNo">330</span> CommandOperationContext createCommandOperationContext(BaseCommand command, CommandIssuer issuer, String commandLabel, String[] args, boolean isAsync) {<a name="line.330"></a>
|
||||
<span class="sourceLineNo">331</span> return new CommandOperationContext(<a name="line.331"></a>
|
||||
<span class="sourceLineNo">332</span> this,<a name="line.332"></a>
|
||||
<span class="sourceLineNo">333</span> issuer,<a name="line.333"></a>
|
||||
<span class="sourceLineNo">334</span> command,<a name="line.334"></a>
|
||||
<span class="sourceLineNo">335</span> commandLabel,<a name="line.335"></a>
|
||||
<span class="sourceLineNo">336</span> args,<a name="line.336"></a>
|
||||
<span class="sourceLineNo">337</span> isAsync<a name="line.337"></a>
|
||||
<span class="sourceLineNo">338</span> );<a name="line.338"></a>
|
||||
<span class="sourceLineNo">339</span> }<a name="line.339"></a>
|
||||
<span class="sourceLineNo">340</span><a name="line.340"></a>
|
||||
<span class="sourceLineNo">341</span> /**<a name="line.341"></a>
|
||||
<span class="sourceLineNo">342</span> * Gets a list of all currently supported languages for this manager.<a name="line.342"></a>
|
||||
<span class="sourceLineNo">343</span> * These locales will be automatically loaded from<a name="line.343"></a>
|
||||
<span class="sourceLineNo">344</span> * @return<a name="line.344"></a>
|
||||
<span class="sourceLineNo">345</span> */<a name="line.345"></a>
|
||||
<span class="sourceLineNo">346</span> public Set<Locale> getSupportedLanguages() {<a name="line.346"></a>
|
||||
<span class="sourceLineNo">347</span> return supportedLanguages;<a name="line.347"></a>
|
||||
<span class="sourceLineNo">348</span> }<a name="line.348"></a>
|
||||
<span class="sourceLineNo">349</span><a name="line.349"></a>
|
||||
<span class="sourceLineNo">350</span> /**<a name="line.350"></a>
|
||||
<span class="sourceLineNo">351</span> * Adds a new locale to the list of automatic Locales to load Message Bundles for.<a name="line.351"></a>
|
||||
<span class="sourceLineNo">352</span> * All bundles loaded under the previous supported languages will now automatically load for this new locale too.<a name="line.352"></a>
|
||||
<span class="sourceLineNo">353</span> *<a name="line.353"></a>
|
||||
<span class="sourceLineNo">354</span> * @param locale<a name="line.354"></a>
|
||||
<span class="sourceLineNo">355</span> */<a name="line.355"></a>
|
||||
<span class="sourceLineNo">356</span> public void addSupportedLanguage(Locale locale) {<a name="line.356"></a>
|
||||
<span class="sourceLineNo">357</span> supportedLanguages.add(locale);<a name="line.357"></a>
|
||||
<span class="sourceLineNo">358</span> getLocales().loadMissingBundles();<a name="line.358"></a>
|
||||
<span class="sourceLineNo">359</span> }<a name="line.359"></a>
|
||||
<span class="sourceLineNo">360</span><a name="line.360"></a>
|
||||
<span class="sourceLineNo">361</span> /**<a name="line.361"></a>
|
||||
<span class="sourceLineNo">362</span> * @deprecated Use this with caution! If you enable and use Unstable API's, your next compile using ACF<a name="line.362"></a>
|
||||
<span class="sourceLineNo">363</span> * may require you to update your implementation to those unstable API's<a name="line.363"></a>
|
||||
<span class="sourceLineNo">364</span> */<a name="line.364"></a>
|
||||
<span class="sourceLineNo">365</span> @Deprecated<a name="line.365"></a>
|
||||
<span class="sourceLineNo">366</span> public void enableUnstableAPI(String api) {<a name="line.366"></a>
|
||||
<span class="sourceLineNo">367</span> unstableAPIs.add(api);<a name="line.367"></a>
|
||||
<span class="sourceLineNo">368</span> }<a name="line.368"></a>
|
||||
<span class="sourceLineNo">369</span> void verifyUnstableAPI(String api) {<a name="line.369"></a>
|
||||
<span class="sourceLineNo">370</span> if (!unstableAPIs.contains(api)) {<a name="line.370"></a>
|
||||
<span class="sourceLineNo">371</span> throw new IllegalStateException("Using an unstable API that has not been enabled ( " + api + "). See https://acfunstable.emc.gs");<a name="line.371"></a>
|
||||
<span class="sourceLineNo">372</span> }<a name="line.372"></a>
|
||||
<span class="sourceLineNo">373</span> }<a name="line.373"></a>
|
||||
<span class="sourceLineNo">374</span>}<a name="line.374"></a>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user