Add event for commands and make __on_player_message not trigger for them (#1525)

* Restoring old behaviour of __on_player_message

Fixes #1511

* Changed to PLAYER_COMMAND

* Updated docs

* Updated event_test.sc

* Updated editor keywords

* Fixed issue
This commit is contained in:
Ghoulboy authored and GitHub committed 2022-12-26 15:30:50 +01:00
1 parent b63dfa1b0a
commit 43bb84437f
6 files changed
+32 -2

No files matched your search

@@ -921,6 +921,13 @@ public class CarpetEventServer
}
};
public static final Event PLAYER_COMMAND = new Event("player_command", 2, false) {
@Override
public boolean onPlayerMessage(ServerPlayer player, String message) {
return handler.call( () -> Arrays.asList(new EntityValue(player), new StringValue(message)), player::createCommandSourceStack);
}
};
public static final Event STATISTICS = new Event("statistic", 4, false)
{
private <T> ResourceLocation getStatId(Stat<T> stat)