Search in sources :

Example 1 with NucleusNicknameService

use of io.github.nucleuspowered.nucleus.api.module.nickname.NucleusNicknameService in project Almura by AlmuraDev.

the class ServerNickManager method sendNicknameUpdate.

public void sendNicknameUpdate(final NucleusNicknameService service, final Player player) {
    final ClientboundNucleusNameChangeMappingPacket packet = this.getMappingMessage(player, this.getFormattedNickname(service, player));
    Sponge.getServer().getOnlinePlayers().stream().filter(onlinePlayer -> !onlinePlayer.getUniqueId().equals(player.getUniqueId())).forEach(onlinePlayer -> this.network.sendTo(onlinePlayer, packet));
    this.network.sendTo(player, this.getMappingMessage(service));
}
Also used : Getter(org.spongepowered.api.event.filter.Getter) ForgeEventFactory(net.minecraftforge.event.ForgeEventFactory) Inject(com.google.inject.Inject) HashMap(java.util.HashMap) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) NucleusChangeNicknameEvent(io.github.nucleuspowered.nucleus.api.module.nickname.event.NucleusChangeNicknameEvent) Text(org.spongepowered.api.text.Text) Order(org.spongepowered.api.event.Order) Map(java.util.Map) IMixinEntityPlayer(com.almuradev.almura.feature.nick.asm.mixin.iface.IMixinEntityPlayer) ClientboundNucleusNameMappingsPacket(com.almuradev.almura.feature.nick.network.ClientboundNucleusNameMappingsPacket) GameState(org.spongepowered.api.GameState) PluginContainer(org.spongepowered.api.plugin.PluginContainer) NucleusNicknameService(io.github.nucleuspowered.nucleus.api.module.nickname.NucleusNicknameService) User(org.spongepowered.api.entity.living.player.User) Scheduler(org.spongepowered.api.scheduler.Scheduler) Sponge(org.spongepowered.api.Sponge) ServiceManager(org.spongepowered.api.service.ServiceManager) ClientboundNucleusNameChangeMappingPacket(com.almuradev.almura.feature.nick.network.ClientboundNucleusNameChangeMappingPacket) NetworkConfig(com.almuradev.almura.shared.network.NetworkConfig) UUID(java.util.UUID) ClientConnectionEvent(org.spongepowered.api.event.network.ClientConnectionEvent) ChannelBinding(org.spongepowered.api.network.ChannelBinding) TextSerializers(org.spongepowered.api.text.serializer.TextSerializers) Witness(com.almuradev.core.event.Witness) EntityPlayer(net.minecraft.entity.player.EntityPlayer) NicknameException(io.github.nucleuspowered.nucleus.api.module.nickname.exception.NicknameException) ChannelId(org.spongepowered.api.network.ChannelId) Optional(java.util.Optional) Player(org.spongepowered.api.entity.living.player.Player) Listener(org.spongepowered.api.event.Listener) Singleton(com.google.inject.Singleton) MoveEntityEvent(org.spongepowered.api.event.entity.MoveEntityEvent) ClientboundNucleusNameChangeMappingPacket(com.almuradev.almura.feature.nick.network.ClientboundNucleusNameChangeMappingPacket)

Aggregations

IMixinEntityPlayer (com.almuradev.almura.feature.nick.asm.mixin.iface.IMixinEntityPlayer)1 ClientboundNucleusNameChangeMappingPacket (com.almuradev.almura.feature.nick.network.ClientboundNucleusNameChangeMappingPacket)1 ClientboundNucleusNameMappingsPacket (com.almuradev.almura.feature.nick.network.ClientboundNucleusNameMappingsPacket)1 NetworkConfig (com.almuradev.almura.shared.network.NetworkConfig)1 Witness (com.almuradev.core.event.Witness)1 Inject (com.google.inject.Inject)1 Singleton (com.google.inject.Singleton)1 NucleusNicknameService (io.github.nucleuspowered.nucleus.api.module.nickname.NucleusNicknameService)1 NucleusChangeNicknameEvent (io.github.nucleuspowered.nucleus.api.module.nickname.event.NucleusChangeNicknameEvent)1 NicknameException (io.github.nucleuspowered.nucleus.api.module.nickname.exception.NicknameException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Optional (java.util.Optional)1 UUID (java.util.UUID)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 ForgeEventFactory (net.minecraftforge.event.ForgeEventFactory)1 GameState (org.spongepowered.api.GameState)1 Sponge (org.spongepowered.api.Sponge)1 Player (org.spongepowered.api.entity.living.player.Player)1