feat: support ServerChat
This commit is contained in:
@@ -464,6 +464,11 @@ public class EventListener implements Listener {
|
|||||||
NativeCallback.onCustomDimensionTransfer(EntityMethod.getIdForEntity(event.getEntity()), from, to);
|
NativeCallback.onCustomDimensionTransfer(EntityMethod.getIdForEntity(event.getEntity()), from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
public void onChat(PlayerChatEvent event) {
|
||||||
|
consumeEvent(event, () -> NativeCallback.onServerChat(event.getPlayer().getNameTag(), event.getMessage(), EntityMethod.getIdForEntity(event.getPlayer())));
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onServerCommand(ServerCommandEvent event) {
|
public void onServerCommand(ServerCommandEvent event) {
|
||||||
final CommandSender sender = event.getSender();
|
final CommandSender sender = event.getSender();
|
||||||
|
|||||||
@@ -543,7 +543,24 @@ public class NativeCallback {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ZoteOnly
|
@ClientOnly
|
||||||
|
public static void onLocalChatSent() {
|
||||||
|
String message = getStringParam("chat_message");
|
||||||
|
Callback.invokeAPICallback("LocalChatSent", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
public static void onLocalChatReceived(boolean debounced) {
|
||||||
|
String author = getStringParam("local_chat_author");
|
||||||
|
String message = getStringParam("local_chat_message");
|
||||||
|
Callback.invokeAPICallback("LocalChatReceived", author, message, debounced);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onServerChat(String author, String message, long player) {
|
||||||
|
Callback.invokeAPICallback("ServerChat", author, message, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void onServerCommand(String command, float x, float y, float z, long entity, boolean fromPacket) {
|
public static void onServerCommand(String command, float x, float y, float z, long entity, boolean fromPacket) {
|
||||||
Callback.invokeAPICallback("ServerCommand", command, new GenericScriptPos3(x, y, z), entity, fromPacket);
|
Callback.invokeAPICallback("ServerCommand", command, new GenericScriptPos3(x, y, z), entity, fromPacket);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user