删除/shrug指令,更新依赖

This commit is contained in:
Xujiayao 2021-12-27 17:38:56 +08:00
parent b7676eee54
commit 105ab654fb
4 changed files with 10 additions and 60 deletions

View file

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.10.64'
id 'fabric-loom' version '0.10.65'
}
sourceCompatibility = JavaVersion.VERSION_17
@ -42,11 +42,11 @@ dependencies {
include "net.sf.trove4j:trove4j:3.0.3"
include 'org.apache.commons:commons-collections4:4.4'
include 'com.neovisionaries:nv-websocket-client:2.14'
include "com.squareup.okhttp3:okhttp:3.13.0"
include "com.fasterxml.jackson.core:jackson-annotations:2.13.0"
include "com.fasterxml.jackson.core:jackson-core:2.13.0"
include "com.fasterxml.jackson.core:jackson-databind:2.13.0"
include "com.squareup.okio:okio:1.17.2"
include "com.squareup.okhttp3:okhttp:3.14.9"
include 'com.fasterxml.jackson.core:jackson-annotations:2.13.1'
include 'com.fasterxml.jackson.core:jackson-core:2.13.1'
include 'com.fasterxml.jackson.core:jackson-databind:2.13.1'
include "com.squareup.okio:okio:1.17.5"
include "com.neovisionaries:nv-websocket-client:2.14"
include(modImplementation("com.vdurmont:emoji-java:5.1.1"))
@ -63,7 +63,7 @@ processResources {
tasks.withType(JavaCompile) {
it.options.encoding = "UTF-8"
it.options.release = 16
it.options.release = 17
}
task sourcesJar(type: Jar, dependsOn: classes) {

View file

@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx4G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.18.1
yarn_mappings=1.18.1+build.2
loader_version=0.12.11
yarn_mappings=1.18.1+build.12
loader_version=0.12.12
# Mod Properties
mod_version=1.18-1.11.2
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.44.0+1.18
fabric_version=0.45.0+1.18

View file

@ -8,9 +8,7 @@ import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.requests.GatewayIntent;
import net.dv8tion.jda.api.utils.MemberCachePolicy;
import net.fabricmc.api.DedicatedServerModInitializer;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import top.xujiayao.mcdiscordchat.commands.ShrugCommand;
import top.xujiayao.mcdiscordchat.listeners.DiscordEventListener;
import top.xujiayao.mcdiscordchat.listeners.MinecraftEventListener;
import top.xujiayao.mcdiscordchat.objects.Texts;
@ -86,11 +84,5 @@ public class Main implements DedicatedServerModInitializer {
new MinecraftEventListener().init();
}
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
if (dedicated) {
ShrugCommand.register(dispatcher);
}
});
}
}

View file

@ -1,42 +0,0 @@
package top.xujiayao.mcdiscordchat.commands;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.command.argument.MessageArgumentType;
import net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket;
import net.minecraft.server.command.ServerCommandSource;
import static net.minecraft.command.argument.MessageArgumentType.getMessage;
import static net.minecraft.server.command.CommandManager.argument;
import static net.minecraft.server.command.CommandManager.literal;
/**
* @author Xujiayao
*/
public class ShrugCommand {
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
dispatcher.register(literal("shrug").then(argument("message", MessageArgumentType.message()).executes(context -> {
if (context.getSource() != null) {
ServerCommandSource source = context.getSource();
if (source.getPlayer() != null) {
source.getPlayer().networkHandler.onChatMessage(new ChatMessageC2SPacket(getMessage(context, "message").getString() + " ¯\\_(ツ)_/¯"));
}
}
return 0;
})));
dispatcher.register(literal("shrug").executes(context -> {
if (context.getSource() != null) {
ServerCommandSource source = context.getSource();
if (source.getPlayer() != null) {
source.getPlayer().networkHandler.onChatMessage(new ChatMessageC2SPacket("¯\\_(ツ)_/¯"));
}
}
return 0;
}));
}
}