package cn.citycraft.JoinMessage.listen;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;

import cn.citycraft.JoinMessage.Main;

public class PlayerJoin implements Listener {

	Main plugin;

	String[] lines;

	Player p;

	public PlayerJoin(Main main) {
		plugin = main;

	}

	// Message:
	// - joinmessage.vip:
	// - '%name%'
	// - '%displayname%'
	// - joinmessage
	// - vip

	@EventHandler(priority = EventPriority.HIGHEST)
	public void onJoin(PlayerJoinEvent e) {
		if (e.getJoinMessage() == null) {
			return;
		}
		if (plugin.authme) {
			return;
		}
		e.setJoinMessage(null);
		Player p = e.getPlayer();
		plugin.sendJoinMessage(p);
	}


}
