mirror of
https://github.com/darksaid98/Builders-Utilities.git
synced 2026-12-03 14:38:48 +00:00
Add light block into /blocks command (#52)
This commit is contained in:
1 parent
be00521b9e
commit
6dfdde0ba6
2 files changed
+22
-10
No files matched your search
@@ -33,38 +33,37 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class SecretBlockMenuProvider implements InventoryProvider {
|
public class SecretBlockMenuProvider implements InventoryProvider {
|
||||||
|
|
||||||
private static final ItemStack SPAWNER = Items.create(Material.SPAWNER, (short) 0, 1, ChatColor.BLUE + "Spawner", "");
|
private static final ItemStack SPAWNER = Items.create(Material.SPAWNER, ChatColor.BLUE + "Spawner", "");
|
||||||
private static final ItemStack BARRIER = Items.create(Material.BARRIER, (short) 0, 1, ChatColor.RED + "Barrier", "");
|
private static final ItemStack BARRIER = Items.create(Material.BARRIER, ChatColor.RED + "Barrier", "");
|
||||||
private static final ItemStack DRAGON_EGG = Items.create(
|
private static final ItemStack DRAGON_EGG = Items.create(
|
||||||
Material.DRAGON_EGG,
|
Material.DRAGON_EGG,
|
||||||
(short) 0,
|
|
||||||
1,
|
|
||||||
ChatColor.LIGHT_PURPLE + "Dragon Egg",
|
ChatColor.LIGHT_PURPLE + "Dragon Egg",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
private static final ItemStack STRUCTURE_VOID = Items.create(
|
private static final ItemStack STRUCTURE_VOID = Items.create(
|
||||||
Material.STRUCTURE_VOID,
|
Material.STRUCTURE_VOID,
|
||||||
(short) 0,
|
|
||||||
1,
|
|
||||||
ChatColor.DARK_AQUA + "Structure Void",
|
ChatColor.DARK_AQUA + "Structure Void",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
private static final ItemStack DEBUG_STICK = Items.create(
|
private static final ItemStack DEBUG_STICK = Items.create(
|
||||||
Material.DEBUG_STICK,
|
Material.DEBUG_STICK,
|
||||||
(short) 0,
|
|
||||||
1,
|
|
||||||
ChatColor.AQUA + "Debug Stick",
|
ChatColor.AQUA + "Debug Stick",
|
||||||
"&7Only works as operator in creative."
|
"&7Only works as operator in creative."
|
||||||
);
|
);
|
||||||
private static final ItemStack STRUCTURE_BLOCK = Items.create(
|
private static final ItemStack STRUCTURE_BLOCK = Items.create(
|
||||||
Material.STRUCTURE_BLOCK,
|
Material.STRUCTURE_BLOCK,
|
||||||
(short) 0,
|
|
||||||
1,
|
|
||||||
ChatColor.AQUA + "Structure Block",
|
ChatColor.AQUA + "Structure Block",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
|
private static final ItemStack LIGHT = Items.create(
|
||||||
|
"LIGHT",
|
||||||
|
ChatColor.GOLD + "Light Block",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Player player, InventoryContents contents) {
|
public void init(Player player, InventoryContents contents) {
|
||||||
@@ -82,6 +81,9 @@ public class SecretBlockMenuProvider implements InventoryProvider {
|
|||||||
5,
|
5,
|
||||||
ClickableItem.of(STRUCTURE_BLOCK, inventoryClickEvent -> player.getInventory().addItem(STRUCTURE_BLOCK))
|
ClickableItem.of(STRUCTURE_BLOCK, inventoryClickEvent -> player.getInventory().addItem(STRUCTURE_BLOCK))
|
||||||
);
|
);
|
||||||
|
if (LIGHT != null) {
|
||||||
|
contents.set(0, 6, ClickableItem.of(LIGHT, inventoryClickEvent -> player.getInventory().addItem(LIGHT)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,16 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class Items {
|
public class Items {
|
||||||
|
|
||||||
|
public static ItemStack create(String materialName, String name, String lore) {
|
||||||
|
Material mat = Material.getMaterial(materialName);
|
||||||
|
|
||||||
|
if(mat == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Items.create(mat, (short) 0, 1, name, lore);
|
||||||
|
}
|
||||||
|
|
||||||
public static ItemStack create(Material mat, String name, String lore) {
|
public static ItemStack create(Material mat, String name, String lore) {
|
||||||
return Items.create(mat, (short) 0, 1, name, lore);
|
return Items.create(mat, (short) 0, 1, name, lore);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user