Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.8 kB
3
Indexable
Never
package fr.starxx.dscraft.chat.events;

import net.luckperms.api.LuckPerms;
import net.luckperms.api.model.user.User;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;


public class DScraftChatEvent extends Event implements Cancellable {



	private boolean isCancelled;
	private final Player player;
	private final User user;
	private String prefix;
	private String message;
	private String channel;
	private final boolean wasCommand;
	
	@Deprecated
	public DScraftChatEvent(Player player, User user, String message, String channel, String prefix) {
		this.user = LuckPerms.getPlayerAdapter(Player.class).getUser(player);
		this.prefix = user.getCachedData().getMetaData().getPrefix();
		this.player = player;
		this.message = message;
		this.channel = channel;
		this.wasCommand = false;
	}
	
	public DScraftChatEvent(Player player, String message, String channel, boolean wasCommand) {
		this.player = player;
		this.message = message;
		this.channel = channel;
		this.wasCommand = wasCommand;
	}

	private static final HandlerList HANDLERS = new HandlerList();

	public HandlerList getHandlers() {
		return HANDLERS;
	}

	public static HandlerList getHandlerList() {
		return HANDLERS;
	}

	public boolean isCancelled() {
		return this.isCancelled;
	}

	public void setCancelled(boolean isCancelled) {
		this.isCancelled = isCancelled;
	}

	public Player getPlayer() {
		return player;
	}

	public String getMessage() {
		return message;
	}

	public String getChannel() {
		return channel;
	}
	
	public boolean wasCommand() {
		return wasCommand;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public void setChannel(String channel) {
		this.channel = channel;
	}

}