-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "add: custom event PreCommandExecuteEvent"
This reverts commit 12eacc8
- Loading branch information
1 parent
8fba23f
commit 29f61fa
Showing
15 changed files
with
72 additions
and
74 deletions.
There are no files selected for viewing
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...sakurawald/common/structure/Position.java → ...io/github/sakurawald/common/Position.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
src/main/java/io/github/sakurawald/common/event/PreCommandExecuteEvent.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
.../java/io/github/sakurawald/module/initializer/command_cooldown/CommandCooldownModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
src/main/java/io/github/sakurawald/module/initializer/command_spy/CommandSpyModule.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/io/github/sakurawald/module/initializer/teleport_warmup/TeleportTicket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/io/github/sakurawald/module/mixin/command_cooldown/CommandsMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package io.github.sakurawald.module.mixin.command_cooldown; | ||
|
||
import com.mojang.brigadier.ParseResults; | ||
import io.github.sakurawald.module.ModuleManager; | ||
import io.github.sakurawald.module.initializer.command_cooldown.CommandCooldownModule; | ||
import io.github.sakurawald.util.MessageUtil; | ||
import net.minecraft.server.command.CommandManager; | ||
import net.minecraft.server.command.ServerCommandSource; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
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; | ||
|
||
@Mixin(CommandManager.class) | ||
|
||
public class CommandsMixin { | ||
|
||
@Unique | ||
private static final CommandCooldownModule module = ModuleManager.getInitializer(CommandCooldownModule.class); | ||
|
||
// If you issue "///abcdefg", then commandLine = "//abcdefg" | ||
@Inject(method = "execute", at = @At("HEAD"), cancellable = true) | ||
public void $execute(ParseResults<ServerCommandSource> parseResults, String string, CallbackInfo ci) { | ||
ServerPlayerEntity player = parseResults.getContext().getSource().getPlayer(); | ||
if (player == null) return; | ||
|
||
long cooldown = module.calculateCommandCooldown(player, string); | ||
if (cooldown > 0) { | ||
MessageUtil.sendActionBar(player, "command_cooldown.cooldown", cooldown / 1000); | ||
ci.cancel(); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/io/github/sakurawald/module/mixin/command_spy/CommandsMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.github.sakurawald.module.mixin.command_spy; | ||
|
||
import com.mojang.brigadier.ParseResults; | ||
import io.github.sakurawald.Fuji; | ||
import net.minecraft.server.command.CommandManager; | ||
import net.minecraft.server.command.ServerCommandSource; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
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; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(CommandManager.class) | ||
public class CommandsMixin { | ||
|
||
// If you issue "///abcdefg", then commandLine = "//abcdefg" | ||
@Inject(method = "execute", at = @At("HEAD")) | ||
public void $execute(ParseResults<ServerCommandSource> parseResults, String string, CallbackInfo ci) { | ||
ServerPlayerEntity player = parseResults.getContext().getSource().getPlayer(); | ||
if (player == null) return; | ||
|
||
// fix: fabric console will not log the command issue | ||
Fuji.LOGGER.info("{} issued server command: {}", player.getGameProfile().getName(), string); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters