當前位置: 首頁>>代碼示例>>Java>>正文


Java OfflinePlayer.getName方法代碼示例

本文整理匯總了Java中org.bukkit.OfflinePlayer.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java OfflinePlayer.getName方法的具體用法?Java OfflinePlayer.getName怎麽用?Java OfflinePlayer.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.OfflinePlayer的用法示例。


在下文中一共展示了OfflinePlayer.getName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ShopLog

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
public ShopLog(KingdomFactionsPlayer kdfPlayer, ShopItem shopItem, ShopAction shopAction){
	this.shopItem = shopItem;
	this.shopAction = shopAction;
	
	if(shopAction == ShopAction.PURCHASE){
		this.coins = shopItem.getBuyPrice();
	}else{
		this.coins = shopItem.getSellPrice();
	}

	OfflinePlayer player = kdfPlayer.getPlayer();

	this.offlineUUID = player.getUniqueId();
	this.playerName = player.getName();

	SimpleDateFormat sdf = new SimpleDateFormat("HH:mm dd-MM-yyyy");
	Date resultdate = new Date(System.currentTimeMillis());
	this.date = sdf.format(resultdate) + "";
	
	ShopLogger.getInstance().getShopLogs().add(this);
}
 
開發者ID:ThEWiZ76,項目名稱:KingdomFactions,代碼行數:22,代碼來源:ShopLog.java

示例2: KvantumPlayer

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
/**
 * Construct a Kvantum player from a Bukkit offline player
 *
 * @param offlinePlayer Bukkit offline player
 */
public KvantumPlayer(@NonNull final OfflinePlayer offlinePlayer)
{
    this.username = offlinePlayer.getName();
    this.uuid = offlinePlayer.getUniqueId().toString();
    final Location location = offlinePlayer.getBedSpawnLocation();
    if ( location != null )
    {
        this.world = location.getWorld().getName();
    } else
    {
        this.world = Bukkit.getWorlds().get( 0 ).getName();
    }
    this.complete = true;
    this.online = false;
}
 
開發者ID:Sauilitired,項目名稱:KvantumBukkit,代碼行數:21,代碼來源:KvantumPlayer.java

