Package com.github.zathrus_writer.commandsex.commands

Source Code of com.github.zathrus_writer.commandsex.commands.Command_cex_invsee

package com.github.zathrus_writer.commandsex.commands;

import com.github.zathrus_writer.commandsex.helpers.Utils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;

import com.github.zathrus_writer.commandsex.helpers.Commands;
import com.github.zathrus_writer.commandsex.helpers.LogHelper;
import com.github.zathrus_writer.commandsex.helpers.Nicknames;

public class Command_cex_invsee {

    public static Boolean run(CommandSender sender, String alias, String[] args){

        if (!(sender instanceof Player)){
            LogHelper.showInfo("inWorldCommandOnly", sender, ChatColor.RED);
            return true;
        }

        if (args.length != 1){
            Commands.showCommandHelpAndUsage(sender, "cex_invsee", alias);
            return true;
        }

        Player player = (Player) sender;
        Player target = Bukkit.getPlayer(args[0]);

        if (target == null){
            target = Utils.getOfflinePlayer(args[0]);
            if (target == null){
                LogHelper.showInfo("invalidPlayer", sender, ChatColor.RED);
                return true;
            }
        }

        Inventory inv = target.getInventory();
        player.openInventory(inv);
        LogHelper.showInfo("invSeeNowEditing#####[" + Nicknames.getNick(target.getName()), sender, ChatColor.AQUA);

        return true;
    }
}
TOP

Related Classes of com.github.zathrus_writer.commandsex.commands.Command_cex_invsee

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.