Report.java

net.minecraft.client.multiplayer.chat.report.Report

信息

  • 全限定名:net.minecraft.client.multiplayer.chat.report.Report
  • 类型:public abstract class
  • 包:net.minecraft.client.multiplayer.chat.report
  • 源码路径:src/main/java/net/minecraft/client/multiplayer/chat/report/Report.java
  • 起始行号:L16
  • 职责:

    TODO

字段/常量

  • reportId

    • 类型: UUID
    • 修饰符: protected final
    • 源码定位: L17
    • 说明:

      TODO

  • createdAt

    • 类型: Instant
    • 修饰符: protected final
    • 源码定位: L18
    • 说明:

      TODO

  • reportedProfileId

    • 类型: UUID
    • 修饰符: protected final
    • 源码定位: L19
    • 说明:

      TODO

  • comments

    • 类型: String
    • 修饰符: protected
    • 源码定位: L20
    • 说明:

      TODO

  • reason

    • 类型: ReportReason
    • 修饰符: protected
    • 源码定位: L21
    • 说明:

      TODO

  • attested

    • 类型: boolean
    • 修饰符: protected
    • 源码定位: L22
    • 说明:

      TODO

内部类/嵌套类型

  • net.minecraft.client.multiplayer.chat.report.Report.Builder

    • 类型: class
    • 修饰符: public abstract static
    • 源码定位: L39
    • 说明:

      TODO

  • net.minecraft.client.multiplayer.chat.report.Report.CannotBuildReason

    • 类型: record
    • 修饰符: public
    • 源码定位: L90
    • 说明:

      TODO

  • net.minecraft.client.multiplayer.chat.report.Report.Result

    • 类型: record
    • 修饰符: public
    • 源码定位: L109
    • 说明:

      TODO

构造器

public Report(UUID reportId, Instant createdAt, UUID reportedProfileId) @ L24

  • 构造器名:Report
  • 源码定位:L24
  • 修饰符:public

参数:

  • reportId: UUID
  • createdAt: Instant
  • reportedProfileId: UUID

说明:

TODO

方法

下面的方法块按源码顺序生成。

public boolean isReportedPlayer(UUID playerId) @ L30

  • 方法名:isReportedPlayer
  • 源码定位:L30
  • 返回类型:boolean
  • 修饰符:public

参数:

  • playerId: UUID

说明:

TODO

public abstract Report copy() @ L34

  • 方法名:copy
  • 源码定位:L34
  • 返回类型:Report
  • 修饰符:public abstract

参数:

说明:

TODO

public abstract Screen createScreen(Screen lastScreen, ReportingContext context) @ L36

  • 方法名:createScreen
  • 源码定位:L36
  • 返回类型:Screen
  • 修饰符:public abstract

参数:

  • lastScreen: Screen
  • context: ReportingContext

说明:

TODO

代码

@OnlyIn(Dist.CLIENT)
public abstract class Report {
    protected final UUID reportId;
    protected final Instant createdAt;
    protected final UUID reportedProfileId;
    protected String comments = "";
    protected @Nullable ReportReason reason;
    protected boolean attested;
 
    public Report(UUID reportId, Instant createdAt, UUID reportedProfileId) {
        this.reportId = reportId;
        this.createdAt = createdAt;
        this.reportedProfileId = reportedProfileId;
    }
 
    public boolean isReportedPlayer(UUID playerId) {
        return playerId.equals(this.reportedProfileId);
    }
 
    public abstract Report copy();
 
    public abstract Screen createScreen(Screen lastScreen, ReportingContext context);
 
    @OnlyIn(Dist.CLIENT)
    public abstract static class Builder<R extends Report> {
        protected final R report;
        protected final AbuseReportLimits limits;
 
        protected Builder(R report, AbuseReportLimits limits) {
            this.report = report;
            this.limits = limits;
        }
 
        public R report() {
            return this.report;
        }
 
        public UUID reportedProfileId() {
            return this.report.reportedProfileId;
        }
 
        public String comments() {
            return this.report.comments;
        }
 
        public boolean attested() {
            return this.report().attested;
        }
 
        public void setComments(String comments) {
            this.report.comments = comments;
        }
 
        public @Nullable ReportReason reason() {
            return this.report.reason;
        }
 
        public void setReason(ReportReason reason) {
            this.report.reason = reason;
        }
 
        public void setAttested(boolean attested) {
            this.report.attested = attested;
        }
 
        public abstract boolean hasContent();
 
        public Report.@Nullable CannotBuildReason checkBuildable() {
            return !this.report().attested ? Report.CannotBuildReason.NOT_ATTESTED : null;
        }
 
        public abstract Either<Report.Result, Report.CannotBuildReason> build(ReportingContext reportingContext);
    }
 
    @OnlyIn(Dist.CLIENT)
    public record CannotBuildReason(Component message) {
        public static final Report.CannotBuildReason NO_REASON = new Report.CannotBuildReason(Component.translatable("gui.abuseReport.send.no_reason"));
        public static final Report.CannotBuildReason NO_REPORTED_MESSAGES = new Report.CannotBuildReason(
            Component.translatable("gui.chatReport.send.no_reported_messages")
        );
        public static final Report.CannotBuildReason TOO_MANY_MESSAGES = new Report.CannotBuildReason(
            Component.translatable("gui.chatReport.send.too_many_messages")
        );
        public static final Report.CannotBuildReason COMMENT_TOO_LONG = new Report.CannotBuildReason(
            Component.translatable("gui.abuseReport.send.comment_too_long")
        );
        public static final Report.CannotBuildReason NOT_ATTESTED = new Report.CannotBuildReason(Component.translatable("gui.abuseReport.send.not_attested"));
 
        public Tooltip tooltip() {
            return Tooltip.create(this.message);
        }
    }
 
    @OnlyIn(Dist.CLIENT)
    public record Result(UUID id, ReportType reportType, AbuseReport report) {
    }
}

引用的其他类

  • Tooltip

    • 引用位置: 方法调用
    • 关联成员: Tooltip.create()
  • Screen

    • 引用位置: 参数/返回值
  • ReportReason

    • 引用位置: 字段
  • ReportingContext

    • 引用位置: 参数
  • Component

    • 引用位置: 方法调用
    • 关联成员: Component.translatable()