/** * Removes the nickname for the specified user. * * @param user The nickname to set. * @throws NicknameException if the nickname could not be set. */ default void removeNickname(User user) throws NicknameException { setNickname(user, null); }
public static String getNick(Player p) { if (!Sponge.getPluginManager().getPlugin("nucleus").isPresent()) return p.getName(); return NucleusAPI.getNicknameService() .map(s -> s.getNickname(p).map(Text::toPlain).orElse(null)) .orElse(p.getName()); }
/** * Sets a user's nickname. * * @param user The {@link User} to change the nickname of * @param nickname The nickname, or {@code null} to remove it. * @throws NicknameException if the nickname could not be set. */ default void setNickname(User user, @Nullable Text nickname) throws NicknameException { setNickname(user, nickname, false); }