mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-21 23:51:42 +01: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
@ -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 New Issue
Block a user