// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.core.event.events.player;

import com.hypixel.hytale.server.core.Message;
import java.util.List;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import javax.annotation.Nonnull;
import com.hypixel.hytale.event.ICancellable;
import com.hypixel.hytale.event.IAsyncEvent;

public class PlayerChatEvent implements IAsyncEvent<String>, ICancellable
{
    @Nonnull
    public static final Formatter DEFAULT_FORMATTER;
    @Nonnull
    private PlayerRef sender;
    @Nonnull
    private List<PlayerRef> targets;
    @Nonnull
    private String content;
    private Formatter formatter;
    private boolean cancelled;
    
    public PlayerChatEvent(@Nonnull final PlayerRef sender, @Nonnull final List<PlayerRef> targets, @Nonnull final String content) {
        this.sender = sender;
        this.targets = targets;
        this.content = content;
        this.formatter = PlayerChatEvent.DEFAULT_FORMATTER;
        this.cancelled = false;
    }
    
    @Nonnull
    public PlayerRef getSender() {
        return this.sender;
    }
    
    public void setSender(@Nonnull final PlayerRef sender) {
        this.sender = sender;
    }
    
    @Nonnull
    public List<PlayerRef> getTargets() {
        return this.targets;
    }
    
    public void setTargets(@Nonnull final List<PlayerRef> targets) {
        this.targets = targets;
    }
    
    @Nonnull
    public String getContent() {
        return this.content;
    }
    
    public void setContent(@Nonnull final String content) {
        this.content = content;
    }
    
    @Nonnull
    public Formatter getFormatter() {
        return this.formatter;
    }
    
    public void setFormatter(@Nonnull final Formatter formatter) {
        this.formatter = formatter;
    }
    
    @Override
    public boolean isCancelled() {
        return this.cancelled;
    }
    
    @Override
    public void setCancelled(final boolean cancelled) {
        this.cancelled = cancelled;
    }
    
    @Nonnull
    @Override
    public String toString() {
        return "PlayerChatEvent{message=" + this.content + ", targets=" + String.valueOf(this.targets) + ", formatter=" + String.valueOf(this.formatter) + ", cancelled=" + this.cancelled + "} " + super.toString();
    }
    
    static {
        DEFAULT_FORMATTER = ((playerRef, msg) -> Message.translation("server.chat.playerMessage").param("username", playerRef.getUsername()).param("message", msg));
    }
    
    public interface Formatter
    {
        @Nonnull
        Message format(@Nonnull final PlayerRef p0, @Nonnull final String p1);
    }
}
