From 71d9caa0db6dc2f000902bc7cc7bf76052a3956b Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 17 Nov 2024 17:01:09 +0700 Subject: [PATCH] feat,refactor: add useCorePlaceBlock in config and refactor default config --- .../chayapak1/chomens_bot/Configuration.java | 1 + .../chomens_bot/plugins/CorePlugin.java | 10 +++++++ src/main/resources/default-config.yml | 26 ++++++++++--------- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/main/java/me/chayapak1/chomens_bot/Configuration.java b/src/main/java/me/chayapak1/chomens_bot/Configuration.java index 171a1368..deffd529 100644 --- a/src/main/java/me/chayapak1/chomens_bot/Configuration.java +++ b/src/main/java/me/chayapak1/chomens_bot/Configuration.java @@ -169,6 +169,7 @@ public class Configuration { public boolean creayun = false; public String serverName; public boolean useCore = true; + public boolean useCorePlaceBlock = false; public boolean useChat = false; public boolean coreCommandSpy = false; public boolean resolveSRV = true; diff --git a/src/main/java/me/chayapak1/chomens_bot/plugins/CorePlugin.java b/src/main/java/me/chayapak1/chomens_bot/plugins/CorePlugin.java index d43507a2..d14ee962 100644 --- a/src/main/java/me/chayapak1/chomens_bot/plugins/CorePlugin.java +++ b/src/main/java/me/chayapak1/chomens_bot/plugins/CorePlugin.java @@ -171,6 +171,11 @@ public class CorePlugin extends PositionPlugin.Listener { if (!ready || command.length() > 32767) return; if (bot.options.useCore) { + if (bot.options.useCorePlaceBlock) { + runPlaceBlock(command); + return; + } + if (isRateLimited() && hasRateLimit()) return; forceRun(command); @@ -185,6 +190,11 @@ public class CorePlugin extends PositionPlugin.Listener { public CompletableFuture runTracked (String command) { if (!bot.options.useCore) return null; + if (bot.options.useCorePlaceBlock) { + runPlaceBlock(command); + return null; + } + final Vector3i coreBlock = block; run(command); diff --git a/src/main/resources/default-config.yml b/src/main/resources/default-config.yml index a0e8e7c8..6c903df7 100644 --- a/src/main/resources/default-config.yml +++ b/src/main/resources/default-config.yml @@ -131,7 +131,8 @@ bots: # username - optional, if not specified it will just use a random username # creayun - defaults to false # serverName - name it whatever you like, it will be used as server name in trusted broadcast and in console - # useCore - if enabled it just sends the command using chat instead of using core. recommended to enable useChat too when this is enabled + # useCore - if enabled it just sends the command using chat instead of using core. recommended to enable useChat too when this is disabled + # useCorePlaceBlock - uses the place block core instead of the main core. only used if useCore is enabled # useChat - when the bot tellraws it will chat instead of using the core to run tellraw # 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 @@ -140,22 +141,23 @@ bots: - host: 'localhost' port: 25565 - username: 'ChomeNS_Bot' - creayun: false serverName: 'Localhost' - useCore: true - useChat: false - coreCommandSpy: false - resolveSRV: true reconnectDelay: 2000 - removeNamespaces: false chatQueueDelay: 125 - coreRateLimit: - limit: 10 - reset: 1000 # in milliseconds - # or without the optional ones: + # or with the optional ones # - host: 'localhost' # port: 25565 + # username: 'ChomeNS_Bot' + # creayun: false # serverName: 'Localhost' + # useCore: true + # useCorePlaceBlock: false + # useChat: false + # coreCommandSpy: false + # resolveSRV: true # reconnectDelay: 2000 + # removeNamespaces: false # chatQueueDelay: 125 + # coreRateLimit: + # limit: 10 + # reset: 1000 # in milliseconds