-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27012ef
commit de5c422
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
src/main/java/me/anastarawneh/mccinametagmod/command/LogExceptionCommand.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,27 @@ | ||
package me.anastarawneh.mccinametagmod.command; | ||
|
||
import com.mojang.brigadier.context.CommandContext; | ||
import me.anastarawneh.mccinametagmod.MCCINametagMod; | ||
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; | ||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; | ||
|
||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; | ||
|
||
public class LogExceptionCommand { | ||
public static void register() { | ||
ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> dispatcher.register(literal("logexception") | ||
.executes(LogExceptionCommand::execute))); | ||
} | ||
|
||
static int execute(CommandContext<FabricClientCommandSource> context) { | ||
if (MCCINametagMod.LATEST_EXCEPTION == null) { | ||
context.getSource().sendFeedback(MCCINametagMod.MESSAGE_PREFIX.copy().append("Nothing to debug.")); | ||
return 1; | ||
} | ||
MCCINametagMod.LOGGER.error("Logging latest exception:"); | ||
MCCINametagMod.LOGGER.throwing(MCCINametagMod.LATEST_EXCEPTION); | ||
context.getSource().sendFeedback(MCCINametagMod.MESSAGE_PREFIX.copy().append("Logged the latest exception.")); | ||
MCCINametagMod.LATEST_EXCEPTION = null; | ||
return 1; | ||
} | ||
} |
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