refactor: add `isConsole method`

dependabot/gradle/org.projectlombok-lombok-1.18.34
William 5 months ago
parent 521769cfd4
commit accf186c33
No known key found for this signature in database

@ -27,6 +27,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.UUID;
@SuppressWarnings("unused")
public interface CommandUser {
@NotNull
@ -36,6 +37,10 @@ public interface CommandUser {
String getName();
@Nullable
UUID getUniqueId();
UUID getUuid();
default boolean isConsole() {
return getName() == null;
}
}

@ -44,7 +44,7 @@ public record FabricCommandUser(@NotNull ServerCommandSource source) implements
@Override
@Nullable
public UUID getUniqueId() {
public UUID getUuid() {
return source.getPlayer() != null ? source.getPlayer().getUuid() : null;
}

@ -44,7 +44,7 @@ public record FabricCommandUser(@NotNull ServerCommandSource source) implements
@Override
@Nullable
public UUID getUniqueId() {
public UUID getUuid() {
return source.getPlayer() != null ? source.getPlayer().getUuid() : null;
}

@ -45,7 +45,7 @@ public record PaperCommandUser(@NotNull BukkitBrigadierCommandSource source) imp
@Override
@Nullable
public UUID getUniqueId() {
public UUID getUuid() {
return source.getBukkitEntity() != null ? source.getBukkitEntity().getUniqueId() : null;
}
}

@ -45,7 +45,7 @@ public record VelocityCommandUser(CommandSource source) implements CommandUser {
@Override
@Nullable
public UUID getUniqueId() {
public UUID getUuid() {
return source instanceof Player ? ((Player) source).getUniqueId() : null;
}

Loading…
Cancel
Save