Search in sources :

Example 6 with Item

use of net.minecraft.server.v1_11_R1.Item in project ORCID-Source by ORCID.

the class ProfileFundingManagerImpl method createItemList.

private List<Item> createItemList(ProfileFundingEntity profileFundingEntity) {
    Item item = new Item();
    item.setItemName(profileFundingEntity.getTitle());
    item.setItemType(ItemType.FUNDING);
    item.setPutCode(String.valueOf(profileFundingEntity.getId()));
    return Arrays.asList(item);
}
Also used : Item(org.orcid.jaxb.model.notification.permission_v2.Item)

Example 7 with Item

use of net.minecraft.server.v1_11_R1.Item in project ORCID-Source by ORCID.

the class WorkManagerImpl method createItemList.

private List<Item> createItemList(WorkEntity workEntity) {
    Item item = new Item();
    item.setItemName(workEntity.getTitle());
    item.setItemType(ItemType.WORK);
    item.setPutCode(String.valueOf(workEntity.getId()));
    return Arrays.asList(item);
}
Also used : Item(org.orcid.jaxb.model.notification.permission_v2.Item)

Example 8 with Item

use of net.minecraft.server.v1_11_R1.Item in project ORCID-Source by ORCID.

the class ExternalIDValidatorTest method testValidateNotificationItems.

@Test
public void testValidateNotificationItems() {
    Item i = new Item();
    Item i2 = new Item();
    Items items = new Items();
    ExternalID id1 = new ExternalID();
    id1.setRelationship(Relationship.SELF);
    id1.setType("doi");
    id1.setValue("value1");
    id1.setUrl(new Url("http://value1.com"));
    ExternalID id2 = new ExternalID();
    id2.setRelationship(Relationship.SELF);
    id2.setType("source-work-id");
    id2.setValue("value2");
    id2.setUrl(new Url("http://value1.com"));
    i.setExternalIdentifier(id1);
    i2.setExternalIdentifier(id2);
    items.getItems().add(i);
    items.getItems().add(i2);
    // both valid
    validator.validateNotificationItems(items);
    // IDS one valid, one invalid
    id2.setType("blah");
    try {
        validator.validateNotificationItems(items);
        fail("no exception thrown for invalid type");
    } catch (Exception e) {
        if (!(e instanceof ActivityIdentifierValidationException))
            throw e;
    }
    // IDS one valid, one VALID due to null (at least we have to do this if we want other tests to pass!)
    id2.setType(null);
    validator.validateNotificationItems(items);
}
Also used : Item(org.orcid.jaxb.model.notification.permission_v2.Item) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Items(org.orcid.jaxb.model.notification.permission_v2.Items) Url(org.orcid.jaxb.model.common_v2.Url) ActivityIdentifierValidationException(org.orcid.core.exception.ActivityIdentifierValidationException) ActivityIdentifierValidationException(org.orcid.core.exception.ActivityIdentifierValidationException) Test(org.junit.Test)

Example 9 with Item

use of net.minecraft.server.v1_11_R1.Item in project ORCID-Source by ORCID.

the class EmailMessageSenderTest method createActivity.

private Item createActivity(ItemType actType, String actName, String doi) {
    Item act = new Item();
    act.setItemType(actType);
    act.setItemName(actName);
    ExternalID extId = new ExternalID();
    extId.setType("doi");
    extId.setValue(doi);
    act.setExternalIdentifier(extId);
    return act;
}
Also used : Item(org.orcid.jaxb.model.notification.permission_v2.Item) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID)

Example 10 with Item

use of net.minecraft.server.v1_11_R1.Item in project acidisland by tastybento.

the class NMSHandler method isPotion.

/* (non-Javadoc)
     * @see com.wasteofplastic.askyblock.nms.NMSAbstraction#isPotion(org.bukkit.inventory.ItemStack)
     */
@Override
public boolean isPotion(ItemStack item) {
    // Bukkit.getLogger().info("DEBUG:item = " + item);
    if (item.getType().equals(Material.POTION)) {
        net.minecraft.server.v1_11_R1.ItemStack stack = CraftItemStack.asNMSCopy(item);
        NBTTagCompound tag = stack.getTag();
        /*
            for (String list : tag.c()) {
                Bukkit.getLogger().info("DEBUG: list = " + list);
            }*/
        if (tag != null && (!tag.getString("Potion").equalsIgnoreCase("minecraft:water") || tag.getString("Potion").isEmpty())) {
            return true;
        }
    }
    return false;
}
Also used : NBTTagCompound(net.minecraft.server.v1_11_R1.NBTTagCompound)

Aggregations

Item (org.orcid.jaxb.model.notification.permission_v2.Item)19 CraftItemStack (org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack)17 ItemStack (org.bukkit.inventory.ItemStack)13 NBTTagCompound (net.minecraft.server.v1_11_R1.NBTTagCompound)12 Test (org.junit.Test)7 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)7 Field (java.lang.reflect.Field)6 ItemStack (net.minecraft.server.v1_11_R1.ItemStack)5 Item (net.minecraft.server.v1_12_R1.Item)5 Items (org.orcid.jaxb.model.notification.permission_v2.Items)5 ArrayList (java.util.ArrayList)4 Container (net.minecraft.server.v1_11_R1.Container)3 NBTTagList (net.minecraft.server.v1_11_R1.NBTTagList)3 NBTTagString (net.minecraft.server.v1_11_R1.NBTTagString)3 ItemMeta (org.bukkit.inventory.meta.ItemMeta)3 CompoundTag (com.wasteofplastic.org.jnbt.CompoundTag)2 ListTag (com.wasteofplastic.org.jnbt.ListTag)2 StringTag (com.wasteofplastic.org.jnbt.StringTag)2 Tag (com.wasteofplastic.org.jnbt.Tag)2 IconMenuItem (de.Keyle.MyPet.api.gui.IconMenuItem)2