Ursprung
10ded26d60
Commit
c77a700442
@ -80,6 +80,7 @@ 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.EntityUseAction;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.ItemSlot;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.Particle;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerAction;
|
||||
@ -866,6 +867,15 @@ public class PacketContainer implements Serializable {
|
||||
EnumWrappers.getSoundCategoryClass(), EnumWrappers.getSoundCategoryConverter());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive a read/write structure for the ItemSlot enum in 1.9.
|
||||
* @return A modifier for ItemSlot enum fields.
|
||||
*/
|
||||
public StructureModifier<ItemSlot> getItemSlots() {
|
||||
return structureModifier.<ItemSlot>withType(
|
||||
EnumWrappers.getItemSlotClass(), EnumWrappers.getItemSlotConverter());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the ID of this packet.
|
||||
* <p>
|
||||
|
@ -306,6 +306,15 @@ public abstract class EnumWrappers {
|
||||
}
|
||||
}
|
||||
|
||||
public enum ItemSlot {
|
||||
MAINHAND,
|
||||
OFFHAND,
|
||||
FEET,
|
||||
LEGS,
|
||||
CHEST,
|
||||
HEAD;
|
||||
}
|
||||
|
||||
private static Class<?> PROTOCOL_CLASS = null;
|
||||
private static Class<?> CLIENT_COMMAND_CLASS = null;
|
||||
private static Class<?> CHAT_VISIBILITY_CLASS = null;
|
||||
@ -322,6 +331,7 @@ public abstract class EnumWrappers {
|
||||
private static Class<?> SCOREBOARD_ACTION_CLASS = null;
|
||||
private static Class<?> PARTICLE_CLASS = null;
|
||||
private static Class<?> SOUND_CATEGORY_CLASS = null;
|
||||
private static Class<?> ITEM_SLOT_CLASS = null;
|
||||
|
||||
private static boolean INITIALIZED = false;
|
||||
private static Map<Class<?>, EquivalentConverter<?>> FROM_NATIVE = Maps.newHashMap();
|
||||
@ -355,6 +365,7 @@ public abstract class EnumWrappers {
|
||||
SCOREBOARD_ACTION_CLASS = getEnum(PacketType.Play.Server.SCOREBOARD_SCORE.getPacketClass(), 0);
|
||||
PARTICLE_CLASS = getEnum(PacketType.Play.Server.WORLD_PARTICLES.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);
|
||||
|
||||
associate(PROTOCOL_CLASS, Protocol.class, getClientCommandConverter());
|
||||
associate(CLIENT_COMMAND_CLASS, ClientCommand.class, getClientCommandConverter());
|
||||
@ -372,6 +383,7 @@ public abstract class EnumWrappers {
|
||||
associate(SCOREBOARD_ACTION_CLASS, ScoreboardAction.class, getUpdateScoreActionConverter());
|
||||
associate(PARTICLE_CLASS, Particle.class, getParticleConverter());
|
||||
associate(SOUND_CATEGORY_CLASS, SoundCategory.class, getSoundCategoryConverter());
|
||||
associate(ITEM_SLOT_CLASS, ItemSlot.class, getItemSlotConverter());
|
||||
INITIALIZED = true;
|
||||
}
|
||||
|
||||
@ -485,6 +497,11 @@ public abstract class EnumWrappers {
|
||||
return SOUND_CATEGORY_CLASS;
|
||||
}
|
||||
|
||||
public static Class<?> getItemSlotClass() {
|
||||
initialize();
|
||||
return ITEM_SLOT_CLASS;
|
||||
}
|
||||
|
||||
// Get the converters
|
||||
public static EquivalentConverter<Protocol> getProtocolConverter() {
|
||||
return new EnumConverter<Protocol>(Protocol.class);
|
||||
@ -550,6 +567,10 @@ public abstract class EnumWrappers {
|
||||
return new EnumConverter<SoundCategory>(SoundCategory.class);
|
||||
}
|
||||
|
||||
public static EquivalentConverter<ItemSlot> getItemSlotConverter() {
|
||||
return new EnumConverter<ItemSlot>(ItemSlot.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a generic enum converter for use with StructureModifiers.
|
||||
* @param enumClass - Enum class
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren