本文整理汇总了Java中net.canarymod.api.entity.living.humanoid.Player.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Player.getName方法的具体用法?Java Player.getName怎么用?Java Player.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.canarymod.api.entity.living.humanoid.Player
的用法示例。
在下文中一共展示了Player.getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPlayerName
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
private String getPlayerName(final String uuid) {
String name = null;
final Player player = Canary.getServer().getPlayerFromUUID(uuid);
if (player != null) {
// Player online
ZownPlugin.LOG.debug("Found online Player");
name = player.getName();
} else {
// Player offline
final OfflinePlayer oPlayer = Canary.getServer().getOfflinePlayer(UUID.fromString(uuid));
if (oPlayer != null) {
ZownPlugin.LOG.debug("Found offline Player");
name = oPlayer.getName();
}
}
return name;
}
示例2: pairPlayer
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
/**
*
* @param player A Minecraft account
* @param token A latch token the user received in her phone
*/
public void pairPlayer(Player player, String token) {
String pName = player.getName();
plugin.getLogman().info("Pairing " + pName + "using token " + token);
LatchResponse response = latch.pair(token);
if (response.getError() == null) {
JsonObject data = response.getData();
String latchAccount = data.get("accountId").getAsString();
plugin.getLogman().info("Account " + latchAccount + " retrieved.");
setLatchAccount(player, latchAccount);
}
else {
// TODO: manage error
plugin.getLogman().info("Fail pairing account.");
}
}
示例3: onConnection
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
/**
* Checks connecting users againts their pair latch account and bans those
* who are latched out.
*
* @param hook A CanaryMod hook launched every time a player connects
* to the server. It allows access to player's info.
*/
@HookHandler
public void onConnection(ConnectionHook hook) {
Player player = hook.getPlayer();
latch.updateStatus(player);
if (latch.isLatchOut(player)) {
String name = player.getName();
plugin.getLogman().info(name + " banned by CanaryLatch.");
latch.latchBan(player);
}
// set a message for ban user
}
示例4: setLatchAccount
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
private void setLatchAccount(Player player, String account) {
LatchDataAccess dataAccess = new LatchDataAccess();
String name = player.getName();
dataAccess.playerName = name;
dataAccess.latchAccount = account;
dataAccess.latchStatus = "on";
plugin.getLogman().info("Setting (" + name + ", " + account + ")");
plugin.getLogman().info("Default status: " + dataAccess.latchStatus);
updateLatchData(player, dataAccess);
}
示例5: getLatchAccount
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
private String getLatchAccount(Player player) {
LatchDataAccess dataAccess = getLatchData(player);
String name = player.getName(), account = dataAccess.latchAccount;
plugin.getLogman().info("(" + name + ", " + account + ")");
return dataAccess.latchAccount;
}
示例6: getLatchStatus
import net.canarymod.api.entity.living.humanoid.Player; //导入方法依赖的package包/类
private String getLatchStatus(Player player) {
LatchDataAccess dataAccess = getLatchData(player);
String name = player.getName(), status = dataAccess.latchStatus;
plugin.getLogman().info("(" + name + ", " + status + ")");
return dataAccess.latchStatus;
}