Package net.citizensnpcs.utils

Source Code of net.citizensnpcs.utils.ServerUtils

package net.citizensnpcs.utils;

import java.util.List;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.server.ServerCommandEvent;

public class ServerUtils {

    public static void dispatchCommandWithEvent(String command) {
        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
        Bukkit.getPluginManager().callEvent(new ServerCommandEvent(Bukkit.getConsoleSender(), command));
    }

    // Get a player object from the provided name
    public static Player matchPlayer(String name) {
        List<Player> players = Bukkit.getServer().matchPlayer(name);
        if (!players.isEmpty()) {
            if (players.get(0) != null) {
                return players.get(0);
            }
        }
        return null;
    }
}
TOP

Related Classes of net.citizensnpcs.utils.ServerUtils

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.