Flectone LogoFlectonePulse

Players

The FEntity and FPlayer models, the FPlayerService lookup service and SocialService for chat settings, ignores and mail

FlectonePulse does not work with platform objects directly. Instead of org.bukkit.entity.Player it uses its own model, the same on every platform

ModelWhat it describes
FEntityAny message sender, be it a player, a mob, a command block, the console or a Discord user
FPlayerA player or the console, extends FEntity with data from the database

FEntity

Package net.flectone.pulse.model.entity
MethodReturnsWhat it gives
name()StringThe display name
uuid()UUIDThe identifier
type()StringThe entity type
showEntityName()ComponentThe name for a hover tooltip, can be null
isUnknown()booleanThe placeholder marker

There are also the constants FEntity.UNKNOWN_UUID, FEntity.UNKNOWN_NAME, FEntity.UNKNOWN_TYPE and the FEntity.unknown() factory


FPlayer

MethodReturnsWhat it gives
id()IntegerThe database identifier
isConsole()booleanThe console marker
isIntegration()booleanThe marker of a sender from Discord, Telegram or Twitch
isOnline()booleanWhether the player is on the server right now
ip()StringThe connection address, can be null
constants()List<Component>Prebuilt name parts that travel between servers

Useful constants

ConstantValue
FPlayer.UNKNOWNThe placeholder used when the real player is not known
FPlayer.UNKNOWN_IDInteger.MIN_VALUE
FPlayer.CONSOLE_ID-1
FPlayer.PLAYER_TYPEPLAYER
FPlayer.CONSOLE_TYPECONSOLE
FPlayer.INTEGRATION_TYPEINTEGRATION
Information

The FPlayer.UNKNOWN placeholder is there for the moment when the receiver is not known yet. This is how the default localization is taken, module.localization(FPlayer.UNKNOWN)

Immutability

FPlayer is immutable as well. The methods withName(), withUuid(), withOnline(), withId(), withIp() and withConstants() give a copy, and toBuilder() opens a prefilled builder

FPlayer renamed = fPlayer.withName("NewName");
Warning

The changed copy lives only in your variable. To put it into the FlectonePulse cache, pass it to fPlayerService.updateCache(fPlayer)


FPlayerService

Package net.flectone.pulse.service
import net.flectone.pulse.service.FPlayerService;

FPlayerService fPlayerService = flectonePulse.get(FPlayerService.class);

Looking up a player

MethodWhat it looks up
getFPlayer(UUID)By account identifier
getFPlayer(String name)By nickname
getFPlayer(int id)By database identifier
getFPlayer(InetAddress)By connection address
getFPlayer(FEntity)Turns an entity into a player
getFPlayer(Object platformPlayer)From a platform object, for example Player in Bukkit
getConsole()Gives the console as an FPlayer
getRandomFPlayer()Gives a random player
Player bukkitPlayer = Bukkit.getPlayer("TheFaser");

// Bukkit
FPlayer fPlayer = fPlayerService.getFPlayer(bukkitPlayer);

// or through UUID
FPlayer byUuid = fPlayerService.getFPlayer(bukkitPlayer.getUniqueId());
Attention

When the player is not found you get FPlayer.UNKNOWN back. Check the result through fPlayer.isUnknown() before you do anything with it

Player lists

MethodWhat it gives
getOnlineFPlayers()Every player online
getPlatformFPlayers()Players the platform can see
getFPlayersWithConsole()Players online together with the console
findAllFPlayers()Every player from the database
getFPlayersByIp(String ip, int limit, int offset)Players from one address page by page
getTotalFPlayersCountByIp(String ip)The number of players from one address

Cache and saving

MethodWhat it does
saveOrUpdate(UUID, String name, String ip, boolean online)Creates or updates a player in the database
addCache(FPlayer)Puts a player into the online cache
updateCache(FPlayer)Updates a player in the cache
clearAndSave(FPlayer)Marks a player offline and saves them to the database
invalidate(UUID)Drops the cache of one player
invalidateCache()Clears the whole cache
loadOnlineCache()Loads online players from the database
Warning

