mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-12-22 16:28:12 +01:00
fix message sending
This commit is contained in:
parent
8c430d57f6
commit
1c9345ada5
@ -74,19 +74,6 @@ public class VRViaVersionInitializer {
|
||||
);
|
||||
return 1;
|
||||
})
|
||||
.suggests((ctx, builder) -> {
|
||||
String args = StringArgumentType.getString(ctx, "args");
|
||||
Via.getManager()
|
||||
.getCommandHandler()
|
||||
.onTabComplete(
|
||||
new NMSCommandSender(
|
||||
ctx.getSource()
|
||||
),
|
||||
args.split(" ", -1)
|
||||
)
|
||||
.forEach(builder::suggest);
|
||||
return builder.buildFuture();
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -28,7 +28,6 @@ import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.loader.FabricLoader;
|
||||
import net.minecraft.client.network.ClientCommandSource;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.command.CommandSource;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.text.TextComponent;
|
||||
@ -54,6 +53,9 @@ public class NMSCommandSender implements ViaCommandSender {
|
||||
public void sendMessage(String s) {
|
||||
if (source instanceof ServerCommandSource) {
|
||||
((ServerCommandSource) source).sendFeedback(TextComponent.Serializer.fromJsonString(ChatRewriter.legacyTextToJson(s)), false);
|
||||
} else if (FabricLoader.INSTANCE.getEnvironmentType() == EnvType.CLIENT && source instanceof ClientCommandSource) {
|
||||
FabricLoader.INSTANCE.getEnvironmentHandler().getClientPlayer()
|
||||
.appendCommandFeedback(TextComponent.Serializer.fromJsonString(ChatRewriter.legacyTextToJson(s)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user