本文整理了Java中org.bukkit.Bukkit.getOfflinePlayer()
方法的一些代码示例,展示了Bukkit.getOfflinePlayer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bukkit.getOfflinePlayer()
方法的具体详情如下:
包路径:org.bukkit.Bukkit
类名称:Bukkit
方法名:getOfflinePlayer
暂无
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
@Deprecated
public OfflinePlayer getPlayer() {
return Bukkit.getOfflinePlayer(entry);
}
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public OfflinePlayer getOwningPlayer() {
return Bukkit.getOfflinePlayer(owner.getId());
}
代码示例来源:origin: GlowstoneMC/Glowstone
/**
* Added needed method for Storage to convert from UUID to owners.
*
* <p>The UUID's are validated through offline player checking.
*
* <p>If a player with the specified UUID has not played on the server before, the owner is not
* set.
*
* @param ownerUniqueId The player UUID of the owner.
*/
public void setOwnerUniqueId(UUID ownerUniqueId) {
if (ownerUniqueId == null) {
this.ownerUniqueId = null;
return;
}
OfflinePlayer player = Bukkit.getOfflinePlayer(ownerUniqueId);
if (player != null && player.hasPlayedBefore()) {
this.ownerUniqueId = ownerUniqueId;
}
}
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public Map<String, String> write() {
Map<String, String> result = new LinkedHashMap<>();
// target
if (list.type == Type.NAME) {
OfflinePlayer player = Bukkit.getOfflinePlayer(target);
result.put("uuid", UuidUtils.toString(player.getUniqueId()));
result.put("name", player.getName());
} else if (list.type == Type.IP) {
result.put("ip", target);
}
// other data
result.put("created", GlowBanList.DATE_FORMAT.format(created));
result.put("source", source);
result.put("expires",
expires == null ? GlowBanList.FOREVER : GlowBanList.DATE_FORMAT.format(expires));
result.put("reason", reason);
return result;
}
代码示例来源:origin: Bukkit/Bukkit
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
if (args.length != 1 || args[0].length() == 0) {
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
return false;
}
OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
player.setOp(true);
Command.broadcastCommandMessage(sender, "Opped " + args[0]);
return true;
}
代码示例来源:origin: Bukkit/Bukkit
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
if (args.length != 1 || args[0].length() == 0) {
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
return false;
}
OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
player.setOp(false);
if (player instanceof Player) {
((Player) player).sendMessage(ChatColor.YELLOW + "You are no longer op!");
}
Command.broadcastCommandMessage(sender, "De-opped " + args[0]);
return true;
}
代码示例来源:origin: Bukkit/Bukkit
if (badPerm(sender, "add")) return true;
Bukkit.getOfflinePlayer(args[1]).setWhitelisted(true);
if (badPerm(sender, "remove")) return true;
Bukkit.getOfflinePlayer(args[1]).setWhitelisted(false);
代码示例来源:origin: Bukkit/Bukkit
offlinePlayer = player;
} else {
offlinePlayer = Bukkit.getOfflinePlayer(playerName);
offlinePlayer = player;
} else {
offlinePlayer = Bukkit.getOfflinePlayer(playerName);
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public void load(T entity, CompoundTag compound) {
// TODO make this better.
super.load(entity, compound);
if (compound.containsKey("OwnerUUID") && !compound.getString("OwnerUUID").isEmpty()) {
entity.setOwnerUniqueId(UuidUtils.fromString(compound.getString("OwnerUUID")));
if (Bukkit.getPlayer(entity.getOwnerUniqueId()) != null) {
entity.setOwner(Bukkit.getPlayer(entity.getOwnerUniqueId()));
}
} else if (compound.containsKey("Owner") && !compound.getString("Owner").isEmpty()) {
String playerName = compound.getString("Owner");
OfflinePlayer player = Bukkit.getOfflinePlayer(playerName);
if (player.hasPlayedBefore()) {
entity.setOwnerUniqueId(player.getUniqueId());
if (Bukkit.getPlayer(entity.getOwnerUniqueId()) != null) {
entity.setOwner(Bukkit.getPlayer(entity.getOwnerUniqueId()));
}
}
}
}
代码示例来源:origin: webbukkit/dynmap
@Override
public boolean hasOfflinePermission(String player, String perm) {
Player p = Bukkit.getPlayerExact(player);
if (p != null) {
return p.hasPermission(name + "." + perm);
}
else {
OfflinePlayer op = Bukkit.getOfflinePlayer(player);
if((op != null) && op.isOp()) {
return true;
}
return false;
}
}
}
代码示例来源:origin: nsporillo/GlobalWarming
/**
* @return never NULL, even when player-record does not exist
*/
public OfflinePlayer getOfflinePlayer() {
return Bukkit.getOfflinePlayer(uuid);
}
代码示例来源:origin: webbukkit/dynmap
private PermissionData getUser(String username) {
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(username);
UUID uuid;
if(offlinePlayer != null && offlinePlayer.getUniqueId() != null)
uuid = offlinePlayer.getUniqueId();
else
uuid = joinFuture(luckPerms.getStorage().getUUID(username));
if(uuid == null)
return null;
User user = luckPerms.getUser(uuid);
if(user == null) {
joinFuture(luckPerms.getStorage().loadUser(uuid));
user = luckPerms.getUser(uuid);
}
if(user == null)
return null;
return user.getCachedData().getPermissionData(luckPerms.getContextManager().getStaticContexts());
}
代码示例来源:origin: MilkBowl/Vault
@Override
public String[] getPlayerGroups(String world, String player) {
OfflinePlayer p = Bukkit.getOfflinePlayer(player);
if (p == null) {
throw new UnsupportedOperationException("Privileges does not support offline players.");
}
Group g = privs.getGroupManager().getGroup(p);
return g != null ? g.getGroupTree().toArray(new String[g.getGroupTree().size()]) : null;
}
代码示例来源:origin: MilkBowl/Vault
@Override
public String[] getPlayerGroups(String world, String player) {
OfflinePlayer op = Bukkit.getOfflinePlayer(player);
GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world));
User user = set.getUser(op);
Set<Group> children = user.getChildren(true);
List<String> groups = new ArrayList<String>();
for (Group child : children) {
groups.add(child.getName());
}
return groups.toArray(new String[groups.size()]);
}
代码示例来源:origin: MilkBowl/Vault
@Override
public boolean playerInGroup(String world, String player, String group) {
OfflinePlayer p = Bukkit.getOfflinePlayer(player);
Group g = privs.getGroupManager().getGroup(p);
return g != null && g.isMemberOf(group);
}
代码示例来源:origin: ProSavage/SavageFactions
public String getName() {
if (this.name == null) {
// Older versions of FactionsUUID don't save the name,
// so `name` will be null the first time it's retrieved
// after updating
OfflinePlayer offline = Bukkit.getOfflinePlayer(UUID.fromString(getId()));
this.name = offline.getName() != null ? offline.getName() : getId();
}
return name;
}
代码示例来源:origin: MilkBowl/Vault
@Override
public String getPrimaryGroup(String world, String player) {
OfflinePlayer op = Bukkit.getOfflinePlayer(player);
GroupSet set = perms.getGroupManager().getWorldSet(Bukkit.getWorld(world));
User user = set.getUser(op);
Set<Group> children = user.getChildren(false);
if (!children.isEmpty()) {
return children.iterator().next().getName();
} else {
return null;
}
}
代码示例来源:origin: ChestShop-authors/ChestShop-3
@EventHandler
public void onAccountCheck(AccountCheckEvent event) {
if (event.hasAccount()) {
return;
}
World world = event.getWorld();
//String lastSeen = NameManager.getLastSeenName(event.getAccount());
OfflinePlayer lastSeen = Bukkit.getOfflinePlayer(event.getAccount());
event.hasAccount(lastSeen != null && provider.hasAccount(lastSeen, world.getName()));
}
代码示例来源:origin: ChestShop-authors/ChestShop-3
@EventHandler
public void onCurrencyCheck(CurrencyCheckEvent event) {
if (event.hasEnough()) {
return;
}
final OfflinePlayer lastSeen = Bukkit.getOfflinePlayer(event.getAccount());
if (lastSeen != null && provided()) {
event.hasEnough(economyAPI.hasHoldings(event.getAccount(),
event.getAmount(),
event.getWorld().getName()));
}
}
代码示例来源:origin: ChestShop-authors/ChestShop-3
@EventHandler
public void onCurrencyAdd(CurrencyAddEvent event) {
if (event.isAdded()) {
return;
}
final OfflinePlayer lastSeen = Bukkit.getOfflinePlayer(event.getTarget());
if (lastSeen != null && provided()) {
event.setAdded(economyAPI.addHoldings(event.getTarget(), event.getAmount(), event.getWorld().getName()));
}
}
内容来源于网络,如有侵权,请联系作者删除!