diff options
| author | Léo Kosman <leo.kosman@proton.me> | 2024-08-31 14:04:12 +0200 |
|---|---|---|
| committer | Léo Kosman <leo.kosman@proton.me> | 2024-08-31 14:04:12 +0200 |
| commit | e760fcfbeb930cc3e31f01c8c2d33f1fbd1977dd (patch) | |
| tree | 9614b97880c69f7e5cb74aa1b2c7937e3d4592dd /src/main/java/world | |
| parent | 6f65825e1504a1090405685404e7cbc59bd0f44b (diff) | |
| parent | d5732c6f04c8718e8734b9794d3e1dbc5c33aec5 (diff) | |
Merge branch 'refs/heads/main' into feat/role-command
Diffstat (limited to 'src/main/java/world')
| -rw-r--r-- | src/main/java/world/anhgelus/molehunt/mixin/NoJoinLeaveMessage.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/world/anhgelus/molehunt/mixin/NoJoinLeaveMessage.java b/src/main/java/world/anhgelus/molehunt/mixin/NoJoinLeaveMessage.java new file mode 100644 index 0000000..a82a21e --- /dev/null +++ b/src/main/java/world/anhgelus/molehunt/mixin/NoJoinLeaveMessage.java @@ -0,0 +1,18 @@ +package world.anhgelus.molehunt.mixin;
+
+import net.minecraft.server.PlayerManager;
+import net.minecraft.text.Text;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(PlayerManager.class)
+public class NoJoinLeaveMessage {
+ @Inject(at = @At("HEAD"), method = "broadcast*", cancellable = true)
+ public void broadcastNoJoinLeaveMessage(Text message, boolean overlay, CallbackInfo ci) {
+ final var content = message.getContent().toString();
+ if (content.startsWith("translation{key='multiplayer.player.joined")) ci.cancel();
+ else if (content.startsWith("translation{key='multiplayer.player.left")) ci.cancel();
+ }
+}
|
