Reformat.
This commit is contained in:
parent
3ec124aac4
commit
a5748444ce
9 changed files with 48 additions and 26 deletions
|
|
@ -21,7 +21,9 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
package com.intellectualsites.commands;import com.intellectualsites.commands.components.CommandComponent;
|
||||
package com.intellectualsites.commands;
|
||||
|
||||
import com.intellectualsites.commands.components.CommandComponent;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginIdentifiableCommand;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
|
@ -34,7 +36,8 @@ public class BukkitCommand extends org.bukkit.command.Command implements PluginI
|
|||
private final CommandComponent<BukkitCommandSender, ?> command;
|
||||
private final BukkitCommandManager bukkitCommandManager;
|
||||
|
||||
BukkitCommand(@Nonnull final CommandComponent<BukkitCommandSender, ?> command, @Nonnull final BukkitCommandManager bukkitCommandManager) {
|
||||
BukkitCommand(@Nonnull final CommandComponent<BukkitCommandSender, ?> command,
|
||||
@Nonnull final BukkitCommandManager bukkitCommandManager) {
|
||||
super(command.getName());
|
||||
this.command = command;
|
||||
this.bukkitCommandManager = bukkitCommandManager;
|
||||
|
|
@ -47,7 +50,8 @@ public class BukkitCommand extends org.bukkit.command.Command implements PluginI
|
|||
for (final String string : strings) {
|
||||
builder.append(" ").append(string);
|
||||
}
|
||||
this.bukkitCommandManager.executeCommand(BukkitCommandSender.of(commandSender), builder.toString()).whenComplete(((commandResult, throwable) -> {
|
||||
this.bukkitCommandManager.executeCommand(BukkitCommandSender.of(commandSender), builder.toString())
|
||||
.whenComplete(((commandResult, throwable) -> {
|
||||
if (throwable != null) {
|
||||
throwable.printStackTrace();
|
||||
} else {
|
||||
|
|
@ -59,7 +63,8 @@ public class BukkitCommand extends org.bukkit.command.Command implements PluginI
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(final CommandSender sender, final String alias, final String[] args) throws IllegalArgumentException {
|
||||
public List<String> tabComplete(final CommandSender sender, final String alias, final String[] args) throws
|
||||
IllegalArgumentException {
|
||||
final StringBuilder builder = new StringBuilder(this.command.getName());
|
||||
for (final String string : args) {
|
||||
builder.append(" ").append(string);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
package com.intellectualsites.commands;import com.intellectualsites.commands.execution.CommandExecutionCoordinator;
|
||||
package com.intellectualsites.commands;
|
||||
|
||||
import com.intellectualsites.commands.execution.CommandExecutionCoordinator;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
|
@ -40,7 +42,8 @@ public class BukkitCommandManager extends CommandManager<BukkitCommandSender> {
|
|||
this.owningPlugin = owningPlugin;
|
||||
}
|
||||
|
||||
@Nonnull public Plugin getOwningPlugin() {
|
||||
@Nonnull
|
||||
public Plugin getOwningPlugin() {
|
||||
return this.owningPlugin;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
package com.intellectualsites.commands;import com.google.common.base.Objects;
|
||||
package com.intellectualsites.commands;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.intellectualsites.commands.sender.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
|
@ -70,12 +72,14 @@ public abstract class BukkitCommandSender implements CommandSender {
|
|||
return Objects.hashCode(internalSender);
|
||||
}
|
||||
|
||||
@Nonnull public org.bukkit.command.CommandSender getInternalSender() {
|
||||
@Nonnull
|
||||
public org.bukkit.command.CommandSender getInternalSender() {
|
||||
return this.internalSender;
|
||||
}
|
||||
|
||||
public abstract boolean isPlayer();
|
||||
|
||||
@Nonnull public abstract Player asPlayer();
|
||||
@Nonnull
|
||||
public abstract Player asPlayer();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
package com.intellectualsites.commands;import org.bukkit.Bukkit;
|
||||
package com.intellectualsites.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
package com.intellectualsites.commands;import org.bukkit.entity.Player;
|
||||
package com.intellectualsites.commands;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,9 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
package com.intellectualsites.commands;import com.intellectualsites.commands.components.CommandComponent;
|
||||
package com.intellectualsites.commands;
|
||||
|
||||
import com.intellectualsites.commands.components.CommandComponent;
|
||||
import com.intellectualsites.commands.internal.CommandRegistrationHandler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandMap;
|
||||
|
|
@ -50,7 +52,8 @@ public class BukkitPluginRegistrationHandler implements CommandRegistrationHandl
|
|||
final Field knownCommands = SimpleCommandMap.class.getDeclaredField("knownCommands");
|
||||
knownCommands.setAccessible(true);
|
||||
@SuppressWarnings("ALL")
|
||||
final Map<String, org.bukkit.command.Command> bukkitCommands = (Map<String, org.bukkit.command.Command>) knownCommands.get(commandMap);
|
||||
final Map<String, org.bukkit.command.Command> bukkitCommands = (Map<String, org.bukkit.command.Command>) knownCommands.get(
|
||||
commandMap);
|
||||
this.bukkitCommands = bukkitCommands;
|
||||
this.bukkitCommandManager = bukkitCommandManager;
|
||||
}
|
||||
|
|
@ -68,7 +71,8 @@ public class BukkitPluginRegistrationHandler implements CommandRegistrationHandl
|
|||
} else {
|
||||
label = commandComponent.getName();
|
||||
}
|
||||
this.bukkitCommands.put(label, new BukkitCommand((CommandComponent<BukkitCommandSender, ?>) commandComponent, this.bukkitCommandManager));
|
||||
this.bukkitCommands.put(label, new BukkitCommand((CommandComponent<BukkitCommandSender, ?>) commandComponent,
|
||||
this.bukkitCommandManager));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@
|
|||
~
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>Commands</artifactId>
|
||||
|
|
|
|||
|
|
@ -109,7 +109,8 @@ public abstract class CommandManager<C extends CommandSender> {
|
|||
this.commandSyntaxFormatter = commandSyntaxFormatter;
|
||||
}
|
||||
|
||||
@Nonnull protected CommandRegistrationHandler getCommandRegistrationHandler() {
|
||||
@Nonnull
|
||||
protected CommandRegistrationHandler getCommandRegistrationHandler() {
|
||||
return this.commandRegistrationHandler;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@ public class CommandTree<C extends CommandSender> {
|
|||
/* Not enough arguments */
|
||||
throw new InvalidSyntaxException(this.commandManager.getCommandSyntaxFormatter()
|
||||
.apply(Objects.requireNonNull(
|
||||
child.getValue().getOwningCommand()).getComponents()),
|
||||
child.getValue().getOwningCommand())
|
||||
.getComponents()),
|
||||
commandContext.getCommandSender(), this.getChain(root)
|
||||
.stream()
|
||||
.map(Node::getValue)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue