本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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 "";
}
示例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() + "]";
}
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例15: PAUser
import org.bukkit.OfflinePlayer; //导入方法依赖的package包/类
public PAUser(OfflinePlayer p) {
this(p.getName());
}