本文整理汇总了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);
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
}
示例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() + "]";
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例11: getPlayer
import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
public static ClanPlayer getPlayer(OfflinePlayer p){
return new ClanPlayer(p.getUniqueId());
}
示例12: TWDPlayer
import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
public TWDPlayer(OfflinePlayer p) {
this(p.getUniqueId());
}
示例13: setAdmin
import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
/**
* @param admin
* the new admin to set
*/
public void setAdmin(OfflinePlayer admin) {
this.admin = admin.getUniqueId();
checkForPersonalUnions();
}
示例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;
}