示例3: onTabComplete

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
public List<String> onTabComplete(final CommandSender sender, final Command command, final String label, final String[] args) {
    if (args.length != 1) {
        return Collections.emptyList();
    }
    final List<String> results = new ArrayList<String>();
    for (final FactionUser factionUser : this.plugin.getUserManager().getUsers().values()) {
        final Deathban deathban = factionUser.getDeathban();
        if (deathban != null && deathban.isActive()) {
            final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(factionUser.getUserUUID());
            final String name = offlinePlayer.getName();
            if (name == null) {
                continue;
            }
            results.add(name);
        }
    }
    return BukkitUtils.getCompletions(args, results);
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:19,代碼來源:ReviveCommand.java

示例4: onTabComplete

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
    if (args.length != 2 || !(sender instanceof Player)) {
        return Collections.emptyList();
    }

    Player player = (Player) sender;
    PlayerFaction playerFaction = plugin.getFactionManager().getPlayerFaction(player);
    if (playerFaction == null || (playerFaction.getMember(player.getUniqueId()).getRole() != Role.LEADER)) {
        return Collections.emptyList();
    }

    List<String> results = new ArrayList<>();
    Collection<UUID> keySet = playerFaction.getMembers().keySet();
    for (UUID entry : keySet) {
        OfflinePlayer target = Bukkit.getOfflinePlayer(entry);
        String targetName = target.getName();
        if (targetName != null && playerFaction.getMember(target.getUniqueId()).getRole() == Role.CAPTAIN) {
            results.add(targetName);
        }
    }

    return results;
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:25,代碼來源:FactionDemoteArgument.java

示例5: onTabComplete

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
    if (args.length != 2) {
        return Collections.emptyList();
    }

    List<String> results = new ArrayList<>();
    for (FactionUser factionUser : plugin.getUserManager().getUsers().values()) {
        Deathban deathban = factionUser.getDeathban();
        if (deathban != null && deathban.isActive()) {
            OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(factionUser.getUserUUID());
            String name = offlinePlayer.getName();
            if (name != null) {
                results.add(name);
            }
        }
    }

    return results;
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:21,代碼來源:LivesCheckDeathbanArgument.java

示例6: onTabComplete

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
    if (args.length != 1) {
        return Collections.emptyList();
    }

    List<String> results = new ArrayList<>();
    for (FactionUser factionUser : plugin.getUserManager().getUsers().values()) {
        Deathban deathban = factionUser.getDeathban();
        if (deathban != null && deathban.isActive()) {
            OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(factionUser.getUserUUID());
            String name = offlinePlayer.getName();
            if (name != null) {
                results.add(name);
            }
        }
    }

    return BukkitUtils.getCompletions(args, results);
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:21,代碼來源:StaffReviveCommand.java

示例7: BasicCheatLog

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
public BasicCheatLog(OfflinePlayer player, EnumCheat cheat)
{
    this.server = SamaGamesAPI.get().getServerName();
    this.date = new Date();
    this.playerID = player.getUniqueId();
    this.playerName = player.getName();

    double[] tab = MinecraftServer.getServer().recentTps;
    this.serverTps = tab[0];

    this.playerLag = ((CraftPlayer) player).getHandle().ping;
    this.cheat = cheat;
}
 
開發者ID:SamaGames,項目名稱:AntiCheat,代碼行數:14,代碼來源:BasicCheatLog.java

示例8: getName

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
/**
 * @return the island display name or the owner's name if none is set
 */
public String getName() {
    if (name != null) {
        return name;
    }
    if (owner != null) {
        OfflinePlayer player = Bukkit.getServer().getOfflinePlayer(owner);
        name = player.getName();
        return player.getName();
    }
    return "";
}
 
開發者ID:tastybento,項目名稱:bskyblock,代碼行數:15,代碼來源:Island.java

示例9: handleOfflinePlayer

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
@Nonnull
private static String handleOfflinePlayer(OfflinePlayer player) {
    if (player instanceof Player) {
        return player.toString();
    } else {
        return "[" + player.getName() + ":" + player.getUniqueId() + "]";
    }
}
 
開發者ID:zachbr,項目名稱:Debuggery,代碼行數:9,代碼來源:OutputFormatter.java

示例10: getPlayer

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
public static RagePlayer getPlayer(OfflinePlayer p) {
    for (RagePlayer pl : players) {
        if (pl.getName() == null) continue;
        if (pl.getName().equalsIgnoreCase(p.getName())) return pl;
    }
    RagePlayer us = new RagePlayer(p.getName());
    if (us.isOnline()) players.add(us);
    return us;
}
 
開發者ID:cadox8,項目名稱:PA,代碼行數:10,代碼來源:RageGames.java

示例11: getPlayer

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
public static NexusPlayer getPlayer(OfflinePlayer p) {
    for (NexusPlayer pl : players) {
        if (pl.getName() == null) continue;
        if (pl.getName().equalsIgnoreCase(p.getName())) return pl;
    }
    NexusPlayer us = new NexusPlayer(p.getName());
    if (us.isOnline()) players.add(us);
    return us;
}
 
開發者ID:cadox8,項目名稱:PA,代碼行數:10,代碼來源:NexusSiege.java

示例12: onTabComplete

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
    if (args.length != 2 || !(sender instanceof Player)) {
        return Collections.emptyList();
    }

    Player player = (Player) sender;
    PlayerFaction playerFaction = plugin.getFactionManager().getPlayerFaction(player);
    if (playerFaction == null) {
        return Collections.emptyList();
    }

    Role memberRole = playerFaction.getMember(player.getUniqueId()).getRole();
    if (memberRole == Role.MEMBER) {
        return Collections.emptyList();
    }

    List<String> results = new ArrayList<>();
    for (UUID entry : playerFaction.getMembers().keySet()) {
        Role targetRole = playerFaction.getMember(entry).getRole();
        if (targetRole == Role.LEADER || (targetRole == Role.CAPTAIN && memberRole != Role.LEADER)) {
            continue;
        }

        OfflinePlayer target = Bukkit.getOfflinePlayer(entry);
        String targetName = target.getName();
        if (targetName != null && !results.contains(targetName)) {
            results.add(targetName);
        }
    }

    return results;
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:34,代碼來源:FactionKickArgument.java

示例13: getScore

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
public Score getScore(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException {
    Validate.notNull(player, "Player cannot be null");
    CraftScoreboard scoreboard = checkState();

    return new CraftScore(this, player.getName());
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:7,代碼來源:CraftObjective.java

示例14: onCommand

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (!(sender instanceof Player)) {
        sender.sendMessage(ChatColor.RED + "This command is only executable by players.");
        return true;
    }

    if (args.length < 3) {
        sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
        return true;
    }

    Player player = (Player) sender;
    PlayerFaction playerFaction = plugin.getFactionManager().getPlayerFaction(player);

    if (playerFaction == null) {
        sender.sendMessage(ChatColor.RED + "You are not in a faction.");
        return true;
    }

    Subclaim subclaim = null;
    for (Claim claim : playerFaction.getClaims()) {
        if ((subclaim = claim.getSubclaim(args[2])) != null) {
            break;
        }
    }

    if (subclaim == null) {
        sender.sendMessage(ChatColor.RED + "Your faction does not have a subclaim named " + args[2] + '.');
        return true;
    }

    List<String> memberNames = new ArrayList<>();
    for (UUID accessibleUUID : subclaim.getAccessibleMembers()) {
        OfflinePlayer target = Bukkit.getOfflinePlayer(accessibleUUID);
        String name = target.getName();
        if (name != null)
            memberNames.add(target.getName());
    }

    sender.sendMessage(ChatColor.YELLOW + "Non-officers accessible of subclaim " + subclaim.getName() + " (" + memberNames.size() + "): " + ChatColor.AQUA + StringUtils.join(memberNames, ", "));

    return true;
}
 
開發者ID:funkemunky,項目名稱:HCFCore,代碼行數:45,代碼來源:FactionSubclaimMembersArgument.java

示例15: PAUser

import org.bukkit.OfflinePlayer; //導入方法依賴的package包/類
public PAUser(OfflinePlayer p) {
    this(p.getName());
}
 
開發者ID:cadox8,項目名稱:PA,代碼行數:4,代碼來源:PAUser.java


注:本文中的org.bukkit.OfflinePlayer.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。