ReportingContext.java
net.minecraft.client.multiplayer.chat.report.ReportingContext
信息
- 全限定名:net.minecraft.client.multiplayer.chat.report.ReportingContext
- 类型:public final class
- 包:net.minecraft.client.multiplayer.chat.report
- 源码路径:src/main/java/net/minecraft/client/multiplayer/chat/report/ReportingContext.java
- 起始行号:L16
- 职责:
TODO
字段/常量
-
LOG_CAPACITY- 类型:
int - 修饰符:
private static final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
sender- 类型:
AbuseReportSender - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
environment- 类型:
ReportEnvironment - 修饰符:
private final - 源码定位:
L19 - 说明:
TODO
- 类型:
-
chatLog- 类型:
ChatLog - 修饰符:
private final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
draftReport- 类型:
Report - 修饰符:
private - 源码定位:
L21 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public ReportingContext(AbuseReportSender sender, ReportEnvironment environment, ChatLog chatLog) @ L23
- 构造器名:ReportingContext
- 源码定位:L23
- 修饰符:public
参数:
- sender: AbuseReportSender
- environment: ReportEnvironment
- chatLog: ChatLog
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static ReportingContext create(ReportEnvironment environment, UserApiService userApiService) @ L29
- 方法名:create
- 源码定位:L29
- 返回类型:ReportingContext
- 修饰符:public static
参数:
- environment: ReportEnvironment
- userApiService: UserApiService
说明:
TODO
public void draftReportHandled(Minecraft minecraft, Screen lastScreen, Runnable onDiscard, boolean quitToTitle) @ L35
- 方法名:draftReportHandled
- 源码定位:L35
- 返回类型:void
- 修饰符:public
参数:
- minecraft: Minecraft
- lastScreen: Screen
- onDiscard: Runnable
- quitToTitle: boolean
说明:
TODO
public AbuseReportSender sender() @ L59
- 方法名:sender
- 源码定位:L59
- 返回类型:AbuseReportSender
- 修饰符:public
参数:
- 无
说明:
TODO
public ChatLog chatLog() @ L63
- 方法名:chatLog
- 源码定位:L63
- 返回类型:ChatLog
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean matches(ReportEnvironment environment) @ L67
- 方法名:matches
- 源码定位:L67
- 返回类型:boolean
- 修饰符:public
参数:
- environment: ReportEnvironment
说明:
TODO
public void setReportDraft(Report draftReport) @ L71
- 方法名:setReportDraft
- 源码定位:L71
- 返回类型:void
- 修饰符:public
参数:
- draftReport: Report
说明:
TODO
public boolean hasDraftReport() @ L75
- 方法名:hasDraftReport
- 源码定位:L75
- 返回类型:boolean
- 修饰符:public
参数:
- 无
说明:
TODO
public boolean hasDraftReportFor(UUID playerId) @ L79
- 方法名:hasDraftReportFor
- 源码定位:L79
- 返回类型:boolean
- 修饰符:public
参数:
- playerId: UUID
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public final class ReportingContext {
private static final int LOG_CAPACITY = 1024;
private final AbuseReportSender sender;
private final ReportEnvironment environment;
private final ChatLog chatLog;
private @Nullable Report draftReport;
public ReportingContext(AbuseReportSender sender, ReportEnvironment environment, ChatLog chatLog) {
this.sender = sender;
this.environment = environment;
this.chatLog = chatLog;
}
public static ReportingContext create(ReportEnvironment environment, UserApiService userApiService) {
ChatLog chatLog = new ChatLog(1024);
AbuseReportSender sender = AbuseReportSender.create(environment, userApiService);
return new ReportingContext(sender, environment, chatLog);
}
public void draftReportHandled(Minecraft minecraft, Screen lastScreen, Runnable onDiscard, boolean quitToTitle) {
if (this.draftReport != null) {
Report report = this.draftReport.copy();
minecraft.setScreen(
new ConfirmScreen(
response -> {
this.setReportDraft(null);
if (response) {
minecraft.setScreen(report.createScreen(lastScreen, this));
} else {
onDiscard.run();
}
},
Component.translatable(quitToTitle ? "gui.abuseReport.draft.quittotitle.title" : "gui.abuseReport.draft.title"),
Component.translatable(quitToTitle ? "gui.abuseReport.draft.quittotitle.content" : "gui.abuseReport.draft.content"),
Component.translatable("gui.abuseReport.draft.edit"),
Component.translatable("gui.abuseReport.draft.discard")
)
);
} else {
onDiscard.run();
}
}
public AbuseReportSender sender() {
return this.sender;
}
public ChatLog chatLog() {
return this.chatLog;
}
public boolean matches(ReportEnvironment environment) {
return Objects.equals(this.environment, environment);
}
public void setReportDraft(@Nullable Report draftReport) {
this.draftReport = draftReport;
}
public boolean hasDraftReport() {
return this.draftReport != null;
}
public boolean hasDraftReportFor(UUID playerId) {
return this.hasDraftReport() && this.draftReport.isReportedPlayer(playerId);
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
ConfirmScreen()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数/字段/构造调用/返回值 - 关联成员:
ChatLog()
- 引用位置:
-
- 引用位置:
参数/字段/方法调用/返回值 - 关联成员:
AbuseReportSender.create()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Component.translatable()
- 引用位置: