当前位置: 首页>>代码示例>>Java>>正文


Java Player.getName方法代码示例

本文整理汇总了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;
}
 
开发者ID:toddharrison,项目名称:Zown,代码行数:18,代码来源:Zown.java

示例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.");
    }
}
 
开发者ID:escueladebits,项目名称:canary_latch,代码行数:21,代码来源:LatchManager.java

示例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
}
 
开发者ID:escueladebits,项目名称:canary_latch,代码行数:19,代码来源:LatchListener.java

示例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);
}
 
开发者ID:escueladebits,项目名称:canary_latch,代码行数:12,代码来源:LatchManager.java

示例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;
}
 
开发者ID:escueladebits,项目名称:canary_latch,代码行数:7,代码来源:LatchManager.java

示例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;
}
 
开发者ID:escueladebits,项目名称:canary_latch,代码行数:7,代码来源:LatchManager.java


注:本文中的net.canarymod.api.entity.living.humanoid.Player.getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。