NameReport.java
net.minecraft.client.multiplayer.chat.report.NameReport
信息
- 全限定名:net.minecraft.client.multiplayer.chat.report.NameReport
- 类型:public class
- 包:net.minecraft.client.multiplayer.chat.report
- 源码路径:src/main/java/net/minecraft/client/multiplayer/chat/report/NameReport.java
- 起始行号:L17
- 继承:Report
- 职责:
TODO
字段/常量
reportedName- 类型:
String - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
内部类/嵌套类型
net.minecraft.client.multiplayer.chat.report.NameReport.Builder- 类型:
class - 修饰符:
public static - 源码定位:
L42 - 说明:
TODO
- 类型:
构造器
private NameReport(UUID reportId, Instant createdAt, UUID reportedProfileId, String reportedName) @ L20
- 构造器名:NameReport
- 源码定位:L20
- 修饰符:private
参数:
- reportId: UUID
- createdAt: Instant
- reportedProfileId: UUID
- reportedName: String
说明:
TODO
方法
下面的方法块按源码顺序生成。
public String getReportedName() @ L25
- 方法名:getReportedName
- 源码定位:L25
- 返回类型:String
- 修饰符:public
参数:
- 无
说明:
TODO
public NameReport copy() @ L29
- 方法名:copy
- 源码定位:L29
- 返回类型:NameReport
- 修饰符:public
参数:
- 无
说明:
TODO
public Screen createScreen(Screen lastScreen, ReportingContext context) @ L36
- 方法名:createScreen
- 源码定位:L36
- 返回类型:Screen
- 修饰符:public
参数:
- lastScreen: Screen
- context: ReportingContext
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class NameReport extends Report {
private final String reportedName;
private NameReport(UUID reportId, Instant createdAt, UUID reportedProfileId, String reportedName) {
super(reportId, createdAt, reportedProfileId);
this.reportedName = reportedName;
}
public String getReportedName() {
return this.reportedName;
}
public NameReport copy() {
NameReport result = new NameReport(this.reportId, this.createdAt, this.reportedProfileId, this.reportedName);
result.comments = this.comments;
result.attested = this.attested;
return result;
}
@Override
public Screen createScreen(Screen lastScreen, ReportingContext context) {
return new NameReportScreen(lastScreen, context, this);
}
@OnlyIn(Dist.CLIENT)
public static class Builder extends Report.Builder<NameReport> {
public Builder(NameReport report, AbuseReportLimits limits) {
super(report, limits);
}
public Builder(UUID reportedProfileId, String reportedName, AbuseReportLimits limits) {
super(new NameReport(UUID.randomUUID(), Instant.now(), reportedProfileId, reportedName), limits);
}
@Override
public boolean hasContent() {
return StringUtils.isNotEmpty(this.comments());
}
@Override
public Report.@Nullable CannotBuildReason checkBuildable() {
return this.report.comments.length() > this.limits.maxOpinionCommentsLength() ? Report.CannotBuildReason.COMMENT_TOO_LONG : super.checkBuildable();
}
@Override
public Either<Report.Result, Report.CannotBuildReason> build(ReportingContext reportingContext) {
Report.CannotBuildReason error = this.checkBuildable();
if (error != null) {
return Either.right(error);
} else {
ReportedEntity reportedEntity = new ReportedEntity(this.report.reportedProfileId);
AbuseReport abuseReport = AbuseReport.name(this.report.comments, reportedEntity, this.report.createdAt);
return Either.left(new Report.Result(this.report.reportId, ReportType.USERNAME, abuseReport));
}
}
}
}引用的其他类
-
- 引用位置:
参数/返回值
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
NameReportScreen()
- 引用位置:
-
- 引用位置:
方法调用/构造调用/继承 - 关联成员:
Report.Result(), Result()
- 引用位置:
-
- 引用位置:
参数
- 引用位置: