当前位置: 首页>>代码示例>>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;未经允许,请勿转载。