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


Java Player.getName方法代码示例

本文整理汇总了Java中org.spongepowered.api.entity.living.player.Player.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Player.getName方法的具体用法?Java Player.getName怎么用?Java Player.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.spongepowered.api.entity.living.player.Player的用法示例。


在下文中一共展示了Player.getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onOpened

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
@Listener
public void onOpened(PlayerOpenedCrateEvent event) {
    Player player = event.getPlayer();
    Manager manager = event.getManager();
    Drop drop = event.getDrop();
    if (manager.isSendOpenMessage()) {
        Optional<String> optional_custom_open_message = manager.getCustomOpenMessage();
        if (optional_custom_open_message.isPresent()) {
            player.sendMessage(TextSerializers.FORMATTING_CODE.
                    deserialize(optional_custom_open_message.get().
                            replace("%MANAGER%", manager.getName())));
        } else {
            player.sendMessage(LanguageUtils.getText("SUCCESSFULLY_OPENED_MANAGER",
                    new Pair<String, String>("%MANAGER%", manager.getName())));
        }
    }
    if (GWMCrates.getInstance().isLogOpenedCrates()) {
        try {
            String time = LocalTime.now().withNano(0).format(DateTimeFormatter.ISO_LOCAL_TIME);
            String player_name = player.getName();
            String player_uuid = player.getUniqueId().toString();
            String manager_name = manager.getName();
            String manager_id = manager.getId();
            String drop_name = drop == null ? "null" : drop.getId().orElse("Unknown ID");
            Location<World> location = player.getLocation();
            String player_location = location.getExtent().getName() + ' ' + location.getBlockX() + ' ' + location.getBlockY() + ' ' + location.getBlockZ();
            LOG_FILE_WRITER.write(LanguageUtils.getPhrase("CRATE_OPENING_LOG_MESSAGE",
                    new Pair("%TIME%", time),
                    new Pair("%PLAYER%", player_name),
                    new Pair("%PLAYER_UUID%", player_uuid),
                    new Pair("%MANAGER_NAME%", manager_name),
                    new Pair("%MANAGER_ID%", manager_id),
                    new Pair("%DROP%", drop_name),
                    new Pair("%LOCATION%", player_location)) + '\n');
            LOG_FILE_WRITER.flush();
        } catch (Exception e) {
            GWMCrates.getInstance().getLogger().warn("Exception logging crate opening!", e);
        }
    }
}
 
开发者ID:GreWeMa,项目名称:gwm_Crates,代码行数:41,代码来源:DebugCrateListener.java

示例2: onPlayerJoin

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
@Listener
public void onPlayerJoin(ClientConnectionEvent.Join event) {
	Player player = (Player) event.getTargetEntity();
	String username = player.getName();
	if ((AurionsVoteListener.SQLType == "MySQL") && (dbHost.isEmpty() || dbHost == null || dbUser.isEmpty()
			|| dbUser == null || dbPass.isEmpty() || dbPass == null)) {
		if (player.hasPermission("*") || player.hasPermission("listener.top")) {
			player.sendMessage(
					Text.builder("<AurionsVoteListener> Please config Database.").color(TextColors.RED).build());
		}
	} else {
		if (SwitchSQL.QueueUsername(username)) {

			List<String> service = SwitchSQL.QueueReward(username);
			int totalVote = service.size();
			for (int i = 0; i < service.size(); i++) {
				RewardsTask.rewardoflline(username, service.get(i));
				SwitchSQL.removeQueue(username, service.get(i));
			}
			MessageChannel messageChannel = MessageChannel.TO_PLAYERS;

			messageChannel.send(AurionsVoteListener.GetInstance()
					.formatmessage(offlineBroadcast.replace("<amt>", String.valueOf(totalVote)), "", username));
			player.sendMessage(Text.of(AurionsVoteListener.GetInstance().formatmessage(
					offlinePlayerMessage.replace("<amt>", String.valueOf(totalVote)), "", username)));
		} else {
		}
		if (joinmessage) {
			for (int i = 0; i < AurionsVoteListener.messagejoin.size(); i++) {
				player.sendMessage(formatmessage(AurionsVoteListener.messagejoin.get(i), "", username));
			}
		}
	}
}
 
开发者ID:Mineaurion,项目名称:AurionVoteListener,代码行数:35,代码来源:AurionsVoteListener.java

示例3: getPlayerSession

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
private PlayerSession getPlayerSession(Player player) {
    return new PlayerSession(
            0,
            player.getName(),
            player.getUniqueId().toString(),
            playerJoins.get(player.getUniqueId()),
            getTime(),
            player.getConnection().getAddress().getAddress().getHostAddress()
    );
}
 
开发者ID:MinecraftMarket,项目名称:MinecraftMarket-Plugin,代码行数:11,代码来源:SpongeStats.java

示例4: getPlayerString

import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
public static String getPlayerString(Player player) {
	return player.getName() + " (" + player.getUniqueId().toString() + ')';
}
 
开发者ID:AuraDevelopmentTeam,项目名称:InvSync,代码行数:4,代码来源:DataSource.java


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