Archiviert
13
0

Rename some enum wrappers to match their NMS counterparts

Dieser Commit ist enthalten in:
Dan Mulloy 2014-12-03 16:24:53 -05:00
Ursprung 1a368299b4
Commit 9a9c5446cc
2 geänderte Dateien mit 66 neuen und 66 gelöschten Zeilen

Datei anzeigen

@ -75,14 +75,14 @@ import com.comphenix.protocol.wrappers.EnumWrappers.ChatVisibility;
import com.comphenix.protocol.wrappers.EnumWrappers.ClientCommand; import com.comphenix.protocol.wrappers.EnumWrappers.ClientCommand;
import com.comphenix.protocol.wrappers.EnumWrappers.CombatEventType; import com.comphenix.protocol.wrappers.EnumWrappers.CombatEventType;
import com.comphenix.protocol.wrappers.EnumWrappers.Difficulty; import com.comphenix.protocol.wrappers.EnumWrappers.Difficulty;
import com.comphenix.protocol.wrappers.EnumWrappers.EntityAction;
import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction; import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;
import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode; import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode;
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerDiggingAction; import com.comphenix.protocol.wrappers.EnumWrappers.PlayerAction;
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerDigType;
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction; import com.comphenix.protocol.wrappers.EnumWrappers.PlayerInfoAction;
import com.comphenix.protocol.wrappers.EnumWrappers.ResourcePackStatus; import com.comphenix.protocol.wrappers.EnumWrappers.ResourcePackStatus;
import com.comphenix.protocol.wrappers.EnumWrappers.ScoreboardAction;
import com.comphenix.protocol.wrappers.EnumWrappers.TitleAction; import com.comphenix.protocol.wrappers.EnumWrappers.TitleAction;
import com.comphenix.protocol.wrappers.EnumWrappers.UpdateScoreAction;
import com.comphenix.protocol.wrappers.EnumWrappers.WorldBorderAction; import com.comphenix.protocol.wrappers.EnumWrappers.WorldBorderAction;
import com.comphenix.protocol.wrappers.WrappedAttribute; import com.comphenix.protocol.wrappers.WrappedAttribute;
import com.comphenix.protocol.wrappers.WrappedChatComponent; import com.comphenix.protocol.wrappers.WrappedChatComponent;
@ -749,33 +749,33 @@ public class PacketContainer implements Serializable {
} }
/** /**
* Retrieve a read/write structure for the PlayerDiggingAction enum in 1.8. * Retrieve a read/write structure for the PlayerDigType enum in 1.8.
* @return A modifier for PlayerDiggingAction enum fields. * @return A modifier for PlayerDigType enum fields.
*/ */
public StructureModifier<PlayerDiggingAction> getPlayerDiggingActions() { public StructureModifier<PlayerDigType> getPlayerDigTypes() {
// Convert to and from the wrapper // Convert to and from the wrapper
return structureModifier.<PlayerDiggingAction>withType( return structureModifier.<PlayerDigType>withType(
EnumWrappers.getPlayerDiggingActionClass(), EnumWrappers.getPlayerDiggingActionConverter()); EnumWrappers.getPlayerDigTypeClass(), EnumWrappers.getPlayerDiggingActionConverter());
} }
/** /**
* Retrieve a read/write structure for the EntityAction enum in 1.8. * Retrieve a read/write structure for the PlayerAction enum in 1.8.
* @return A modifier for EntityAction enum fields. * @return A modifier for PlayerAction enum fields.
*/ */
public StructureModifier<EntityAction> getEntityActions() { public StructureModifier<PlayerAction> getPlayerActions() {
// Convert to and from the wrapper // Convert to and from the wrapper
return structureModifier.<EntityAction>withType( return structureModifier.<PlayerAction>withType(
EnumWrappers.getEntityActionClass(), EnumWrappers.getEntityActionConverter()); EnumWrappers.getPlayerActionClass(), EnumWrappers.getEntityActionConverter());
} }
/** /**
* Retrieve a read/write structure for the UpdateScoreAction enum in 1.8. * Retrieve a read/write structure for the ScoreboardAction enum in 1.8.
* @return A modifier for UpdateScoreAction enum fields. * @return A modifier for ScoreboardAction enum fields.
*/ */
public StructureModifier<UpdateScoreAction> getUpdateScoreActions() { public StructureModifier<ScoreboardAction> getScoreboardActions() {
// Convert to and from the wrapper // Convert to and from the wrapper
return structureModifier.<UpdateScoreAction>withType( return structureModifier.<ScoreboardAction>withType(
EnumWrappers.getUpdateScoreActionClass(), EnumWrappers.getUpdateScoreActionConverter()); EnumWrappers.getScoreboardActionClass(), EnumWrappers.getUpdateScoreActionConverter());
} }
/** /**

Datei anzeigen

@ -98,28 +98,28 @@ public abstract class EnumWrappers {
ENTITY_DIED; ENTITY_DIED;
} }
public enum PlayerDiggingAction { public enum PlayerDigType {
START_DESTROY_BLOCK, START_DESTROY_BLOCK,
ABORT_DESTROY_BLOCK, ABORT_DESTROY_BLOCK,
STOP_DESTROY_BLOCK, STOP_DESTROY_BLOCK,
DROP_ALL_ITEMS, DROP_ALL_ITEMS,
DROP_ITEM, DROP_ITEM,
RELEASE_USE_ITEM; RELEASE_USE_ITEM;
} }
public enum EntityAction { public enum PlayerAction {
START_SNEAKING, START_SNEAKING,
STOP_SNEAKING, STOP_SNEAKING,
STOP_SLEEPING, STOP_SLEEPING,
START_SPRINTING, START_SPRINTING,
STOP_SPRINTING, STOP_SPRINTING,
RIDING_JUMP, RIDING_JUMP,
OPEN_INVENTORY; OPEN_INVENTORY;
} }
public enum UpdateScoreAction { public enum ScoreboardAction {
CHANGE, CHANGE,
REMOVE; REMOVE;
} }
private static Class<?> PROTOCOL_CLASS = null; private static Class<?> PROTOCOL_CLASS = null;
@ -133,9 +133,9 @@ public abstract class EnumWrappers {
private static Class<?> TITLE_ACTION_CLASS = null; private static Class<?> TITLE_ACTION_CLASS = null;
private static Class<?> WORLD_BORDER_ACTION_CLASS = null; private static Class<?> WORLD_BORDER_ACTION_CLASS = null;
private static Class<?> COMBAT_EVENT_TYPE_CLASS = null; private static Class<?> COMBAT_EVENT_TYPE_CLASS = null;
private static Class<?> PLAYER_DIGGING_ACTION_CLASS = null; private static Class<?> PLAYER_DIG_TYPE_CLASS = null;
private static Class<?> ENTITY_ACTION_CLASS = null; private static Class<?> PLAYER_ACTION_CLASS = null;
private static Class<?> UPDATE_SCORE_ACTION_CLASS = null; private static Class<?> SCOREBOARD_ACTION_CLASS = null;
private static boolean INITIALIZED = false; private static boolean INITIALIZED = false;
private static Map<Class<?>, EquivalentConverter<?>> FROM_NATIVE = Maps.newHashMap(); private static Map<Class<?>, EquivalentConverter<?>> FROM_NATIVE = Maps.newHashMap();
@ -162,9 +162,9 @@ public abstract class EnumWrappers {
TITLE_ACTION_CLASS = getEnum(PacketType.Play.Server.TITLE.getPacketClass(), 0); TITLE_ACTION_CLASS = getEnum(PacketType.Play.Server.TITLE.getPacketClass(), 0);
WORLD_BORDER_ACTION_CLASS = getEnum(PacketType.Play.Server.WORLD_BORDER.getPacketClass(), 0); WORLD_BORDER_ACTION_CLASS = getEnum(PacketType.Play.Server.WORLD_BORDER.getPacketClass(), 0);
COMBAT_EVENT_TYPE_CLASS = getEnum(PacketType.Play.Server.COMBAT_EVENT.getPacketClass(), 0); COMBAT_EVENT_TYPE_CLASS = getEnum(PacketType.Play.Server.COMBAT_EVENT.getPacketClass(), 0);
PLAYER_DIGGING_ACTION_CLASS = getEnum(PacketType.Play.Client.BLOCK_DIG.getPacketClass(), 0); PLAYER_DIG_TYPE_CLASS = getEnum(PacketType.Play.Client.BLOCK_DIG.getPacketClass(), 0);
ENTITY_ACTION_CLASS = getEnum(PacketType.Play.Client.ENTITY_ACTION.getPacketClass(), 0); PLAYER_ACTION_CLASS = getEnum(PacketType.Play.Client.ENTITY_ACTION.getPacketClass(), 0);
UPDATE_SCORE_ACTION_CLASS = getEnum(PacketType.Play.Server.SCOREBOARD_SCORE.getPacketClass(), 0); SCOREBOARD_ACTION_CLASS = getEnum(PacketType.Play.Server.SCOREBOARD_SCORE.getPacketClass(), 0);
associate(PROTOCOL_CLASS, Protocol.class, getClientCommandConverter()); associate(PROTOCOL_CLASS, Protocol.class, getClientCommandConverter());
associate(CLIENT_COMMAND_CLASS, ClientCommand.class, getClientCommandConverter()); associate(CLIENT_COMMAND_CLASS, ClientCommand.class, getClientCommandConverter());
@ -177,9 +177,9 @@ public abstract class EnumWrappers {
associate(TITLE_ACTION_CLASS, TitleAction.class, getTitleActionConverter()); associate(TITLE_ACTION_CLASS, TitleAction.class, getTitleActionConverter());
associate(WORLD_BORDER_ACTION_CLASS, WorldBorderAction.class, getWorldBorderActionConverter()); associate(WORLD_BORDER_ACTION_CLASS, WorldBorderAction.class, getWorldBorderActionConverter());
associate(COMBAT_EVENT_TYPE_CLASS, CombatEventType.class, getCombatEventTypeConverter()); associate(COMBAT_EVENT_TYPE_CLASS, CombatEventType.class, getCombatEventTypeConverter());
associate(PLAYER_DIGGING_ACTION_CLASS, PlayerDiggingAction.class, getPlayerDiggingActionConverter()); associate(PLAYER_DIG_TYPE_CLASS, PlayerDigType.class, getPlayerDiggingActionConverter());
associate(ENTITY_ACTION_CLASS, EntityAction.class, getEntityActionConverter()); associate(PLAYER_ACTION_CLASS, PlayerAction.class, getEntityActionConverter());
associate(UPDATE_SCORE_ACTION_CLASS, UpdateScoreAction.class, getUpdateScoreActionConverter()); associate(SCOREBOARD_ACTION_CLASS, ScoreboardAction.class, getUpdateScoreActionConverter());
INITIALIZED = true; INITIALIZED = true;
} }
@ -262,20 +262,20 @@ public abstract class EnumWrappers {
return COMBAT_EVENT_TYPE_CLASS; return COMBAT_EVENT_TYPE_CLASS;
} }
public static Class<?> getPlayerDiggingActionClass() { public static Class<?> getPlayerDigTypeClass() {
initialize(); initialize();
return PLAYER_DIGGING_ACTION_CLASS; return PLAYER_DIG_TYPE_CLASS;
} }
public static Class<?> getEntityActionClass() { public static Class<?> getPlayerActionClass() {
initialize(); initialize();
return ENTITY_ACTION_CLASS; return PLAYER_ACTION_CLASS;
} }
public static Class<?> getUpdateScoreActionClass() { public static Class<?> getScoreboardActionClass() {
initialize(); initialize();
return UPDATE_SCORE_ACTION_CLASS; return SCOREBOARD_ACTION_CLASS;
} }
// Get the converters // Get the converters
public static EquivalentConverter<Protocol> getProtocolConverter() { public static EquivalentConverter<Protocol> getProtocolConverter() {
@ -322,17 +322,17 @@ public abstract class EnumWrappers {
return new EnumConverter<CombatEventType>(CombatEventType.class); return new EnumConverter<CombatEventType>(CombatEventType.class);
} }
public static EquivalentConverter<PlayerDiggingAction> getPlayerDiggingActionConverter() { public static EquivalentConverter<PlayerDigType> getPlayerDiggingActionConverter() {
return new EnumConverter<PlayerDiggingAction>(PlayerDiggingAction.class); return new EnumConverter<PlayerDigType>(PlayerDigType.class);
} }
public static EquivalentConverter<EntityAction> getEntityActionConverter() { public static EquivalentConverter<PlayerAction> getEntityActionConverter() {
return new EnumConverter<EntityAction>(EntityAction.class); return new EnumConverter<PlayerAction>(PlayerAction.class);
} }
public static EquivalentConverter<UpdateScoreAction> getUpdateScoreActionConverter() { public static EquivalentConverter<ScoreboardAction> getUpdateScoreActionConverter() {
return new EnumConverter<UpdateScoreAction>(UpdateScoreAction.class); return new EnumConverter<ScoreboardAction>(ScoreboardAction.class);
} }
// The common enum converter // The common enum converter
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })