本文整理了Java中org.bukkit.Server.getPlayer()
方法的一些代码示例,展示了Server.getPlayer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getPlayer()
方法的具体详情如下:
包路径:org.bukkit.Server
类名称:Server
方法名:getPlayer
[英]Gets a player object by the given username.
This method may not return objects for offline players.
[中]按给定用户名获取播放器对象。
此方法可能不会为脱机玩家返回对象。
代码示例来源:origin: Bukkit/Bukkit
/**
* @see Server#getPlayer(java.util.UUID)
*/
public static Player getPlayer(UUID id) {
return server.getPlayer(id);
}
代码示例来源:origin: BuycraftPlugin/BuycraftX
private Player getPlayer(QueuedPlayer player) {
if (player.getUuid() != null && (plugin.getServer().getOnlineMode() || plugin.getConfiguration().isBungeeCord())) {
return plugin.getServer().getPlayer(UuidUtil.mojangUuidToJavaUuid(player.getUuid()));
}
return plugin.getServer().getPlayerExact(player.getName());
}
代码示例来源:origin: Bukkit/Bukkit
/**
* @see Server#getPlayer(String name)
*/
@Deprecated
public static Player getPlayer(String name) {
return server.getPlayer(name);
}
代码示例来源:origin: Bukkit/Bukkit
@Override
protected boolean isInputValid(ConversationContext context, String input) {
return plugin.getServer().getPlayer(input) != null;
}
代码示例来源:origin: EngineHub/WorldEdit
@Override
public boolean isActive() {
// This is a thread safe call on CraftBukkit because it uses a
// CopyOnWrite list for the list of players, but the Bukkit
// specification doesn't require thread safety (though the
// spec is extremely incomplete)
return Bukkit.getServer().getPlayer(uuid) != null;
}
代码示例来源:origin: Bukkit/Bukkit
@Override
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
return acceptValidatedInput(context, plugin.getServer().getPlayer(input));
}
代码示例来源:origin: Bukkit/Bukkit
final Player player = sender.getServer().getPlayer(args[0]);
代码示例来源:origin: SpigotMC/Spigot-API
/**
* @see Server#getPlayer(java.util.UUID)
*/
public static Player getPlayer(UUID id) {
return server.getPlayer(id);
}
代码示例来源:origin: me.lucko/helper
/**
* Gets a player by uuid.
*
* @param uuid the uuid
* @return a player, or null
*/
@Nullable
public static Player getNullable(UUID uuid) {
return Helper.server().getPlayer(uuid);
}
代码示例来源:origin: PEXPlugins/PermissionsEx
public Optional<Commander<?>> getCommanderFor(String identifier) {
return Optional.ofNullable(plugin.getServer().getPlayer(UUID.fromString(identifier))).map(ply -> new BukkitCommander(plugin, ply));
}
}
代码示例来源:origin: MilkBowl/Vault
@Override
public String getPlayerPrefix(String world, String player) {
Player p = Bukkit.getServer().getPlayer(player);
if (p ==null) {
throw new UnsupportedOperationException("mChat does not support offline player prefixes");
}
return mChat.getPrefix(p);
}
代码示例来源:origin: MilkBowl/Vault
@Override
public String getPlayerInfoString(String world, String player, String node, String defaultValue) {
Player p = Bukkit.getServer().getPlayer(player);
if (p ==null) {
throw new UnsupportedOperationException("mChat does not support offline player prefixes");
}
String s = mChat.getInfo(p, node);
return s == null ? defaultValue : s;
}
代码示例来源:origin: MilkBowl/Vault
@Override
public boolean playerHas(String world, String player, String permission) {
Player p = plugin.getServer().getPlayer(player);
return p != null ? p.hasPermission(permission) : false;
}
代码示例来源:origin: SkyWars/SkyWars
@Override
public void respawnPlayer(UUID playerUuid) {
Validate.notNull(playerUuid, "Player uuid cannot be null");
Player p = plugin.getServer().getPlayer(playerUuid);
Validate.isTrue(p != null, String.format("Player (uuid: %s) not online", playerUuid));
this.respawnPlayer(p);
}
代码示例来源:origin: SkyWars/SkyWars
@Override
public void run() {
SkyStatic.debug("Finished delay. Re-attempting apply for %s. [InventorySaveListener.restoreInventory]", uuid);
Player player = plugin.getServer().getPlayer(uuid);
if (player != null) {
restoreInventory(player, false, true);
} else {
plugin.getLogger().log(Level.WARNING, "Player {0} no longer logged in, not restoring saved inventory! Note: 4 tick delay due to workaround for teleportation failure.", uuid);
}
}
}, 4);
代码示例来源:origin: MilkBowl/Vault
@Override
public String getPlayerPrefix(String world, String player) {
Player p = plugin.getServer().getPlayer(player);
if (p == null) {
throw new UnsupportedOperationException("iChat does not support offline player info nodes!");
}
if (!p.getWorld().getName().equals(world)) {
return null;
}
return iChat.getPrefix(p);
}
代码示例来源:origin: MilkBowl/Vault
@Override
public String getPlayerSuffix(String world, String player) {
Player p = plugin.getServer().getPlayer(player);
if (p == null) {
throw new UnsupportedOperationException("iChat does not support offline player info nodes!");
}
if (!p.getWorld().getName().equals(world)) {
return null;
}
return iChat.getSuffix(p);
}
代码示例来源:origin: MilkBowl/Vault
@Override
public String getPlayerInfoString(String world, String player, String node, String defaultValue) {
Player p = plugin.getServer().getPlayer(player);
if (p == null) {
throw new UnsupportedOperationException("iChat does not support offline player info nodes!");
}
if (!p.getWorld().getName().equals(world)) {
return null;
}
String val = iChat.getInfo(p, node);
return val != null ? val : defaultValue;
}
代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common
public PlayerStatistic(UUID uuid) {
this.uuid = uuid;
Player player = BedwarsRel.getInstance().getServer().getPlayer(uuid);
if (player != null && !this.name.equals(player.getName())) {
this.name = player.getName();
}
}
代码示例来源:origin: com.greatmancode/tools
@Override
public String getPlayerWorld(UUID uuid) {
Player p = ((BukkitLoader) getCaller().getLoader()).getServer().getPlayer(uuid);
return (p != null) ? p.getWorld().getName() : "";
}
内容来源于网络,如有侵权,请联系作者删除!