Rename some enum wrappers to match their NMS counterparts
Dieser Commit ist enthalten in:
Ursprung
1a368299b4
Commit
9a9c5446cc
@ -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<PlayerDiggingAction> getPlayerDiggingActions() {
|
||||
public StructureModifier<PlayerDigType> getPlayerDigTypes() {
|
||||
// Convert to and from the wrapper
|
||||
return structureModifier.<PlayerDiggingAction>withType(
|
||||
EnumWrappers.getPlayerDiggingActionClass(), EnumWrappers.getPlayerDiggingActionConverter());
|
||||
return structureModifier.<PlayerDigType>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<EntityAction> getEntityActions() {
|
||||
public StructureModifier<PlayerAction> getPlayerActions() {
|
||||
// Convert to and from the wrapper
|
||||
return structureModifier.<EntityAction>withType(
|
||||
EnumWrappers.getEntityActionClass(), EnumWrappers.getEntityActionConverter());
|
||||
return structureModifier.<PlayerAction>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<UpdateScoreAction> getUpdateScoreActions() {
|
||||
public StructureModifier<ScoreboardAction> getScoreboardActions() {
|
||||
// Convert to and from the wrapper
|
||||
return structureModifier.<UpdateScoreAction>withType(
|
||||
EnumWrappers.getUpdateScoreActionClass(), EnumWrappers.getUpdateScoreActionConverter());
|
||||
return structureModifier.<ScoreboardAction>withType(
|
||||
EnumWrappers.getScoreboardActionClass(), EnumWrappers.getUpdateScoreActionConverter());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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<Class<?>, 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<Protocol> getProtocolConverter() {
|
||||
@ -322,17 +322,17 @@ public abstract class EnumWrappers {
|
||||
return new EnumConverter<CombatEventType>(CombatEventType.class);
|
||||
}
|
||||
|
||||
public static EquivalentConverter<PlayerDiggingAction> getPlayerDiggingActionConverter() {
|
||||
return new EnumConverter<PlayerDiggingAction>(PlayerDiggingAction.class);
|
||||
}
|
||||
public static EquivalentConverter<PlayerDigType> getPlayerDiggingActionConverter() {
|
||||
return new EnumConverter<PlayerDigType>(PlayerDigType.class);
|
||||
}
|
||||
|
||||
public static EquivalentConverter<EntityAction> getEntityActionConverter() {
|
||||
return new EnumConverter<EntityAction>(EntityAction.class);
|
||||
}
|
||||
public static EquivalentConverter<PlayerAction> getEntityActionConverter() {
|
||||
return new EnumConverter<PlayerAction>(PlayerAction.class);
|
||||
}
|
||||
|
||||
public static EquivalentConverter<UpdateScoreAction> getUpdateScoreActionConverter() {
|
||||
return new EnumConverter<UpdateScoreAction>(UpdateScoreAction.class);
|
||||
}
|
||||
public static EquivalentConverter<ScoreboardAction> getUpdateScoreActionConverter() {
|
||||
return new EnumConverter<ScoreboardAction>(ScoreboardAction.class);
|
||||
}
|
||||
|
||||
// The common enum converter
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren