Java Code Examples for org.bukkit.Material#REDSTONE_BLOCK

The following examples show how to use org.bukkit.Material#REDSTONE_BLOCK . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageGui.java    From WildernessTp with MIT License 8 votes vote down vote up
public static void openMessGui(Player p) {
    ItemStack close = new ItemStack(Material.REDSTONE_BLOCK, 1);
    ItemMeta meta = close.getItemMeta();
    meta.setDisplayName("Close");
    ArrayList<String> lore = new ArrayList<>();
    lore.add("Click to close the inventory and return to normal gameplay");
    meta.setLore(lore);
    close.setItemMeta(meta);
    Inventory messages = Bukkit.createInventory(p, 27, "WildTp");
    p.openInventory(messages);
    messages.setItem(0, makeItem("Teleport" , "Click to set the message to be said on teleport"));
    messages.setItem(2, makeItem("NoSuit", "Click to set the no suitable location message"));
    messages.setItem(4, makeItem("CostMsg", "Click to set the cost message"));
    messages.setItem(6, makeItem("No-Break", "Click to set the no perm for sign break message"));
    messages.setItem(8, makeItem("No-Perm", "Click to set the No permission to make a sign message"));
    messages.setItem(10, makeItem( "Cooldown Message", "Click to set the cool down message"));
    messages.setItem(12, makeItem( "Wait/Warmup Message", "Click to set the warmp/delay/wait message"));
    messages.setItem(14, makeItem("Used command Message", "Click to set the command used message"));
    messages.setItem(17, makeItem("Refund Message", "Click to set the RefundMessage"));
    messages.setItem(19, makeItem("Blocked Command Message", "Click me to set the Blocked Command Message"));
    messages.setItem(21, makeItem("World Message","Click me to set the message for when command is used \nin a non configured world"));
    messages.setItem(23, makeItem("Cancel Message", "Click me to set the message for when a player \ncauses teleportation to be canceld"));
    messages.setItem(24, MainGui.backItem());
    messages.setItem(26, close);
}
 
