use of com.github.dirtpowered.dirtmv.data.protocol.objects.ItemStack in project DirtMultiversion by DirtPowered.
the class ViaHandItemProvider method getHandItem.
@Override
public Item getHandItem(UserConnection userConnection) {
if (userConnection.getProtocolInfo() == null) {
return super.getHandItem(userConnection);
}
UserData userData = api.getUserDataFromUsername(userConnection.getProtocolInfo().getUsername());
if (userData != null) {
ProtocolStorage storage = userData.getProtocolStorage();
if (storage.hasObject(QuickBarTracker.class)) {
QuickBarTracker cache = storage.get(QuickBarTracker.class);
ItemStack item = cache.getItemInHand();
return new DataItem(item.getItemId(), (byte) item.getAmount(), (short) item.getData(), null);
}
}
return super.getHandItem(userConnection);
}
Aggregations