Clean up non-Player CommandSender implementations

This commit is contained in:
Kieran Wallbanks 2021-03-01 15:58:00 +00:00
parent 4f0944ba9f
commit cfa9cffe87
3 changed files with 6 additions and 13 deletions

View File

@ -22,7 +22,7 @@ public interface CommandSender extends PermissionHandler, Audience {
* @deprecated Use {@link #sendMessage(Component)}
*/
@Deprecated
void sendMessage(@NotNull String message);
default void sendMessage(@NotNull String message) { this.sendMessage(Component.text(message)); }
/**
* Sends multiple raw string messages.

View File

@ -27,11 +27,6 @@ public class ConsoleSender implements CommandSender {
LOGGER.info(PlainComponentSerializer.plain().serialize(message));
}
@Override
public void sendMessage(@NotNull String message) {
LOGGER.info(message);
}
@NotNull
@Override
public Set<Permission> getAllPermissions() {

View File

@ -1,6 +1,8 @@
package net.minestom.server.command;
import net.minestom.server.command.builder.CommandContext;
import net.kyori.adventure.audience.Audience;
import net.minestom.server.command.builder.Arguments;
import net.minestom.server.permission.Permission;
import org.jetbrains.annotations.NotNull;
@ -11,18 +13,14 @@ import java.util.Set;
/**
* Sender used in {@link CommandManager#executeServerCommand(String)}.
* <p>
* Be aware that {@link #sendMessage(String)} is empty on purpose because the purpose
* of this sender is to process the data of {@link CommandContext#getReturnData()}.
* Although this class implemented {@link CommandSender} and thus {@link Audience}, no
* data can be sent to this sender because it's purpose is to process the data of
* {@link CommandContext#getReturnData()}.
*/
public class ServerSender implements CommandSender {
private final Set<Permission> permissions = Collections.unmodifiableSet(new HashSet<>());
@Override
public void sendMessage(@NotNull String message) {
// Empty on purpose
}
@NotNull
@Override
public Set<Permission> getAllPermissions() {