Remove Identifiable

This commit is contained in:
Yeregorix
2018-11-15 17:02:26 +01:00
parent da259951c7
commit 3cba196ba7
9 changed files with 24 additions and 34 deletions

View File

@@ -7,7 +7,6 @@ import com.velocitypowered.api.proxy.player.PlayerSettings;
import com.velocitypowered.api.proxy.player.TabList;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.util.GameProfile;
import com.velocitypowered.api.util.Identifiable;
import com.velocitypowered.api.util.MessagePosition;
import com.velocitypowered.api.util.ModInfo;
import com.velocitypowered.api.util.title.Title;
@@ -20,7 +19,7 @@ import net.kyori.text.Component;
* Represents a player who is connected to the proxy.
*/
public interface Player extends CommandSource, InboundConnection, ChannelMessageSource,
ChannelMessageSink, Identifiable {
ChannelMessageSink {
/**
* Returns the player's current username.
@@ -29,6 +28,14 @@ public interface Player extends CommandSource, InboundConnection, ChannelMessage
*/
String getUsername();
/**
* Returns the player's UUID.
*
* @return the UUID
*/
UUID getUniqueId();
/**
* Returns the server that the player is currently connected to.
*

View File

@@ -8,7 +8,7 @@ import java.util.UUID;
/**
* Represents a Mojang game profile. This class is immutable.
*/
public final class GameProfile implements Identifiable {
public final class GameProfile {
private final UUID id;
private final String undashedId, name;
@@ -31,13 +31,12 @@ public final class GameProfile implements Identifiable {
this.properties = properties;
}
@Override
public UUID getUniqueId() {
return this.id;
public String getId() {
return undashedId;
}
public String getUndashedId() {
return this.undashedId;
public UUID idAsUuid() {
return id;
}
public String getName() {
@@ -54,7 +53,7 @@ public final class GameProfile implements Identifiable {
* @param id the new unique id
* @return the new {@code GameProfile}
*/
public GameProfile withUniqueId(UUID id) {
public GameProfile withUuid(UUID id) {
return new GameProfile(Preconditions.checkNotNull(id, "id"), UuidUtils.toUndashed(id),
this.name, this.properties);
}
@@ -65,7 +64,7 @@ public final class GameProfile implements Identifiable {
* @param undashedId the new undashed id
* @return the new {@code GameProfile}
*/
public GameProfile withUndashedId(String undashedId) {
public GameProfile withId(String undashedId) {
return new GameProfile(
UuidUtils.fromUndashed(Preconditions.checkNotNull(undashedId, "undashedId")), undashedId,
this.name, this.properties);

View File

@@ -1,16 +0,0 @@
package com.velocitypowered.api.util;
import java.util.UUID;
/**
* Represents an object that can be identified by its UUID
*/
public interface Identifiable {
/**
* Returns the {@code UUID} attached to this object.
*
* @return the UUID
*/
UUID getUniqueId();
}