Search in sources :

Example 6 with Item

use of net.minecraft.server.v1_8_R3.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 7 with Item

use of net.minecraft.server.v1_8_R3.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 8 with Item

use of net.minecraft.server.v1_8_R3.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 9 with Item

use of net.minecraft.server.v1_8_R3.Item in project powerbot by powerbot.

the class DrawItems method repaint.

public void repaint(final Graphics render) {
    if (!ctx.game.loggedIn()) {
        return;
    }
    render.setFont(new Font("Arial", 0, 10));
    render.setColor(Color.green);
    if (ctx.bank.opened()) {
        final Component container = ctx.widgets.component(Constants.BANK_WIDGET, Constants.BANK_ITEMS);
        final Rectangle r = container.viewportRect();
        if (r != null) {
            for (final Item item : ctx.bank.select()) {
                final Component c = item.component();
                if (c == null) {
                    continue;
                }
                final Rectangle r2 = c.boundingRect();
                if (r2 == null) {
                    continue;
                }
                if (c.relativePoint().y == 0 || !r.contains(r2)) {
                    continue;
                }
                final Point p = c.screenPoint();
                render.drawString(c.itemId() + "", p.x, p.y + c.height());
            }
        }
    }
    if (ctx.backpack.component().visible()) {
        for (final Item item : ctx.backpack.select()) {
            final Component c = item.component();
            if (c == null) {
                continue;
            }
            final Point p = c.screenPoint();
            render.drawString(c.itemId() + "", p.x, p.y + c.height());
        }
    }
    if (ctx.equipment.component().visible()) {
        for (final Item item : ctx.equipment.select()) {
            if (item == null) {
                continue;
            }
            final Component c = item.component();
            if (c == null) {
                continue;
            }
            final Point p = c.screenPoint();
            render.drawString(c.itemId() + "", p.x, p.y + c.height());
        }
    }
}
Also used : Item(org.powerbot.script.rt6.Item) Rectangle(java.awt.Rectangle) Point(java.awt.Point) Component(org.powerbot.script.rt6.Component) Font(java.awt.Font)

Example 10 with Item

use of net.minecraft.server.v1_8_R3.Item in project powerbot by powerbot.

the class TicketDestroy method poll.

@Override
public void poll() {
    if (ctx.properties.getProperty("key.token.disable", "").equals("true")) {
        // TODO: review this random event
        return;
    }
    final Item item = ctx.backpack.select().id(Constants.TICKETDESTROY_ITEMS).poll();
    if (!item.valid() || !ctx.hud.opened(Hud.Window.BACKPACK) || !ctx.players.local().idle()) {
        priority.set(0);
        return;
    }
    priority.set(3);
    if (!ctx.backpack.scroll(item)) {
        return;
    }
    if (((ctx.varpbits.varpbit(1448) & 0xFF00) >>> 8) < (item.id() == Constants.TICKETDESTROY_ITEMS[0] ? 10 : 9)) {
        item.interact("Claim");
        return;
    }
    if (!item.interact("Destroy")) {
        return;
    }
    final Widget widget = ctx.widgets.widget(1183);
    if (!Condition.wait(new Condition.Check() {

        @Override
        public boolean poll() {
            return widget.valid();
        }
    })) {
        return;
    }
    Component component = null;
    for (final Component c : widget.components()) {
        if (c.visible() && c.tooltip().trim().equalsIgnoreCase("destroy")) {
            component = c;
            break;
        }
    }
    if (component != null && component.interact("Destroy")) {
        Condition.wait(new Condition.Check() {

            @Override
            public boolean poll() {
                return item.component().itemId() == -1;
            }
        }, 175);
    }
}
Also used : Condition(org.powerbot.script.Condition) Item(org.powerbot.script.rt6.Item) Widget(org.powerbot.script.rt6.Widget) Component(org.powerbot.script.rt6.Component)

Aggregations

Item (org.orcid.jaxb.model.notification.permission_v2.Item)19 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)7 CraftItemStack (org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack)6 ItemStack (org.bukkit.inventory.ItemStack)5 Test (org.junit.Test)5 Items (org.orcid.jaxb.model.notification.permission_v2.Items)5 ArrayList (java.util.ArrayList)4 NBTTagCompound (net.minecraft.server.v1_8_R3.NBTTagCompound)4 ItemStack (net.minecraft.server.v1_8_R3.ItemStack)3 NBTTagList (net.minecraft.server.v1_8_R3.NBTTagList)3 NBTTagString (net.minecraft.server.v1_8_R3.NBTTagString)3 Url (org.orcid.jaxb.model.common_v2.Url)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 Font (java.awt.Font)2 Point (java.awt.Point)2 Map (java.util.Map)2