public static final Codec<PermissionLevel> INT_CODEC = Codec.INT.xmap(BY_ID::apply, level -> level.id);
18
private final String name;
19
private final int id;
20
21
PermissionLevel(final String name, final int id) {
22
this.name = name;
23
this.id = id;
24
}
25
26
public boolean isEqualOrHigherThan(final PermissionLevel other) {
27
return this.id >= other.id;
28
}
29
30
public static PermissionLevel byId(final int level) {
31
return BY_ID.apply(level);
32
}
33
34
public int id() {
35
return this.id;
36
}
37
38
@Override
39
public String getSerializedName() {
40
return this.name;
41
}
42
}
43
Decompiled Minecraft 26.3 source of PermissionLevel (net/minecraft/server/permissions/PermissionLevel.java) with Mojang official mappings, stored verbatim on the site.