A full cache drop makes FlectonePulse reread the data of every player from the database. In ordinary code invalidate(uuid) for one player is enough


SocialService

Holds chat settings, colors, ignores, mail and the vanish state

import net.flectone.pulse.constant.SettingText;
import net.flectone.pulse.service.SocialService;

SocialService socialService = flectonePulse.get(SocialService.class);

// the language of a player
String locale = socialService.getSetting(fPlayer, SettingText.LOCALE);

Settings

MethodWhat it does
getSetting(FPlayer, SettingText)Gives a text setting of a player
getSetting(FPlayer, ModuleName)Gives a setting bound to a module
isSetting(FPlayer, ModuleName)Checks whether a module setting is on
saveSetting(FPlayer, SettingText, String)Saves a text setting
saveSetting(FPlayer, String, boolean)Saves a toggle
loadSettings(FPlayer)Loads every setting of a player
updateLocale(FPlayer, String)Changes the language of a player

Available SettingText values

ConstantWhat it holds
LOCALEThe chosen language
CHAT_NAMEThe active chat
NICKNAMEThe set nickname
WORLD_PREFIXThe world prefix
STREAM_PREFIXThe streamer prefix
SERVERThe server in the proxy network
SPY_STATUSThe spy mode state
VANISH_STATUSThe vanish state
AFK_SUFFIXThe AFK suffix

Colors, ignores and mail

MethodWhat it does
loadColors(FPlayer)Gives the personal colors of a player
saveColors(FPlayer, FColor.Type, Set<FColor>)Saves the colors of a chosen type
isIgnored(FPlayer, FPlayer target)Checks whether one player ignores another
loadIgnores(FPlayer)Gives the ignore list
saveIgnore(FPlayer, FPlayer target)Adds a player to the ignore list
deleteIgnore(FPlayer, Ignore)Removes a player from the ignore list
getReceiverMails(FPlayer)Gives received mail
getSenderMails(FPlayer)Gives sent mail
saveMail(FPlayer, FPlayer target, String message)Sends a letter
deleteMail(Mail)Deletes a letter

Vanish

MethodWhat it does
isVanished(FEntity)Checks whether an entity is hidden
isVanished(FEntity, boolean checkVanishIntegration)The same, but with third party vanish plugins in mind
canSeeVanished(FEntity target, FEntity viewer)Checks whether a viewer sees a hidden entity
// do not send a message about a hidden player
if (socialService.isVanished(fPlayer)) return;

Playtime and skins

PlaytimeService counts played time and AFK sessions

MethodWhat it does
getPlayTime(FPlayer)Gives playtime statistics, can return null
getAllPlayTimes(int limit, int offset)Gives the playtime top page by page
getPlayTimesCount()Gives the number of records
saveAfkSession(FPlayer, boolean afk)Marks entering or leaving AFK

SkinService gives links to the look of a player

MethodWhat it gives
getSkin(FEntity)The skin texture
getAvatarUrl(FEntity)A link to the avatar
getBodyUrl(FEntity)A link to the body image

Example

import net.flectone.pulse.annotation.Pulse;
import net.flectone.pulse.constant.SettingText;
import net.flectone.pulse.listener.PulseListener;
import net.flectone.pulse.model.entity.FPlayer;
import net.flectone.pulse.model.event.player.PlayerLoadEvent;
import net.flectone.pulse.service.SocialService;

public class WelcomeListener implements PulseListener {

    private final SocialService socialService;

    public WelcomeListener(SocialService socialService) {
        this.socialService = socialService;
    }

    @Pulse
    public void onLoad(PlayerLoadEvent event) {
        if (event.reload()) return;

        FPlayer fPlayer = event.player();
        if (fPlayer.isUnknown() || fPlayer.isConsole()) return;

        String locale = socialService.getSetting(fPlayer, SettingText.LOCALE);
        getLogger().info(fPlayer.name() + " joined with the language " + locale);
    }

}
Note

FPlayer describes both ordinary players and the console, so check isConsole() before you act. Database calls such as findAllFPlayers() belong in an async task of the scheduler

Last update August 11, 2026
Edit on Github

On this page