Fix direction and dimension enums

This commit is contained in:
Dan Mulloy 2020-05-03 15:59:55 -04:00
parent 308e3d3417
commit bfa0eee91e
No known key found for this signature in database
GPG Key ID: 2B62F7DACFF133E8
2 changed files with 4 additions and 5 deletions

View File

@ -1133,8 +1133,7 @@ public class BukkitConverters {
private static MethodAccessor idFromDimension = null; private static MethodAccessor idFromDimension = null;
public static EquivalentConverter<Integer> getDimensionIDConverter() { public static EquivalentConverter<Integer> getDimensionIDConverter() {
return new EquivalentConverter<Integer>() { return ignoreNull(new EquivalentConverter<Integer>() {
@Override @Override
public Object getGeneric(Integer specific) { public Object getGeneric(Integer specific) {
if (dimensionFromId == null) { if (dimensionFromId == null) {
@ -1149,7 +1148,7 @@ public class BukkitConverters {
dimensionFromId = Accessors.getMethodAccessor(reflection.getMethod(contract)); dimensionFromId = Accessors.getMethodAccessor(reflection.getMethod(contract));
} }
return dimensionFromId.invoke(null, (int) specific); return dimensionFromId.invoke(null, specific);
} }
@Override @Override
@ -1173,6 +1172,6 @@ public class BukkitConverters {
public Class<Integer> getSpecificType() { public Class<Integer> getSpecificType() {
return Integer.class; return Integer.class;
} }
}; });
} }
} }

View File

@ -422,7 +422,7 @@ public abstract class EnumWrappers {
SOUND_CATEGORY_CLASS = getEnum(PacketType.Play.Server.CUSTOM_SOUND_EFFECT.getPacketClass(), 0); SOUND_CATEGORY_CLASS = getEnum(PacketType.Play.Server.CUSTOM_SOUND_EFFECT.getPacketClass(), 0);
ITEM_SLOT_CLASS = getEnum(PacketType.Play.Server.ENTITY_EQUIPMENT.getPacketClass(), 0); ITEM_SLOT_CLASS = getEnum(PacketType.Play.Server.ENTITY_EQUIPMENT.getPacketClass(), 0);
HAND_CLASS = getEnum(PacketType.Play.Client.USE_ENTITY.getPacketClass(), 1); HAND_CLASS = getEnum(PacketType.Play.Client.USE_ENTITY.getPacketClass(), 1);
DIRECTION_CLASS = getEnum(PacketType.Play.Client.USE_ITEM.getPacketClass(), 0); DIRECTION_CLASS = getEnum(PacketType.Play.Server.SPAWN_ENTITY_PAINTING.getPacketClass(), 0);
CHAT_TYPE_CLASS = getEnum(PacketType.Play.Server.CHAT.getPacketClass(), 0); CHAT_TYPE_CLASS = getEnum(PacketType.Play.Server.CHAT.getPacketClass(), 0);
associate(PROTOCOL_CLASS, Protocol.class, getClientCommandConverter()); associate(PROTOCOL_CLASS, Protocol.class, getClientCommandConverter());