本文整理汇总了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);
}
}
}
示例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));
}
}
}
}
示例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()
);
}
示例4: getPlayerString
import org.spongepowered.api.entity.living.player.Player; //导入方法依赖的package包/类
public static String getPlayerString(Player player) {
return player.getName() + " (" + player.getUniqueId().toString() + ')';
}