feat,refactor: add useCorePlaceBlock in config and refactor default config

This commit is contained in:
Chayapak 2024-11-17 17:01:09 +07:00
parent a942cfd557
commit 71d9caa0db
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA
3 changed files with 25 additions and 12 deletions

View file

@ -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;

View file

@ -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<Component> runTracked (String command) {
if (!bot.options.useCore) return null;
if (bot.options.useCorePlaceBlock) {
runPlaceBlock(command);
return null;
}
final Vector3i coreBlock = block;
run(command);

View file

@ -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