From 9a9c5446ccc1211bd312424eb82a242ae2b4d679 Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Wed, 3 Dec 2014 16:24:53 -0500 Subject: [PATCH] Rename some enum wrappers to match their NMS counterparts --- .../protocol/events/PacketContainer.java | 36 +++---- .../protocol/wrappers/EnumWrappers.java | 96 +++++++++---------- 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java b/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java index c6394b16..ed414f8b 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/events/PacketContainer.java @@ -75,14 +75,14 @@ import com.comphenix.protocol.wrappers.EnumWrappers.ChatVisibility; import com.comphenix.protocol.wrappers.EnumWrappers.ClientCommand; import com.comphenix.protocol.wrappers.EnumWrappers.CombatEventType; 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.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.ResourcePackStatus; +import com.comphenix.protocol.wrappers.EnumWrappers.ScoreboardAction; 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.WrappedAttribute; 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. - * @return A modifier for PlayerDiggingAction enum fields. + * Retrieve a read/write structure for the PlayerDigType enum in 1.8. + * @return A modifier for PlayerDigType enum fields. */ - public StructureModifier getPlayerDiggingActions() { + public StructureModifier getPlayerDigTypes() { // Convert to and from the wrapper - return structureModifier.withType( - EnumWrappers.getPlayerDiggingActionClass(), EnumWrappers.getPlayerDiggingActionConverter()); + return structureModifier.withType( + EnumWrappers.getPlayerDigTypeClass(), EnumWrappers.getPlayerDiggingActionConverter()); } /** - * Retrieve a read/write structure for the EntityAction enum in 1.8. - * @return A modifier for EntityAction enum fields. + * Retrieve a read/write structure for the PlayerAction enum in 1.8. + * @return A modifier for PlayerAction enum fields. */ - public StructureModifier getEntityActions() { + public StructureModifier getPlayerActions() { // Convert to and from the wrapper - return structureModifier.withType( - EnumWrappers.getEntityActionClass(), EnumWrappers.getEntityActionConverter()); + return structureModifier.withType( + EnumWrappers.getPlayerActionClass(), EnumWrappers.getEntityActionConverter()); } /** - * Retrieve a read/write structure for the UpdateScoreAction enum in 1.8. - * @return A modifier for UpdateScoreAction enum fields. + * Retrieve a read/write structure for the ScoreboardAction enum in 1.8. + * @return A modifier for ScoreboardAction enum fields. */ - public StructureModifier getUpdateScoreActions() { + public StructureModifier getScoreboardActions() { // Convert to and from the wrapper - return structureModifier.withType( - EnumWrappers.getUpdateScoreActionClass(), EnumWrappers.getUpdateScoreActionConverter()); + return structureModifier.withType( + EnumWrappers.getScoreboardActionClass(), EnumWrappers.getUpdateScoreActionConverter()); } /** diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java index 0f5614ba..00845721 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/EnumWrappers.java @@ -98,28 +98,28 @@ public abstract class EnumWrappers { ENTITY_DIED; } - public enum PlayerDiggingAction { - START_DESTROY_BLOCK, - ABORT_DESTROY_BLOCK, - STOP_DESTROY_BLOCK, - DROP_ALL_ITEMS, - DROP_ITEM, - RELEASE_USE_ITEM; + public enum PlayerDigType { + START_DESTROY_BLOCK, + ABORT_DESTROY_BLOCK, + STOP_DESTROY_BLOCK, + DROP_ALL_ITEMS, + DROP_ITEM, + RELEASE_USE_ITEM; } - public enum EntityAction { - START_SNEAKING, - STOP_SNEAKING, - STOP_SLEEPING, - START_SPRINTING, - STOP_SPRINTING, - RIDING_JUMP, - OPEN_INVENTORY; + public enum PlayerAction { + START_SNEAKING, + STOP_SNEAKING, + STOP_SLEEPING, + START_SPRINTING, + STOP_SPRINTING, + RIDING_JUMP, + OPEN_INVENTORY; } - public enum UpdateScoreAction { - CHANGE, - REMOVE; + public enum ScoreboardAction { + CHANGE, + REMOVE; } private static Class PROTOCOL_CLASS = null; @@ -133,9 +133,9 @@ public abstract class EnumWrappers { private static Class TITLE_ACTION_CLASS = null; private static Class WORLD_BORDER_ACTION_CLASS = null; private static Class COMBAT_EVENT_TYPE_CLASS = null; - private static Class PLAYER_DIGGING_ACTION_CLASS = null; - private static Class ENTITY_ACTION_CLASS = null; - private static Class UPDATE_SCORE_ACTION_CLASS = null; + private static Class PLAYER_DIG_TYPE_CLASS = null; + private static Class PLAYER_ACTION_CLASS = null; + private static Class SCOREBOARD_ACTION_CLASS = null; private static boolean INITIALIZED = false; private static Map, EquivalentConverter> FROM_NATIVE = Maps.newHashMap(); @@ -162,9 +162,9 @@ public abstract class EnumWrappers { TITLE_ACTION_CLASS = getEnum(PacketType.Play.Server.TITLE.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); - PLAYER_DIGGING_ACTION_CLASS = getEnum(PacketType.Play.Client.BLOCK_DIG.getPacketClass(), 0); - ENTITY_ACTION_CLASS = getEnum(PacketType.Play.Client.ENTITY_ACTION.getPacketClass(), 0); - UPDATE_SCORE_ACTION_CLASS = getEnum(PacketType.Play.Server.SCOREBOARD_SCORE.getPacketClass(), 0); + PLAYER_DIG_TYPE_CLASS = getEnum(PacketType.Play.Client.BLOCK_DIG.getPacketClass(), 0); + PLAYER_ACTION_CLASS = getEnum(PacketType.Play.Client.ENTITY_ACTION.getPacketClass(), 0); + SCOREBOARD_ACTION_CLASS = getEnum(PacketType.Play.Server.SCOREBOARD_SCORE.getPacketClass(), 0); associate(PROTOCOL_CLASS, Protocol.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(WORLD_BORDER_ACTION_CLASS, WorldBorderAction.class, getWorldBorderActionConverter()); associate(COMBAT_EVENT_TYPE_CLASS, CombatEventType.class, getCombatEventTypeConverter()); - associate(PLAYER_DIGGING_ACTION_CLASS, PlayerDiggingAction.class, getPlayerDiggingActionConverter()); - associate(ENTITY_ACTION_CLASS, EntityAction.class, getEntityActionConverter()); - associate(UPDATE_SCORE_ACTION_CLASS, UpdateScoreAction.class, getUpdateScoreActionConverter()); + associate(PLAYER_DIG_TYPE_CLASS, PlayerDigType.class, getPlayerDiggingActionConverter()); + associate(PLAYER_ACTION_CLASS, PlayerAction.class, getEntityActionConverter()); + associate(SCOREBOARD_ACTION_CLASS, ScoreboardAction.class, getUpdateScoreActionConverter()); INITIALIZED = true; } @@ -262,20 +262,20 @@ public abstract class EnumWrappers { return COMBAT_EVENT_TYPE_CLASS; } - public static Class getPlayerDiggingActionClass() { - initialize(); - return PLAYER_DIGGING_ACTION_CLASS; - } + public static Class getPlayerDigTypeClass() { + initialize(); + return PLAYER_DIG_TYPE_CLASS; + } - public static Class getEntityActionClass() { - initialize(); - return ENTITY_ACTION_CLASS; - } + public static Class getPlayerActionClass() { + initialize(); + return PLAYER_ACTION_CLASS; + } - public static Class getUpdateScoreActionClass() { - initialize(); - return UPDATE_SCORE_ACTION_CLASS; - } + public static Class getScoreboardActionClass() { + initialize(); + return SCOREBOARD_ACTION_CLASS; + } // Get the converters public static EquivalentConverter getProtocolConverter() { @@ -322,17 +322,17 @@ public abstract class EnumWrappers { return new EnumConverter(CombatEventType.class); } - public static EquivalentConverter getPlayerDiggingActionConverter() { - return new EnumConverter(PlayerDiggingAction.class); - } + public static EquivalentConverter getPlayerDiggingActionConverter() { + return new EnumConverter(PlayerDigType.class); + } - public static EquivalentConverter getEntityActionConverter() { - return new EnumConverter(EntityAction.class); - } + public static EquivalentConverter getEntityActionConverter() { + return new EnumConverter(PlayerAction.class); + } - public static EquivalentConverter getUpdateScoreActionConverter() { - return new EnumConverter(UpdateScoreAction.class); - } + public static EquivalentConverter getUpdateScoreActionConverter() { + return new EnumConverter(ScoreboardAction.class); + } // The common enum converter @SuppressWarnings({ "rawtypes", "unchecked" })