[FEAT] Added Compat API for Advanced Chat
This commit is contained in:
@@ -15,6 +15,7 @@ dependencies {
|
||||
modImplementation("me.shedaniel.cloth:cloth-config-fabric:${cloth_config}")
|
||||
modImplementation "maven.modrinth:fabrictailor:${fabrictailor}"
|
||||
modImplementation "maven.modrinth:vanish:${vanish}"
|
||||
modImplementation("unimaven.modrinth:advanced-chat:${advanced_chat}")
|
||||
|
||||
// Do not edit or remove
|
||||
implementation project(":Common")
|
||||
|
@@ -5,6 +5,8 @@ import com.hypherionmc.craterlib.compat.Vanish;
|
||||
import com.hypherionmc.craterlib.core.platform.CompatUtils;
|
||||
import com.hypherionmc.craterlib.core.platform.ModloaderEnvironment;
|
||||
import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
|
||||
import me.wesley1808.advancedchat.api.AdvancedChatAPI;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
public class FabricCompatHelper implements CompatUtils {
|
||||
|
||||
@@ -35,4 +37,15 @@ public class FabricCompatHelper implements CompatUtils {
|
||||
public boolean playerRevived(BridgedPlayer player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrivateMessage(BridgedPlayer player) {
|
||||
return !AdvancedChatAPI.isPublicChat(player.toMojangServerPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getChannelPrefix(BridgedPlayer player) {
|
||||
net.minecraft.network.chat.Component c = AdvancedChatAPI.getChannelPrefix(player.toMojangServerPlayer());
|
||||
return c.getString().isBlank() ? Component.empty() : Component.text(c.getString());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user