Search in sources :

Example 1 with PlayerChatEvent

use of cn.nukkit.event.player.PlayerChatEvent in project Plan by plan-player-analytics.

the class ChatListener method actOnChatEvent.

private void actOnChatEvent(PlayerChatEvent event) {
    long time = System.currentTimeMillis();
    Player player = event.getPlayer();
    UUID uuid = player.getUniqueId();
    String displayName = player.getDisplayName();
    dbSystem.getDatabase().executeTransaction(new NicknameStoreTransaction(uuid, new Nickname(displayName, time, serverInfo.getServerUUID()), (playerUUID, name) -> nicknameCache.getDisplayName(playerUUID).map(name::equals).orElse(false)));
}
Also used : NicknameCache(com.djrapitops.plan.gathering.cache.NicknameCache) ServerInfo(com.djrapitops.plan.identification.ServerInfo) UUID(java.util.UUID) EventHandler(cn.nukkit.event.EventHandler) Listener(cn.nukkit.event.Listener) DBSystem(com.djrapitops.plan.storage.database.DBSystem) Inject(javax.inject.Inject) ErrorLogger(com.djrapitops.plan.utilities.logging.ErrorLogger) Player(cn.nukkit.Player) NicknameStoreTransaction(com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction) EventPriority(cn.nukkit.event.EventPriority) ErrorContext(com.djrapitops.plan.utilities.logging.ErrorContext) Nickname(com.djrapitops.plan.delivery.domain.Nickname) PlayerChatEvent(cn.nukkit.event.player.PlayerChatEvent) Player(cn.nukkit.Player) NicknameStoreTransaction(com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction) UUID(java.util.UUID) Nickname(com.djrapitops.plan.delivery.domain.Nickname)

Aggregations

Player (cn.nukkit.Player)1 EventHandler (cn.nukkit.event.EventHandler)1 EventPriority (cn.nukkit.event.EventPriority)1 Listener (cn.nukkit.event.Listener)1 PlayerChatEvent (cn.nukkit.event.player.PlayerChatEvent)1 Nickname (com.djrapitops.plan.delivery.domain.Nickname)1 NicknameCache (com.djrapitops.plan.gathering.cache.NicknameCache)1 ServerInfo (com.djrapitops.plan.identification.ServerInfo)1 DBSystem (com.djrapitops.plan.storage.database.DBSystem)1 NicknameStoreTransaction (com.djrapitops.plan.storage.database.transactions.events.NicknameStoreTransaction)1 ErrorContext (com.djrapitops.plan.utilities.logging.ErrorContext)1 ErrorLogger (com.djrapitops.plan.utilities.logging.ErrorLogger)1 UUID (java.util.UUID)1 Inject (javax.inject.Inject)1