fix message sending

This commit is contained in:
creeper123123321 2019-02-08 18:18:25 -02:00
parent 8c430d57f6
commit 1c9345ada5
No known key found for this signature in database
GPG Key ID: 0AC57D54786721D1
2 changed files with 3 additions and 14 deletions

View File

@ -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();
})
)
)
);

View File

@ -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)));
}
}