@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);
}
java类org.bukkit.inventory.MainHand的实例源码
InputFormatterTest.java 文件源码
项目:Debuggery
阅读 20
收藏 0
点赞 0
评论 0
ClientSettings.java 文件源码
项目:ProtocolSupport
阅读 22
收藏 0
点赞 0
评论 0
@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;
}
ClientSettings.java 文件源码
项目:ProtocolSupport
阅读 25
收藏 0
点赞 0
评论 0
@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;
}
ClientSettings.java 文件源码
项目:ProtocolSupport
阅读 18
收藏 0
点赞 0
评论 0
@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;
}
EntityPlayer.java 文件源码
项目:SpigotSource
阅读 24
收藏 0
点赞 0
评论 0
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)));
}
PlayerMock.java 文件源码
项目:MockBukkit
阅读 18
收藏 0
点赞 0
评论 0
@Override
public MainHand getMainHand()
{
// TODO Auto-generated method stub
throw new UnimplementedOperationException();
}
GlowNPC.java 文件源码
项目:GlowNPC
阅读 20
收藏 0
点赞 0
评论 0
public GlowNPC(Location location, PlayerProfile profile) {
super(location, profile);
this.hand = MainHand.LEFT;
}
GlowNPC.java 文件源码
项目:GlowNPC
阅读 21
收藏 0
点赞 0
评论 0
@Override
public MainHand getMainHand() {
return hand;
}
FakePlayer.java 文件源码
项目:HiddenOre
阅读 24
收藏 0
点赞 0
评论 0
@Override
public MainHand getMainHand() {
return null;
}
PokkitHumanEntity.java 文件源码
项目:Pokkit
阅读 18
收藏 0
点赞 0
评论 0
@Override
public MainHand getMainHand() {
return MainHand.LEFT;
}
TestPlayer.java 文件源码
项目:BlockLocker
阅读 25
收藏 0
点赞 0
评论 0
@Override
public MainHand getMainHand() {
throw new UnsupportedOperationException();
}
CraftHumanEntity.java 文件源码
项目:SpigotSource
阅读 19
收藏 0
点赞 0
评论 0
public MainHand getMainHand() {
return getHandle().getMainHand()== EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT;
}