mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Added a display name to Actors
This commit is contained in:
parent
bc3562eb57
commit
54142c8669
@ -92,6 +92,11 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
|||||||
return player.getName();
|
return player.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayName() {
|
||||||
|
return player.getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void giveItem(BaseItemStack itemStack) {
|
public void giveItem(BaseItemStack itemStack) {
|
||||||
final PlayerInventory inv = player.getInventory();
|
final PlayerInventory inv = player.getInventory();
|
||||||
|
@ -38,6 +38,15 @@ public interface Actor extends Identifiable, SessionOwner, Subject {
|
|||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the display name of the actor. This can be a nickname, and is not guaranteed to be unique.
|
||||||
|
*
|
||||||
|
* @return The display name
|
||||||
|
*/
|
||||||
|
default String getDisplayName() {
|
||||||
|
return getName();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a message.
|
* Print a message.
|
||||||
*
|
*
|
||||||
|
@ -99,6 +99,11 @@ public class PlayerProxy extends AbstractPlayerActor {
|
|||||||
return basePlayer.getName();
|
return basePlayer.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayName() {
|
||||||
|
return basePlayer.getDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseEntity getState() {
|
public BaseEntity getState() {
|
||||||
throw new UnsupportedOperationException("Can't withPropertyId() on a player");
|
throw new UnsupportedOperationException("Can't withPropertyId() on a player");
|
||||||
|
@ -35,7 +35,6 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|||||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||||
import com.sk89q.worldedit.world.gamemode.GameModes;
|
import com.sk89q.worldedit.world.gamemode.GameModes;
|
||||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||||
|
|
||||||
import org.spongepowered.api.Sponge;
|
import org.spongepowered.api.Sponge;
|
||||||
import org.spongepowered.api.data.type.HandTypes;
|
import org.spongepowered.api.data.type.HandTypes;
|
||||||
import org.spongepowered.api.entity.living.player.Player;
|
import org.spongepowered.api.entity.living.player.Player;
|
||||||
@ -79,6 +78,11 @@ public class SpongePlayer extends AbstractPlayerActor {
|
|||||||
return this.player.getName();
|
return this.player.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayName() {
|
||||||
|
return player.getDisplayNameData().displayName().getDirect().map(TextSerializers.LEGACY_FORMATTING_CODE::serialize).orElse(getName());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseEntity getState() {
|
public BaseEntity getState() {
|
||||||
throw new UnsupportedOperationException("Cannot create a state from this object");
|
throw new UnsupportedOperationException("Cannot create a state from this object");
|
||||||
|
Loading…
Reference in New Issue
Block a user