Make enum variables final.

This commit is contained in:
Photon-GitHub 2022-07-25 13:30:20 +02:00
parent 287f735c5f
commit 09847ac0f3
5 changed files with 16 additions and 16 deletions

View File

@ -580,8 +580,8 @@ public class PacketType implements Serializable, Cloneable, Comparable<PacketTyp
*/
LEGACY("", "");
private String packetName;
private String mojangName;
private final String packetName;
private final String mojangName;
Protocol(String packetName, String mojangName) {
this.packetName = packetName;
@ -636,9 +636,9 @@ public class PacketType implements Serializable, Cloneable, Comparable<PacketTyp
*/
SERVER("Clientbound", "Out", "server");
private String mojangName;
private String packetName;
private String mcpName;
private final String mojangName;
private final String packetName;
private final String mcpName;
Sender(String mojangName, String packetName, String mcpName) {
this.mojangName = mojangName;

View File

@ -1341,7 +1341,7 @@ public class BukkitConverters {
THE_NETHER_IMPL(-1),
THE_END_IMPL(1);
int id;
final int id;
DimensionImpl(int id) {
this.id = id;
}

View File

@ -159,7 +159,7 @@ public abstract class EnumWrappers {
RELEASE_USE_ITEM,
SWAP_HELD_ITEMS("SWAP_ITEM_WITH_OFFHAND");
String[] aliases;
final String[] aliases;
PlayerDigType(String... aliases) {
this.aliases = aliases;
}
@ -180,7 +180,7 @@ public abstract class EnumWrappers {
OPEN_INVENTORY,
START_FALL_FLYING;
String[] aliases;
final String[] aliases;
PlayerAction(String... aliases) {
this.aliases = aliases;
}

View File

@ -102,9 +102,9 @@ public class WrappedAttributeModifier extends AbstractWrapper {
*/
ADD_PERCENTAGE(2);
private int id;
private final int id;
private Operation(int id) {
Operation(int id) {
this.id = id;
}

View File

@ -94,19 +94,19 @@ public enum NbtType {
*/
TAG_LONG_ARRAY(12, long[].class);
private int rawID;
private Class<?> valueType;
private final int rawID;
private final Class<?> valueType;
// Used to lookup a specified NBT
private static NbtType[] lookup;
private static final NbtType[] lookup;
// Lookup NBT by class
private static Map<Class<?>, NbtType> classLookup;
private static final Map<Class<?>, NbtType> classLookup;
static {
NbtType[] values = values();
lookup = new NbtType[values.length];
classLookup = new HashMap<Class<?>, NbtType>();
classLookup = new HashMap<>();
// Initialize lookup tables
for (NbtType type : values) {
@ -124,7 +124,7 @@ public enum NbtType {
classLookup.put(NbtCompound.class, TAG_COMPOUND);
}
private NbtType(int rawID, Class<?> valueType) {
NbtType(int rawID, Class<?> valueType) {
this.rawID = rawID;
this.valueType = valueType;
}