mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-01-05 23:08:23 +00:00
Dispatch commands on main thread when run from XMPP (#3803)
This PR fixes an issue reported on Discord, where commands executed through XMPP are dispatched async from the XMPP listener thread.
This commit is contained in:
parent
43eff69a2f
commit
5bb3cc88e5
1 changed files with 7 additions and 5 deletions
|
@ -320,11 +320,13 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
|||
|
||||
private void sendCommand(final Chat chat, final String message) {
|
||||
if (config.getStringList("op-users").contains(StringUtils.parseBareAddress(chat.getParticipant()))) {
|
||||
try {
|
||||
parent.getServer().dispatchCommand(Console.getInstance().getCommandSender(), message.substring(1));
|
||||
} catch (final Exception ex) {
|
||||
logger.log(Level.SEVERE, ex.getMessage(), ex);
|
||||
}
|
||||
parent.getServer().getScheduler().runTask(parent, () -> {
|
||||
try {
|
||||
parent.getServer().dispatchCommand(Console.getInstance().getCommandSender(), message.substring(1));
|
||||
} catch (final Exception ex) {
|
||||
logger.log(Level.SEVERE, ex.getMessage(), ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue