docs: 更新代码示例

This commit is contained in:
2024-02-19 23:58:29 +08:00
parent c8eabd5a8b
commit 84a114a1c6

View File

@@ -179,11 +179,10 @@ public class BallListener {
if (!"GlobalChat".equals(event.getChannel())) { if (!"GlobalChat".equals(event.getChannel())) {
return; return;
} }
BallMessage ballMessage = event.getMessage(); String action = event.getAction();
String action = ballMessage.getAction();
switch (action) { switch (action) {
case "onPlayerChat": { case "onPlayerChat": {
JsonObject object = ballMessage.getContentAsJsonObject(); JsonObject object = event.getContentAsJsonObject();
String name = object.get("name").getAsString(); String name = object.get("name").getAsString();
String message = object.get("message").getAsString(); String message = object.get("message").getAsString();
String world = object.get("world").getAsString(); String world = object.get("world").getAsString();