当前位置: 首页>>代码示例>>Java>>正文


Java OfflinePlayer.getUniqueId方法代码示例

本文整理汇总了Java中org.bukkit.OfflinePlayer.getUniqueId方法的典型用法代码示例。如果您正苦于以下问题:Java OfflinePlayer.getUniqueId方法的具体用法?Java OfflinePlayer.getUniqueId怎么用?Java OfflinePlayer.getUniqueId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.OfflinePlayer的用法示例。


在下文中一共展示了OfflinePlayer.getUniqueId方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onCommand

import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
    if (args.length < 1) {
        sender.sendMessage(ChatColor.RED + "Usage: /" + label + " <playerName>");
        return true;
    }
    final OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
    if (!target.hasPlayedBefore() && !target.isOnline()) {
        sender.sendMessage(ChatColor.GOLD + "Player '" + ChatColor.WHITE + args[0] + ChatColor.GOLD + "' not found.");
        return true;
    }
    final UUID targetUUID = target.getUniqueId();
    final FactionUser factionTarget = HCF.getPlugin().getUserManager().getUser(targetUUID);
    final Deathban deathban = factionTarget.getDeathban();
    if (deathban == null || !deathban.isActive()) {
        sender.sendMessage(ChatColor.RED + target.getName() + " is not death-banned.");
        return true;
    }
    factionTarget.removeDeathban();
    Command.broadcastCommandMessage(sender, ChatColor.LIGHT_PURPLE + "A staff has revived " + target.getName() + ".");
    return false;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:22,代码来源:ReviveCommand.java

示例3: equals

