use of org.geysermc.floodgate.player.VelocityUserAudience.VelocityConsoleAudience in project Floodgate by GeyserMC.
the class VelocityCommandUtil method getAudience.
@Override
@NonNull
public UserAudience getAudience(@NonNull Object sourceObj) {
if (!(sourceObj instanceof CommandSource)) {
throw new IllegalArgumentException("Can only work with CommandSource!");
}
CommandSource source = (CommandSource) sourceObj;
if (!(source instanceof Player)) {
if (console != null) {
return console;
}
return console = new VelocityConsoleAudience(source, this);
}
Player player = (Player) source;
UUID uuid = player.getUniqueId();
String username = player.getUsername();
String locale = Utils.getLocale(player.getPlayerSettings().getLocale());
return AUDIENCE_CACHE.computeIfAbsent(uuid, $ -> new VelocityPlayerAudience(uuid, username, locale, source, true, this));
}
Aggregations