Getting an offline user


So I am trying to make a ban panel where you will be able to ban anyone offline/online Players but I don’t know how to do it anyone has some examples?

This is what I have right now

package org.devoflua.hello.commands;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.devoflua.hello.Main;
import org.devoflua.hello.utils.IconMenu;
import org.bukkit.ChatColor;
import org.bukkit.Material;

public class tempban implements CommandExecutor {

	private Main plugin;
	public tempban(Main plugin) {
		this.plugin = plugin;

    public boolean onCommand(CommandSender Sender, Command cmd, String commandLabel, String[] arg) {

		if (!(Sender instanceof Player)) {
			Sender.sendMessage("Only senders can use this command");
			return true;
		Player p = (Player) Sender;
		if (p.hasPermission("tempban.use")) {
			if (arg.length == 0) {
				p.sendMessage(ChatColor.DARK_RED + "You cannot ban yourself");
				return true;
			Player target = Bukkit.getPlayerExact(arg[0]);
			if (target == null) {
				target = (Player) Bukkit.getOfflinePlayer(arg[0]);
			if (target == null) {
				p.sendMessage("Your target " + arg[0] + " does not exists");
			} else {
				if (p.getUniqueId() != target.getUniqueId()) {
		            IconMenu menu = new IconMenu("Menu", 27, new IconMenu.OptionClickEventHandler() {
		                public void onOptionClick(IconMenu.OptionClickEvent event) {
		                    event.getPlayer().sendMessage("You have chosen " + event.getName());
		            }, plugin);
		            menu.setOption(3, new ItemStack(Material.APPLE, 1), "Food", "The food is delicious");
		            menu.setOption(4, new ItemStack(Material.IRON_SWORD, 1), "Weapon", "Weapons are for awesome people");
		            menu.setOption(5, new ItemStack(Material.EMERALD, 1), "Money", "Money brings happiness");
		            return true;
				} else {
					p.sendMessage(ChatColor.DARK_RED + "You cannot ban yourself");
		} else {
			p.sendMessage("You do not have permission to send this message");

        return false;


Errrr. Just so you know that is Bukkit code. This is Sponge, a completely different api.

You will probably find better help at

If you are wanting to develop for sponge and just didnt know that it didnt use the Bukkit API then great, here is a good starting point.


I cannot post bukkit stuff?


Please note how it states it’s for sponge plugin development.


Its like posting how to fix a macbook on the windows forums. The help you will get isn’t going to be as great as if you just posted on the apple forums.