Skip to content

Commit

Permalink
Quick dumb fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqzn committed Oct 16, 2024
1 parent 667d6ba commit e346961
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ public ParameterOfflinePlayer() {
ExecutionContext<BukkitSource> context,
@NotNull CommandInputStream<BukkitSource> commandInputStream
) throws ImperatException {
String name = commandInputStream.currentRaw();
String name = commandInputStream.currentRaw().orElse(null);
if (name == null) return null;

if (name.length() > 16) {
throw new UnknownPlayerException(name);
}
Expand All @@ -67,7 +68,7 @@ public ParameterOfflinePlayer() {

@Override
public boolean matchesInput(String input, CommandParameter<BukkitSource> parameter) {
return input.length() <= 16; //TODO impl other logic
return input.length() <= 16;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ public ParameterPlayer() {
ExecutionContext<BukkitSource> context,
@NotNull CommandInputStream<BukkitSource> commandInputStream
) throws ImperatException {
String raw = commandInputStream.currentRaw();
String raw = commandInputStream.currentRaw().orElse(null);
if (raw == null) return null;

if (raw.equalsIgnoreCase("me")) {
if (context.source().isConsole()) {
throw new UnknownPlayerException(raw);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ private ParameterTargetSelector() {
@NotNull CommandInputStream<BukkitSource> commandInputStream
) throws ImperatException {

String raw = commandInputStream.currentRaw();
String raw = commandInputStream.currentRaw().orElse(null);
if (raw == null)
return TargetSelector.of();

char last = raw.charAt(raw.length() - 1);

if (commandInputStream.currentLetter() != SelectionType.MENTION_CHARACTER) {
if (commandInputStream.currentLetter().filter((c) -> c != SelectionType.MENTION_CHARACTER).isPresent()) {
Player target = Bukkit.getPlayer(raw);
if (target == null)
return TargetSelector.of();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ParameterWorld() {

@Override
public @Nullable World resolve(ExecutionContext<BukkitSource> context, @NotNull CommandInputStream<BukkitSource> commandInputStream) throws ImperatException {
String raw = commandInputStream.currentRaw();
String raw = commandInputStream.currentRaw().orElse(null);
if (raw == null) return null;

World world = Bukkit.getWorld(raw.toLowerCase());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ParameterProxiedPlayer() {
ExecutionContext<BungeeSource> context,
@NotNull CommandInputStream<BungeeSource> commandInputStream
) throws ImperatException {
String currentRaw = commandInputStream.currentRaw();
String currentRaw = commandInputStream.currentRaw().orElse(null);
if (currentRaw == null) return null;

if (currentRaw.equalsIgnoreCase("me")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public ParameterPlayer(ProxyServer server) {
ExecutionContext<VelocitySource> context,
@NotNull CommandInputStream<VelocitySource> commandInputStream
) throws ImperatException {
String currentRaw = commandInputStream.currentRaw();
String currentRaw = commandInputStream.currentRaw().orElse(null);
if (currentRaw == null) return null;

if (currentRaw.equalsIgnoreCase("me")) {
Expand Down

0 comments on commit e346961

Please sign in to comment.