import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
@Override
public boolean equals(Object obj) {
    if (obj == null || !(obj instanceof OfflinePlayer)) {
        return false;
    }

    OfflinePlayer other = (OfflinePlayer) obj;
    if ((this.getUniqueId() == null) || (other.getUniqueId() == null)) {
        return false;
    }

    return this.getUniqueId().equals(other.getUniqueId());
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:14,代码来源:CraftOfflinePlayer.java

示例4: 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

示例5: create

import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
/**
 * @param player
 * the creator of the faction
 * @param name
 * the name of the faction
 * @param checkPersonalUnions
 */
public Faction create(OfflinePlayer player, Location home, String name, boolean checkPersonalUnions) {
    int id = generateId();
    File file = new File(FactionsXL.FACTIONS, id + ".yml");

    try {
        file.createNewFile();
        MessageUtil.log(plugin, FMessage.LOG_NEW_FACTION_DATA.getMessage(file.getName()));
    } catch (IOException exception) {
    }

    Board board = plugin.getBoard();

    Faction faction = new Faction(id);
    faction.creationDate = System.currentTimeMillis();
    faction.active = true;
    faction.name = name;
    faction.admin = player.getUniqueId();
    faction.type = GovernmentType.MONARCHY;
    faction.stability = 10;
    faction.setHome(home);
    faction.capital = board.getByLocation(faction.home);
    faction.capital.setOwner(faction);
    faction.capital.getCoreFactions().put(faction, Calendar.getInstance().getTime());
    faction.members.add(player);
    faction.manpowerModifier = plugin.getFConfig().getDefaultManpowerModifier();
    faction.save();
    faction.load();
    entities.add(faction);
    factions.add(faction);
    if (checkPersonalUnions) {
        faction.checkForPersonalUnions();
    }
    return faction;
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:42,代码来源:FactionCache.java

示例6: getByPlayer

import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
/**
 * @return
 * the FPlayer that represents the player
 */
public FPlayer getByPlayer(OfflinePlayer player) {
    for (FPlayer fPlayer : fPlayers) {
        if (player.equals(fPlayer.getPlayer())) {
            return fPlayer;
        }
    }

    if (hasPlayedBefore(player)) {
        return new FPlayer(player.getUniqueId());
    } else {
        return null;
    }
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:18,代码来源:FPlayerCache.java

示例7: 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

示例8: onCommand

import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
    final Player p = (Player)sender;
    if (args.length < 2) {
        sender.sendMessage(ChatColor.RED + "Usage: " + this.getUsage(label));
        return true;
    }
    if (Cooldowns.isOnCooldown("medic_cooldown", p)) {
        p.sendMessage(ChatColor.RED + "You still have a " + ChatColor.DARK_GRAY + ChatColor.BOLD + "Titanium" + ChatColor.RED + " cooldown for another " + (Cooldowns.getCooldownForPlayerLong("medic_cooldown", p)) + ChatColor.RED + '.');
        return true;
    }
    final OfflinePlayer target = Bukkit.getOfflinePlayer(args[1]);
    if (!target.hasPlayedBefore() && !target.isOnline()) {
        sender.sendMessage(ChatColor.RED + target.getName() + " is not online.");
        return true;
    }
    final UUID targetUUID = target.getUniqueId();
    final FactionUser factionTarget = this.plugin.getUserManager().getUser(targetUUID);
    final Deathban deathban = factionTarget.getDeathban();
    if (deathban == null || !deathban.isActive()) {
        sender.sendMessage(ChatColor.RED + target.getName() + " is not death-banned.");
        return true;
    }
    Relation relation = Relation.ENEMY;
    if (sender instanceof Player) {
        final Player player = (Player)sender;
        final UUID playerUUID = player.getUniqueId();
        final int selfLives = this.plugin.getDeathbanManager().getLives(playerUUID);
        Cooldowns.addCooldown("medic_cooldown", p, 5400);
        final PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player);
        relation = ((playerFaction == null) ? Relation.ENEMY : playerFaction.getFactionRelation(this.plugin.getFactionManager().getPlayerFaction(targetUUID)));
        sender.sendMessage(ChatColor.YELLOW + "You have revived " + relation.toChatColour() + target.getName() + ChatColor.YELLOW + '.');
        Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&',"&8&l" + p.getName().toUpperCase() + " &7has used their Titanium Rank &eto revive &8&l" + target.getName().toUpperCase() + "&7."));
    }
    factionTarget.removeDeathban();
    return true;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:37,代码来源:MedicCommand.java

示例9: onCommand

import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (args.length < 1) {
        sender.sendMessage(ChatColor.RED + "Usage: /" + label + " <playerName>");
        return true;
    }

    OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]); // TODO: breaking

    if (!target.hasPlayedBefore() && !target.isOnline()) {
        sender.sendMessage(ChatColor.GOLD + "Player '" + ChatColor.WHITE + args[0] + ChatColor.GOLD + "' not found.");
        return true;
    }

    UUID targetUUID = target.getUniqueId();
    FactionUser factionTarget = HCF.getPlugin().getUserManager().getUser(targetUUID);
    Deathban deathban = factionTarget.getDeathban();

    if (deathban == null || !deathban.isActive()) {
        sender.sendMessage(ChatColor.RED + target.getName() + " is not death-banned.");
        return true;
    }

    factionTarget.removeDeathban();
    Command.broadcastCommandMessage(sender, ChatColor.LIGHT_PURPLE + "Staff revived " + target.getName() + ".");
    //sender.sendMessage(ChatColor.GREEN +"You have revived: " + target.getName() + ChatColor.GRAY + ChatColor.ITALIC + "(Click here to refund items)").setHoverText(ChatColor.GREEN + "Click here to refund items for: " + ChatColor.GRAY + target.getPlayer().getName().setClick(ClickAction.RUN_COMMAND, "/inv " + target.getPlayer().getName()));
    return false;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:29,代码来源:StaffReviveCommand.java

示例10: getIdentificationFor

import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
/**
 * Returns the identification for a given player
 *
 * @param player         player to fetch a UUID for
 * @param enableFetching if set to true, the UUID will be fetched from Mojang if {@code player} is offline
 * @return identification for the given player
 */