Example 2
Source File: SetGui.java    From WildernessTp with MIT License 6 votes vote down vote up
public static void OpenSet(Player p) {

        ItemStack close = new ItemStack(Material.REDSTONE_BLOCK, 1);
        ItemMeta meta = close.getItemMeta();
        meta.setDisplayName("Close");
        ArrayList<String> lore = new ArrayList<>();
        lore.add("Click to close the inventory and return to normal gameplay");
        meta.setLore(lore);
        close.setItemMeta(meta);
        Inventory set = Bukkit.createInventory(p, 27, "WildTp");
        p.openInventory(set);
        set.setItem(0, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Book")), "MinX", Collections.singletonList("Click to set the minx")));
        set.setItem(2, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Book")), "MaxX", Collections.singletonList("Click to set the maxx")));
        set.setItem(4, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Book")), "MinZ", Collections.singletonList("Click to set the minz")));
        set.setItem(6, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Book")), "MaxZ", Collections.singletonList("Click to set the maxz")));
        set.setItem(8, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Watch")), "Cooldown", Collections.singletonList("Click me to set the cooldown for the command")));
        set.setItem(10, MainGui.makeItem(Material.GOLD_BLOCK, "Cost", Collections.singletonList("Click me to set the cost for the command")));
        set.setItem(12, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Watch")), "Wait", Collections.singletonList("Click to set the wait before telepoting happens")));
        set.setItem(14, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Watch")), "Retries", Collections.singletonList("Click to set the number of retries if a location is unsuitable")));
        set.setItem(16, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Watch")), "Do Retry", Collections.singletonList("Click to set true or false for doing retries")));
        set.setItem(18, MainGui.makeItem(Material.MAP, "Distance", Arrays.asList("Click to set the distance the plugin checks for a claim")));
        set.setItem(24, MainGui.backItem());
        set.setItem(26, close);
    }
 
Example 3
Source File: TrueFalseGui.java    From WildernessTp with MIT License 6 votes vote down vote up
public static void openTrue(Player p) {
    ItemStack close = new ItemStack(Material.REDSTONE_BLOCK, 1);
    ItemMeta meta = close.getItemMeta();
    meta.setDisplayName("Close");
    ArrayList<String> lore = new ArrayList<String>();
    lore.add("Click to close the inventory and return to normal gameplay");
    meta.setLore(lore);
    close.setItemMeta(meta);
    Inventory Wildtp = Bukkit.createInventory(p, 9, "Hooks");
    p.openInventory(Wildtp);
    if(!Wild.getInstance().thirteen) {
        Wildtp.setItem(2, MainGui.makeItem(Material.valueOf("WOOL"), "True", Collections.singletonList("Click to to enable the value to true"), (byte) 5));
        Wildtp.setItem(5, MainGui.makeItem(Material.valueOf("WOOL"), "False", Collections.singletonList("Click to to disable the value to false"), (byte) 14));
    }else{
        Wildtp.setItem(2, MainGui.makeItem(Material.valueOf("GREEN_WOOL"), "True", Collections.singletonList("Click to to enable the value to true")));
        Wildtp.setItem(5, MainGui.makeItem(Material.valueOf("RED_WOOL"), "False", Collections.singletonList("Click to to disable the value to false")));
    }
    Wildtp.setItem(8, close);
}
 
Example 4
Source File: HookGui.java    From WildernessTp with MIT License 6 votes vote down vote up
public static void openHook(Player p) {
    ItemStack close = new ItemStack(Material.REDSTONE_BLOCK, 1);
    ItemMeta meta = close.getItemMeta();
    meta.setDisplayName("Close");
    ArrayList<String> lore = new ArrayList<String>();
    lore.add("Click to close the inventory and return to normal gameplay");
    meta.setLore(lore);
    close.setItemMeta(meta);
    Inventory wildTp = Bukkit.createInventory(p, 27, "Hooks");
    p.openInventory(wildTp);
    wildTp.setItem(0, MainGui.makeItem(Material.DIAMOND_PICKAXE, "Towny Hook", Collections.singletonList("Click to enable or disable Towny Hook")));
    wildTp.setItem(2, MainGui.makeItem(Material.TNT, "Factions Hook", Collections.singletonList("Click to enable or disable Factions hook")));
    wildTp.setItem(4, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Wood_Shovel")), "GreifPrevention Hook", Collections.singletonList("Click to enable or disable Grief Prevention Hoo")));
    wildTp.setItem(6, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Wood_Axe")), "WorldGuard Hook", Collections.singletonList("Click to enable or disable WorldGuard Hook")));
    wildTp.setItem(8, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Wood_Axe")), "Kingdom Hook", Collections.singletonList("Click to enable or disable Kingdom Hook")));
    wildTp.setItem(10, MainGui.makeItem(Material.TNT, "FactionsUUD Hook", Collections.singletonList("Click to enable or disable FactionsUuid Hook")));
    wildTp.setItem(12, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Gold_Shovel")), "Residence Hook", Collections.singletonList("Click to enable or disable Residence Hook")));
    wildTp.setItem(14, MainGui.makeItem(Material.valueOf(MainGui.getMaterials().get("Gold_Axe")), "LandLord Hook", Collections.singletonList("Click to enable or disable LandLord Hook")));
    wildTp.setItem(16, MainGui.makeItem(Material.TNT, "LegacyFactions Hook", Collections.singletonList("Click to enable or disable LegacyFactions hook")));
    wildTp.setItem(18, MainGui.makeItem(Material.DIAMOND_AXE,"Feudal Hook", Collections.singletonList("Click to enable or disable Feudal hook")));
    wildTp.setItem(24, MainGui.backItem());
    wildTp.setItem(26, close);
}
 
Example 5
Source File: MainGui.java    From WildernessTp with MIT License 6 votes vote down vote up
public static void OpenGUI(Player p) {
    ItemStack Close = new ItemStack(Material.REDSTONE_BLOCK, 1);
    ItemMeta meta = Close.getItemMeta();
    meta.setDisplayName("Close");
    ArrayList<String> lore = new ArrayList<String>();
    lore.add("Click to close the inventory and return to normal gameplay");
    meta.setLore(lore);
    Close.setItemMeta(meta);
    Inventory Wildtp = Bukkit.createInventory(p, 18, "WildTp");
    putEdit(p);
    p.openInventory(Wildtp);
    p.sendMessage(ChatColor.RED+"Please make sure to use the redstone block to close early or you wont be able to chat");
    Wildtp.setItem(17, Close);
    Wildtp.setItem(2, makeItem(Material.valueOf(getMaterials().get("Book")), "Messages", Collections.singletonList("Click to set the messages")));
    Wildtp.setItem(4, makeItem(Material.PAPER, "Set", Arrays.asList("Click me to set the values for x and z ","along with cooldown and cost")));
    Wildtp.setItem(6, makeItem(Material.BOOK,"Add a potion or world", Collections.singletonList("Click to add a potion or world")));
    Wildtp.setItem(0, makeItem(Material.JUKEBOX, "Sounds", Collections.singletonList("Click me to set the sound")));
    Wildtp.setItem(8, makeItem(Material.TRIPWIRE_HOOK,"Hooks", Collections.singletonList("Click me to enable or disable a hook")));
}
 
Example 6
Source File: Gizmos.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST)
public void click(final InventoryClickEvent event) {
    if(event.getCurrentItem() == null) return;

    Player player = (Player) event.getWhoClicked();
    if(!purchasingMap.containsKey(player)) return;

    Material clicked = event.getCurrentItem().getType();

    for(Gizmo gizmo : gizmos) {
        if(clicked == gizmo.getIcon()) {
            player.closeInventory();
            if(gizmo.ownsGizmo(player)) {
                GizmoUtils.setGizmo(player, gizmo, false);
            } else if(purchasingMap.containsKey(player)) {
                player.sendMessage(ChatColor.GOLD + LobbyTranslations.get().t("gizmo.currentlyPurchasing", player));
            } else if(gizmo.canPurchase(player)) {
                GizmoUtils.openShop(player, gizmo);
                purchasingMap.put(player, gizmo);
            } else {
                player.sendMessage(gizmo.getNoPurchaseMessage(player));
            }

            break;
        }
    }

    if(clicked == Material.DIAMOND) {
        GizmoUtils.purchaseGizmo(player, purchasingMap.get(player));
    } else if(clicked == Material.REDSTONE_BLOCK) {
        GizmoUtils.cancelPurchase(player);
    }

    event.setCancelled(true);
}
 
Example 7
Source File: GizmoUtils.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void openShop(Player player, Gizmo gizmo) {
    Inventory inventory = Bukkit.createInventory(player, 54, StringUtils.truncate(ChatColor.GOLD + LobbyTranslations.get().t("gizmos.shopFor", player, gizmo.getColoredName(player)), 32));

    inventory.setItem(4, Utils.getGhastTear(player, RaindropsListener.raindrops.get(player)));
    inventory.setItem(22, gizmo.getItemStack(player));

    ItemStack accept = new ItemStack(Material.DIAMOND);
    ItemMeta acceptMeta = accept.getItemMeta();
    acceptMeta.setDisplayName(ChatColor.GREEN + LobbyTranslations.get().t("purchase.purchase", player, gizmo.getColoredName(player)));
    acceptMeta.setLore(Lists.newArrayList(gizmo.getCostText(player)));
    accept.setItemMeta(acceptMeta);

    ItemStack exit = new ItemStack(Material.REDSTONE_BLOCK);
    ItemMeta exitMeta = exit.getItemMeta();
    exitMeta.setDisplayName(ChatColor.RED + LobbyTranslations.get().t("purchase.cancel", player));
    exit.setItemMeta(exitMeta);

    for(int i = 3; i < 6; i++) {
        for(int x = 0; x < 3; x++) {
            inventory.setItem(i * 9 + x, accept);
        }

        for(int y = 6; y < 9; y++) {
            inventory.setItem(i * 9 + y, exit);
        }
    }

    player.openInventory(inventory);
}
 
Example 8
Source File: TestGuideOpening.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testOpenItemStack() throws InterruptedException {
    ItemStack item = new ItemStack(Material.REDSTONE_BLOCK);

    SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class);
    PlayerProfile profile = prepare(guide, history -> history.add(item, 1));
    Mockito.verify(guide).displayItem(profile, item, 1, false);
}
 
Example 9
Source File: TestRechargeableItems.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testItemChargeBounds() {
    Rechargeable rechargeable = mock("CHARGING_BOUNDS_TEST", 10);
    ItemStack item = new CustomItem(Material.REDSTONE_BLOCK, "&4Chargeable Item with bounds", "", LoreBuilder.powerCharged(0, 10));

    Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.setItemCharge(item, -1));
    Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.setItemCharge(item, -0.01F));
    Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.setItemCharge(item, 10.01F));
    Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.setItemCharge(item, 11));

    Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.addItemCharge(item, -0.1F));
    Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.removeItemCharge(item, -0.1F));
}
 
Example 10
Source File: TestRechargeableItems.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testAddItemCharge() {
    Rechargeable rechargeable = mock("CHARGING_BOUNDS_TEST", 10);
    ItemStack item = new CustomItem(Material.REDSTONE_BLOCK, "&4Chargeable Item with additions", "", LoreBuilder.powerCharged(0, 10));

    Assertions.assertTrue(rechargeable.addItemCharge(item, 10));
    Assertions.assertEquals(10, rechargeable.getItemCharge(item));

    Assertions.assertFalse(rechargeable.addItemCharge(item, 1));
}
 
Example 11
Source File: TestRechargeableItems.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testAddItemChargeWithoutLore() {
    Rechargeable rechargeable = mock("CHARGING_NO_LORE_TEST", 10);
    ItemStack item = new CustomItem(Material.REDSTONE_BLOCK, "&4Chargeable Item with no lore");

    Assertions.assertEquals(0, rechargeable.getItemCharge(item));

    Assertions.assertTrue(rechargeable.addItemCharge(item, 10));
    Assertions.assertEquals(10, rechargeable.getItemCharge(item));

    String lore = ChatColors.color("&c&o&8\u21E8 &e\u26A1 &7") + "10.0 / 10.0 J";
    Assertions.assertEquals(lore, item.getItemMeta().getLore().get(0));
}
 
Example 12
Source File: TestRechargeableItems.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testRemoveItemCharge() {
    Rechargeable rechargeable = mock("CHARGING_BOUNDS_TEST", 10);
    ItemStack item = new CustomItem(Material.REDSTONE_BLOCK, "&4Chargeable Item with removal", "", LoreBuilder.powerCharged(0, 10));

    Assertions.assertFalse(rechargeable.removeItemCharge(item, 1));

    rechargeable.setItemCharge(item, 10);

    Assertions.assertTrue(rechargeable.removeItemCharge(item, 10));
    Assertions.assertEquals(0, rechargeable.getItemCharge(item));

    Assertions.assertFalse(rechargeable.removeItemCharge(item, 1));
}