Scanning for Chatmessages does not work properly since Port to 1.12 in MULTIPLAYER.
It sometimes triggers without any reason and Chat message in the Chat.
It always worked without any problems till Port to 1.12
I think there is a bug with minescript.getChatMessages.
Here is my script:
function generateStopStrategy(whenToStop, force, description) {
var StopOnConditionStrategy = Java.type("net.famzangl.minecraft.minebot.ai.strategy.StopOnConditionStrategy");
var StopCondition = Java.type("net.famzangl.minecraft.minebot.ai.strategy.StopOnConditionStrategy$StopCondition");
var cond = Java.extend(StopCondition, {
shouldStop: whenToStop
});
return new StopOnConditionStrategy(new cond(), force, description);
}
function stopOnChatMessage() {
var re = /\bMYTRIGGERWORD\b/;
// we ignore old messages
var messageCount = minescript.getChatMessages().length;
// we should not just return false once, so we need to store the status.
var stopReceived = false;
var startTime = Date.now();
return generateStopStrategy(function(h) {
var messages = minescript.getChatMessages();
// this goes through all new messages
for (; messageCount < messages.length; messageCount++) {
stopReceived |= re.test(messages[messageCount].text + "");
}
return stopReceived || Date.now() - startTime > 120000;
}, false, "STOP.");
}
while (true) {
minescript.doStrategy(minescript.stack(
stopOnChatMessage(),
minescript.strategy("minebot", "eat"),;
minescript.doStrategy(minescript.strategyWalkTowards(minescript.getPlayer().x - 13, minescript.getPlayer().z + 0));
minescript.doStrategy(minescript.strategy("minebot", "pause", "2"))
minescript.doStrategy(minescript.strategyWalkTowards(minescript.getPlayer().x + 13, minescript.getPlayer().z + 0));
minescript.doStrategy(minescript.strategy("minebot", "pause", "2"))
minescript.doStrategy(minescript.strategy("minebot", "eat"));
}
Scanning for Chatmessages does not work properly since Port to 1.12 in MULTIPLAYER. It sometimes triggers without any reason and Chat message in the Chat. It always worked without any problems till Port to 1.12 I think there is a bug with minescript.getChatMessages. Here is my script:
Sent from my Google Nexus 5X using FastHub