public static Object getIdentificationFor(OfflinePlayer player, boolean enableFetching) {
    if (player instanceof Player) {
        if (supportsUuid()) {
            return player.getUniqueId();
        }
        return player.getName();
    } else {
        if (enableFetching) {
            return getIdentificationFor(player.getName());
        }
        return null;
    }
}
 
开发者ID:Borlea,项目名称:EchoPet,代码行数:21,代码来源:UUIDMigration.java

示例11: getPlayer

import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
public static ClanPlayer getPlayer(OfflinePlayer p){
    return new ClanPlayer(p.getUniqueId());
}
 
开发者ID:cadox8,项目名称:WC,代码行数:4,代码来源:WCClans.java

示例12: TWDPlayer

import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
public TWDPlayer(OfflinePlayer p) {
    this(p.getUniqueId());
}
 
开发者ID:cadox8,项目名称:WC,代码行数:4,代码来源:TWDPlayer.java

示例13: setAdmin

import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
/**
 * @param admin
 * the new admin to set
 */
public void setAdmin(OfflinePlayer admin) {
    this.admin = admin.getUniqueId();
    checkForPersonalUnions();
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:9,代码来源:Faction.java

示例14: onCommand

import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (args.length < 2) {
        sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
        return true;
    }

    OfflinePlayer target = Bukkit.getOfflinePlayer(args[1]); // TODO: breaking

    if (!target.hasPlayedBefore() && !target.isOnline()) {
        sender.sendMessage(ChatColor.GOLD + "Player '" + ChatColor.WHITE + args[1] + ChatColor.GOLD + "' not found.");
        return true;
    }

    UUID targetUUID = target.getUniqueId();
    FactionUser factionTarget = plugin.getUserManager().getUser(targetUUID);
    Deathban deathban = factionTarget.getDeathban();

    if (deathban == null || !deathban.isActive()) {
        sender.sendMessage(ChatColor.RED + target.getName() + " is not death-banned.");
        return true;
    }

    Relation relation = Relation.ENEMY;
    if (sender instanceof Player) {
        if (!sender.hasPermission(REVIVE_BYPASS_PERMISSION)) {
            if (plugin.getEotwHandler().isEndOfTheWorld()) {
                sender.sendMessage(ChatColor.RED + "You cannot revive players during EOTW.");
                return true;
            }
        }

        Player player = (Player) sender;
        UUID playerUUID = player.getUniqueId();
        int selfLives = plugin.getDeathbanManager().getLives(playerUUID);

        if (selfLives <= 0) {
            sender.sendMessage(ChatColor.RED + "You do not have any lives.");
            return true;
        }

        plugin.getDeathbanManager().setLives(playerUUID, selfLives - 1);
        PlayerFaction playerFaction = plugin.getFactionManager().getPlayerFaction(player);
        relation = playerFaction == null ? Relation.ENEMY : playerFaction.getFactionRelation(plugin.getFactionManager().getPlayerFaction(targetUUID));
        sender.sendMessage(ChatColor.YELLOW + "You have used a life to revive " + relation.toChatColour() + target.getName() + ChatColor.YELLOW + '.');
    } else {
        sender.sendMessage(ChatColor.YELLOW + "You have revived " + SettingsYML.ENEMY_COLOUR + target.getName() + ChatColor.YELLOW + '.');
    }

    if (sender instanceof PluginMessageRecipient) {
        // NOTE: This server needs at least 1 player online.
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("Message");
        out.writeUTF(args[1]);

        String serverDisplayName = ChatColor.GREEN + "HCF"; // TODO: Non hard-coded server display name.
        out.writeUTF(relation.toChatColour() + sender.getName() + ChatColor.GOLD + " has just revived you from " + serverDisplayName + ChatColor.GOLD + '.');
        ((PluginMessageRecipient) sender).sendPluginMessage(plugin, PROXY_CHANNEL_NAME, out.toByteArray());
    }

    factionTarget.removeDeathban();
    return true;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:64,代码来源:LivesReviveArgument.java


注:本文中的org.bukkit.OfflinePlayer.getUniqueId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。