Player and Chat Delay issues, help!

Started by monteroarer on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2026
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Player and Chat Delay issues, help!

Hello, I've been trying out mcreator as a way to dip my legs into the world of Java Modding, and I've tried to code a simple chatbot-esque system but I have this issue where,

 

* The Server sends the chat before the player's chat goes through

* The Server doesn't send any chat as a result.


public class ConverationplayerProcedure {
	@SubscribeEvent
	public static void onChat(ServerChatEvent event) {
		execute(event, event.getPlayer().level(), event.getRawText());
	}

	public static void execute(LevelAccessor world, String text) {
		execute(null, world, text);
	}

	private static void execute(@Nullable Event event, LevelAccessor world, String text) {
		if (text == null)
			return;
		String chatsent = "";
		if ((text).isEmpty() == false) {
			chatsent = (text).toLowerCase();
			if (chatsent.contains("hello")) {
				OtherplayersMod.queueServerWork(5, () -> {
					OtherplayersMod.LOGGER.info("SHOULD FIRE TEST NOW TEST TICK 5");
					if (world instanceof ServerLevel _level) {
						_level.getServer().getPlayerList().broadcastSystemMessage(Component.literal("Hi!"), false);
					}
				});
			} else if (chatsent.contains("hi")) {
				OtherplayersMod.queueServerWork(5, () -> {
					OtherplayersMod.LOGGER.info("SHOULD FIRE TEST NOW TEST TICK 5");
					if (world instanceof ServerLevel _level) {
						_level.getServer().getPlayerList().broadcastSystemMessage(Component.literal("Hi!"), false);
					}
				});
			}
		}
	}
}

The key thing I've noticed that the server wont send any message if the .queueServerWork is there.