diff --git a/build-number.txt b/build-number.txt index 085a6265..f5b9e8bf 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -1911 \ No newline at end of file +1912 \ No newline at end of file diff --git a/src/main/java/me/chayapak1/chomens_bot/plugins/SelfCarePlugin.java b/src/main/java/me/chayapak1/chomens_bot/plugins/SelfCarePlugin.java index 717767b5..32be9085 100644 --- a/src/main/java/me/chayapak1/chomens_bot/plugins/SelfCarePlugin.java +++ b/src/main/java/me/chayapak1/chomens_bot/plugins/SelfCarePlugin.java @@ -125,21 +125,18 @@ public class SelfCarePlugin extends Bot.Listener { // core else if (selfCares.icu.enabled && positionPacketsPerSecond > selfCares.icu.positionPacketsPerSecond) bot.core.run("essentials:sudo * icu stop"); else if (hasEssentials) { - // TODO: improve lol, this is ohio + final String usernameOrBlank = !bot.options.useChat ? + bot.username + " " : + ""; if (selfCares.vanish && !vanish && !visibility && !creayun) { - if (bot.options.useChat) bot.chat.sendCommandInstantly("essentials:vanish enable"); - else bot.core.run("essentials:vanish " + bot.username + " enable"); + runEssentialsCommand("essentials:vanish " + usernameOrBlank + "enable"); } else if (selfCares.nickname && !nickname) { - if (bot.options.useChat) bot.chat.sendCommandInstantly("essentials:nick off"); - else bot.core.run("essentials:nickname " + bot.username + " off"); + runEssentialsCommand("essentials:nickname " + usernameOrBlank + "off"); } else if (selfCares.socialspy && !socialspy && !creayun) { - if (bot.options.useChat) bot.chat.sendCommandInstantly("essentials:socialspy enable"); - else bot.core.run("essentials:socialspy " + bot.username + " enable"); + runEssentialsCommand("essentials:socialspy " + usernameOrBlank + "enable"); } else if (selfCares.mute && muted && !creayun) { - if (bot.options.useChat) bot.chat.sendCommandInstantly("essentials:mute " + bot.profile.getIdAsString()); - else bot.core.run("essentials:mute " + bot.profile.getIdAsString()); - + runEssentialsCommand("essentials:mute " + bot.profile.getIdAsString()); muted = false; } } @@ -232,6 +229,11 @@ public class SelfCarePlugin extends Bot.Listener { positionPacketsPerSecond++; } + private void runEssentialsCommand (String command) { + if (bot.options.useChat) bot.chat.sendCommandInstantly(command); + else bot.core.run(command); + } + @Override public void disconnected (DisconnectedEvent event) { checkTask.cancel(true);