-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
修复吞字bug /mcstats reportqq现在将不会发送到游戏里
- Loading branch information
Showing
4 changed files
with
19 additions
and
6 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
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 |
---|---|---|
@@ -1,16 +1,19 @@ | ||
package top.infsky.mcstats.command; | ||
|
||
import com.mojang.brigadier.context.CommandContext; | ||
import com.mojang.brigadier.exceptions.CommandSyntaxException; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.level.GameRules; | ||
import top.infsky.mcstats.McStats; | ||
import top.infsky.mcstats.log.LogUtils; | ||
|
||
public class ReportCommand { | ||
public static int execute(CommandContext<CommandSourceStack> context) { | ||
LogUtils.LOGGER.info("通过指令输出报告 report"); | ||
final boolean tmpRule = context.getSource().getLevel().getGameRules().getRule(GameRules.RULE_SENDCOMMANDFEEDBACK).get(); | ||
context.getSource().getLevel().getGameRules().getRule(GameRules.RULE_SENDCOMMANDFEEDBACK).set(true, context.getSource().getServer()); | ||
context.getSource().sendSuccess(() -> Component.literal(McStats.getStatsData().getReport()), false); | ||
context.getSource().getLevel().getGameRules().getRule(GameRules.RULE_SENDCOMMANDFEEDBACK).set(tmpRule, context.getSource().getServer()); | ||
return 1; | ||
} | ||
} |
7 changes: 4 additions & 3 deletions
7
src/main/java/top/infsky/mcstats/command/ReportQQCommand.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 |
---|---|---|
@@ -1,16 +1,17 @@ | ||
package top.infsky.mcstats.command; | ||
|
||
import com.mojang.brigadier.context.CommandContext; | ||
import com.mojang.brigadier.exceptions.CommandSyntaxException; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.network.chat.Component; | ||
import top.infsky.mcstats.McStats; | ||
import top.infsky.mcstats.log.LogUtils; | ||
import top.infsky.mcstats.mcbot.McBot; | ||
|
||
public class ReportQQCommand { | ||
public static int execute(CommandContext<CommandSourceStack> context) throws CommandSyntaxException { | ||
public static int execute(CommandContext<CommandSourceStack> context) { | ||
LogUtils.LOGGER.info("通过指令输出报告 reportQQ"); | ||
McStats.getStatsData().report(); | ||
context.getSource().sendSuccess(() -> Component.literal("将当日截止目前的统计信息发送到QQ"), true); | ||
McBot.sendGroupMsg(McStats.getStatsData().getReport()); | ||
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