@Test public void testValueFromEnum() throws InputException { Class[] inputTypes = { WeatherType.class, EquipmentSlot.class, MainHand.class, PermissionDefault.class }; String[] input = { "downfall", "HeAd", "lEfT", "NOT_OP" }; Object[] output = InputFormatter.getTypesFromInput(inputTypes, Arrays.asList(input), null); // First let's make sure we didn't lose anything, or get anything assertEquals(inputTypes.length, output.length); // Next let's make sure everything is the right type assertTrue(output[0] instanceof WeatherType); assertTrue(output[1] instanceof EquipmentSlot); assertTrue(output[2] instanceof MainHand); assertTrue(output[3] instanceof PermissionDefault); // Finally, let's make sure the values are correct assertSame(output[0], WeatherType.DOWNFALL); assertSame(output[1], EquipmentSlot.HEAD); assertSame(output[2], MainHand.LEFT); assertSame(output[3], PermissionDefault.NOT_OP); }
@Override public void readFromClientData(ByteBuf clientdata) { locale = StringSerializer.readString(clientdata, connection.getVersion(), 16); viewDist = clientdata.readByte(); chatMode = MiscSerializer.readByteEnum(clientdata, ChatMode.CONSTANT_LOOKUP); chatColors = clientdata.readBoolean(); skinFlags = clientdata.readUnsignedByte(); mainHand = MainHand.RIGHT; }
@Override public void readFromClientData(ByteBuf clientdata) { locale = StringSerializer.readString(clientdata, connection.getVersion(), 16); viewDist = clientdata.readByte(); int chatState = clientdata.readByte(); chatMode = ChatMode.CONSTANT_LOOKUP.getByOrdinal(chatState & 7); chatColors = (chatState & 8) == 8; clientdata.readByte(); clientdata.readBoolean(); skinFlags = 255; mainHand = MainHand.RIGHT; }
@Override public void readFromClientData(ByteBuf clientdata) { locale = StringSerializer.readString(clientdata, connection.getVersion(), 16); viewDist = clientdata.readByte(); chatMode = MiscSerializer.readByteEnum(clientdata, ChatMode.CONSTANT_LOOKUP); chatColors = clientdata.readBoolean(); clientdata.readByte(); clientdata.readBoolean(); skinFlags = 255; mainHand = MainHand.RIGHT; }
public void a(PacketPlayInSettings packetplayinsettings) { // CraftBukkit start if (getMainHand() != packetplayinsettings.f()) { // PAIL: rename PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT); this.server.server.getPluginManager().callEvent(event); } // CraftBukkit end this.locale = packetplayinsettings.a(); this.cg = packetplayinsettings.c(); this.ch = packetplayinsettings.d(); this.getDataWatcher().set(EntityPlayer.bq, Byte.valueOf((byte) packetplayinsettings.e())); this.getDataWatcher().set(EntityPlayer.br, Byte.valueOf((byte) (packetplayinsettings.f() == EnumMainHand.LEFT ? 0 : 1))); }
@Override public MainHand getMainHand() { // TODO Auto-generated method stub throw new UnimplementedOperationException(); }
public GlowNPC(Location location, PlayerProfile profile) { super(location, profile); this.hand = MainHand.LEFT; }
@Override public MainHand getMainHand() { return hand; }
@Override public MainHand getMainHand() { return null; }
@Override public MainHand getMainHand() { return MainHand.LEFT; }
@Override public MainHand getMainHand() { throw new UnsupportedOperationException(); }
public MainHand getMainHand() { return getHandle().getMainHand()== EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT; }