mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-15 23:26:21 +01:00
Clean up non-Player CommandSender implementations
This commit is contained in:
parent
4f0944ba9f
commit
cfa9cffe87
@ -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.
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user