Skip to content

Commit 1ae2114

Browse files
committed
Protect the scripts command
1 parent 1d3bb67 commit 1ae2114

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/io/github/techstreet/dfscript/mixin/player/MLocalPlayer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
import io.github.techstreet.dfscript.event.SendChatEvent;
44
import io.github.techstreet.dfscript.event.TickEvent;
55
import io.github.techstreet.dfscript.event.system.EventManager;
6-
import io.github.techstreet.dfscript.util.chat.ChatUtil;
76
import net.minecraft.client.network.ClientPlayerEntity;
87
import net.minecraft.text.Text;
9-
import org.jetbrains.annotations.Nullable;
108
import org.spongepowered.asm.mixin.Mixin;
119
import org.spongepowered.asm.mixin.injection.At;
1210
import org.spongepowered.asm.mixin.injection.Inject;
@@ -27,6 +25,7 @@ private void chat(String message, Text preview, CallbackInfo ci) {
2725

2826
@Inject(method = "sendCommand(Ljava/lang/String;)Z", at = @At("HEAD"), cancellable = true)
2927
private void command(String command, CallbackInfoReturnable<Boolean> ci) {
28+
if(command.startsWith("scripts")) return;
3029
SendChatEvent event = new SendChatEvent("/"+command);
3130
EventManager.getInstance().dispatch(event);
3231
if (event.isCancelled()) {
@@ -36,6 +35,7 @@ private void command(String command, CallbackInfoReturnable<Boolean> ci) {
3635

3736
@Inject(method = "sendCommand(Ljava/lang/String;Lnet/minecraft/text/Text;)V", at = @At("HEAD"), cancellable = true)
3837
private void command2(String command, Text preview, CallbackInfo ci) {
38+
if(command.startsWith("scripts")) return;
3939
SendChatEvent event = new SendChatEvent("/"+command);
4040
EventManager.getInstance().dispatch(event);
4141
if (event.isCancelled()) {

0 commit comments

Comments
 (0)