automatically switch to chat if player is deopped or not in creative
This commit is contained in:
parent
a7045c4b15
commit
46a3cbbb33
1 changed files with 3 additions and 1 deletions
|
@ -10,6 +10,7 @@ import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
|||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
|
||||
public class CustomChat {
|
||||
private final MinecraftClient client;
|
||||
|
@ -30,7 +31,8 @@ public class CustomChat {
|
|||
}
|
||||
|
||||
public void chat (String message) {
|
||||
if (!enabled) {
|
||||
final ClientPlayerEntity player = client.player;
|
||||
if (!enabled || !player.hasPermissionLevel(2) || !player.isCreative()) {
|
||||
final ClientPlayNetworkHandler networkHandler = client.getNetworkHandler();
|
||||
networkHandler.sendChatMessage(message);
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue