🎨 Add caption for string "No input was provided"
This commit is contained in:
parent
c67cc35cf6
commit
fba29041e6
29 changed files with 191 additions and 31 deletions
|
|
@ -29,6 +29,7 @@ import cloud.commandframework.arguments.parser.ArgumentParser;
|
|||
import cloud.commandframework.bukkit.BukkitCaptionKeys;
|
||||
import cloud.commandframework.captions.CaptionVariable;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
|
||||
import cloud.commandframework.exceptions.parsing.ParserException;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
|
|
@ -132,7 +133,10 @@ public class EnchantmentArgument<C> extends CommandArgument<C, Enchantment> {
|
|||
) {
|
||||
final String input = inputQueue.peek();
|
||||
if (input == null) {
|
||||
return ArgumentParseResult.failure(new NullPointerException("No input was provided"));
|
||||
return ArgumentParseResult.failure(new NoInputProvidedException(
|
||||
EnchantmentParser.class,
|
||||
commandContext
|
||||
));
|
||||
}
|
||||
|
||||
final NamespacedKey key;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import cloud.commandframework.arguments.parser.ArgumentParser;
|
|||
import cloud.commandframework.bukkit.BukkitCaptionKeys;
|
||||
import cloud.commandframework.captions.CaptionVariable;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
|
||||
import cloud.commandframework.exceptions.parsing.ParserException;
|
||||
import org.bukkit.Material;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
|
@ -131,7 +132,10 @@ public class MaterialArgument<C> extends CommandArgument<C, Material> {
|
|||
) {
|
||||
String input = inputQueue.peek();
|
||||
if (input == null) {
|
||||
return ArgumentParseResult.failure(new NullPointerException("No input was provided"));
|
||||
return ArgumentParseResult.failure(new NoInputProvidedException(
|
||||
MaterialParser.class,
|
||||
commandContext
|
||||
));
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import cloud.commandframework.arguments.parser.ArgumentParser;
|
|||
import cloud.commandframework.bukkit.BukkitCaptionKeys;
|
||||
import cloud.commandframework.captions.CaptionVariable;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
|
||||
import cloud.commandframework.exceptions.parsing.ParserException;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
|
@ -141,7 +142,10 @@ public final class OfflinePlayerArgument<C> extends CommandArgument<C, OfflinePl
|
|||
) {
|
||||
final String input = inputQueue.peek();
|
||||
if (input == null) {
|
||||
return ArgumentParseResult.failure(new NullPointerException("No input was provided"));
|
||||
return ArgumentParseResult.failure(new NoInputProvidedException(
|
||||
OfflinePlayerParser.class,
|
||||
commandContext
|
||||
));
|
||||
}
|
||||
inputQueue.remove();
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import cloud.commandframework.arguments.parser.ArgumentParser;
|
|||
import cloud.commandframework.bukkit.BukkitCaptionKeys;
|
||||
import cloud.commandframework.captions.CaptionVariable;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
|
||||
import cloud.commandframework.exceptions.parsing.ParserException;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
|
@ -135,7 +136,10 @@ public final class PlayerArgument<C> extends CommandArgument<C, Player> {
|
|||
) {
|
||||
final String input = inputQueue.peek();
|
||||
if (input == null) {
|
||||
return ArgumentParseResult.failure(new NullPointerException("No input was provided"));
|
||||
return ArgumentParseResult.failure(new NoInputProvidedException(
|
||||
PlayerParser.class,
|
||||
commandContext
|
||||
));
|
||||
}
|
||||
inputQueue.remove();
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import cloud.commandframework.arguments.parser.ArgumentParser;
|
|||
import cloud.commandframework.bukkit.BukkitCaptionKeys;
|
||||
import cloud.commandframework.captions.CaptionVariable;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
|
||||
import cloud.commandframework.exceptions.parsing.ParserException;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
|
@ -128,7 +129,10 @@ public class WorldArgument<C> extends CommandArgument<C, World> {
|
|||
) {
|
||||
final String input = inputQueue.peek();
|
||||
if (input == null) {
|
||||
return ArgumentParseResult.failure(new NullPointerException("No input was provided"));
|
||||
return ArgumentParseResult.failure(new NoInputProvidedException(
|
||||
WorldParser.class,
|
||||
commandContext
|
||||
));
|
||||
}
|
||||
|
||||
final World world = Bukkit.getWorld(input);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import cloud.commandframework.arguments.parser.ArgumentParser;
|
|||
import cloud.commandframework.bukkit.CloudBukkitCapabilities;
|
||||
import cloud.commandframework.bukkit.arguments.selector.MultipleEntitySelector;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
|
@ -141,7 +142,10 @@ public final class MultipleEntitySelectorArgument<C> extends CommandArgument<C,
|
|||
}
|
||||
final String input = inputQueue.peek();
|
||||
if (input == null) {
|
||||
return ArgumentParseResult.failure(new NullPointerException("No input was provided"));
|
||||
return ArgumentParseResult.failure(new NoInputProvidedException(
|
||||
MultipleEntitySelectorParser.class,
|
||||
commandContext
|
||||
));
|
||||
}
|
||||
inputQueue.remove();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import cloud.commandframework.bukkit.CloudBukkitCapabilities;
|
|||
import cloud.commandframework.bukkit.arguments.selector.MultiplePlayerSelector;
|
||||
import cloud.commandframework.bukkit.parsers.PlayerArgument;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
|
@ -136,7 +137,10 @@ public final class MultiplePlayerSelectorArgument<C> extends CommandArgument<C,
|
|||
) {
|
||||
final String input = inputQueue.peek();
|
||||
if (input == null) {
|
||||
return ArgumentParseResult.failure(new NullPointerException("No input was provided"));
|
||||
return ArgumentParseResult.failure(new NoInputProvidedException(
|
||||
MultiplePlayerSelectorParser.class,
|
||||
commandContext
|
||||
));
|
||||
}
|
||||
inputQueue.remove();
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import cloud.commandframework.arguments.parser.ArgumentParser;
|
|||
import cloud.commandframework.bukkit.CloudBukkitCapabilities;
|
||||
import cloud.commandframework.bukkit.arguments.selector.SingleEntitySelector;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
|
@ -139,7 +140,10 @@ public final class SingleEntitySelectorArgument<C> extends CommandArgument<C, Si
|
|||
}
|
||||
final String input = inputQueue.peek();
|
||||
if (input == null) {
|
||||
return ArgumentParseResult.failure(new NullPointerException("No input was provided"));
|
||||
return ArgumentParseResult.failure(new NoInputProvidedException(
|
||||
SingleEntitySelectorParser.class,
|
||||
commandContext
|
||||
));
|
||||
}
|
||||
inputQueue.remove();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import cloud.commandframework.bukkit.CloudBukkitCapabilities;
|
|||
import cloud.commandframework.bukkit.arguments.selector.SinglePlayerSelector;
|
||||
import cloud.commandframework.bukkit.parsers.PlayerArgument;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import cloud.commandframework.exceptions.parsing.NoInputProvidedException;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
|
@ -134,7 +135,10 @@ public final class SinglePlayerSelectorArgument<C> extends CommandArgument<C, Si
|
|||
) {
|
||||
final String input = inputQueue.peek();
|
||||
if (input == null) {
|
||||
return ArgumentParseResult.failure(new NullPointerException("No input was provided"));
|
||||
return ArgumentParseResult.failure(new NoInputProvidedException(
|
||||
SinglePlayerSelectorParser.class,
|
||||
commandContext
|
||||
));
|
||||
}
|
||||
inputQueue.remove();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue