Player has an identity

This commit is contained in:
Riley Park
2020-10-12 16:47:49 -07:00
parent 3b1009caba
commit 60e917b4a1
12 changed files with 69 additions and 64 deletions

View File

@@ -1,7 +1,9 @@
package com.velocitypowered.api.command;
import com.velocitypowered.api.permission.PermissionSubject;
import com.velocitypowered.api.proxy.ProxyAudience;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacytext3.LegacyText3ComponentSerializer;
import org.checkerframework.checker.nullness.qual.NonNull;
@@ -9,7 +11,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents something that can be used to run a {@link Command}.
*/
public interface CommandSource extends PermissionSubject, ProxyAudience {
public interface CommandSource extends Audience, PermissionSubject {
/**
* Sends the specified {@code component} to the invoker.
@@ -21,7 +23,8 @@ public interface CommandSource extends PermissionSubject, ProxyAudience {
void sendMessage(net.kyori.text.Component component);
@Override
default void sendMessage(@NonNull Component message) {
default void sendMessage(@NonNull Identity identity, @NonNull Component message,
@NonNull MessageType type) {
this.sendMessage(LegacyText3ComponentSerializer.get().serialize(message));
}
}

View File

@@ -14,13 +14,14 @@ import com.velocitypowered.api.util.title.Title;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import net.kyori.adventure.identity.Identified;
import net.kyori.adventure.text.Component;
/**
* Represents a player who is connected to the proxy.
*/
public interface Player extends CommandSource, InboundConnection, ChannelMessageSource,
ChannelMessageSink {
public interface Player extends CommandSource, Identified, InboundConnection,
ChannelMessageSource, ChannelMessageSink {
/**
* Returns the player's current username.

View File

@@ -1,25 +0,0 @@
package com.velocitypowered.api.proxy;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.audience.MessageType;
import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Indicates an {@link Audience} that is on the proxy. This interface contains no-op default methods
* that are used to bridge compatibility issues with the new adventure API. This interface will go
* away in Velocity 2.0.0.
*
* @deprecated Only used to handle compatibility problems, will go away in Velocity 2.0.0
*/
@Deprecated
public interface ProxyAudience extends Audience {
@Override
void sendMessage(@NonNull Component message);
@Override
default void sendMessage(@NonNull Component message, @NonNull MessageType type) {
sendMessage(message);
}
}