@Override public String replace(String command, QueuedPlayer player, QueuedCommand queuedCommand) { return REPLACE_NAME.matcher(command).replaceAll(player.getName()); } }
public List<String> format(RecentPayment p) { NumberFormat format = NumberFormat.getCurrencyInstance(Locale.US); format.setCurrency(Currency.getInstance(p.getCurrency().getIso4217())); List<String> formatted = new ArrayList<>(); for (String line : lines) { formatted.add(line.replace("%player%", p.getPlayer().getName()) .replace("%amount%", format.format(p.getAmount()))); } return formatted; } }
@Override public String replace(String command, QueuedPlayer player, QueuedCommand queuedCommand) { if (player.getUuid() == null || player.getUuid() == "") { return REPLACE_NAME.matcher(command).replaceAll(player.getName()); } OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(UuidUtil.mojangUuidToJavaUuid(player.getUuid())); if (offlinePlayer == null || !offlinePlayer.hasPlayedBefore()) { return REPLACE_NAME.matcher(command).replaceAll(player.getName()); } return REPLACE_NAME.matcher(command).replaceAll(offlinePlayer.getName()); } }
private Player getPlayer(QueuedPlayer player) { return plugin.getServer().getPlayer(player.getName()); }
.map(payment -> payment.getPlayer().getName()) .collect(Collectors.toSet());
platform.log(Level.INFO, String.format("Dispatching command '%s' for player '%s'.", finalCommand, command.getPlayer().getName())); try { platform.dispatchCommand(finalCommand); } catch (Exception e) { platform.log(Level.SEVERE, String.format("Could not dispatch command '%s' for player '%s'. " + "This is typically a plugin error, not an issue with BuycraftX.", finalCommand, command.getPlayer().getName()), e);
@Override public void run() { QueueInformation information; try { information = platform.getApiClient().getPlayerQueue(player.getId()); } catch (IOException | ApiException e) { // TODO: Implement retry logic. platform.log(Level.SEVERE, "Could not fetch command queue for player", e); return; } platform.log(Level.INFO, String.format("Fetched %d commands for player '%s'.", information.getCommands().size(), player.getName())); // Queue commands for later. for (QueuedCommand command : information.getCommands()) { platform.getExecutor().queue(new ToRunQueuedCommand(player, command, true)); } } }
Skull skull = (Skull) skullBlock.getState(); skull.setSkullType(SkullType.PLAYER); skull.setOwner(entry.getValue() == null ? UNKNOWN_USERNAME : entry.getValue().getPlayer().getName()); skull.update();
allDue.put(player.getName().toLowerCase(Locale.US), player);
private ProxiedPlayer getPlayer(QueuedPlayer player) { if (player.getUuid() != null && plugin.getProxy().getConfig().isOnlineMode()) { return plugin.getProxy().getPlayer(UuidUtil.mojangUuidToJavaUuid(player.getUuid())); } return plugin.getProxy().getPlayer(player.getName()); }
private Player getPlayer(QueuedPlayer player) { if (player.getUuid() != null && (plugin.getServer().getOnlineMode() || plugin.getConfiguration().isBungeeCord())) { return plugin.getServer().getPlayer(UuidUtil.mojangUuidToJavaUuid(player.getUuid())); } return plugin.getServer().getPlayerExact(player.getName()); }
private Optional<Player> getPlayer(QueuedPlayer player) { if (player.getUuid() != null && (plugin.getConfiguration().isBungeeCord() || Sponge.getServer().getOnlineMode())) { return Sponge.getServer().getPlayer(UuidUtil.mojangUuidToJavaUuid(player.getUuid())); } return Sponge.getServer().getPlayer(player.getName()); }