From 232c8705026a8ab6526cad4ac4e95bca74b55a23 Mon Sep 17 00:00:00 2001 From: Andre_601 <11576465+Andre601@users.noreply.github.com> Date: Fri, 4 Jun 2021 07:40:05 +0200 Subject: [PATCH] Only override Activity when non-null (#3) Implements JDA-Applications/JDA-Utilities#110 --- .../jagrosh/jdautilities/command/CommandClientBuilder.java | 2 +- .../jdautilities/command/impl/CommandClientImpl.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/CommandClientBuilder.java b/command/src/main/java/com/jagrosh/jdautilities/command/CommandClientBuilder.java index 6d0e4349..d86b3008 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/CommandClientBuilder.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/CommandClientBuilder.java @@ -274,7 +274,7 @@ public CommandClientBuilder setEmojis(String success, String warning, String err /** * Sets the {@link net.dv8tion.jda.api.entities.Activity Game} to use when the bot is ready. - *
Can be set to {@code null} for no activity. + *
Can be set to {@code null} for JDA Utilities to not set it. * * @param activity * The Game to use when the bot is ready diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java b/command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java index 5a5e7d21..a9a5f159 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/impl/CommandClientImpl.java @@ -490,8 +490,10 @@ private void onReady(ReadyEvent event) return; } textPrefix = prefix.equals(DEFAULT_PREFIX) ? "@"+event.getJDA().getSelfUser().getName()+" " : prefix; - event.getJDA().getPresence().setPresence(status==null ? OnlineStatus.ONLINE : status, - activity ==null ? null : "default".equals(activity.getName()) ? Activity.playing("Type "+textPrefix+helpWord) : activity); + + if(activity != null) + event.getJDA().getPresence().setPresence(status==null ? OnlineStatus.ONLINE : status, + "default".equals(activity.getName()) ? Activity.playing("Type "+textPrefix+helpWord) : activity); // Start SettingsManager if necessary GuildSettingsManager manager = getSettingsManager();