mirror of
https://github.com/System-End/Discord-MC-Chat.git
synced 2026-04-19 22:05:11 +00:00
更新到1.17
This commit is contained in:
parent
2f6d768821
commit
49db91f765
6 changed files with 20 additions and 15 deletions
1
TODO.txt
Normal file
1
TODO.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
写Config文档
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
plugins {
|
||||
id 'fabric-loom' version '0.8.17'
|
||||
id 'fabric-loom' version '0.9.9'
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_16
|
||||
|
|
@ -33,8 +33,9 @@ dependencies {
|
|||
|
||||
include "net.sf.trove4j:trove4j:+"
|
||||
include "org.apache.commons:commons-collections4:+"
|
||||
include "org.apache.httpcomponents:httpclient:+"
|
||||
include "org.jetbrains:annotations:+"
|
||||
include "org.slf4j:slf4j-api:+"
|
||||
//include "org.slf4j:slf4j-api:+"
|
||||
include "com.neovisionaries:nv-websocket-client:+"
|
||||
include "com.fasterxml.jackson.core:jackson-annotations:+"
|
||||
include "com.fasterxml.jackson.core:jackson-core:+"
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
org.gradle.jvmargs=-Xmx1G
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.16.5
|
||||
yarn_mappings=1.16.5+build.9
|
||||
loader_version=0.11.3
|
||||
minecraft_version=1.17
|
||||
yarn_mappings=1.17+build.9
|
||||
loader_version=0.11.6
|
||||
# Mod Properties
|
||||
mod_version=1.16-1.5.3
|
||||
mod_version=1.17-1.6.0
|
||||
maven_group=top.xujiayao
|
||||
archives_base_name=MCDiscordChat
|
||||
# Dependencies
|
||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||
fabric_version=0.35.0+1.16
|
||||
fabric_version=0.36.0+1.17
|
||||
|
|
|
|||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package top.xujiayao.mcdiscordchat.mixins;
|
|||
import net.minecraft.network.MessageType;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.filter.TextStream.Message;
|
||||
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
|
|
@ -43,11 +44,13 @@ public abstract class MixinServerPlayNetworkHandler {
|
|||
@Shadow
|
||||
protected abstract void executeCommand(String input);
|
||||
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcastChatMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/MessageType;Ljava/util/UUID;)V"), method = "method_31286", cancellable = true)
|
||||
private void onGameMessage(String string, CallbackInfo ci) {
|
||||
String message = StringUtils.normalizeSpace(string);
|
||||
Text text = new TranslatableText("chat.type.text", this.player.getDisplayName(), message);
|
||||
Optional<Text> eventResult = ServerChatCallback.EVENT.invoker().onServerChat(this.player, message, text);
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcast(Lnet/minecraft/text/Text;Ljava/util/function/Function;Lnet/minecraft/network/MessageType;Ljava/util/UUID;)V"), method = "handleMessage", cancellable = true)
|
||||
private void handleMessage(Message message, CallbackInfo ci) {
|
||||
String string = message.getRaw();
|
||||
String msg = StringUtils.normalizeSpace(string);
|
||||
Text text = new TranslatableText("chat.type.text", this.player.getDisplayName(), msg);
|
||||
Optional<Text> eventResult = ServerChatCallback.EVENT.invoker().onServerChat(this.player, msg, text);
|
||||
|
||||
if (eventResult.isPresent()) {
|
||||
this.server.getPlayerManager().broadcastChatMessage(eventResult.get(), MessageType.CHAT, this.player.getUuid());
|
||||
ci.cancel();
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@
|
|||
"mcdiscordchat.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.11.3",
|
||||
"fabricloader": ">=0.11.6",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.16.x",
|
||||
"minecraft": "1.17.x",
|
||||
"java": ">=16"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue