feat: finally add customizable essentials messages

This commit is contained in:
ChomeNS
2024-12-05 15:20:32 +07:00
parent 79b6ae13a6
commit c2cdf8bcf9
4 changed files with 27 additions and 10 deletions

View File

@@ -1 +1 @@
1199
1200

View File

@@ -173,8 +173,24 @@ public class Configuration {
public int reconnectDelay = 2000;
public boolean removeNamespaces = false;
public int chatQueueDelay = 125;
public EssentialsMessages essentialsMessages = new EssentialsMessages();
public CoreRateLimit coreRateLimit = new CoreRateLimit();
public static class EssentialsMessages {
public String vanishEnable1 = "Vanish for %s: enabled";
public String vanishEnable2 = "You are now completely invisible to normal users, and hidden from in-game commands.";
public String vanishDisable = "Vanish for %s: disabled";
public String nickNameRemove = "You no longer have a nickname.";
public String nickNameSet = "Your nickname is now ";
public String socialSpyEnable = "SocialSpy for %s: enabled";
public String socialSpyDisable = "SocialSpy for %s: disabled";
public String muted = "You have been muted";
public String unmuted = "You have been unmuted.";
}
public static class CoreRateLimit {
public int limit = 0;
public int reset = 0;

View File

@@ -52,18 +52,18 @@ public class SelfCarePlugin extends Bot.Listener {
if (string.equals("Successfully enabled CommandSpy")) cspy = true;
else if (string.equals("Successfully disabled CommandSpy")) cspy = false;
else if (string.equals("Vanish for " + bot.username + ": enabled")) vanish = true;
else if (string.equals("You are now completely invisible to normal users, and hidden from in-game commands.")) vanish = true;
else if (string.equals("Vanish for " + bot.username + ": disabled")) vanish = false;
else if (string.equals(String.format(bot.options.essentialsMessages.vanishEnable1, bot.username))) vanish = true;
else if (string.equals(bot.options.essentialsMessages.vanishEnable2)) vanish = true;
else if (string.equals(String.format(bot.options.essentialsMessages.vanishDisable, bot.username))) vanish = false;
else if (string.equals("You no longer have a nickname.")) nickname = true;
else if (string.startsWith("Your nickname is now ")) nickname = false;
else if (string.equals(bot.options.essentialsMessages.nickNameRemove)) nickname = true;
else if (string.startsWith(bot.options.essentialsMessages.nickNameSet)) nickname = false;
else if (string.equals("SocialSpy for " + bot.username + ": enabled")) socialspy = true;
else if (string.equals("SocialSpy for " + bot.username + ": disabled")) socialspy = false;
else if (string.equals(bot.options.essentialsMessages.socialSpyEnable)) socialspy = true;
else if (string.equals(bot.options.essentialsMessages.socialSpyDisable)) socialspy = false;
else if (string.startsWith("You have been muted")) muted = true;
else if (string.equals("You have been unmuted.")) muted = false;
else if (string.startsWith(bot.options.essentialsMessages.muted)) muted = true;
else if (string.equals(bot.options.essentialsMessages.unmuted)) muted = false;
else if (string.equals("You now have the tag: " + bot.config.selfCare.prefix.prefix)) prefix = true;
else if (string.startsWith("You no longer have a tag")) prefix = false;

View File

@@ -140,6 +140,7 @@ bots:
# coreCommandSpy - set to true if server supports enabling player's commandspy though command block
# resolveSRV - whether to resolve SRV records on the server. the notchian minecraft doesn't resolve them
# removeNamespaces - when the bot sends a command it will remove like `minecraft:` for example if set to true
# essentialsMessages - the messages in essentials that the bot uses for self care (no example is intentional)
# coreRateLimit - will ignore commands if reached the ratelimit
- host: 'localhost'