From e55b9e51b44d45fd3dd1d2b64d67ac01f86750fa Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 2 Jul 2023 08:04:40 +0700 Subject: [PATCH 01/15] stuff stuff stuff yea yea yea yea yeayea yea yeay ay aey yea y eay eayae yey ae yeaye ayea yea --- build.gradle | 6 ----- gradle.properties | 4 +-- gradle/wrapper/gradle-wrapper.jar | Bin 61574 -> 62076 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 11 ++++---- lombok.config | 2 -- .../chipmunk/chipmunkmod/Configuration.java | 14 +++++++--- .../chipmunkmod/commands/AutoSkinCommand.java | 4 +-- .../chipmunkmod/commands/CloopCommand.java | 6 ++--- .../commands/CustomChatCommand.java | 4 +-- .../commands/FullBrightCommand.java | 2 +- .../commands/LoopCrouchCommand.java | 2 +- .../chipmunkmod/commands/MusicCommand.java | 20 +++++++-------- .../commands/RainbowNameCommand.java | 2 +- .../chipmunkmod/commands/SelfCareCommand.java | 6 ++--- .../chipmunk/chipmunkmod/data/BlockArea.java | 13 +++++----- .../chipmunkmod/data/CommandLoop.java | 15 ----------- .../data/MutablePlayerListEntry.java | 19 ++++++++------ .../chipmunkmod/mixin/ChatHudMixin.java | 2 +- .../mixin/ClientPlayerEntityMixin.java | 2 +- .../chipmunkmod/mixin/KeyboardInputMixin.java | 6 ++--- .../mixin/LightmapTextureManagerMixin.java | 2 +- .../chipmunkmod/modules/CommandCore.java | 24 +++++++++--------- .../modules/CommandLoopManager.java | 12 ++++----- .../chipmunkmod/modules/CustomChat.java | 8 +++--- .../chipmunkmod/modules/FullBright.java | 6 ++--- .../chipmunkmod/modules/KaboomCheck.java | 4 +-- .../chipmunkmod/modules/LoopCrouch.java | 8 +++--- .../chipmunk/chipmunkmod/modules/Players.java | 16 ++++++------ .../chipmunkmod/modules/RainbowName.java | 8 +++--- .../chipmunkmod/modules/SelfCare.java | 18 ++++++------- .../chipmunkmod/modules/SongPlayer.java | 24 +++++++++--------- .../land/chipmunk/chipmunkmod/song/Note.java | 9 +++++-- .../chipmunkmod/song/SongLoaderException.java | 3 +-- src/main/resources/fabric.mod.json | 2 +- 35 files changed, 140 insertions(+), 146 deletions(-) delete mode 100644 lombok.config delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/data/CommandLoop.java diff --git a/build.gradle b/build.gradle index 631f623..4397120 100644 --- a/build.gradle +++ b/build.gradle @@ -39,12 +39,6 @@ dependencies { // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" - - compileOnly 'org.projectlombok:lombok:1.18.24' - annotationProcessor 'org.projectlombok:lombok:1.18.24' - - testCompileOnly 'org.projectlombok:lombok:1.18.24' - testAnnotationProcessor 'org.projectlombok:lombok:1.18.24' } processResources { diff --git a/gradle.properties b/gradle.properties index 6b01b90..0399033 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop minecraft_version=1.20.1 - yarn_mappings=1.20.1+build.2 + yarn_mappings=1.20.1+build.9 loader_version=0.14.21 # Mod Properties @@ -14,6 +14,6 @@ org.gradle.parallel=true archives_base_name = chipmunkmod # Dependencies - fabric_version=0.83.1+1.20.1 + fabric_version=0.84.0+1.20.1 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cbfa754578e88a3dae77fce6e3dea56edbf..c1962a79e29d3e0ab67b14947c167a862655af9b 100644 GIT binary patch delta 13895 zcmZ8|Wmp``)-~=Hdu)0n3Y-8OvyK$p9^s9MM|Aj$miotNhy-{udLczZyd9uWtD)X_{|!LhIEF9y8(e*Z zW>^w$u&x|i9OjL=#6Nl~*ERulzX>8C-}o;iSMRYdfCU5d`~U{V4>HCg0HG4Xg2uP;fn!>S9+>LbuWbc0bETMQfo9~h}yI*TSv;Oikl~t-+xqI-`P$Rj@yi{mr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ea2pFz!9gK7@{Ox?vH6;ZM6|9@@6 z>XV7Ny#<@Qn~go&|Bd8rsxbinr-Q(NI1!t-1!W!)ft-&1yndlz2LQz#Awi;pGLG12 z|MR{7b$UX+Jq?0}fMEMq4gpaZIPD0^@56nw4B~(koe)6e$8i58`yXrJ|Hyti|05&( zcjQ6GR8V3bf8o^=1W=X-!oQS)=iA~rMuMXD{FerL(*8@Y_yRzBCrD6DzW>q~et>`J zDIfs!^^GnA{zK!ujr2GX075xMf*MHtS3?fM`&Y990)Xt^=qAu#I{K9MP1A5n1=X4H z7eLSa&xNC%Q9%V{|Al4GaQ|!g|KsZUpW)l){7wIwgUTg9ZNmCL9O;d!f1Zy^)lttY-EmuCD*Ls0=TtpgKnWo-FO+&mW7kxx<=g>fwml$x0zy4h1{{yI$%}4+M diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f398c33..a363877 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68..aeb74cb 100755 --- a/gradlew +++ b/gradlew @@ -85,9 +85,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +141,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +149,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/lombok.config b/lombok.config deleted file mode 100644 index 347c825..0000000 --- a/lombok.config +++ /dev/null @@ -1,2 +0,0 @@ -config.stopBubbling = true -lombok.accessors.fluent = true \ No newline at end of file diff --git a/src/main/java/land/chipmunk/chipmunkmod/Configuration.java b/src/main/java/land/chipmunk/chipmunkmod/Configuration.java index 830673b..546cca5 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/Configuration.java +++ b/src/main/java/land/chipmunk/chipmunkmod/Configuration.java @@ -3,7 +3,7 @@ package land.chipmunk.chipmunkmod; import com.google.gson.JsonObject; import land.chipmunk.chipmunkmod.data.BlockArea; import net.minecraft.util.math.BlockPos; -import lombok.AllArgsConstructor; + public class Configuration { public CommandManager commands = new CommandManager(); @@ -30,16 +30,24 @@ public class Configuration { public TestBotInfo testbot = new TestBotInfo("-", null); } - @AllArgsConstructor public static class TestBotInfo { public String prefix; public String webhookUrl; + + public TestBotInfo (String prefix, String webhookUrl) { + this.prefix = prefix; + this.webhookUrl = webhookUrl; + } } - @AllArgsConstructor public static class BotInfo { public String prefix; public String key; + + public BotInfo (String prefix, String key) { + this.prefix = prefix; + this.key = key; + } } public static class CustomChat { diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/AutoSkinCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/AutoSkinCommand.java index c860ec3..50de716 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/AutoSkinCommand.java +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/AutoSkinCommand.java @@ -28,11 +28,11 @@ public class AutoSkinCommand { final String username = getString(context, "username"); - SelfCare.INSTANCE.skin(username); + SelfCare.INSTANCE.skin = username; if (username.equals("off")) source.sendFeedback(Text.literal("Successfully disabled auto skin")); else { - SelfCare.INSTANCE.hasSkin(false); + SelfCare.INSTANCE.hasSkin = false; source.sendFeedback(Text.literal("Set your auto skin username to: " + username)); } diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/CloopCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/CloopCommand.java index 6ba5aac..5db68b9 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/CloopCommand.java +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/CloopCommand.java @@ -68,7 +68,7 @@ public class CloopCommand { final CommandLoopManager manager = CommandLoopManager.INSTANCE; final int id = getInteger(context, "id"); - if (id < 0 || id >= manager.commandLoops().size()) throw INVALID_CLOOP_ID_EXCEPTION.create(id); + if (id < 0 || id >= manager.commandLoops.size()) throw INVALID_CLOOP_ID_EXCEPTION.create(id); manager.removeAndStop(id); @@ -88,11 +88,11 @@ public class CloopCommand { public static int listCloops (CommandContext context) { final FabricClientCommandSource source = context.getSource(); - final List loops = CommandLoopManager.INSTANCE.commandLoops(); + final List loops = CommandLoopManager.INSTANCE.commandLoops; int id = 0; for (CommandLoopManager.CommandLoop loop : loops) { - source.sendFeedback(Text.translatable("%s: %s (%s)", Text.literal(String.valueOf(id)), Text.literal(loop.command()), Text.literal(String.valueOf(loop.interval())))); + source.sendFeedback(Text.translatable("%s: %s (%s)", Text.literal(String.valueOf(id)), Text.literal(loop.command), Text.literal(String.valueOf(loop.interval)))); id++; } diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/CustomChatCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/CustomChatCommand.java index 4a419b0..bb1696c 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/CustomChatCommand.java +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/CustomChatCommand.java @@ -38,7 +38,7 @@ public class CustomChatCommand { public static int enabled (CommandContext context) { final FabricClientCommandSource source = context.getSource(); final boolean bool = getBool(context, "boolean"); - CustomChat.INSTANCE.enabled(bool); + CustomChat.INSTANCE.enabled = bool; source.sendFeedback(Text.literal("Custom chat is now " + (bool ? "on" : "off"))); return Command.SINGLE_SUCCESS; @@ -47,7 +47,7 @@ public class CustomChatCommand { public static int setFormat (CommandContext context) { final FabricClientCommandSource source = context.getSource(); final String format = getString(context, "format"); - CustomChat.INSTANCE.format(format); + CustomChat.INSTANCE.format = format; source.sendFeedback(Text.literal("Set the custom chat format to: " + format)); return Command.SINGLE_SUCCESS; diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/FullBrightCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/FullBrightCommand.java index a67f44f..5f76436 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/FullBrightCommand.java +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/FullBrightCommand.java @@ -28,7 +28,7 @@ public class FullBrightCommand { final boolean bool = getBool(context, "boolean"); - FullBright.enabled(bool); + FullBright.enabled = bool; source.sendFeedback(Text.literal("Fullbright is now " + (bool ? "enabled" : "disabled"))); diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/LoopCrouchCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/LoopCrouchCommand.java index d13f441..4e33156 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/LoopCrouchCommand.java +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/LoopCrouchCommand.java @@ -28,7 +28,7 @@ public class LoopCrouchCommand { final boolean enabled = getBool(context, "enabled"); - LoopCrouch.INSTANCE.enabled(enabled); + LoopCrouch.INSTANCE.enabled = enabled; source.sendFeedback(Text.literal("Loop crouch is now " + (enabled ? "enabled" : "disabled"))); diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/MusicCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/MusicCommand.java index 0e34a42..40deb98 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/MusicCommand.java +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/MusicCommand.java @@ -125,10 +125,10 @@ public class MusicCommand { final FabricClientCommandSource source = context.getSource(); final SongPlayer songPlayer = SongPlayer.INSTANCE; - if (songPlayer.currentSong() == null) throw NO_SONG_IS_CURRENTLY_PLAYING.create(); + if (songPlayer.currentSong == null) throw NO_SONG_IS_CURRENTLY_PLAYING.create(); songPlayer.stopPlaying(); - songPlayer.songQueue().clear(); + songPlayer.songQueue.clear(); source.sendFeedback(Text.literal("Stopped music playback").formatted(Formatting.GREEN)); return 1; @@ -138,7 +138,7 @@ public class MusicCommand { final FabricClientCommandSource source = context.getSource(); final SongPlayer songPlayer = SongPlayer.INSTANCE; - if (songPlayer.currentSong() == null) throw NO_SONG_IS_CURRENTLY_PLAYING.create(); + if (songPlayer.currentSong == null) throw NO_SONG_IS_CURRENTLY_PLAYING.create(); songPlayer.stopPlaying(); source.sendFeedback(Text.literal("Skipped the current song").formatted(Formatting.GREEN)); @@ -149,7 +149,7 @@ public class MusicCommand { public int pause (CommandContext context) throws CommandSyntaxException { final FabricClientCommandSource source = context.getSource(); final SongPlayer songPlayer = SongPlayer.INSTANCE; - final Song currentSong = songPlayer.currentSong(); + final Song currentSong = songPlayer.currentSong; if (currentSong == null) throw NO_SONG_IS_CURRENTLY_PLAYING.create(); @@ -240,7 +240,7 @@ public class MusicCommand { public int toggleLoop (CommandContext context) throws CommandSyntaxException { final FabricClientCommandSource source = context.getSource(); final SongPlayer songPlayer = SongPlayer.INSTANCE; - final Song currentSong = songPlayer.currentSong(); + final Song currentSong = songPlayer.currentSong; if (currentSong == null) throw NO_SONG_IS_CURRENTLY_PLAYING.create(); @@ -255,7 +255,7 @@ public class MusicCommand { public int loop (CommandContext context) throws CommandSyntaxException { final FabricClientCommandSource source = context.getSource(); final SongPlayer songPlayer = SongPlayer.INSTANCE; - final Song currentSong = songPlayer.currentSong(); + final Song currentSong = songPlayer.currentSong; final int count = getInteger(context, "count"); if (currentSong == null) throw NO_SONG_IS_CURRENTLY_PLAYING.create(); @@ -271,7 +271,7 @@ public class MusicCommand { public int gotoCommand (CommandContext context) throws CommandSyntaxException { final FabricClientCommandSource source = context.getSource(); final SongPlayer songPlayer = SongPlayer.INSTANCE; - final Song currentSong = songPlayer.currentSong(); + final Song currentSong = songPlayer.currentSong; final long millis = getLong(context, "timestamp"); if (currentSong == null) throw NO_SONG_IS_CURRENTLY_PLAYING.create(); @@ -290,7 +290,7 @@ public class MusicCommand { final boolean enabled = getBool(context, "boolean"); - SongPlayer.INSTANCE.useCore(enabled); + SongPlayer.INSTANCE.useCore = enabled; source.sendFeedback(Text.literal("Playing music using core is now " + (enabled ? "enabled" : "disabled"))); @@ -302,7 +302,7 @@ public class MusicCommand { final boolean enabled = getBool(context, "boolean"); - SongPlayer.INSTANCE.actionbar(enabled); + SongPlayer.INSTANCE.actionbar = enabled; source.sendFeedback(Text.literal("Showing actionbar is now " + (enabled ? "enabled" : "disabled"))); @@ -314,7 +314,7 @@ public class MusicCommand { final float pitch = getFloat(context, "pitch"); - SongPlayer.INSTANCE.pitch(pitch); + SongPlayer.INSTANCE.pitch = pitch; source.sendFeedback( Text.translatable( diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/RainbowNameCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/RainbowNameCommand.java index 65ff64c..24a4a54 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/RainbowNameCommand.java +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/RainbowNameCommand.java @@ -56,7 +56,7 @@ public class RainbowNameCommand { final String name = getString(context, "name"); - RainbowName.INSTANCE.displayName(name); + RainbowName.INSTANCE.displayName = name; source.sendFeedback(Text.literal("Set the display name to: " + name)); diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java index 0ef9be1..d80e00f 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java @@ -47,15 +47,15 @@ public class SelfCareCommand { switch (type) { case "op" -> { - SelfCare.INSTANCE.opEnabled(bool); + SelfCare.INSTANCE.opEnabled = bool; source.sendFeedback(Text.literal("The op self care is now " + (bool ? "enabled" : "disabled"))); } case "gamemode" -> { - SelfCare.INSTANCE.gamemodeEnabled(bool); + SelfCare.INSTANCE.gamemodeEnabled = bool; source.sendFeedback(Text.literal("The gamemode self care is now " + (bool ? "enabled" : "disabled"))); } case "cspy" -> { - SelfCare.INSTANCE.cspyEnabled(bool); + SelfCare.INSTANCE.cspyEnabled = bool; source.sendFeedback(Text.literal("The CommandSpy self care is now " + (bool ? "enabled" : "disabled"))); } } diff --git a/src/main/java/land/chipmunk/chipmunkmod/data/BlockArea.java b/src/main/java/land/chipmunk/chipmunkmod/data/BlockArea.java index 29093d3..f671ac9 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/data/BlockArea.java +++ b/src/main/java/land/chipmunk/chipmunkmod/data/BlockArea.java @@ -1,13 +1,14 @@ package land.chipmunk.chipmunkmod.data; import net.minecraft.util.math.BlockPos; -import lombok.AllArgsConstructor; -import lombok.Data; // ? Am I reinventing the wheel here? -@AllArgsConstructor -@Data public class BlockArea { - private BlockPos start; - private BlockPos end; + public BlockPos start; + public BlockPos end; + + public BlockArea (BlockPos start, BlockPos end) { + this.start = start; + this.end = end; + } } diff --git a/src/main/java/land/chipmunk/chipmunkmod/data/CommandLoop.java b/src/main/java/land/chipmunk/chipmunkmod/data/CommandLoop.java deleted file mode 100644 index b2fdc22..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/data/CommandLoop.java +++ /dev/null @@ -1,15 +0,0 @@ -package land.chipmunk.chipmunkmod.data; - -import lombok.Getter; - -public class CommandLoop { - @Getter - private String command; - @Getter - private long interval; - - public CommandLoop (String command, long interval) { - this.command = command; - this.interval = interval; - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/data/MutablePlayerListEntry.java b/src/main/java/land/chipmunk/chipmunkmod/data/MutablePlayerListEntry.java index 4e62570..6b5a966 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/data/MutablePlayerListEntry.java +++ b/src/main/java/land/chipmunk/chipmunkmod/data/MutablePlayerListEntry.java @@ -1,19 +1,22 @@ package land.chipmunk.chipmunkmod.data; import com.mojang.authlib.GameProfile; -import lombok.AllArgsConstructor; -import lombok.Data; import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket; import net.minecraft.text.Text; import net.minecraft.world.GameMode; -@Data -@AllArgsConstructor public class MutablePlayerListEntry { - private GameProfile profile; - private GameMode gamemode; - private int latency; - private Text displayName; + public GameProfile profile; + public GameMode gamemode; + public int latency; + public Text displayName; + + public MutablePlayerListEntry(GameProfile profile, GameMode gamemode, int latency, Text displayName) { + this.profile = profile; + this.gamemode = gamemode; + this.latency = latency; + this.displayName = displayName; + } public MutablePlayerListEntry (PlayerListS2CPacket.Entry entry) { this(entry.profile(), entry.gameMode(), entry.latency(), entry.displayName()); diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java index 690b930..831a236 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java @@ -17,7 +17,7 @@ public class ChatHudMixin { @Inject(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V", cancellable = true) public void addMessage(Text message, MessageSignatureData signature, int ticks, MessageIndicator indicator, boolean refresh, CallbackInfo ci) { try { - if (RainbowName.INSTANCE.enabled()) { + if (RainbowName.INSTANCE.enabled) { if (message.getString().contains("Your nickname is now ") || message.getString().contains("Nickname changed.")) { ci.cancel(); return; diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayerEntityMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayerEntityMixin.java index abdb4b3..443030a 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayerEntityMixin.java @@ -26,7 +26,7 @@ public class ClientPlayerEntityMixin { final ClientWorld world = CLIENT.getNetworkHandler().getWorld(); - final BlockPos origin = CommandCore.INSTANCE.origin(); + final BlockPos origin = CommandCore.INSTANCE.origin; if (origin == null) { CommandCore.INSTANCE.move(position); return; } final int distance = (int) Math.sqrt(new Vec2f(origin.getX() / 16, origin.getZ() / 16).distanceSquared(new Vec2f((int) position.getX() / 16, (int) position.getZ() / 16))); if (distance > world.getSimulationDistance()) CommandCore.INSTANCE.move(position); diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/KeyboardInputMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/KeyboardInputMixin.java index a0bb60f..5465b1d 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/KeyboardInputMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/KeyboardInputMixin.java @@ -34,10 +34,10 @@ public class KeyboardInputMixin extends Input { this.jumping = this.settings.jumpKey.isPressed(); // ohio code - this.sneaking = LoopCrouch.INSTANCE.enabled() ? - !LoopCrouch.INSTANCE.sneaking() : + this.sneaking = LoopCrouch.INSTANCE.enabled ? + !LoopCrouch.INSTANCE.sneaking : this.settings.sneakKey.isPressed(); - LoopCrouch.INSTANCE.sneaking(!LoopCrouch.INSTANCE.sneaking()); + LoopCrouch.INSTANCE.sneaking = !LoopCrouch.INSTANCE.sneaking; if (slowDown) { this.movementSideways *= f; diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/LightmapTextureManagerMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/LightmapTextureManagerMixin.java index 848e865..9512c7c 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/LightmapTextureManagerMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/LightmapTextureManagerMixin.java @@ -11,6 +11,6 @@ import org.spongepowered.asm.mixin.injection.invoke.arg.Args; public class LightmapTextureManagerMixin { @ModifyArgs(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/NativeImage;setColor(III)V")) private void update (Args args) { - if (FullBright.enabled()) args.set(2, 0xFFFFFFFF); + if (FullBright.enabled) args.set(2, 0xFFFFFFFF); } } diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java b/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java index 2c141c9..0b77372 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java @@ -2,8 +2,8 @@ package land.chipmunk.chipmunkmod.modules; import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.data.BlockArea; -import lombok.Getter; -import lombok.Setter; + + import net.minecraft.block.entity.CommandBlockBlockEntity; import net.minecraft.client.MinecraftClient; import net.minecraft.nbt.NbtCompound; @@ -18,10 +18,10 @@ import java.util.concurrent.CompletableFuture; public class CommandCore { private final MinecraftClient client; - @Getter @Setter private boolean ready = false; - @Getter @Setter private BlockPos origin; - @Getter private BlockArea relativeArea; - @Getter @Setter private BlockPos currentBlockRelative; + public boolean ready = false; + public BlockPos origin; + public BlockArea relativeArea; + public BlockPos currentBlockRelative; public static CommandCore INSTANCE = new CommandCore(MinecraftClient.getInstance(), ChipmunkMod.CONFIG.core.relativeArea); @@ -46,17 +46,17 @@ public class CommandCore { ((int) position.getZ() / 16) * 16 ); - if (currentBlockRelative == null) currentBlockRelative = new BlockPos(relativeArea.start()); + if (currentBlockRelative == null) currentBlockRelative = new BlockPos(relativeArea.start); refill(); } public void refill () { // final PositionManager position = client.position(); - final BlockPos relStart = relativeArea.start(); - final BlockPos relEnd = relativeArea.end(); + final BlockPos relStart = relativeArea.start; + final BlockPos relEnd = relativeArea.end; final String command = String.format( - KaboomCheck.INSTANCE.isKaboom() ? + KaboomCheck.INSTANCE.isKaboom ? "fill %s %s %s %s %s %s repeating_command_block replace" : "fill %s %s %s %s %s %s command_block", relStart.getX() + origin.getX(), @@ -72,8 +72,8 @@ public class CommandCore { } public void incrementCurrentBlock () { - final BlockPos start = relativeArea.start(); - final BlockPos end = relativeArea.end(); + final BlockPos start = relativeArea.start; + final BlockPos end = relativeArea.end; int x = currentBlockRelative.getX(); int y = currentBlockRelative.getY(); diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/CommandLoopManager.java b/src/main/java/land/chipmunk/chipmunkmod/modules/CommandLoopManager.java index 9917f05..8587c9b 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/CommandLoopManager.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/CommandLoopManager.java @@ -1,7 +1,7 @@ package land.chipmunk.chipmunkmod.modules; -import lombok.Getter; -import lombok.Setter; + + import java.util.List; import java.util.ArrayList; import java.util.Timer; @@ -9,7 +9,7 @@ import java.util.TimerTask; public class CommandLoopManager { private final CommandCore core; - @Getter @Setter private List commandLoops = new ArrayList<>(); + public List commandLoops = new ArrayList<>(); public CommandLoopManager (CommandCore core) { this.core = core; @@ -40,9 +40,9 @@ public class CommandLoopManager { public void cleanup () { this.clearLoops(); } public static class CommandLoop { - @Getter @Setter private CommandCore core; - @Getter @Setter private String command; - @Getter private long interval; + public CommandCore core; + public String command; + public long interval; private Timer timer; public CommandLoop (CommandCore core, String command, long interval) { diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/CustomChat.java b/src/main/java/land/chipmunk/chipmunkmod/modules/CustomChat.java index 298ab21..1aba8da 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/CustomChat.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/CustomChat.java @@ -2,8 +2,8 @@ package land.chipmunk.chipmunkmod.modules; import com.google.gson.JsonElement; import land.chipmunk.chipmunkmod.ChipmunkMod; -import lombok.Getter; -import lombok.Setter; + + import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; @@ -17,9 +17,9 @@ public class CustomChat { public static final CustomChat INSTANCE = new CustomChat(MinecraftClient.getInstance()); - @Getter @Setter private boolean enabled = true; + public boolean enabled = true; - @Getter @Setter private String format; + public String format; public CustomChat (MinecraftClient client) { this.client = client; diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/FullBright.java b/src/main/java/land/chipmunk/chipmunkmod/modules/FullBright.java index 23eda1d..6448dbe 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/FullBright.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/FullBright.java @@ -1,9 +1,9 @@ package land.chipmunk.chipmunkmod.modules; import land.chipmunk.chipmunkmod.ChipmunkMod; -import lombok.Getter; -import lombok.Setter; + + public class FullBright { - @Getter @Setter private static boolean enabled = ChipmunkMod.CONFIG.fullbright; + public static boolean enabled = ChipmunkMod.CONFIG.fullbright; } diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/KaboomCheck.java b/src/main/java/land/chipmunk/chipmunkmod/modules/KaboomCheck.java index 1eebfc4..8bbdb12 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/KaboomCheck.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/KaboomCheck.java @@ -2,7 +2,7 @@ package land.chipmunk.chipmunkmod.modules; import land.chipmunk.chipmunkmod.listeners.Listener; import land.chipmunk.chipmunkmod.listeners.ListenerManager; -import lombok.Getter; + import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.network.packet.Packet; @@ -18,7 +18,7 @@ public class KaboomCheck extends Listener { public static final String SUBTITLE_START_TEXT = "Free OP"; - @Getter private boolean isKaboom = false; + public boolean isKaboom = false; private boolean hasKaboomTitle = false; private boolean hasKaboomSubtitle = false; diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/LoopCrouch.java b/src/main/java/land/chipmunk/chipmunkmod/modules/LoopCrouch.java index 58ec004..bf6f6b2 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/LoopCrouch.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/LoopCrouch.java @@ -1,14 +1,14 @@ package land.chipmunk.chipmunkmod.modules; -import lombok.Getter; -import lombok.Setter; + + public class LoopCrouch { public static final LoopCrouch INSTANCE = new LoopCrouch(); - @Getter @Setter private boolean enabled = false; + public boolean enabled = false; - @Getter @Setter private boolean sneaking = false; + public boolean sneaking = false; public LoopCrouch () { } diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/Players.java b/src/main/java/land/chipmunk/chipmunkmod/modules/Players.java index e79f3f2..e162342 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/Players.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/Players.java @@ -75,7 +75,7 @@ public class Players extends Listener { public final MutablePlayerListEntry getEntry (UUID uuid) { try { for (MutablePlayerListEntry candidate : list) { - if (candidate.profile().getId().equals(uuid)) { + if (candidate.profile.getId().equals(uuid)) { return candidate; } } @@ -88,7 +88,7 @@ public class Players extends Listener { public final MutablePlayerListEntry getEntry (String username) { for (MutablePlayerListEntry candidate : list) { - if (candidate.profile().getName().equals(username)) { + if (candidate.profile.getName().equals(username)) { return candidate; } } @@ -98,7 +98,7 @@ public class Players extends Listener { public final MutablePlayerListEntry getEntry (Text displayName) { for (MutablePlayerListEntry candidate : list) { - if (candidate.displayName() != null && candidate.displayName().equals(displayName)) { + if (candidate.displayName != null && candidate.displayName.equals(displayName)) { return candidate; } } @@ -114,7 +114,7 @@ public class Players extends Listener { try { final MutablePlayerListEntry duplicate = getEntry(newEntry); if (duplicate != null) { - removeFromPlayerList(duplicate.profile().getId()); + removeFromPlayerList(duplicate.profile.getId()); list.remove(duplicate); } @@ -129,7 +129,7 @@ public class Players extends Listener { final MutablePlayerListEntry target = getEntry(newEntry); if (target == null) return; - target.gamemode(newEntry.gameMode()); + target.gamemode = newEntry.gameMode(); } catch (Exception e) { e.printStackTrace(); } @@ -139,14 +139,14 @@ public class Players extends Listener { final MutablePlayerListEntry target = getEntry(newEntry); if (target == null) return; - target.latency(newEntry.latency()); + target.latency = newEntry.latency(); } private void updateDisplayName (PlayerListS2CPacket.Entry newEntry) { final MutablePlayerListEntry target = getEntry(newEntry); if (target == null) return; - target.displayName(newEntry.displayName()); + target.displayName = newEntry.displayName(); } private void removePlayer (UUID uuid) { @@ -166,7 +166,7 @@ public class Players extends Listener { future.thenApply(packet -> { final Suggestions matches = packet.getSuggestions(); - final String username = target.profile().getName(); + final String username = target.profile.getName(); for (int i = 0; i < matches.getList().size(); i++) { final Suggestion suggestion = matches.getList().get(i); diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/RainbowName.java b/src/main/java/land/chipmunk/chipmunkmod/modules/RainbowName.java index 87348c8..25a2c1b 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/RainbowName.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/RainbowName.java @@ -1,8 +1,8 @@ package land.chipmunk.chipmunkmod.modules; import land.chipmunk.chipmunkmod.util.ColorUtilities; -import lombok.Getter; -import lombok.Setter; + + import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.TextColor; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; @@ -23,11 +23,11 @@ public class RainbowName { private Timer timer = null; - @Getter @Setter private boolean enabled = false; + public boolean enabled = false; private String[] team; - @Getter @Setter private String displayName; + public String displayName; private int startHue = 0; diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/SelfCare.java b/src/main/java/land/chipmunk/chipmunkmod/modules/SelfCare.java index e9da51b..256a458 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/SelfCare.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/SelfCare.java @@ -3,11 +3,11 @@ package land.chipmunk.chipmunkmod.modules; import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.listeners.Listener; import land.chipmunk.chipmunkmod.listeners.ListenerManager; -import lombok.Setter; + import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayerEntity; -import lombok.Getter; + import net.minecraft.text.Text; import java.util.Timer; @@ -17,17 +17,17 @@ import static land.chipmunk.chipmunkmod.util.ServerUtilities.serverHasCommand; public class SelfCare extends Listener { private final MinecraftClient client; - @Getter private final long interval; - @Getter private final long chatInterval; + public final long interval; + public final long chatInterval; - @Getter @Setter private boolean opEnabled = true; - @Getter @Setter private boolean gamemodeEnabled = true; - @Getter @Setter private boolean cspyEnabled = true; + public boolean opEnabled = true; + public boolean gamemodeEnabled = true; + public boolean cspyEnabled = true; - @Getter @Setter private String skin; + public String skin; private boolean cspy = false; - @Getter @Setter private boolean hasSkin = false; + public boolean hasSkin = false; private Timer timer = null; private Timer chatTimer = null; diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/SongPlayer.java b/src/main/java/land/chipmunk/chipmunkmod/modules/SongPlayer.java index 1bcb73b..dcb644f 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/SongPlayer.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/SongPlayer.java @@ -8,8 +8,8 @@ import land.chipmunk.chipmunkmod.song.Song; import land.chipmunk.chipmunkmod.song.SongLoaderException; import land.chipmunk.chipmunkmod.song.SongLoaderThread; import land.chipmunk.chipmunkmod.util.MathUtilities; -import lombok.Getter; -import lombok.Setter; + + import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; @@ -42,16 +42,16 @@ public class SongPlayer { public static final SongPlayer INSTANCE = new SongPlayer(MinecraftClient.getInstance()); - @Getter @Setter private Song currentSong; - @Getter @Setter private LinkedList songQueue = new LinkedList<>(); - @Getter @Setter private Timer playTimer; - @Getter @Setter private SongLoaderThread loaderThread; + public Song currentSong; + public LinkedList songQueue = new LinkedList<>(); + public Timer playTimer; + public SongLoaderThread loaderThread; private int ticksUntilPausedActionbar = 20; - @Getter @Setter private boolean useCore = true; - @Getter @Setter private boolean actionbar = true; + public boolean useCore = true; + public boolean actionbar = true; - @Getter @Setter private float pitch = 0; + public float pitch = 0; private final MinecraftClient client; @@ -73,7 +73,7 @@ public class SongPlayer { _loaderThread.start(); loaderThread = _loaderThread; } catch (SongLoaderException e) { - client.player.sendMessage(Component.translatable("Failed to load song: %s", e.message()).color(NamedTextColor.RED)); + client.player.sendMessage(Component.translatable("Failed to load song: %s", e.message).color(NamedTextColor.RED)); loaderThread = null; } } @@ -90,7 +90,7 @@ public class SongPlayer { _loaderThread.start(); loaderThread = _loaderThread; } catch (SongLoaderException e) { - client.player.sendMessage(Component.translatable("Failed to load song: %s", e.message()).color(NamedTextColor.RED)); + client.player.sendMessage(Component.translatable("Failed to load song: %s", e.message).color(NamedTextColor.RED)); loaderThread = null; } } @@ -110,7 +110,7 @@ public class SongPlayer { if (loaderThread != null && !loaderThread.isAlive()) { if (loaderThread.exception != null) { - client.player.sendMessage(Component.translatable("Failed to load song: %s", loaderThread.exception.message()).color(NamedTextColor.RED)); + client.player.sendMessage(Component.translatable("Failed to load song: %s", loaderThread.exception.message).color(NamedTextColor.RED)); } else { songQueue.add(loaderThread.song); client.player.sendMessage(Component.translatable("Added %s to the song queue", Component.empty().append(loaderThread.song.name).color(NamedTextColor.DARK_GREEN)).color(NamedTextColor.GREEN)); diff --git a/src/main/java/land/chipmunk/chipmunkmod/song/Note.java b/src/main/java/land/chipmunk/chipmunkmod/song/Note.java index 94e5b09..f50496d 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/song/Note.java +++ b/src/main/java/land/chipmunk/chipmunkmod/song/Note.java @@ -1,14 +1,19 @@ package land.chipmunk.chipmunkmod.song; -import lombok.AllArgsConstructor; -@AllArgsConstructor public class Note implements Comparable { public Instrument instrument; public int pitch; public float volume; public long time; + public Note (Instrument instrument, int pitch, float volume, long time) { + this.instrument = instrument; + this.pitch = pitch; + this.volume = volume; + this.time = time; + } + @Override public int compareTo(Note other) { if (time < other.time) { diff --git a/src/main/java/land/chipmunk/chipmunkmod/song/SongLoaderException.java b/src/main/java/land/chipmunk/chipmunkmod/song/SongLoaderException.java index dd5dc37..ea0bb7f 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/song/SongLoaderException.java +++ b/src/main/java/land/chipmunk/chipmunkmod/song/SongLoaderException.java @@ -1,10 +1,9 @@ package land.chipmunk.chipmunkmod.song; -import lombok.Getter; import net.minecraft.text.Text; public class SongLoaderException extends Exception { - @Getter private final Text message; + public final Text message; public SongLoaderException (Text message) { super(); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 49c1f0e..9ff25d5 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -31,7 +31,7 @@ "depends": { "fabricloader": ">=0.14.11", "fabric-api": "*", - "minecraft": ">1.19.3", + "minecraft": ">1.20", "java": ">=17" }, "suggests": { From 0af580f80473dd44017938eae5f2d1286ddafe8c Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 2 Jul 2023 17:21:26 +0700 Subject: [PATCH 02/15] WIP chomens bot command suggestion --- .../chipmunkmod/mixin/ChatHudMixin.java | 61 +++++++++++++++++-- .../mixin/ChatInputSuggestorAccessor.java | 17 ++++++ .../mixin/ChatInputSuggestorMixin.java | 41 +++++++++++++ .../chipmunkmod/mixin/ChatScreenAccessor.java | 12 ++++ .../ClientPlayNetworkHandlerInvoker.java | 11 ---- .../chipmunkmod/modules/ChatInputGlobals.java | 8 +++ .../chipmunkmod/modules/TabComplete.java | 3 +- .../modules/TransactionManager.java | 11 ++++ .../chipmunkmod/util/UUIDUtilities.java | 24 ++++++++ src/main/resources/chipmunkmod.mixins.json | 3 +- 10 files changed, 171 insertions(+), 20 deletions(-) create mode 100644 src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorAccessor.java create mode 100644 src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenAccessor.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerInvoker.java create mode 100644 src/main/java/land/chipmunk/chipmunkmod/modules/ChatInputGlobals.java create mode 100644 src/main/java/land/chipmunk/chipmunkmod/modules/TransactionManager.java create mode 100644 src/main/java/land/chipmunk/chipmunkmod/util/UUIDUtilities.java diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java index 831a236..77d8f38 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java @@ -1,9 +1,17 @@ package land.chipmunk.chipmunkmod.mixin; +import com.mojang.brigadier.suggestion.SuggestionsBuilder; +import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.listeners.Listener; import land.chipmunk.chipmunkmod.listeners.ListenerManager; +import land.chipmunk.chipmunkmod.modules.ChatInputGlobals; import land.chipmunk.chipmunkmod.modules.RainbowName; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.hud.MessageIndicator; +import net.minecraft.client.gui.screen.ChatScreen; +import net.minecraft.command.CommandSource; import net.minecraft.network.message.MessageSignatureData; import net.minecraft.text.Text; import net.minecraft.text.TranslatableTextContent; @@ -12,18 +20,20 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.List; + @Mixin(net.minecraft.client.gui.hud.ChatHud.class) public class ChatHudMixin { @Inject(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V", cancellable = true) public void addMessage(Text message, MessageSignatureData signature, int ticks, MessageIndicator indicator, boolean refresh, CallbackInfo ci) { - try { - if (RainbowName.INSTANCE.enabled) { - if (message.getString().contains("Your nickname is now ") || message.getString().contains("Nickname changed.")) { - ci.cancel(); - return; - } + if (RainbowName.INSTANCE.enabled) { + if (message.getString().contains("Your nickname is now ") || message.getString().contains("Nickname changed.")) { + ci.cancel(); + return; } + } + try { if (((TranslatableTextContent) message.getContent()).getKey().equals("advMode.setCommand.success")) { ci.cancel(); return; @@ -33,5 +43,44 @@ public class ChatHudMixin { for (Listener listener : ListenerManager.listeners) { listener.chatMessageReceived(message); } + + try { + final Component component = message.asComponent(); + + final List children = component.children(); + + if (children.size() == 0) return; + + if (!((TextComponent) children.get(0)).content().equals("chomens_bot_command_suggestion")) return; + + ci.cancel(); + + final String[] matches = children.subList(2, children.size()) + .stream() + .map((each) -> ((TextComponent) each).content()) + .toArray(String[]::new); + + if (!(MinecraftClient.getInstance().currentScreen instanceof ChatScreen chatScreen)) return; + + final ChatScreenAccessor chatScreenAccessor = (ChatScreenAccessor) chatScreen; + + final ChatInputSuggestorAccessor chatInputSuggestorAccessor = (ChatInputSuggestorAccessor) chatScreenAccessor.chatInputSuggestor(); + + chatInputSuggestorAccessor.setPendingSuggestions( + CommandSource.suggestMatching( + matches, + new SuggestionsBuilder( + ChatInputGlobals.textUpToCursor, + ChipmunkMod.CONFIG.bots.chomens.prefix.length() + ) + ) + ); + + chatInputSuggestorAccessor.pendingSuggestions().thenRun(() -> { + if (!chatInputSuggestorAccessor.pendingSuggestions().isDone()) return; + + ((ChatScreenAccessor) chatScreen).chatInputSuggestor().show(true); + }); + } catch (ClassCastException | NumberFormatException ignored) {} } } diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorAccessor.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorAccessor.java new file mode 100644 index 0000000..dd9e9c5 --- /dev/null +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorAccessor.java @@ -0,0 +1,17 @@ +package land.chipmunk.chipmunkmod.mixin; + +import com.mojang.brigadier.suggestion.Suggestions; +import net.minecraft.client.gui.screen.ChatInputSuggestor; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import java.util.concurrent.CompletableFuture; + +@Mixin(ChatInputSuggestor.class) +public interface ChatInputSuggestorAccessor { + @Accessor("pendingSuggestions") + CompletableFuture pendingSuggestions (); + + @Accessor("pendingSuggestions") + void setPendingSuggestions (CompletableFuture pendingSuggestions); +} diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorMixin.java index 634c8c6..49ce058 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorMixin.java @@ -3,10 +3,18 @@ package land.chipmunk.chipmunkmod.mixin; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.suggestion.Suggestions; +import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.command.CommandManager; +import land.chipmunk.chipmunkmod.modules.ChatInputGlobals; +import land.chipmunk.chipmunkmod.modules.CommandCore; +import land.chipmunk.chipmunkmod.modules.TransactionManager; +import land.chipmunk.chipmunkmod.util.UUIDUtilities; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.widget.TextFieldWidget; +import net.minecraft.client.network.ClientPlayerEntity; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mutable; @@ -15,6 +23,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.List; import java.util.concurrent.CompletableFuture; @Mixin(net.minecraft.client.gui.screen.ChatInputSuggestor.class) @@ -38,6 +47,8 @@ public class ChatInputSuggestorMixin { textField = null; } + public int transactionId = 0; + @Inject(at = @At("TAIL"), method = "refresh()V") public void refresh (CallbackInfo ci) { if (slashOptional) return; @@ -47,6 +58,36 @@ public class ChatInputSuggestorMixin { final String text = this.textField.getText(); final int cursor = this.textField.getCursor(); + final ClientPlayerEntity player = MinecraftClient.getInstance().player; + + final String chomeNSPrefix = ChipmunkMod.CONFIG.bots.chomens.prefix; + + if (text.startsWith(chomeNSPrefix) && player != null) { + final String textUpToCursor = text.substring(chomeNSPrefix.length(), Math.max(chomeNSPrefix.length(), cursor)); + + ChatInputGlobals.text = text; + ChatInputGlobals.cursor = cursor; + ChatInputGlobals.textUpToCursor = textUpToCursor; + + final String selfSelector = UUIDUtilities.selector(player.getUuid()); + + TransactionManager.INSTANCE.nextTransactionId(); + + final Component component = Component + .text("chomens_bot_command_suggestion") + .append(Component.text(transactionId)) + .append(Component.text(selfSelector)) + .append(Component.text(textUpToCursor)); + + CommandCore.INSTANCE.run( + "minecraft:tellraw @a[tag=chomens_bot] " + GsonComponentSerializer.gson().serialize(component) + ); + + transactionId++; + + return; + } + if (cursor < commandManager.prefix.length() || !text.startsWith(commandManager.prefix)) return; final StringReader reader = new StringReader(text); diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenAccessor.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenAccessor.java new file mode 100644 index 0000000..e2e9ae2 --- /dev/null +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenAccessor.java @@ -0,0 +1,12 @@ +package land.chipmunk.chipmunkmod.mixin; + +import net.minecraft.client.gui.screen.ChatInputSuggestor; +import net.minecraft.client.gui.screen.ChatScreen; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(ChatScreen.class) +public interface ChatScreenAccessor { + @Accessor("chatInputSuggestor") + ChatInputSuggestor chatInputSuggestor (); +} diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerInvoker.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerInvoker.java deleted file mode 100644 index 9cac251..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerInvoker.java +++ /dev/null @@ -1,11 +0,0 @@ -package land.chipmunk.chipmunkmod.mixin; - -import net.minecraft.client.network.ClientPlayNetworkHandler; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(ClientPlayNetworkHandler.class) -public interface ClientPlayNetworkHandlerInvoker { - @Invoker("isSecureChatEnforced") - public boolean isSecureChatEnforced(); -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/ChatInputGlobals.java b/src/main/java/land/chipmunk/chipmunkmod/modules/ChatInputGlobals.java new file mode 100644 index 0000000..e30d5dc --- /dev/null +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/ChatInputGlobals.java @@ -0,0 +1,8 @@ +package land.chipmunk.chipmunkmod.modules; + +// bad +public class ChatInputGlobals { + public static String text = ""; + public static int cursor; + public static String textUpToCursor = ""; +} diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/TabComplete.java b/src/main/java/land/chipmunk/chipmunkmod/modules/TabComplete.java index de799d6..c493e8d 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/TabComplete.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/TabComplete.java @@ -16,7 +16,6 @@ import java.util.concurrent.CompletableFuture; public class TabComplete extends Listener { private final MinecraftClient client; - private int nextTransactionId = 0; private final Map> transactions = new HashMap<>(); public static TabComplete INSTANCE = new TabComplete(MinecraftClient.getInstance()); @@ -37,7 +36,7 @@ public class TabComplete extends Listener { if (connection == null) return null; - final int transactionId = nextTransactionId++; + final int transactionId = TransactionManager.INSTANCE.nextTransactionId(); connection.send(new RequestCommandCompletionsC2SPacket(transactionId, command)); final CompletableFuture future = new CompletableFuture<>(); diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/TransactionManager.java b/src/main/java/land/chipmunk/chipmunkmod/modules/TransactionManager.java new file mode 100644 index 0000000..03f7bd0 --- /dev/null +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/TransactionManager.java @@ -0,0 +1,11 @@ +package land.chipmunk.chipmunkmod.modules; + +public class TransactionManager { + public static final TransactionManager INSTANCE = new TransactionManager(); + + private int transactionId = 0; + + public int transactionId () { return transactionId; } + + public int nextTransactionId () { return transactionId++; } +} diff --git a/src/main/java/land/chipmunk/chipmunkmod/util/UUIDUtilities.java b/src/main/java/land/chipmunk/chipmunkmod/util/UUIDUtilities.java new file mode 100644 index 0000000..277c709 --- /dev/null +++ b/src/main/java/land/chipmunk/chipmunkmod/util/UUIDUtilities.java @@ -0,0 +1,24 @@ +package land.chipmunk.chipmunkmod.util; + +import java.nio.ByteBuffer; +import java.util.UUID; + +public class UUIDUtilities { + public static int[] intArray (UUID uuid) { + final ByteBuffer buffer = ByteBuffer.wrap(new byte[16]); + buffer.putLong(0, uuid.getMostSignificantBits()); + buffer.putLong(8, uuid.getLeastSignificantBits()); + + final int[] intArray = new int[4]; + for (int i = 0; i < intArray.length; i++) intArray[i] = buffer.getInt(); + + return intArray; + } + + public static String snbt (UUID uuid) { + int[] array = intArray(uuid); + return "[I;" + array[0] + "," + array[1] + "," + array[2] + "," + array[3] + "]"; // TODO: improve lol + } + + public static String selector (UUID uuid) { return "@a[limit=1,nbt={UUID:" + snbt(uuid) + "}]"; } +} diff --git a/src/main/resources/chipmunkmod.mixins.json b/src/main/resources/chipmunkmod.mixins.json index 16cfcb5..d73c2c6 100644 --- a/src/main/resources/chipmunkmod.mixins.json +++ b/src/main/resources/chipmunkmod.mixins.json @@ -6,12 +6,13 @@ "client": [ "ChatHudMixin", "ChatInputSuggestorMixin", + "ChatInputSuggestorAccessor", "ChatScreenMixin", + "ChatScreenAccessor", "ClientConnectionMixin", "ClientPlayerEntityMixin", "ClientPlayNetworkHandlerAccessor", "ClientPlayNetworkHandlerMixin", - "ClientPlayNetworkHandlerInvoker", "MinecraftClientAccessor", "LightmapTextureManagerMixin", "DecoderHandlerMixin", From 49327ce22e0a3cdc3d6c995e90713e3d1c18569f Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Tue, 4 Jul 2023 16:26:38 +0700 Subject: [PATCH 03/15] fart? --- .../land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java index 77d8f38..5d0075c 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java @@ -6,8 +6,6 @@ import land.chipmunk.chipmunkmod.listeners.Listener; import land.chipmunk.chipmunkmod.listeners.ListenerManager; import land.chipmunk.chipmunkmod.modules.ChatInputGlobals; import land.chipmunk.chipmunkmod.modules.RainbowName; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.hud.MessageIndicator; import net.minecraft.client.gui.screen.ChatScreen; @@ -45,19 +43,17 @@ public class ChatHudMixin { } try { - final Component component = message.asComponent(); - - final List children = component.children(); + final List children = message.getSiblings(); if (children.size() == 0) return; - if (!((TextComponent) children.get(0)).content().equals("chomens_bot_command_suggestion")) return; + if (!children.get(0).getString().equals("chomens_bot_command_suggestion")) return; ci.cancel(); final String[] matches = children.subList(2, children.size()) .stream() - .map((each) -> ((TextComponent) each).content()) + .map(Text::getString) .toArray(String[]::new); if (!(MinecraftClient.getInstance().currentScreen instanceof ChatScreen chatScreen)) return; From 143a47162dade9c5a30c7c043cc128472f43ed8f Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Tue, 4 Jul 2023 18:59:30 +0700 Subject: [PATCH 04/15] WIP /username not showing in player list fix current problem is display name, gamemode and latency not working but it shows in the player list now at least --- .../ClientPlayNetworkHandlerAccessor.java | 1 + .../mixin/ClientPlayNetworkHandlerMixin.java | 17 +++++-- .../mixin/PlayerListEntryAccessor.java | 16 +++++++ .../chipmunk/chipmunkmod/modules/Players.java | 48 +++++++++++++++++-- src/main/resources/chipmunkmod.mixins.json | 3 +- 5 files changed, 77 insertions(+), 8 deletions(-) create mode 100644 src/main/java/land/chipmunk/chipmunkmod/mixin/PlayerListEntryAccessor.java diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerAccessor.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerAccessor.java index acb74c0..6608a03 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerAccessor.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerAccessor.java @@ -2,6 +2,7 @@ package land.chipmunk.chipmunkmod.mixin; import net.minecraft.client.network.PlayerListEntry; import net.minecraft.network.ClientConnection; +import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; import net.minecraft.text.Text; diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java index 9cd2470..7debdfd 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java @@ -1,11 +1,19 @@ package land.chipmunk.chipmunkmod.mixin; +import com.mojang.authlib.GameProfile; import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.command.CommandManager; import land.chipmunk.chipmunkmod.modules.*; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.network.ClientDynamicRegistryType; +import net.minecraft.client.network.PlayerListEntry; +import net.minecraft.client.network.ServerInfo; +import net.minecraft.client.util.telemetry.WorldSession; import net.minecraft.command.CommandRegistryAccess; +import net.minecraft.network.ClientConnection; import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket; +import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket; import net.minecraft.network.packet.s2c.play.PlayerRemoveS2CPacket; import net.minecraft.registry.CombinedDynamicRegistries; import net.minecraft.resource.featuretoggle.FeatureSet; @@ -20,6 +28,11 @@ public class ClientPlayNetworkHandlerMixin { @Shadow private FeatureSet enabledFeatures; @Shadow private CombinedDynamicRegistries combinedDynamicRegistries; + @Inject(method = "", at = @At("TAIL")) + private void init (MinecraftClient client, Screen screen, ClientConnection connection, ServerInfo serverInfo, GameProfile profile, WorldSession worldSession, CallbackInfo ci) { + + } + @Inject(method = "onGameJoin", at = @At("TAIL")) private void onGameJoin (GameJoinS2CPacket packet, CallbackInfo ci) { final CommandRegistryAccess commandRegistryAccess = CommandRegistryAccess.of(this.combinedDynamicRegistries.getCombinedRegistryManager(), this.enabledFeatures); @@ -33,7 +46,5 @@ public class ClientPlayNetworkHandlerMixin { } @Inject(method = "onPlayerRemove", at = @At("HEAD"), cancellable = true) - private void onPlayerRemove (PlayerRemoveS2CPacket packet, CallbackInfo ci) { - ci.cancel(); - } + private void onPlayerRemove (PlayerRemoveS2CPacket packet, CallbackInfo ci) { ci.cancel(); } } diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/PlayerListEntryAccessor.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/PlayerListEntryAccessor.java new file mode 100644 index 0000000..39faf9a --- /dev/null +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/PlayerListEntryAccessor.java @@ -0,0 +1,16 @@ +package land.chipmunk.chipmunkmod.mixin; + +import net.minecraft.client.network.PlayerListEntry; +import net.minecraft.world.GameMode; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.gen.Invoker; + +@Mixin(PlayerListEntry.class) +public interface PlayerListEntryAccessor { + @Accessor("gameMode") + void setGameMode (GameMode gameMode); + + @Accessor("latency") + void setLatency (int latency); +} diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/Players.java b/src/main/java/land/chipmunk/chipmunkmod/modules/Players.java index e162342..1e21707 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/Players.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/Players.java @@ -3,11 +3,11 @@ package land.chipmunk.chipmunkmod.modules; import com.mojang.brigadier.Message; import com.mojang.brigadier.suggestion.Suggestion; import com.mojang.brigadier.suggestion.Suggestions; -import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.data.MutablePlayerListEntry; import land.chipmunk.chipmunkmod.listeners.Listener; import land.chipmunk.chipmunkmod.listeners.ListenerManager; import land.chipmunk.chipmunkmod.mixin.ClientPlayNetworkHandlerAccessor; +import land.chipmunk.chipmunkmod.mixin.PlayerListEntryAccessor; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.PlayerListEntry; import net.minecraft.network.packet.Packet; @@ -118,7 +118,9 @@ public class Players extends Listener { list.remove(duplicate); } - list.add(new MutablePlayerListEntry(newEntry)); + final MutablePlayerListEntry entry = new MutablePlayerListEntry(newEntry); + + list.add(entry); } catch (Exception e) { e.printStackTrace(); } @@ -130,6 +132,14 @@ public class Players extends Listener { if (target == null) return; target.gamemode = newEntry.gameMode(); + + final ClientPlayNetworkHandlerAccessor accessor = ((ClientPlayNetworkHandlerAccessor) MinecraftClient.getInstance().getNetworkHandler()); + + if (accessor == null) return; + + final PlayerListEntryAccessor entryAccessor = (PlayerListEntryAccessor) accessor.playerListEntries().get(newEntry.profile().getId()); + + entryAccessor.setGameMode(newEntry.gameMode()); } catch (Exception e) { e.printStackTrace(); } @@ -140,6 +150,14 @@ public class Players extends Listener { if (target == null) return; target.latency = newEntry.latency(); + + final ClientPlayNetworkHandlerAccessor accessor = ((ClientPlayNetworkHandlerAccessor) MinecraftClient.getInstance().getNetworkHandler()); + + if (accessor == null) return; + + final PlayerListEntryAccessor entryAccessor = (PlayerListEntryAccessor) accessor.playerListEntries().get(newEntry.profile().getId()); + + entryAccessor.setLatency(newEntry.latency()); } private void updateDisplayName (PlayerListS2CPacket.Entry newEntry) { @@ -147,6 +165,12 @@ public class Players extends Listener { if (target == null) return; target.displayName = newEntry.displayName(); + + final ClientPlayNetworkHandlerAccessor accessor = ((ClientPlayNetworkHandlerAccessor) MinecraftClient.getInstance().getNetworkHandler()); + + if (accessor == null) return; + + accessor.playerListEntries().get(newEntry.profile().getId()).setDisplayName(newEntry.displayName()); } private void removePlayer (UUID uuid) { @@ -155,7 +179,6 @@ public class Players extends Listener { if (target == null) return; if (!serverHasCommand("scoreboard")) { - ChipmunkMod.LOGGER.warn("Server doesn't have /scoreboard, so not showing vanished players."); removeFromPlayerList(uuid); return; } @@ -179,9 +202,14 @@ public class Players extends Listener { list.remove(target); - // TODO: fix players using /username gone from the player list, the cause is exactly at the next line and it's because uuid i guess removeFromPlayerList(uuid); + for (MutablePlayerListEntry entry : list) { + if (!entry.profile.getId().equals(uuid)) continue; + + addToPlayerList(new PlayerListEntry(entry.profile, false)); + } + return packet; }); } catch (Exception e) { @@ -189,6 +217,18 @@ public class Players extends Listener { } } + public void addToPlayerList (PlayerListEntry entry) { + client.getSocialInteractionsManager().setPlayerOnline(entry); + + final ClientPlayNetworkHandlerAccessor accessor = ((ClientPlayNetworkHandlerAccessor) MinecraftClient.getInstance().getNetworkHandler()); + + if (accessor == null) return; + + accessor.playerListEntries().put(entry.getProfile().getId(), entry); + + accessor.listedPlayerListEntries().add(entry); + } + private void removeFromPlayerList (UUID uuid) { client.getSocialInteractionsManager().setPlayerOffline(uuid); diff --git a/src/main/resources/chipmunkmod.mixins.json b/src/main/resources/chipmunkmod.mixins.json index d73c2c6..9dd6e9e 100644 --- a/src/main/resources/chipmunkmod.mixins.json +++ b/src/main/resources/chipmunkmod.mixins.json @@ -24,7 +24,8 @@ "DecoratedPotBlockEntitySherdsMixin", "TextMixin", "ClientConnectionInvoker", - "ClientConnectionAccessor" + "ClientConnectionAccessor", + "PlayerListEntryAccessor" ], "injectors": { "defaultRequire": 1 From 2452f555ef576206898d812cfa7da7b05b4486d4 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Thu, 6 Jul 2023 19:05:48 +0700 Subject: [PATCH 05/15] fix self care + some improvements --- .../chipmunk/chipmunkmod/ChipmunkMod.java | 2 + .../mixin/ClientPlayNetworkHandlerMixin.java | 4 +- .../chipmunkmod/modules/SelfCare.java | 41 ++++++++++++++----- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/main/java/land/chipmunk/chipmunkmod/ChipmunkMod.java b/src/main/java/land/chipmunk/chipmunkmod/ChipmunkMod.java index 7438ebe..478002f 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/ChipmunkMod.java +++ b/src/main/java/land/chipmunk/chipmunkmod/ChipmunkMod.java @@ -3,6 +3,7 @@ package land.chipmunk.chipmunkmod; import com.google.gson.GsonBuilder; import land.chipmunk.chipmunkmod.modules.KaboomCheck; import land.chipmunk.chipmunkmod.modules.Players; +import land.chipmunk.chipmunkmod.modules.SelfCare; import land.chipmunk.chipmunkmod.util.gson.BlockPosTypeAdapter; import net.fabricmc.api.ModInitializer; import java.io.InputStream; @@ -46,6 +47,7 @@ public class ChipmunkMod implements ModInitializer { Players.INSTANCE.init(); KaboomCheck.INSTANCE.init(); + SelfCare.INSTANCE.init(); LOGGER.info("Loaded ChipmunkMod (chayapak's fork)"); } diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java index 7debdfd..0839a98 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java @@ -7,13 +7,11 @@ import land.chipmunk.chipmunkmod.modules.*; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.network.ClientDynamicRegistryType; -import net.minecraft.client.network.PlayerListEntry; import net.minecraft.client.network.ServerInfo; import net.minecraft.client.util.telemetry.WorldSession; import net.minecraft.command.CommandRegistryAccess; import net.minecraft.network.ClientConnection; import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket; -import net.minecraft.network.packet.s2c.play.PlayerListS2CPacket; import net.minecraft.network.packet.s2c.play.PlayerRemoveS2CPacket; import net.minecraft.registry.CombinedDynamicRegistries; import net.minecraft.resource.featuretoggle.FeatureSet; @@ -39,7 +37,7 @@ public class ClientPlayNetworkHandlerMixin { KaboomCheck.INSTANCE.onJoin(); CommandManager.INSTANCE = new CommandManager(ChipmunkMod.CONFIG.commands.prefix, commandRegistryAccess); - SelfCare.INSTANCE.init(); + SelfCare.INSTANCE.onJoin(); LoopCrouch.INSTANCE.init(); SongPlayer.INSTANCE.coreReady(); RainbowName.INSTANCE.init(); diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/SelfCare.java b/src/main/java/land/chipmunk/chipmunkmod/modules/SelfCare.java index 256a458..3fc5aff 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/SelfCare.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/SelfCare.java @@ -3,11 +3,12 @@ package land.chipmunk.chipmunkmod.modules; import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.listeners.Listener; import land.chipmunk.chipmunkmod.listeners.ListenerManager; - import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayerEntity; - +import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket; +import net.minecraft.network.packet.s2c.play.GameStateChangeS2CPacket; import net.minecraft.text.Text; import java.util.Timer; @@ -24,14 +25,16 @@ public class SelfCare extends Listener { public boolean gamemodeEnabled = true; public boolean cspyEnabled = true; - public String skin; + private int gameMode; - private boolean cspy = false; - public boolean hasSkin = false; + public String skin; private Timer timer = null; private Timer chatTimer = null; + private boolean cspy = false; + public boolean hasSkin = false; + public static final SelfCare INSTANCE = new SelfCare(MinecraftClient.getInstance(), 70L, 500L); // make the intervals in config? public SelfCare (MinecraftClient client, long interval, long chatInterval) { @@ -44,7 +47,9 @@ public class SelfCare extends Listener { ListenerManager.addListener(this); } - public void init () { + public void init () {} + + public void onJoin () { final TimerTask task = new TimerTask() { public void run () { tick(); @@ -57,8 +62,6 @@ public class SelfCare extends Listener { } }; - if (timer != null || chatTimer != null) cleanup(); - timer = new Timer(); chatTimer = new Timer(); @@ -71,11 +74,11 @@ public class SelfCare extends Listener { timer.cancel(); timer.purge(); - timer = null; chatTimer.cancel(); chatTimer.purge(); - chatTimer = null; + + gameMode = -1; hasSkin = false; // cspy too mabe? @@ -105,7 +108,7 @@ public class SelfCare extends Listener { } if (player != null && !player.hasPermissionLevel(2) && opEnabled) { if (serverHasCommand("op")) networkHandler.sendChatCommand("op @s[type=player]"); } - else if (client.player != null && !client.player.isCreative() && gamemodeEnabled) networkHandler.sendChatCommand("gamemode creative"); + else if (gameMode != 1 && gamemodeEnabled) networkHandler.sendChatCommand("gamemode creative"); } public void chatTick () { @@ -114,4 +117,20 @@ public class SelfCare extends Listener { if (!cspy && cspyEnabled) { if (serverHasCommand("c")) networkHandler.sendChatCommand("c on"); } else if (!hasSkin && !skin.equals("off")) { if (serverHasCommand("skin")) networkHandler.sendChatCommand("skin " + skin); } } + + @Override + public void packetReceived(Packet packet) { + if (packet instanceof GameJoinS2CPacket) packetReceived((GameJoinS2CPacket) packet); + else if (packet instanceof GameStateChangeS2CPacket) packetReceived((GameStateChangeS2CPacket) packet); + } + + public void packetReceived(GameJoinS2CPacket packet) { + gameMode = packet.gameMode().getId(); + } + + public void packetReceived(GameStateChangeS2CPacket packet) { + if (packet.getReason() != GameStateChangeS2CPacket.GAME_MODE_CHANGED) return; + + gameMode = (int) packet.getValue(); + } } From 9a92ccbfec959760deb553609f1e5c928a62045c Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 8 Jul 2023 17:18:34 +0700 Subject: [PATCH 06/15] remove some commands for some reason --- .../chipmunkmod/command/CommandManager.java | 3 - .../commands/FullBrightCommand.java | 37 ----------- .../commands/LoopCrouchCommand.java | 37 ----------- .../chipmunkmod/commands/SelfCareCommand.java | 65 ------------------- .../mixin/ClientPlayNetworkHandlerMixin.java | 1 - .../chipmunkmod/mixin/KeyboardInputMixin.java | 54 --------------- .../mixin/LightmapTextureManagerMixin.java | 16 ----- .../chipmunkmod/modules/FullBright.java | 9 --- .../chipmunkmod/modules/LoopCrouch.java | 17 ----- src/main/resources/chipmunkmod.mixins.json | 2 - 10 files changed, 241 deletions(-) delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/commands/FullBrightCommand.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/commands/LoopCrouchCommand.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/mixin/KeyboardInputMixin.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/mixin/LightmapTextureManagerMixin.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/modules/FullBright.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/modules/LoopCrouch.java diff --git a/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java b/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java index c31b01a..c8cfbb0 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java +++ b/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java @@ -33,14 +33,11 @@ public class CommandManager { ItemCommand.register(this.dispatcher, commandRegistryAccess); CustomChatCommand.register(this.dispatcher); EvalCommand.register(this.dispatcher); - FullBrightCommand.register(this.dispatcher); MusicCommand.register(this.dispatcher); RainbowNameCommand.register(this.dispatcher); SayCommand.register(this.dispatcher); - SelfCareCommand.register(this.dispatcher); AutoSkinCommand.register(this.dispatcher); ReloadConfigCommand.register(this.dispatcher); - LoopCrouchCommand.register(this.dispatcher); } public void executeCommand (String command) { diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/FullBrightCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/FullBrightCommand.java deleted file mode 100644 index 5f76436..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/FullBrightCommand.java +++ /dev/null @@ -1,37 +0,0 @@ -package land.chipmunk.chipmunkmod.commands; - -import com.mojang.brigadier.Command; -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.context.CommandContext; -import land.chipmunk.chipmunkmod.modules.FullBright; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.text.Text; - -import static com.mojang.brigadier.arguments.BoolArgumentType.bool; -import static com.mojang.brigadier.arguments.BoolArgumentType.getBool; -import static land.chipmunk.chipmunkmod.command.CommandManager.argument; -import static land.chipmunk.chipmunkmod.command.CommandManager.literal; - -public class FullBrightCommand { - public static void register (CommandDispatcher dispatcher) { - dispatcher.register( - literal("fullbright") - .then( - argument("boolean", bool()) - .executes(FullBrightCommand::set) - ) - ); - } - - public static int set (CommandContext context) { - final FabricClientCommandSource source = context.getSource(); - - final boolean bool = getBool(context, "boolean"); - - FullBright.enabled = bool; - - source.sendFeedback(Text.literal("Fullbright is now " + (bool ? "enabled" : "disabled"))); - - return Command.SINGLE_SUCCESS; - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/LoopCrouchCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/LoopCrouchCommand.java deleted file mode 100644 index 4e33156..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/LoopCrouchCommand.java +++ /dev/null @@ -1,37 +0,0 @@ -package land.chipmunk.chipmunkmod.commands; - -import com.mojang.brigadier.Command; -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.context.CommandContext; -import land.chipmunk.chipmunkmod.modules.LoopCrouch; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.text.Text; - -import static com.mojang.brigadier.arguments.BoolArgumentType.bool; -import static com.mojang.brigadier.arguments.BoolArgumentType.getBool; -import static land.chipmunk.chipmunkmod.command.CommandManager.argument; -import static land.chipmunk.chipmunkmod.command.CommandManager.literal; - -public class LoopCrouchCommand { - public static void register (CommandDispatcher dispatcher) { - dispatcher.register( - literal("loopcrouch") - .then( - argument("enabled", bool()) - .executes(LoopCrouchCommand::run) - ) - ); - } - - public static int run (CommandContext context) { - final FabricClientCommandSource source = context.getSource(); - - final boolean enabled = getBool(context, "enabled"); - - LoopCrouch.INSTANCE.enabled = enabled; - - source.sendFeedback(Text.literal("Loop crouch is now " + (enabled ? "enabled" : "disabled"))); - - return Command.SINGLE_SUCCESS; - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java deleted file mode 100644 index d80e00f..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java +++ /dev/null @@ -1,65 +0,0 @@ -package land.chipmunk.chipmunkmod.commands; - -import com.mojang.brigadier.Command; -import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.context.CommandContext; -import land.chipmunk.chipmunkmod.modules.SelfCare; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.text.Text; - -import static com.mojang.brigadier.arguments.BoolArgumentType.bool; -import static com.mojang.brigadier.arguments.BoolArgumentType.getBool; -import static land.chipmunk.chipmunkmod.command.CommandManager.argument; -import static land.chipmunk.chipmunkmod.command.CommandManager.literal; - -public class SelfCareCommand { - public static void register (CommandDispatcher dispatcher) { - dispatcher.register( - literal("selfcare") - .then( - literal("op") - .then( - argument("boolean", bool()) - .executes(m -> setSelfCare(m, "op")) - ) - ) - .then( - literal("gamemode") - .then( - argument("boolean", bool()) - .executes(m -> setSelfCare(m, "gamemode")) - ) - ) - .then( - literal("cspy") - .then( - argument("boolean", bool()) - .executes(m -> setSelfCare(m, "cspy")) - ) - ) - ); - } - - // setSelfCare is probably not a good name for this - public static int setSelfCare (CommandContext context, String type) { - final FabricClientCommandSource source = context.getSource(); - final boolean bool = getBool(context, "boolean"); - - switch (type) { - case "op" -> { - SelfCare.INSTANCE.opEnabled = bool; - source.sendFeedback(Text.literal("The op self care is now " + (bool ? "enabled" : "disabled"))); - } - case "gamemode" -> { - SelfCare.INSTANCE.gamemodeEnabled = bool; - source.sendFeedback(Text.literal("The gamemode self care is now " + (bool ? "enabled" : "disabled"))); - } - case "cspy" -> { - SelfCare.INSTANCE.cspyEnabled = bool; - source.sendFeedback(Text.literal("The CommandSpy self care is now " + (bool ? "enabled" : "disabled"))); - } - } - - return Command.SINGLE_SUCCESS; - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java index 0839a98..27c8c53 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java @@ -38,7 +38,6 @@ public class ClientPlayNetworkHandlerMixin { KaboomCheck.INSTANCE.onJoin(); CommandManager.INSTANCE = new CommandManager(ChipmunkMod.CONFIG.commands.prefix, commandRegistryAccess); SelfCare.INSTANCE.onJoin(); - LoopCrouch.INSTANCE.init(); SongPlayer.INSTANCE.coreReady(); RainbowName.INSTANCE.init(); } diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/KeyboardInputMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/KeyboardInputMixin.java deleted file mode 100644 index 5465b1d..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/KeyboardInputMixin.java +++ /dev/null @@ -1,54 +0,0 @@ -package land.chipmunk.chipmunkmod.mixin; - -import land.chipmunk.chipmunkmod.modules.LoopCrouch; -import net.minecraft.client.input.Input; -import net.minecraft.client.input.KeyboardInput; -import net.minecraft.client.option.GameOptions; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Mutable; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(KeyboardInput.class) -public class KeyboardInputMixin extends Input { - @Final - @Mutable - @Shadow - private final GameOptions settings; - - public KeyboardInputMixin (GameOptions settings) { - this.settings = settings; - } - - @Inject(method = "tick", at = @At("TAIL")) - private void tick (boolean slowDown, float f, CallbackInfo ci) { - this.pressingForward = this.settings.forwardKey.isPressed(); - this.pressingBack = this.settings.backKey.isPressed(); - this.pressingLeft = this.settings.leftKey.isPressed(); - this.pressingRight = this.settings.rightKey.isPressed(); - this.movementForward = getMovementMultiplier(this.pressingForward, this.pressingBack); - this.movementSideways = getMovementMultiplier(this.pressingLeft, this.pressingRight); - this.jumping = this.settings.jumpKey.isPressed(); - - // ohio code - this.sneaking = LoopCrouch.INSTANCE.enabled ? - !LoopCrouch.INSTANCE.sneaking : - this.settings.sneakKey.isPressed(); - LoopCrouch.INSTANCE.sneaking = !LoopCrouch.INSTANCE.sneaking; - - if (slowDown) { - this.movementSideways *= f; - this.movementForward *= f; - } - } - - private float getMovementMultiplier(boolean positive, boolean negative) { - if (positive == negative) { - return 0.0f; - } - return positive ? 1.0f : -1.0f; - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/LightmapTextureManagerMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/LightmapTextureManagerMixin.java deleted file mode 100644 index 9512c7c..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/LightmapTextureManagerMixin.java +++ /dev/null @@ -1,16 +0,0 @@ -package land.chipmunk.chipmunkmod.mixin; - -import land.chipmunk.chipmunkmod.modules.FullBright; -import net.minecraft.client.render.LightmapTextureManager; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyArgs; -import org.spongepowered.asm.mixin.injection.invoke.arg.Args; - -@Mixin(LightmapTextureManager.class) -public class LightmapTextureManagerMixin { - @ModifyArgs(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/NativeImage;setColor(III)V")) - private void update (Args args) { - if (FullBright.enabled) args.set(2, 0xFFFFFFFF); - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/FullBright.java b/src/main/java/land/chipmunk/chipmunkmod/modules/FullBright.java deleted file mode 100644 index 6448dbe..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/FullBright.java +++ /dev/null @@ -1,9 +0,0 @@ -package land.chipmunk.chipmunkmod.modules; - -import land.chipmunk.chipmunkmod.ChipmunkMod; - - - -public class FullBright { - public static boolean enabled = ChipmunkMod.CONFIG.fullbright; -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/LoopCrouch.java b/src/main/java/land/chipmunk/chipmunkmod/modules/LoopCrouch.java deleted file mode 100644 index bf6f6b2..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/LoopCrouch.java +++ /dev/null @@ -1,17 +0,0 @@ -package land.chipmunk.chipmunkmod.modules; - - - - -public class LoopCrouch { - public static final LoopCrouch INSTANCE = new LoopCrouch(); - - public boolean enabled = false; - - public boolean sneaking = false; - - public LoopCrouch () { - } - - public void init () {} -} diff --git a/src/main/resources/chipmunkmod.mixins.json b/src/main/resources/chipmunkmod.mixins.json index 9dd6e9e..bad472d 100644 --- a/src/main/resources/chipmunkmod.mixins.json +++ b/src/main/resources/chipmunkmod.mixins.json @@ -14,11 +14,9 @@ "ClientPlayNetworkHandlerAccessor", "ClientPlayNetworkHandlerMixin", "MinecraftClientAccessor", - "LightmapTextureManagerMixin", "DecoderHandlerMixin", "StringHelperMixin", "NbtIoMixin", - "KeyboardInputMixin", "ElderGuardianAppearanceParticleMixin", "IdentifierMixin", "DecoratedPotBlockEntitySherdsMixin", From 0aedbff525ecbd00a935e3a44f0b931f08dadf81 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 8 Jul 2023 21:29:53 +0700 Subject: [PATCH 07/15] fix retard --- .../java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java index 9b826e1..99829f9 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java @@ -30,7 +30,7 @@ public class ChatScreenMixin extends Screen { public void sendMessage(String chatText, boolean addToHistory, CallbackInfoReturnable cir) { final CommandManager commandManager = CommandManager.INSTANCE; - if (ChipmunkMod.CONFIG.bots.testbot.webhookUrl != null) { + if (ChipmunkMod.CONFIG.bots.testbot.webhookUrl != null && chatText.startsWith(ChipmunkMod.CONFIG.bots.testbot.prefix)) { ChipmunkMod.executorService.submit(() -> { final Webhook webhook = new Webhook(ChipmunkMod.CONFIG.bots.testbot.webhookUrl); webhook.setUsername("ChipmunkMod"); From 1b7ace7aa8f32adc1ea302797fa0f589b8aedbdf Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Thu, 13 Jul 2023 20:22:19 +0700 Subject: [PATCH 08/15] add and fix stuff about chomens bot 15 files modified basically this fixes and improves the command suggestion and make the validation automatic --- .../chipmunkmod/command/CommandManager.java | 2 +- .../chipmunkmod/commands/ValidateCommand.java | 143 ++---------------- .../chipmunkmod/data/ChomeNSBotCommand.java | 20 +++ .../chipmunkmod/listeners/Listener.java | 4 + .../chipmunkmod/mixin/ChatHudMixin.java | 49 +----- .../mixin/ChatInputSuggestorAccessor.java | 17 --- .../mixin/ChatInputSuggestorMixin.java | 52 +++---- .../chipmunkmod/mixin/ChatScreenAccessor.java | 12 -- .../chipmunkmod/mixin/ChatScreenMixin.java | 29 +++- .../mixin/ClientPlayNetworkHandlerMixin.java | 2 + .../chipmunkmod/modules/ChatInputGlobals.java | 8 - .../modules/ChomeNSBotCommandSuggestions.java | 79 ++++++++++ .../chipmunkmod/modules/CommandCore.java | 49 +++++- .../util/BotValidationUtilities.java | 116 ++++++++++++++ src/main/resources/chipmunkmod.mixins.json | 2 - 15 files changed, 336 insertions(+), 248 deletions(-) create mode 100644 src/main/java/land/chipmunk/chipmunkmod/data/ChomeNSBotCommand.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorAccessor.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenAccessor.java delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/modules/ChatInputGlobals.java create mode 100644 src/main/java/land/chipmunk/chipmunkmod/modules/ChomeNSBotCommandSuggestions.java create mode 100644 src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java diff --git a/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java b/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java index c8cfbb0..6e438f8 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java +++ b/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java @@ -53,7 +53,7 @@ public class CommandManager { if (context != null) commandSource.sendError(context); } catch (CommandException e) { commandSource.sendError(e.getTextMessage()); - } catch (RuntimeException e) { + } catch (Exception e) { commandSource.sendError(Text.of(e.getMessage())); } } diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/ValidateCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/ValidateCommand.java index fa4734d..806f4cf 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/commands/ValidateCommand.java +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/ValidateCommand.java @@ -1,141 +1,28 @@ package land.chipmunk.chipmunkmod.commands; -import com.mojang.brigadier.Command; import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.context.CommandContext; -import static land.chipmunk.chipmunkmod.command.CommandManager.literal; -import static land.chipmunk.chipmunkmod.command.CommandManager.argument; -import static com.mojang.brigadier.arguments.StringArgumentType.greedyString; -import static com.mojang.brigadier.arguments.StringArgumentType.getString; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import net.minecraft.text.Text; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayNetworkHandler; -import java.util.Arrays; -import java.math.BigInteger; -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import land.chipmunk.chipmunkmod.ChipmunkMod; -import land.chipmunk.chipmunkmod.Configuration; -import land.chipmunk.chipmunkmod.util.Hexadecimal; + +import static com.mojang.brigadier.arguments.StringArgumentType.getString; +import static com.mojang.brigadier.arguments.StringArgumentType.greedyString; +import static land.chipmunk.chipmunkmod.command.CommandManager.argument; +import static land.chipmunk.chipmunkmod.command.CommandManager.literal; +import static land.chipmunk.chipmunkmod.util.BotValidationUtilities.*; public class ValidateCommand { - private static final SimpleCommandExceptionType UNSPECIFIED_KEY = new SimpleCommandExceptionType(Text.literal("The key of the bot is unspecified (null), did you incorrectly add it to your config?")); - public static void register (CommandDispatcher dispatcher) { dispatcher.register( literal("validate") - .then(literal("hbot").then(argument("command", greedyString()).executes(c -> hbot(c)))) - .then(literal("sbot").then(argument("command", greedyString()).executes(c -> sbot(c)))) - // .then(literal("chipmunk").then(argument("command", greedyString()).executes(c -> chipmunk(c)))) - .then(literal("chomens").then(argument("command", greedyString()).executes(c -> chomens(c)))) - .then(literal("kittycorp").then(argument("command", greedyString()).executes(c -> kittycorp(c)))) + .then(literal("hbot").then(argument("command", greedyString()).executes(c -> hbot(getString(c, "command"))))) + .then(literal("sbot").then(argument("command", greedyString()).executes(c -> sbot(getString(c, "command"))))) + // .then(literal("chipmunk").then(argument("command", greedyString()).executes(c -> chipmunk(getString(c, "command"))))) + .then(literal("chomens").then(argument("command", greedyString()).executes(c -> { + c.getSource().sendFeedback(Text.literal("Warning: Manual ChomeNS Bot validation is deprecated")); + + return chomens(getString(c, "command")); + }))) + .then(literal("kittycorp").then(argument("command", greedyString()).executes(c -> kittycorp(getString(c, "command"))))) ); } - - - public static int hbot (CommandContext context) throws CommandSyntaxException { - final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.hbot; - final String command = getString(context, "command"); - final MinecraftClient client = context.getSource().getClient(); - final ClientPlayNetworkHandler networkHandler = client.getNetworkHandler(); - - final String prefix = info.prefix; - final String key = info.key; - if (key == null) throw UNSPECIFIED_KEY.create(); - - try { - MessageDigest md = MessageDigest.getInstance("SHA-256"); - String time = String.valueOf(System.currentTimeMillis() / 10000); - String input = command.replaceAll("&[0-9a-fklmnor]", "") + ";" + client.player.getUuidAsString() + ";" + time + ";" + key; - byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8)); - BigInteger bigInt = new BigInteger(1, Arrays.copyOfRange(hash, 0, 4)); - String stringHash = bigInt.toString(Character.MAX_RADIX); - - networkHandler.sendChatMessage(prefix + command + " " + stringHash); - } catch (NoSuchAlgorithmException e) { - throw new SimpleCommandExceptionType(Text.literal(e.getMessage())).create(); - } - - return Command.SINGLE_SUCCESS; - } - - public static int sbot (CommandContext context) throws CommandSyntaxException { - final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.sbot; - final String command = getString(context, "command"); - final MinecraftClient client = context.getSource().getClient(); - final ClientPlayNetworkHandler networkHandler = client.getNetworkHandler(); - - final String prefix = info.prefix; - final String key = info.key; - if (key == null) throw UNSPECIFIED_KEY.create(); - - try { - MessageDigest md = MessageDigest.getInstance("SHA-256"); - String time = String.valueOf(System.currentTimeMillis() / 20000); - String input = prefix + command.replaceAll("&[0-9a-fklmnorx]", "") + ";" + client.player.getName() + ";" + time + ";" + key; - byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8)); - BigInteger bigInt = new BigInteger(1, Arrays.copyOfRange(hash, 0, 4)); - String stringHash = bigInt.toString(Character.MAX_RADIX); - - networkHandler.sendChatMessage(prefix + command + " " + stringHash); - } catch (NoSuchAlgorithmException e) { - throw new SimpleCommandExceptionType(Text.literal(e.getMessage())).create(); - } - - return Command.SINGLE_SUCCESS; - } - - public static int chomens (CommandContext context) throws CommandSyntaxException { - final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.chomens; - final String command = getString(context, "command"); - final ClientPlayNetworkHandler networkHandler = context.getSource().getClient().getNetworkHandler(); - - final String prefix = info.prefix; - final String key = info.key; - if (key == null) throw UNSPECIFIED_KEY.create(); - - try { - MessageDigest md = MessageDigest.getInstance("SHA-256"); - String time = String.valueOf(System.currentTimeMillis() / 5_000); - String input = time + key; - byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8)); - String stringHash = Hexadecimal.encode(hash).substring(0, 16); - - String[] arguments = command.split(" "); - networkHandler.sendChatMessage(prefix + arguments[0] + " " + stringHash + " " + String.join(" ", Arrays.copyOfRange(arguments, 1, arguments.length))); - } catch (NoSuchAlgorithmException e) { - throw new SimpleCommandExceptionType(Text.literal(e.getMessage())).create(); - } - - return Command.SINGLE_SUCCESS; - } - - public static int kittycorp (CommandContext context) throws CommandSyntaxException { - final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.kittycorp; - final String command = getString(context, "command"); - final ClientPlayNetworkHandler networkHandler = context.getSource().getClient().getNetworkHandler(); - - final String prefix = info.prefix; - final String key = info.key; - if (key == null) throw UNSPECIFIED_KEY.create(); - - try { - MessageDigest md = MessageDigest.getInstance("SHA-256"); - String time = String.valueOf(System.currentTimeMillis() / 10000); - String input = prefix + command.replaceAll("&[0-9a-fklmnorx]", "") + ";" + time + ";" + key; - byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8)); - BigInteger bigInt = new BigInteger(1, Arrays.copyOfRange(hash, 0, 4)); - String stringHash = bigInt.toString(Character.MAX_RADIX); - - networkHandler.sendChatMessage(prefix + command + " " + stringHash); - } catch (NoSuchAlgorithmException e) { - throw new SimpleCommandExceptionType(Text.literal(e.getMessage())).create(); - } - - return Command.SINGLE_SUCCESS; - } } diff --git a/src/main/java/land/chipmunk/chipmunkmod/data/ChomeNSBotCommand.java b/src/main/java/land/chipmunk/chipmunkmod/data/ChomeNSBotCommand.java new file mode 100644 index 0000000..978e705 --- /dev/null +++ b/src/main/java/land/chipmunk/chipmunkmod/data/ChomeNSBotCommand.java @@ -0,0 +1,20 @@ +package land.chipmunk.chipmunkmod.data; + +public class ChomeNSBotCommand { + public final String name; + public final TrustLevel trustLevel; + + public ChomeNSBotCommand ( + String name, + TrustLevel trustLevel + ) { + this.name = name; + this.trustLevel = trustLevel; + } + + public enum TrustLevel { + PUBLIC, + TRUSTED, + OWNER + } +} diff --git a/src/main/java/land/chipmunk/chipmunkmod/listeners/Listener.java b/src/main/java/land/chipmunk/chipmunkmod/listeners/Listener.java index 5542c0e..26864e8 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/listeners/Listener.java +++ b/src/main/java/land/chipmunk/chipmunkmod/listeners/Listener.java @@ -9,4 +9,8 @@ public class Listener { public void packetReceived (Packet packet) {} public void packetSent (Packet packet) {} + + public void coreReady () {} + + public void coreMoved () {} } diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java index 5d0075c..1d83869 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java @@ -1,15 +1,11 @@ package land.chipmunk.chipmunkmod.mixin; -import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.listeners.Listener; import land.chipmunk.chipmunkmod.listeners.ListenerManager; -import land.chipmunk.chipmunkmod.modules.ChatInputGlobals; +import land.chipmunk.chipmunkmod.modules.ChomeNSBotCommandSuggestions; import land.chipmunk.chipmunkmod.modules.RainbowName; -import net.minecraft.client.MinecraftClient; +import net.kyori.adventure.text.TextComponent; import net.minecraft.client.gui.hud.MessageIndicator; -import net.minecraft.client.gui.screen.ChatScreen; -import net.minecraft.command.CommandSource; import net.minecraft.network.message.MessageSignatureData; import net.minecraft.text.Text; import net.minecraft.text.TranslatableTextContent; @@ -18,8 +14,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.List; - @Mixin(net.minecraft.client.gui.hud.ChatHud.class) public class ChatHudMixin { @Inject(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V", cancellable = true) @@ -43,40 +37,9 @@ public class ChatHudMixin { } try { - final List children = message.getSiblings(); - - if (children.size() == 0) return; - - if (!children.get(0).getString().equals("chomens_bot_command_suggestion")) return; - - ci.cancel(); - - final String[] matches = children.subList(2, children.size()) - .stream() - .map(Text::getString) - .toArray(String[]::new); - - if (!(MinecraftClient.getInstance().currentScreen instanceof ChatScreen chatScreen)) return; - - final ChatScreenAccessor chatScreenAccessor = (ChatScreenAccessor) chatScreen; - - final ChatInputSuggestorAccessor chatInputSuggestorAccessor = (ChatInputSuggestorAccessor) chatScreenAccessor.chatInputSuggestor(); - - chatInputSuggestorAccessor.setPendingSuggestions( - CommandSource.suggestMatching( - matches, - new SuggestionsBuilder( - ChatInputGlobals.textUpToCursor, - ChipmunkMod.CONFIG.bots.chomens.prefix.length() - ) - ) - ); - - chatInputSuggestorAccessor.pendingSuggestions().thenRun(() -> { - if (!chatInputSuggestorAccessor.pendingSuggestions().isDone()) return; - - ((ChatScreenAccessor) chatScreen).chatInputSuggestor().show(true); - }); - } catch (ClassCastException | NumberFormatException ignored) {} + if (((TextComponent) message.asComponent().children().get(0)).content().equals(ChomeNSBotCommandSuggestions.ID)) { + ci.cancel(); + } + } catch (Exception ignored) {} } } diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorAccessor.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorAccessor.java deleted file mode 100644 index dd9e9c5..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorAccessor.java +++ /dev/null @@ -1,17 +0,0 @@ -package land.chipmunk.chipmunkmod.mixin; - -import com.mojang.brigadier.suggestion.Suggestions; -import net.minecraft.client.gui.screen.ChatInputSuggestor; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -import java.util.concurrent.CompletableFuture; - -@Mixin(ChatInputSuggestor.class) -public interface ChatInputSuggestorAccessor { - @Accessor("pendingSuggestions") - CompletableFuture pendingSuggestions (); - - @Accessor("pendingSuggestions") - void setPendingSuggestions (CompletableFuture pendingSuggestions); -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorMixin.java index 49ce058..eef285a 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatInputSuggestorMixin.java @@ -3,18 +3,16 @@ package land.chipmunk.chipmunkmod.mixin; import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.suggestion.Suggestions; +import com.mojang.brigadier.suggestion.SuggestionsBuilder; import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.command.CommandManager; -import land.chipmunk.chipmunkmod.modules.ChatInputGlobals; -import land.chipmunk.chipmunkmod.modules.CommandCore; -import land.chipmunk.chipmunkmod.modules.TransactionManager; -import land.chipmunk.chipmunkmod.util.UUIDUtilities; +import land.chipmunk.chipmunkmod.data.ChomeNSBotCommand; +import land.chipmunk.chipmunkmod.modules.ChomeNSBotCommandSuggestions; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.command.CommandSource; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mutable; @@ -38,6 +36,11 @@ public class ChatInputSuggestorMixin { @Shadow public void show (boolean narrateFirstSuggestion) {} + @Shadow + private static int getStartOfCurrentWord (String input) { + return 0; + } + @Mutable @Final @Shadow @@ -47,8 +50,6 @@ public class ChatInputSuggestorMixin { textField = null; } - public int transactionId = 0; - @Inject(at = @At("TAIL"), method = "refresh()V") public void refresh (CallbackInfo ci) { if (slashOptional) return; @@ -62,28 +63,27 @@ public class ChatInputSuggestorMixin { final String chomeNSPrefix = ChipmunkMod.CONFIG.bots.chomens.prefix; - if (text.startsWith(chomeNSPrefix) && player != null) { - final String textUpToCursor = text.substring(chomeNSPrefix.length(), Math.max(chomeNSPrefix.length(), cursor)); + if (!text.contains(" ") && text.startsWith(chomeNSPrefix) && player != null) { + final String textUpToCursor = text.substring(0, cursor); - ChatInputGlobals.text = text; - ChatInputGlobals.cursor = cursor; - ChatInputGlobals.textUpToCursor = textUpToCursor; + final List commands = ChomeNSBotCommandSuggestions.INSTANCE.commands + .stream() + .map((command) -> command.name) + .toList(); - final String selfSelector = UUIDUtilities.selector(player.getUuid()); - - TransactionManager.INSTANCE.nextTransactionId(); - - final Component component = Component - .text("chomens_bot_command_suggestion") - .append(Component.text(transactionId)) - .append(Component.text(selfSelector)) - .append(Component.text(textUpToCursor)); - - CommandCore.INSTANCE.run( - "minecraft:tellraw @a[tag=chomens_bot] " + GsonComponentSerializer.gson().serialize(component) + pendingSuggestions = CommandSource.suggestMatching( + commands, + new SuggestionsBuilder( + textUpToCursor, + getStartOfCurrentWord(textUpToCursor) + ) ); - transactionId++; + pendingSuggestions.thenRun(() -> { + if (!pendingSuggestions.isDone()) return; + + show(true); + }); return; } diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenAccessor.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenAccessor.java deleted file mode 100644 index e2e9ae2..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package land.chipmunk.chipmunkmod.mixin; - -import net.minecraft.client.gui.screen.ChatInputSuggestor; -import net.minecraft.client.gui.screen.ChatScreen; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(ChatScreen.class) -public interface ChatScreenAccessor { - @Accessor("chatInputSuggestor") - ChatInputSuggestor chatInputSuggestor (); -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java index 99829f9..07b30b6 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java @@ -2,7 +2,10 @@ package land.chipmunk.chipmunkmod.mixin; import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.command.CommandManager; +import land.chipmunk.chipmunkmod.data.ChomeNSBotCommand; +import land.chipmunk.chipmunkmod.modules.ChomeNSBotCommandSuggestions; import land.chipmunk.chipmunkmod.modules.CustomChat; +import land.chipmunk.chipmunkmod.util.BotValidationUtilities; import land.chipmunk.chipmunkmod.util.Webhook; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ChatInputSuggestor; @@ -12,12 +15,14 @@ import net.minecraft.text.MutableText; import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.io.IOException; +import java.util.List; @Mixin(net.minecraft.client.gui.screen.ChatScreen.class) public class ChatScreenMixin extends Screen { @@ -28,6 +33,8 @@ public class ChatScreenMixin extends Screen { @Inject(at = @At("HEAD"), method = "sendMessage", cancellable = true) public void sendMessage(String chatText, boolean addToHistory, CallbackInfoReturnable cir) { + if (addToHistory) MinecraftClient.getInstance().inGameHud.getChatHud().addToMessageHistory(chatText); + final CommandManager commandManager = CommandManager.INSTANCE; if (ChipmunkMod.CONFIG.bots.testbot.webhookUrl != null && chatText.startsWith(ChipmunkMod.CONFIG.bots.testbot.prefix)) { @@ -41,19 +48,32 @@ public class ChatScreenMixin extends Screen { e.printStackTrace(); } }); + } else if (chatText.startsWith(ChipmunkMod.CONFIG.bots.chomens.prefix)) { + final List commands = ChomeNSBotCommandSuggestions.INSTANCE.commands; + + final List moreOrTrustedCommands = commands.stream() + .filter((command) -> command.trustLevel != ChomeNSBotCommand.TrustLevel.PUBLIC) + .map((command) -> command.name.toLowerCase()) + .toList(); + + if (moreOrTrustedCommands.contains(chatText.toLowerCase().split("\\s")[0])) { + try { + BotValidationUtilities.chomens(chatText.substring(ChipmunkMod.CONFIG.bots.chomens.prefix.length())); + + cir.setReturnValue(true); + + return; + } catch (Exception ignored) {} + } } if (chatText.startsWith(commandManager.prefix)) { commandManager.executeCommand(chatText.substring(commandManager.prefix.length())); - if (addToHistory) MinecraftClient.getInstance().inGameHud.getChatHud().addToMessageHistory(chatText); - cir.setReturnValue(true); } else if (!chatText.startsWith("/")) { CustomChat.INSTANCE.chat(chatText); - if (addToHistory) MinecraftClient.getInstance().inGameHud.getChatHud().addToMessageHistory(chatText); - cir.setReturnValue(true); } } @@ -86,6 +106,7 @@ public class ChatScreenMixin extends Screen { ci.cancel(); } + @Unique private void onChatFieldUpdate(String chatText) { String string = this.chatField.getText(); this.chatInputSuggestor.setWindowActive(!string.equals(this.originalChatText)); diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java index 27c8c53..d36ec6c 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java @@ -38,8 +38,10 @@ public class ClientPlayNetworkHandlerMixin { KaboomCheck.INSTANCE.onJoin(); CommandManager.INSTANCE = new CommandManager(ChipmunkMod.CONFIG.commands.prefix, commandRegistryAccess); SelfCare.INSTANCE.onJoin(); + CommandCore.INSTANCE.init(); SongPlayer.INSTANCE.coreReady(); RainbowName.INSTANCE.init(); + ChomeNSBotCommandSuggestions.INSTANCE.init(); } @Inject(method = "onPlayerRemove", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/ChatInputGlobals.java b/src/main/java/land/chipmunk/chipmunkmod/modules/ChatInputGlobals.java deleted file mode 100644 index e30d5dc..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/ChatInputGlobals.java +++ /dev/null @@ -1,8 +0,0 @@ -package land.chipmunk.chipmunkmod.modules; - -// bad -public class ChatInputGlobals { - public static String text = ""; - public static int cursor; - public static String textUpToCursor = ""; -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/ChomeNSBotCommandSuggestions.java b/src/main/java/land/chipmunk/chipmunkmod/modules/ChomeNSBotCommandSuggestions.java new file mode 100644 index 0000000..7f86071 --- /dev/null +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/ChomeNSBotCommandSuggestions.java @@ -0,0 +1,79 @@ +package land.chipmunk.chipmunkmod.modules; + +import land.chipmunk.chipmunkmod.ChipmunkMod; +import land.chipmunk.chipmunkmod.data.ChomeNSBotCommand; +import land.chipmunk.chipmunkmod.listeners.Listener; +import land.chipmunk.chipmunkmod.listeners.ListenerManager; +import land.chipmunk.chipmunkmod.util.UUIDUtilities; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.text.Text; + +import java.util.ArrayList; +import java.util.List; + +public class ChomeNSBotCommandSuggestions extends Listener { + public static final String ID = "chomens_bot_request_command_suggestion"; + + public static ChomeNSBotCommandSuggestions INSTANCE = new ChomeNSBotCommandSuggestions(MinecraftClient.getInstance()); + + private final MinecraftClient client; + + public List commands = new ArrayList<>(); + + public ChomeNSBotCommandSuggestions (MinecraftClient client) { + this.client = client; + + ListenerManager.addListener(this); + } + + public void init () {} + + @Override + public void coreMoved () { forceRequest(); } + + public void forceRequest () { + final ClientPlayerEntity player = client.player; + + if (player == null) return; + + final String selector = UUIDUtilities.selector(player.getUuid()); + + final Component component = Component + .text(ID) + .append(Component.text(selector)); + + final String serialized = GsonComponentSerializer.gson().serialize(component); + + CommandCore.INSTANCE.run("tellraw @a[tag=chomens_bot] " + serialized); + } + + @Override + public void chatMessageReceived(Text message) { + try { + final Component component = message.asComponent(); + + final List children = component.children(); + + if (children.size() == 0) return; + + final TextComponent textComponent = (TextComponent) children.get(0); + + if (!textComponent.content().equals(ID)) return; + + commands = children.subList(1, children.size()) + .stream() + .map( + (eachCum) -> + new ChomeNSBotCommand( + ChipmunkMod.CONFIG.bots.chomens.prefix + ((TextComponent) eachCum).content(), + ChomeNSBotCommand.TrustLevel.valueOf(((TextComponent) eachCum.children().get(0)).content()) + ) + ) + .toList(); + } catch (Exception ignored) {} + } +} diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java b/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java index 0b77372..8e00299 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/CommandCore.java @@ -4,14 +4,18 @@ import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.data.BlockArea; +import land.chipmunk.chipmunkmod.listeners.Listener; +import land.chipmunk.chipmunkmod.listeners.ListenerManager; import net.minecraft.block.entity.CommandBlockBlockEntity; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.nbt.NbtCompound; import net.minecraft.network.ClientConnection; import net.minecraft.network.packet.c2s.play.UpdateCommandBlockC2SPacket; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; +import java.util.List; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.CompletableFuture; @@ -23,6 +27,8 @@ public class CommandCore { public BlockArea relativeArea; public BlockPos currentBlockRelative; + private Timer timer; + public static CommandCore INSTANCE = new CommandCore(MinecraftClient.getInstance(), ChipmunkMod.CONFIG.core.relativeArea); public CommandCore (MinecraftClient client, BlockArea relativeArea) { @@ -30,16 +36,34 @@ public class CommandCore { this.relativeArea = relativeArea; } + public void init () { + if (timer != null) { + cleanup(); + return; + } + + final TimerTask task = new TimerTask() { + public void run () { + tick(); + } + }; + + timer = new Timer(); + + timer.schedule(task, 50, 50); + } + + private void tick () { + final ClientPlayNetworkHandler networkHandler = client.getNetworkHandler(); + + if (networkHandler == null) cleanup(); + } + public void reloadRelativeArea () { relativeArea = ChipmunkMod.CONFIG.core.relativeArea; } public void move (Vec3d position) { - if (!ready) { - ready = true; - // for (Listener listener : listeners) listener.ready(); - } - origin = new BlockPos( ((int) position.getX() / 16) * 16, 0, // TODO: Use the actual bottom of the world instead of hardcoding to 0 @@ -48,6 +72,13 @@ public class CommandCore { if (currentBlockRelative == null) currentBlockRelative = new BlockPos(relativeArea.start); refill(); + + for (Listener listener : ListenerManager.listeners) listener.coreMoved(); + if (!ready) { + ready = true; + + for (Listener listener : ListenerManager.listeners) listener.coreReady(); + } } public void refill () { @@ -131,8 +162,7 @@ public class CommandCore { final TimerTask queryTask = new TimerTask() { public void run () { - client.getNetworkHandler().getDataQueryHandler().queryBlockNbt(currentBlock, - future::complete); + client.getNetworkHandler().getDataQueryHandler().queryBlockNbt(currentBlock, future::complete); timer.cancel(); // ? Is this necesary? timer.purge(); @@ -145,6 +175,11 @@ public class CommandCore { } public void cleanup () { + if (timer == null) return; + + timer.cancel(); + timer.purge(); + origin = null; currentBlockRelative = null; ready = false; diff --git a/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java b/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java new file mode 100644 index 0000000..d300d1b --- /dev/null +++ b/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java @@ -0,0 +1,116 @@ +package land.chipmunk.chipmunkmod.util; + +import com.mojang.brigadier.Command; +import land.chipmunk.chipmunkmod.ChipmunkMod; +import land.chipmunk.chipmunkmod.Configuration; +import land.chipmunk.chipmunkmod.modules.CustomChat; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayNetworkHandler; + +import java.math.BigInteger; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; + +public class BotValidationUtilities { + public static int hbot (String command) throws RuntimeException { + final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.hbot; + final MinecraftClient client = MinecraftClient.getInstance(); + final ClientPlayNetworkHandler networkHandler = client.getNetworkHandler(); + + final String prefix = info.prefix; + final String key = info.key; + if (key == null) throw new RuntimeException("The key of the bot is unspecified (null), did you incorrectly add it to your config?"); + + try { + MessageDigest md = MessageDigest.getInstance("SHA-256"); + String time = String.valueOf(System.currentTimeMillis() / 10000); + String input = command.replaceAll("&[0-9a-fklmnor]", "") + ";" + client.player.getUuidAsString() + ";" + time + ";" + key; + byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8)); + BigInteger bigInt = new BigInteger(1, Arrays.copyOfRange(hash, 0, 4)); + String stringHash = bigInt.toString(Character.MAX_RADIX); + + networkHandler.sendChatMessage(prefix + command + " " + stringHash); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + + return Command.SINGLE_SUCCESS; + } + + public static int sbot (String command) throws RuntimeException { + final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.sbot; + final MinecraftClient client = MinecraftClient.getInstance(); + final ClientPlayNetworkHandler networkHandler = client.getNetworkHandler(); + + final String prefix = info.prefix; + final String key = info.key; + if (key == null) throw new RuntimeException("The key of the bot is unspecified (null), did you incorrectly add it to your config?"); + + try { + MessageDigest md = MessageDigest.getInstance("SHA-256"); + String time = String.valueOf(System.currentTimeMillis() / 20000); + String input = prefix + command.replaceAll("&[0-9a-fklmnorx]", "") + ";" + client.player.getName() + ";" + time + ";" + key; + byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8)); + BigInteger bigInt = new BigInteger(1, Arrays.copyOfRange(hash, 0, 4)); + String stringHash = bigInt.toString(Character.MAX_RADIX); + + networkHandler.sendChatMessage(prefix + command + " " + stringHash); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + + return Command.SINGLE_SUCCESS; + } + + public static int chomens (String command) throws RuntimeException { + final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.chomens; + + final String prefix = info.prefix; + final String key = info.key; + if (key == null) throw new RuntimeException("The key of the bot is unspecified (null), did you incorrectly add it to your config?"); + + try { + MessageDigest md = MessageDigest.getInstance("SHA-256"); + String time = String.valueOf(System.currentTimeMillis() / 5_000); + String input = time + key; + byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8)); + String stringHash = Hexadecimal.encode(hash).substring(0, 16); + + String[] arguments = command.split(" "); + + final String toSend = prefix + arguments[0] + " " + stringHash + " " + String.join(" ", Arrays.copyOfRange(arguments, 1, arguments.length)); + + CustomChat.INSTANCE.chat(toSend); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + + return Command.SINGLE_SUCCESS; + } + + public static int kittycorp (String command) throws RuntimeException { + final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.kittycorp; + final ClientPlayNetworkHandler networkHandler = MinecraftClient.getInstance().getNetworkHandler(); + + final String prefix = info.prefix; + final String key = info.key; + if (key == null) throw new RuntimeException("The key of the bot is unspecified (null), did you incorrectly add it to your config?"); + + try { + MessageDigest md = MessageDigest.getInstance("SHA-256"); + String time = String.valueOf(System.currentTimeMillis() / 10000); + String input = prefix + command.replaceAll("&[0-9a-fklmnorx]", "") + ";" + time + ";" + key; + byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8)); + BigInteger bigInt = new BigInteger(1, Arrays.copyOfRange(hash, 0, 4)); + String stringHash = bigInt.toString(Character.MAX_RADIX); + + networkHandler.sendChatMessage(prefix + command + " " + stringHash); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + + return Command.SINGLE_SUCCESS; + } +} diff --git a/src/main/resources/chipmunkmod.mixins.json b/src/main/resources/chipmunkmod.mixins.json index bad472d..920438c 100644 --- a/src/main/resources/chipmunkmod.mixins.json +++ b/src/main/resources/chipmunkmod.mixins.json @@ -6,9 +6,7 @@ "client": [ "ChatHudMixin", "ChatInputSuggestorMixin", - "ChatInputSuggestorAccessor", "ChatScreenMixin", - "ChatScreenAccessor", "ClientConnectionMixin", "ClientPlayerEntityMixin", "ClientPlayNetworkHandlerAccessor", From 2081ed942352128577a1ad90b8750dc9893c0135 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Fri, 14 Jul 2023 16:49:23 +0700 Subject: [PATCH 09/15] owo --- .../modules/ChomeNSBotCommandSuggestions.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/ChomeNSBotCommandSuggestions.java b/src/main/java/land/chipmunk/chipmunkmod/modules/ChomeNSBotCommandSuggestions.java index 7f86071..9f12d1f 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/ChomeNSBotCommandSuggestions.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/ChomeNSBotCommandSuggestions.java @@ -13,6 +13,7 @@ import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.text.Text; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class ChomeNSBotCommandSuggestions extends Listener { @@ -67,13 +68,14 @@ public class ChomeNSBotCommandSuggestions extends Listener { commands = children.subList(1, children.size()) .stream() .map( - (eachCum) -> - new ChomeNSBotCommand( - ChipmunkMod.CONFIG.bots.chomens.prefix + ((TextComponent) eachCum).content(), - ChomeNSBotCommand.TrustLevel.valueOf(((TextComponent) eachCum.children().get(0)).content()) - ) + (eachCum) -> new ChomeNSBotCommand( + ChipmunkMod.CONFIG.bots.chomens.prefix + ((TextComponent) eachCum).content(), + ChomeNSBotCommand.TrustLevel.valueOf(((TextComponent) eachCum.children().get(0)).content()) + ) ) .toList(); - } catch (Exception ignored) {} + } catch (Exception ignored) { + ignored.printStackTrace(); + } } } From a9972c323c923ac6fe0df5bb6818f2dd93b386ec Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Fri, 14 Jul 2023 20:57:31 +0700 Subject: [PATCH 10/15] move to play network hadnler so it doens't log in mc logs this actually took ages beacuse i am dumb --- .../chipmunkmod/mixin/ChatHudMixin.java | 45 ------------------- .../mixin/ClientPlayNetworkHandlerMixin.java | 40 +++++++++++++++++ .../modules/ChomeNSBotCommandSuggestions.java | 4 +- src/main/resources/chipmunkmod.mixins.json | 1 - 4 files changed, 41 insertions(+), 49 deletions(-) delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java deleted file mode 100644 index 1d83869..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatHudMixin.java +++ /dev/null @@ -1,45 +0,0 @@ -package land.chipmunk.chipmunkmod.mixin; - -import land.chipmunk.chipmunkmod.listeners.Listener; -import land.chipmunk.chipmunkmod.listeners.ListenerManager; -import land.chipmunk.chipmunkmod.modules.ChomeNSBotCommandSuggestions; -import land.chipmunk.chipmunkmod.modules.RainbowName; -import net.kyori.adventure.text.TextComponent; -import net.minecraft.client.gui.hud.MessageIndicator; -import net.minecraft.network.message.MessageSignatureData; -import net.minecraft.text.Text; -import net.minecraft.text.TranslatableTextContent; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(net.minecraft.client.gui.hud.ChatHud.class) -public class ChatHudMixin { - @Inject(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V", cancellable = true) - public void addMessage(Text message, MessageSignatureData signature, int ticks, MessageIndicator indicator, boolean refresh, CallbackInfo ci) { - if (RainbowName.INSTANCE.enabled) { - if (message.getString().contains("Your nickname is now ") || message.getString().contains("Nickname changed.")) { - ci.cancel(); - return; - } - } - - try { - if (((TranslatableTextContent) message.getContent()).getKey().equals("advMode.setCommand.success")) { - ci.cancel(); - return; - } - } catch (ClassCastException ignored) {} - - for (Listener listener : ListenerManager.listeners) { - listener.chatMessageReceived(message); - } - - try { - if (((TextComponent) message.asComponent().children().get(0)).content().equals(ChomeNSBotCommandSuggestions.ID)) { - ci.cancel(); - } - } catch (Exception ignored) {} - } -} diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java index d36ec6c..020de43 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ClientPlayNetworkHandlerMixin.java @@ -3,7 +3,10 @@ package land.chipmunk.chipmunkmod.mixin; import com.mojang.authlib.GameProfile; import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.command.CommandManager; +import land.chipmunk.chipmunkmod.listeners.Listener; +import land.chipmunk.chipmunkmod.listeners.ListenerManager; import land.chipmunk.chipmunkmod.modules.*; +import net.kyori.adventure.text.TextComponent; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.network.ClientDynamicRegistryType; @@ -12,9 +15,12 @@ import net.minecraft.client.util.telemetry.WorldSession; import net.minecraft.command.CommandRegistryAccess; import net.minecraft.network.ClientConnection; import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket; +import net.minecraft.network.packet.s2c.play.GameMessageS2CPacket; import net.minecraft.network.packet.s2c.play.PlayerRemoveS2CPacket; import net.minecraft.registry.CombinedDynamicRegistries; import net.minecraft.resource.featuretoggle.FeatureSet; +import net.minecraft.text.Text; +import net.minecraft.text.TranslatableTextContent; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -46,4 +52,38 @@ public class ClientPlayNetworkHandlerMixin { @Inject(method = "onPlayerRemove", at = @At("HEAD"), cancellable = true) private void onPlayerRemove (PlayerRemoveS2CPacket packet, CallbackInfo ci) { ci.cancel(); } + + + @Inject(method = "onGameMessage", at = @At("HEAD"), cancellable = true) + private void onGameMessage (GameMessageS2CPacket packet, CallbackInfo ci) { + final Text message = packet.content(); + + try { + if (RainbowName.INSTANCE.enabled) { + if (message.getString().contains("Your nickname is now ") || message.getString().contains("Nickname changed.")) { + ci.cancel(); + return; + } + } + + try { + if (((TranslatableTextContent) message.getContent()).getKey().equals("advMode.setCommand.success")) { + ci.cancel(); + return; + } + } catch (ClassCastException ignored) {} + + for (Listener listener : ListenerManager.listeners) { + listener.chatMessageReceived(message); + } + + try { + if (((TextComponent) message.asComponent().children().get(0)).content().equals(ChomeNSBotCommandSuggestions.ID)) { + ci.cancel(); + } + } catch (Exception ignored) {} + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/ChomeNSBotCommandSuggestions.java b/src/main/java/land/chipmunk/chipmunkmod/modules/ChomeNSBotCommandSuggestions.java index 9f12d1f..32a28b2 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/ChomeNSBotCommandSuggestions.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/ChomeNSBotCommandSuggestions.java @@ -74,8 +74,6 @@ public class ChomeNSBotCommandSuggestions extends Listener { ) ) .toList(); - } catch (Exception ignored) { - ignored.printStackTrace(); - } + } catch (Exception ignored) {} } } diff --git a/src/main/resources/chipmunkmod.mixins.json b/src/main/resources/chipmunkmod.mixins.json index 920438c..063bc82 100644 --- a/src/main/resources/chipmunkmod.mixins.json +++ b/src/main/resources/chipmunkmod.mixins.json @@ -4,7 +4,6 @@ "package": "land.chipmunk.chipmunkmod.mixin", "compatibilityLevel": "JAVA_17", "client": [ - "ChatHudMixin", "ChatInputSuggestorMixin", "ChatScreenMixin", "ClientConnectionMixin", From 10dca6c78632a5fb078009c80afe6efdc332d96e Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 15 Jul 2023 16:41:47 +0700 Subject: [PATCH 11/15] fart fix --- .../mixin/ElderGuardianAppearanceParticleMixin.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ElderGuardianAppearanceParticleMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ElderGuardianAppearanceParticleMixin.java index 2821723..e729f6d 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ElderGuardianAppearanceParticleMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ElderGuardianAppearanceParticleMixin.java @@ -11,8 +11,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(ElderGuardianAppearanceParticle.Factory.class) public class ElderGuardianAppearanceParticleMixin { - @Inject(method = "createParticle(Lnet/minecraft/particle/DefaultParticleType;Lnet/minecraft/client/world/ClientWorld;DDDDDD)Lnet/minecraft/client/particle/Particle;", at = @At("HEAD")) + @Inject(method = "createParticle(Lnet/minecraft/particle/DefaultParticleType;Lnet/minecraft/client/world/ClientWorld;DDDDDD)Lnet/minecraft/client/particle/Particle;", at = @At("HEAD"), cancellable = true) private void createParticle (DefaultParticleType defaultParticleType, ClientWorld clientWorld, double d, double e, double f, double g, double h, double i, CallbackInfoReturnable cir) { + if (cir.isCancelled() || !cir.isCancellable()) return; + cir.cancel(); } } From 5ca7f086cf0682b8442665fa828a86c2ebd7c337 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 15 Jul 2023 17:11:24 +0700 Subject: [PATCH 12/15] don't use the skid webhook thing --- .../chipmunkmod/mixin/ChatScreenMixin.java | 29 +- .../chipmunk/chipmunkmod/util/Webhook.java | 390 ------------------ 2 files changed, 24 insertions(+), 395 deletions(-) delete mode 100644 src/main/java/land/chipmunk/chipmunkmod/util/Webhook.java diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java index 07b30b6..97e764d 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/ChatScreenMixin.java @@ -1,12 +1,12 @@ package land.chipmunk.chipmunkmod.mixin; +import com.google.gson.JsonObject; import land.chipmunk.chipmunkmod.ChipmunkMod; import land.chipmunk.chipmunkmod.command.CommandManager; import land.chipmunk.chipmunkmod.data.ChomeNSBotCommand; import land.chipmunk.chipmunkmod.modules.ChomeNSBotCommandSuggestions; import land.chipmunk.chipmunkmod.modules.CustomChat; import land.chipmunk.chipmunkmod.util.BotValidationUtilities; -import land.chipmunk.chipmunkmod.util.Webhook; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ChatInputSuggestor; import net.minecraft.client.gui.screen.Screen; @@ -21,7 +21,10 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import javax.net.ssl.HttpsURLConnection; import java.io.IOException; +import java.io.OutputStream; +import java.net.URL; import java.util.List; @Mixin(net.minecraft.client.gui.screen.ChatScreen.class) @@ -39,11 +42,27 @@ public class ChatScreenMixin extends Screen { if (ChipmunkMod.CONFIG.bots.testbot.webhookUrl != null && chatText.startsWith(ChipmunkMod.CONFIG.bots.testbot.prefix)) { ChipmunkMod.executorService.submit(() -> { - final Webhook webhook = new Webhook(ChipmunkMod.CONFIG.bots.testbot.webhookUrl); - webhook.setUsername("ChipmunkMod"); - webhook.setContent(MinecraftClient.getInstance().getSession().getUsername()); try { - webhook.execute(); + final URL url = new URL(ChipmunkMod.CONFIG.bots.testbot.webhookUrl); + + final HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); + connection.addRequestProperty("Content-Type", "application/json"); + connection.addRequestProperty("User-Agent", "ChipmunkMod"); + connection.setDoOutput(true); + connection.setRequestMethod("POST"); + + final JsonObject jsonObject = new JsonObject(); + + jsonObject.addProperty("username", "ChipmunkMod UwU"); + jsonObject.addProperty("content", MinecraftClient.getInstance().getSession().getUsername()); + + final OutputStream stream = connection.getOutputStream(); + stream.write(jsonObject.toString().getBytes()); + stream.flush(); + stream.close(); + + connection.getInputStream().close(); + connection.disconnect(); } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/java/land/chipmunk/chipmunkmod/util/Webhook.java b/src/main/java/land/chipmunk/chipmunkmod/util/Webhook.java deleted file mode 100644 index c6ea273..0000000 --- a/src/main/java/land/chipmunk/chipmunkmod/util/Webhook.java +++ /dev/null @@ -1,390 +0,0 @@ -package land.chipmunk.chipmunkmod.util; - -import javax.net.ssl.HttpsURLConnection; -import java.awt.*; -import java.io.IOException; -import java.io.OutputStream; -import java.lang.reflect.Array; -import java.net.URL; -import java.util.List; -import java.util.*; - -// i am sure blackilykat did not write this - chayapak - -/** - * Class used to execute Discord Webhooks with low effort - */ -public class Webhook { - - private final String url; - private String content; - private String username; - private String avatarUrl; - private boolean tts; - private List embeds = new ArrayList<>(); - - /** - * Constructs a new DiscordWebhook instance - * - * @param url The webhook URL obtained in Discord - */ - public Webhook(String url) { - this.url = url; - } - - public void setContent(String content) { - this.content = content; - } - - public void setUsername(String username) { - this.username = username; - } - - public void setAvatarUrl(String avatarUrl) { - this.avatarUrl = avatarUrl; - } - - public void setTts(boolean tts) { - this.tts = tts; - } - - public void addEmbed(EmbedObject embed) { - this.embeds.add(embed); - } - - public void execute() throws IOException { - if (this.content == null && this.embeds.isEmpty()) { - throw new IllegalArgumentException("Set content or add at least one EmbedObject"); - } - - JSONObject json = new JSONObject(); - - json.put("content", this.content); - json.put("username", this.username); - json.put("avatar_url", this.avatarUrl); - json.put("tts", this.tts); - - if (!this.embeds.isEmpty()) { - List embedObjects = new ArrayList<>(); - - for (EmbedObject embed : this.embeds) { - JSONObject jsonEmbed = new JSONObject(); - - jsonEmbed.put("title", embed.getTitle()); - jsonEmbed.put("description", embed.getDescription()); - jsonEmbed.put("url", embed.getUrl()); - - if (embed.getColor() != null) { - Color color = embed.getColor(); - int rgb = color.getRed(); - rgb = (rgb << 8) + color.getGreen(); - rgb = (rgb << 8) + color.getBlue(); - - jsonEmbed.put("color", rgb); - } - - EmbedObject.Footer footer = embed.getFooter(); - EmbedObject.Image image = embed.getImage(); - EmbedObject.Thumbnail thumbnail = embed.getThumbnail(); - EmbedObject.Author author = embed.getAuthor(); - List fields = embed.getFields(); - - if (footer != null) { - JSONObject jsonFooter = new JSONObject(); - - jsonFooter.put("text", footer.getText()); - jsonFooter.put("icon_url", footer.getIconUrl()); - jsonEmbed.put("footer", jsonFooter); - } - - if (image != null) { - JSONObject jsonImage = new JSONObject(); - - jsonImage.put("url", image.getUrl()); - jsonEmbed.put("image", jsonImage); - } - - if (thumbnail != null) { - JSONObject jsonThumbnail = new JSONObject(); - - jsonThumbnail.put("url", thumbnail.getUrl()); - jsonEmbed.put("thumbnail", jsonThumbnail); - } - - if (author != null) { - JSONObject jsonAuthor = new JSONObject(); - - jsonAuthor.put("name", author.getName()); - jsonAuthor.put("url", author.getUrl()); - jsonAuthor.put("icon_url", author.getIconUrl()); - jsonEmbed.put("author", jsonAuthor); - } - - List jsonFields = new ArrayList<>(); - for (EmbedObject.Field field : fields) { - JSONObject jsonField = new JSONObject(); - - jsonField.put("name", field.getName()); - jsonField.put("value", field.getValue()); - jsonField.put("inline", field.isInline()); - - jsonFields.add(jsonField); - } - - jsonEmbed.put("fields", jsonFields.toArray()); - embedObjects.add(jsonEmbed); - } - - json.put("embeds", embedObjects.toArray()); - } - - URL url = new URL(this.url); - HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); - connection.addRequestProperty("Content-Type", "application/json"); - connection.addRequestProperty("User-Agent", "Java-DiscordWebhook-BY-Gelox_"); - connection.setDoOutput(true); - connection.setRequestMethod("POST"); - - OutputStream stream = connection.getOutputStream(); - stream.write(json.toString().getBytes()); - stream.flush(); - stream.close(); - - connection.getInputStream().close(); //I'm not sure why but it doesn't work without getting the InputStream - connection.disconnect(); - } - - public static class EmbedObject { - private String title; - private String description; - private String url; - private Color color; - - private Footer footer; - private Thumbnail thumbnail; - private Image image; - private Author author; - private List fields = new ArrayList<>(); - - public String getTitle() { - return title; - } - - public String getDescription() { - return description; - } - - public String getUrl() { - return url; - } - - public Color getColor() { - return color; - } - - public Footer getFooter() { - return footer; - } - - public Thumbnail getThumbnail() { - return thumbnail; - } - - public Image getImage() { - return image; - } - - public Author getAuthor() { - return author; - } - - public List getFields() { - return fields; - } - - public EmbedObject setTitle(String title) { - this.title = title; - return this; - } - - public EmbedObject setDescription(String description) { - this.description = description; - return this; - } - - public EmbedObject setUrl(String url) { - this.url = url; - return this; - } - - public EmbedObject setColor(Color color) { - this.color = color; - return this; - } - - public EmbedObject setFooter(String text, String icon) { - this.footer = new Footer(text, icon); - return this; - } - - public EmbedObject setThumbnail(String url) { - this.thumbnail = new Thumbnail(url); - return this; - } - - public EmbedObject setImage(String url) { - this.image = new Image(url); - return this; - } - - public EmbedObject setAuthor(String name, String url, String icon) { - this.author = new Author(name, url, icon); - return this; - } - - public EmbedObject addField(String name, String value, boolean inline) { - this.fields.add(new Field(name, value, inline)); - return this; - } - - private class Footer { - private String text; - private String iconUrl; - - private Footer(String text, String iconUrl) { - this.text = text; - this.iconUrl = iconUrl; - } - - private String getText() { - return text; - } - - private String getIconUrl() { - return iconUrl; - } - } - - private class Thumbnail { - private String url; - - private Thumbnail(String url) { - this.url = url; - } - - private String getUrl() { - return url; - } - } - - private class Image { - private String url; - - private Image(String url) { - this.url = url; - } - - private String getUrl() { - return url; - } - } - - private class Author { - private String name; - private String url; - private String iconUrl; - - private Author(String name, String url, String iconUrl) { - this.name = name; - this.url = url; - this.iconUrl = iconUrl; - } - - private String getName() { - return name; - } - - private String getUrl() { - return url; - } - - private String getIconUrl() { - return iconUrl; - } - } - - private class Field { - private String name; - private String value; - private boolean inline; - - private Field(String name, String value, boolean inline) { - this.name = name; - this.value = value; - this.inline = inline; - } - - private String getName() { - return name; - } - - private String getValue() { - return value; - } - - private boolean isInline() { - return inline; - } - } - } - - private class JSONObject { - - private final HashMap map = new HashMap<>(); - - void put(String key, Object value) { - if (value != null) { - map.put(key, value); - } - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - Set> entrySet = map.entrySet(); - builder.append("{"); - - int i = 0; - for (Map.Entry entry : entrySet) { - Object val = entry.getValue(); - builder.append(quote(entry.getKey())).append(":"); - - if (val instanceof String) { - builder.append(quote(String.valueOf(val))); - } else if (val instanceof Integer) { - builder.append(Integer.valueOf(String.valueOf(val))); - } else if (val instanceof Boolean) { - builder.append(val); - } else if (val instanceof JSONObject) { - builder.append(val.toString()); - } else if (val.getClass().isArray()) { - builder.append("["); - int len = Array.getLength(val); - for (int j = 0; j < len; j++) { - builder.append(Array.get(val, j).toString()).append(j != len - 1 ? "," : ""); - } - builder.append("]"); - } - - builder.append(++i == entrySet.size() ? "}" : ","); - } - - return builder.toString(); - } - - private String quote(String string) { - return "\"" + string + "\""; - } - } - -} From 306319e6a19389e4a693be03421298fa566b64c4 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 16 Jul 2023 09:59:43 +0700 Subject: [PATCH 13/15] still does nothing but whatever --- .../java/land/chipmunk/chipmunkmod/mixin/StringHelperMixin.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/StringHelperMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/StringHelperMixin.java index dd5ce5c..716f38f 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/mixin/StringHelperMixin.java +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/StringHelperMixin.java @@ -11,10 +11,12 @@ public class StringHelperMixin { @Inject(method = "truncateChat", at = @At("HEAD"), cancellable = true) private static void truncateChat (String text, CallbackInfoReturnable cir) { cir.setReturnValue(text); + cir.cancel(); } @Inject(method = "stripTextFormat", at = @At("HEAD"), cancellable = true) private static void stripTextFormat(String text, CallbackInfoReturnable cir) { cir.setReturnValue(text); + cir.cancel(); } } From e578d454908f8ab8efc185cf3d34ba76521922bf Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 16 Jul 2023 18:36:23 +0700 Subject: [PATCH 14/15] bring back .selfcare it's so hard to toggle the self cares --- .../chipmunkmod/command/CommandManager.java | 1 + .../chipmunkmod/commands/SelfCareCommand.java | 65 +++++++++++++++++++ .../mixin/SharedConstantsMixin.java | 16 +++++ src/main/resources/chipmunkmod.mixins.json | 3 +- 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java create mode 100644 src/main/java/land/chipmunk/chipmunkmod/mixin/SharedConstantsMixin.java diff --git a/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java b/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java index 6e438f8..5861999 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java +++ b/src/main/java/land/chipmunk/chipmunkmod/command/CommandManager.java @@ -38,6 +38,7 @@ public class CommandManager { SayCommand.register(this.dispatcher); AutoSkinCommand.register(this.dispatcher); ReloadConfigCommand.register(this.dispatcher); + SelfCareCommand.register(this.dispatcher); } public void executeCommand (String command) { diff --git a/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java b/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java new file mode 100644 index 0000000..d80e00f --- /dev/null +++ b/src/main/java/land/chipmunk/chipmunkmod/commands/SelfCareCommand.java @@ -0,0 +1,65 @@ +package land.chipmunk.chipmunkmod.commands; + +import com.mojang.brigadier.Command; +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.context.CommandContext; +import land.chipmunk.chipmunkmod.modules.SelfCare; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; +import net.minecraft.text.Text; + +import static com.mojang.brigadier.arguments.BoolArgumentType.bool; +import static com.mojang.brigadier.arguments.BoolArgumentType.getBool; +import static land.chipmunk.chipmunkmod.command.CommandManager.argument; +import static land.chipmunk.chipmunkmod.command.CommandManager.literal; + +public class SelfCareCommand { + public static void register (CommandDispatcher dispatcher) { + dispatcher.register( + literal("selfcare") + .then( + literal("op") + .then( + argument("boolean", bool()) + .executes(m -> setSelfCare(m, "op")) + ) + ) + .then( + literal("gamemode") + .then( + argument("boolean", bool()) + .executes(m -> setSelfCare(m, "gamemode")) + ) + ) + .then( + literal("cspy") + .then( + argument("boolean", bool()) + .executes(m -> setSelfCare(m, "cspy")) + ) + ) + ); + } + + // setSelfCare is probably not a good name for this + public static int setSelfCare (CommandContext context, String type) { + final FabricClientCommandSource source = context.getSource(); + final boolean bool = getBool(context, "boolean"); + + switch (type) { + case "op" -> { + SelfCare.INSTANCE.opEnabled = bool; + source.sendFeedback(Text.literal("The op self care is now " + (bool ? "enabled" : "disabled"))); + } + case "gamemode" -> { + SelfCare.INSTANCE.gamemodeEnabled = bool; + source.sendFeedback(Text.literal("The gamemode self care is now " + (bool ? "enabled" : "disabled"))); + } + case "cspy" -> { + SelfCare.INSTANCE.cspyEnabled = bool; + source.sendFeedback(Text.literal("The CommandSpy self care is now " + (bool ? "enabled" : "disabled"))); + } + } + + return Command.SINGLE_SUCCESS; + } +} diff --git a/src/main/java/land/chipmunk/chipmunkmod/mixin/SharedConstantsMixin.java b/src/main/java/land/chipmunk/chipmunkmod/mixin/SharedConstantsMixin.java new file mode 100644 index 0000000..ac5e810 --- /dev/null +++ b/src/main/java/land/chipmunk/chipmunkmod/mixin/SharedConstantsMixin.java @@ -0,0 +1,16 @@ +package land.chipmunk.chipmunkmod.mixin; + +import net.minecraft.SharedConstants; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(SharedConstants.class) +public class SharedConstantsMixin { + @Inject(method = "isValidChar", at = @At("HEAD"), cancellable = true) + private static void isValidChar (char chr, CallbackInfoReturnable cir) { + cir.setReturnValue(chr >= ' ' && chr != '\u007f'); + cir.cancel(); + } +} diff --git a/src/main/resources/chipmunkmod.mixins.json b/src/main/resources/chipmunkmod.mixins.json index 063bc82..53d3953 100644 --- a/src/main/resources/chipmunkmod.mixins.json +++ b/src/main/resources/chipmunkmod.mixins.json @@ -20,7 +20,8 @@ "TextMixin", "ClientConnectionInvoker", "ClientConnectionAccessor", - "PlayerListEntryAccessor" + "PlayerListEntryAccessor", + "SharedConstantsMixin" ], "injectors": { "defaultRequire": 1 From 701ad443257b67b7977590011f8dcb909251676a Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 16 Jul 2023 19:07:40 +0700 Subject: [PATCH 15/15] update chomens bot hashing --- .../chipmunk/chipmunkmod/util/BotValidationUtilities.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java b/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java index d300d1b..4467000 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java +++ b/src/main/java/land/chipmunk/chipmunkmod/util/BotValidationUtilities.java @@ -67,19 +67,21 @@ public class BotValidationUtilities { public static int chomens (String command) throws RuntimeException { final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.chomens; + final MinecraftClient client = MinecraftClient.getInstance(); + final String prefix = info.prefix; final String key = info.key; if (key == null) throw new RuntimeException("The key of the bot is unspecified (null), did you incorrectly add it to your config?"); try { + String[] arguments = command.split(" "); + MessageDigest md = MessageDigest.getInstance("SHA-256"); String time = String.valueOf(System.currentTimeMillis() / 5_000); - String input = time + key; + String input = client.player.getUuidAsString() + arguments[0] + time + key; byte[] hash = md.digest(input.getBytes(StandardCharsets.UTF_8)); String stringHash = Hexadecimal.encode(hash).substring(0, 16); - String[] arguments = command.split(" "); - final String toSend = prefix + arguments[0] + " " + stringHash + " " + String.join(" ", Arrays.copyOfRange(arguments, 1, arguments.length)); CustomChat.INSTANCE.chat(toSend);