mirror of
https://github.com/darksaid98/Builders-Utilities.git
synced 2026-12-02 14:38:47 +00:00
Banner menu (WIP)
This commit is contained in:
1 parent
d455f46cc7
commit
58c9602594
4 files changed
+218
-238
No files matched your search
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* ____ _ _ _ _ _ _ _ _ _ _ _
|
||||
* | _ \ (_) | | | | | | | | (_) (_) | (_)
|
||||
* | |_) |_ _ _| | __| | ___ _ __ ___ ______| | | | |_ _| |_| |_ _ ___ ___
|
||||
* | _ <| | | | | |/ _` |/ _ \ '__/ __|______| | | | __| | | | __| |/ _ \/ __|
|
||||
* | |_) | |_| | | | (_| | __/ | \__ \ | |__| | |_| | | | |_| | __/\__ \
|
||||
* |____/ \__,_|_|_|\__,_|\___|_| |___/ \____/ \__|_|_|_|\__|_|\___||___/
|
||||
*
|
||||
* Builder's Utilities is a collection of a lot of tiny features that help with building.
|
||||
* Copyright (C) 2020 Arcaniax
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.arcaniax.buildersutilities.menus;
|
||||
|
||||
import net.arcaniax.buildersutilities.menus.inv.content.InventoryContents;
|
||||
import net.arcaniax.buildersutilities.menus.inv.content.InventoryProvider;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BannerMenuProvider implements InventoryProvider {
|
||||
@Override
|
||||
public void init(Player player, InventoryContents contents) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,9 @@
|
||||
package net.arcaniax.buildersutilities.menus;
|
||||
|
||||
import net.arcaniax.buildersutilities.Main;
|
||||
import net.arcaniax.buildersutilities.menus.bannermenus.BannerColorMenuProvider;
|
||||
import net.arcaniax.buildersutilities.menus.bannermenus.BannerMenuProvider;
|
||||
import net.arcaniax.buildersutilities.menus.bannermenus.BannerPatternMenuProvider;
|
||||
import net.arcaniax.buildersutilities.menus.inv.InventoryListener;
|
||||
import net.arcaniax.buildersutilities.menus.inv.SmartInventory;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -53,6 +55,26 @@ public class Menus {
|
||||
.closeable(true)
|
||||
.build();
|
||||
|
||||
public static final SmartInventory BANNER_MENU_COLOR = SmartInventory.builder()
|
||||
.manager(Main.getInstance().getInventoryManager())
|
||||
.id("buildersutilsbannercolor")
|
||||
.provider(new BannerColorMenuProvider())
|
||||
.size(6, 9)
|
||||
.listener(removeGhostItemsListener)
|
||||
.title(ChatColor.BLUE + "Select a color")
|
||||
.closeable(true)
|
||||
.build();
|
||||
|
||||
public static final SmartInventory BANNER_MENU_PATTERN = SmartInventory.builder()
|
||||
.manager(Main.getInstance().getInventoryManager())
|
||||
.id("buildersutilsbannerpattern")
|
||||
.provider(new BannerPatternMenuProvider())
|
||||
.size(6, 9)
|
||||
.listener(removeGhostItemsListener)
|
||||
.title(ChatColor.BLUE + "Select a pattern")
|
||||
.closeable(true)
|
||||
.build();
|
||||
|
||||
public static final SmartInventory COLOR_MENU = SmartInventory.builder()
|
||||
.manager(Main.getInstance().getInventoryManager())
|
||||
.id("buildersutilscolor")
|
||||
|
||||
+39
-3
@@ -25,13 +25,22 @@
|
||||
|
||||
package net.arcaniax.buildersutilities.menus.bannermenus;
|
||||
|
||||
import net.arcaniax.buildersutilities.menus.Menus;
|
||||
import net.arcaniax.buildersutilities.menus.inv.ClickableItem;
|
||||
import net.arcaniax.buildersutilities.menus.inv.SmartInventory;
|
||||
import net.arcaniax.buildersutilities.menus.inv.content.InventoryContents;
|
||||
import net.arcaniax.buildersutilities.menus.inv.content.InventoryProvider;
|
||||
import net.arcaniax.buildersutilities.menus.inv.content.SlotPos;
|
||||
import net.arcaniax.buildersutilities.utils.BannerUtil;
|
||||
import net.arcaniax.buildersutilities.utils.Items;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BannerMenuProvider implements InventoryProvider {
|
||||
|
||||
private static final ItemStack grayPane = Items
|
||||
@@ -42,12 +51,27 @@ public class BannerMenuProvider implements InventoryProvider {
|
||||
// private static final ItemStack currentColor = BannerUtil.createBanner("&a", 1, DyeColor.WHITE, "");
|
||||
private static final ItemStack closeButton = Items
|
||||
.create(Material.BARRIER, (short) 0, 1, "&cClick to close", "");
|
||||
private static final ItemStack whiteBanner = Items
|
||||
.create(Material.WHITE_BANNER, (short) 0, 1, "&c", "");
|
||||
|
||||
@Override
|
||||
public void init(Player player, InventoryContents contents) {
|
||||
// for (int x = 0; x < 54; x++) {
|
||||
// contents.set(x / 9, x % 9, ClickableItem.empty(grayPane));
|
||||
// }
|
||||
contents.fillRect(0, 0, 5,8, ClickableItem.empty(grayPane));
|
||||
contents.set(0, 1, ClickableItem.of(randomizeHead, inventoryClickEvent -> selectRandomColor(player)));
|
||||
contents.set(0, 7, ClickableItem.empty(whiteBanner));
|
||||
contents.set(0, 7, ClickableItem.of(closeButton, inventoryClickEvent -> contents.inventory().close(player)));
|
||||
|
||||
int row = 2;
|
||||
int column = 1;
|
||||
for (DyeColor color : BannerUtil.allColors){
|
||||
contents.set(row, column, ClickableItem.of(BannerUtil.createBanner("&3" + color.toString().toLowerCase().replace("_", " "), color, "&7__&7click to select"), inventoryClickEvent -> selectColor(player, color)));
|
||||
column++;
|
||||
if (column==9){
|
||||
column = 1;
|
||||
row++;
|
||||
}
|
||||
}
|
||||
|
||||
// contents.set(0, 1, ClickableItem.of(randomizeHead, NULL));
|
||||
// contents.set(0, 4, ClickableItem.empty(currentColor));
|
||||
// contents.set(0, 7, ClickableItem.of(closeButton, inventoryClickEvent -> contents.inventory().close(player)));
|
||||
@@ -60,4 +84,16 @@ public class BannerMenuProvider implements InventoryProvider {
|
||||
// contents.set(x / 9, x % 9, ClickableItem.of(banner, NULL));
|
||||
// }
|
||||
}
|
||||
|
||||
private void selectRandomColor(Player player){
|
||||
Random random = new Random();
|
||||
DyeColor dyeColor = BannerUtil.allColors.get(random.nextInt(BannerUtil.allColors.size()-1));
|
||||
BannerUtil.currentBanner.put(player.getUniqueId(), BannerUtil.createBanner("&3" + dyeColor.toString().toLowerCase().replace("_", " "), dyeColor, "&7__&7click to select"));
|
||||
Menus.BANNER_MENU_COLOR.open(player);
|
||||
}
|
||||
|
||||
private void selectColor(Player player, DyeColor dyeColor){
|
||||
BannerUtil.currentBanner.put(player.getUniqueId(), BannerUtil.createBanner("&3" + dyeColor.toString().toLowerCase().replace("_", " "), dyeColor, "&7__&7click to select"));
|
||||
Menus.BANNER_MENU_COLOR.open(player);
|
||||
}
|
||||
}
|
||||
@@ -20,203 +20,162 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https:www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//package net.arcaniax.buildersutilities.utils;
|
||||
//
|
||||
//import net.arcaniax.buildersutilities.Main;
|
||||
//import org.bukkit.ChatColor;
|
||||
//import org.bukkit.DyeColor;
|
||||
//import org.bukkit.block.banner.Pattern;
|
||||
//import org.bukkit.block.banner.PatternType;
|
||||
//import org.bukkit.inventory.ItemStack;
|
||||
//import org.bukkit.inventory.meta.BannerMeta;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//import java.util.Random;
|
||||
//
|
||||
//public class BannerUtil {
|
||||
// public static final List<DyeColor> allColors = new ArrayList<>();
|
||||
// public static final List<PatternType> allPatterns = new ArrayList<>();
|
||||
// private static final Random random = new Random();
|
||||
//
|
||||
// {
|
||||
// addColors();
|
||||
// addPatterns();
|
||||
// }
|
||||
//
|
||||
// private void addPatterns() {
|
||||
// for (PatternType pt : PatternType.values()) {
|
||||
// if (!pt.equals(PatternType.BASE)) {
|
||||
// allPatterns.add(pt);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void addColors() {
|
||||
// allColors.add(DyeColor.BLACK);
|
||||
// allColors.add(DyeColor.RED);
|
||||
// allColors.add(DyeColor.GREEN);
|
||||
// allColors.add(DyeColor.BROWN);
|
||||
// allColors.add(DyeColor.BLUE);
|
||||
// allColors.add(DyeColor.PURPLE);
|
||||
// allColors.add(DyeColor.CYAN);
|
||||
// allColors.add(DyeColor.LIGHT_GRAY);
|
||||
// allColors.add(DyeColor.GRAY);
|
||||
// allColors.add(DyeColor.PINK);
|
||||
// allColors.add(DyeColor.LIME);
|
||||
// allColors.add(DyeColor.YELLOW);
|
||||
// allColors.add(DyeColor.LIGHT_BLUE);
|
||||
// allColors.add(DyeColor.MAGENTA);
|
||||
// allColors.add(DyeColor.ORANGE);
|
||||
// allColors.add(DyeColor.WHITE);
|
||||
// }
|
||||
//
|
||||
// public static ItemStack createBanner(String name, DyeColor base, String lore, List<Pattern> patterns) {
|
||||
// ItemStack item = Items.create(XMaterial.fromString(base.toString() + "_BANNER").parseMaterial(), (short) 0, 1, name, "");
|
||||
// BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
// if (Main.getInstance().getNmsManager().isAtLeastVersion(1, 11, 0)) {
|
||||
// item.setDurability((short) allColors.indexOf(base));
|
||||
// } else {
|
||||
// meta.setBaseColor(base);
|
||||
// }
|
||||
//
|
||||
// meta.setPatterns(patterns);
|
||||
// if (!lore.equals("")) {
|
||||
// String[] loreListArray = lore.split("__");
|
||||
// List<String> loreList = new ArrayList<>();
|
||||
// for (String s : loreListArray) {
|
||||
// loreList.add(s.replace('&', ChatColor.COLOR_CHAR));
|
||||
// }
|
||||
// meta.setLore(loreList);
|
||||
// }
|
||||
// item.setItemMeta(meta);
|
||||
// return item;
|
||||
// }
|
||||
//
|
||||
// public static ItemStack createBanner(String name, int amount, DyeColor base, String lore) {
|
||||
// //TODO this might be how we fix it:
|
||||
// XMaterial.matchXMaterial(base.toString() + "_BANNER").get().parseMaterial();
|
||||
//
|
||||
// ItemStack item = Items.create(XMaterial.fromString(base.toString() + "_BANNER").parseMaterial(), (short) 0, 1, name, "");
|
||||
// BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
// if (!lore.equals("")) {
|
||||
// String[] loreListArray = lore.split("__");
|
||||
// List<String> loreList = new ArrayList<>();
|
||||
// for (String s : loreListArray) {
|
||||
// loreList.add(s.replace('&', ChatColor.COLOR_CHAR));
|
||||
// }
|
||||
// meta.setLore(loreList);
|
||||
// }
|
||||
// item.setItemMeta(meta);
|
||||
// return item;
|
||||
// }
|
||||
//
|
||||
// public static ItemStack createBanner(String name, int amount, DyeColor base, String lore, Pattern pat) {
|
||||
// ItemStack item = Items.create(XMaterial.fromString(base.toString() + "_BANNER").parseMaterial(), (short) 0, 1, name, "");
|
||||
// BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
// meta.addPattern(pat);
|
||||
// if (!lore.equals("")) {
|
||||
// String[] loreListArray = lore.split("__");
|
||||
// List<String> loreList = new ArrayList<>();
|
||||
// for (String s : loreListArray) {
|
||||
// loreList.add(s.replace('&', ChatColor.COLOR_CHAR));
|
||||
// }
|
||||
// meta.setLore(loreList);
|
||||
// }
|
||||
// item.setItemMeta(meta);
|
||||
// return item;
|
||||
// }
|
||||
//
|
||||
// public static ItemStack addPattern(ItemStack i, Pattern pat) {
|
||||
// if (i.getType().toString().contains("BANNER")) {
|
||||
// BannerMeta meta = (BannerMeta) i.getItemMeta();
|
||||
// List<Pattern> patterns = meta.getPatterns();
|
||||
// patterns.add(pat);
|
||||
// meta.setPatterns(patterns);
|
||||
// i.setItemMeta(meta);
|
||||
// return i;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public static DyeColor getBaseColor(ItemStack i) {
|
||||
// if (i.getType().toString().contains("BANNER")) {
|
||||
// BannerMeta meta = (BannerMeta) i.getItemMeta();
|
||||
// if (Main.getInstance().getNmsManager().isAtLeastVersion(1, 11, 0)) {
|
||||
// return allColors.get(i.getDurability());
|
||||
// } else {
|
||||
// return meta.getBaseColor();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public static PatternType getPatternType(ItemStack i) {
|
||||
// if (i.getType().toString().contains("BANNER")) {
|
||||
// BannerMeta meta = (BannerMeta) i.getItemMeta();
|
||||
// return meta.getPattern(0).getPattern();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public static DyeColor getColorFromBanner(ItemStack i) {
|
||||
// if (i.getType().toString().contains("BANNER")) {
|
||||
// BannerMeta meta = (BannerMeta) i.getItemMeta();
|
||||
// return meta.getPattern(0).getColor();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public static DyeColor getRandomDye() {
|
||||
// return allColors.get(random.nextInt(allColors.size()));
|
||||
// }
|
||||
//
|
||||
// public static PatternType getRandomPattern() {
|
||||
// return allPatterns.get(random.nextInt(allPatterns.size()));
|
||||
// }
|
||||
//
|
||||
// DyeColor getDyeColor(ItemStack i) {
|
||||
// switch (i.getType()) {
|
||||
// case INK_SAC:
|
||||
// return DyeColor.BLACK;
|
||||
// case ROSE_RED:
|
||||
// return DyeColor.RED;
|
||||
// case CACTUS_GREEN:
|
||||
// return DyeColor.GREEN;
|
||||
// case COCOA_BEANS:
|
||||
// return DyeColor.BROWN;
|
||||
// case LAPIS_LAZULI:
|
||||
// return DyeColor.BLUE;
|
||||
// case PURPLE_DYE:
|
||||
// return DyeColor.PURPLE;
|
||||
// case CYAN_DYE:
|
||||
// return DyeColor.CYAN;
|
||||
// case LIGHT_GRAY_DYE:
|
||||
// return DyeColor.LIGHT_GRAY;
|
||||
// case GRAY_DYE:
|
||||
// return DyeColor.GRAY;
|
||||
// case PINK_DYE:
|
||||
// return DyeColor.PINK;
|
||||
// case LIME_DYE:
|
||||
// return DyeColor.LIME;
|
||||
// case DANDELION_YELLOW:
|
||||
// return DyeColor.YELLOW;
|
||||
// case LIGHT_BLUE_DYE:
|
||||
// return DyeColor.LIGHT_BLUE;
|
||||
// case MAGENTA_DYE:
|
||||
// return DyeColor.MAGENTA;
|
||||
// case ORANGE_DYE:
|
||||
// return DyeColor.ORANGE;
|
||||
// case BONE_MEAL:
|
||||
// return DyeColor.WHITE;
|
||||
// default:
|
||||
// return DyeColor.BLACK;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
package net.arcaniax.buildersutilities.utils;
|
||||
|
||||
import net.arcaniax.buildersutilities.Main;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.block.banner.Pattern;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BannerMeta;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class BannerUtil {
|
||||
public static final HashMap<UUID, ItemStack> currentBanner = new HashMap<>();
|
||||
|
||||
public static final List<DyeColor> allColors = new ArrayList<>();
|
||||
public static final List<PatternType> allPatterns = new ArrayList<>();
|
||||
private static final Random random = new Random();
|
||||
|
||||
{
|
||||
addColors();
|
||||
addPatterns();
|
||||
}
|
||||
|
||||
private void addPatterns() {
|
||||
for (PatternType pt : PatternType.values()) {
|
||||
if (!pt.equals(PatternType.BASE)) {
|
||||
allPatterns.add(pt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addColors() {
|
||||
allColors.add(DyeColor.BLACK);
|
||||
allColors.add(DyeColor.RED);
|
||||
allColors.add(DyeColor.GREEN);
|
||||
allColors.add(DyeColor.BROWN);
|
||||
allColors.add(DyeColor.BLUE);
|
||||
allColors.add(DyeColor.PURPLE);
|
||||
allColors.add(DyeColor.CYAN);
|
||||
allColors.add(DyeColor.LIGHT_GRAY);
|
||||
allColors.add(DyeColor.GRAY);
|
||||
allColors.add(DyeColor.PINK);
|
||||
allColors.add(DyeColor.LIME);
|
||||
allColors.add(DyeColor.YELLOW);
|
||||
allColors.add(DyeColor.LIGHT_BLUE);
|
||||
allColors.add(DyeColor.MAGENTA);
|
||||
allColors.add(DyeColor.ORANGE);
|
||||
allColors.add(DyeColor.WHITE);
|
||||
}
|
||||
|
||||
public static ItemStack createBanner(String name, DyeColor base, String lore, List<Pattern> patterns) {
|
||||
ItemStack item = Items.create(XMaterial.matchXMaterial(base.toString() + "_BANNER").get().parseMaterial(), (short) 0, 1, name, "");
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
if (Main.getInstance().getNmsManager().isAtLeastVersion(1, 11, 0)) {
|
||||
item.setDurability((short) allColors.indexOf(base));
|
||||
} else {
|
||||
meta.setBaseColor(base);
|
||||
}
|
||||
|
||||
meta.setPatterns(patterns);
|
||||
if (!lore.equals("")) {
|
||||
String[] loreListArray = lore.split("__");
|
||||
List<String> loreList = new ArrayList<>();
|
||||
for (String s : loreListArray) {
|
||||
loreList.add(s.replace('&', ChatColor.COLOR_CHAR));
|
||||
}
|
||||
meta.setLore(loreList);
|
||||
}
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
|
||||
public static ItemStack createBanner(String name, DyeColor base, String lore) {
|
||||
XMaterial.matchXMaterial(base.toString() + "_BANNER").get().parseMaterial();
|
||||
|
||||
ItemStack item = Items.create(XMaterial.matchXMaterial(base.toString() + "_BANNER").get().parseMaterial(), (short) 0, 1, name, "");
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
if (!lore.equals("")) {
|
||||
String[] loreListArray = lore.split("__");
|
||||
List<String> loreList = new ArrayList<>();
|
||||
for (String s : loreListArray) {
|
||||
loreList.add(s.replace('&', ChatColor.COLOR_CHAR));
|
||||
}
|
||||
meta.setLore(loreList);
|
||||
}
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
|
||||
public static ItemStack createBanner(String name, int amount, DyeColor base, String lore, Pattern pat) {
|
||||
ItemStack item = Items.create(XMaterial.matchXMaterial(base.toString() + "_BANNER").get().parseMaterial(), (short) 0, 1, name, "");
|
||||
BannerMeta meta = (BannerMeta) item.getItemMeta();
|
||||
meta.addPattern(pat);
|
||||
if (!lore.equals("")) {
|
||||
String[] loreListArray = lore.split("__");
|
||||
List<String> loreList = new ArrayList<>();
|
||||
for (String s : loreListArray) {
|
||||
loreList.add(s.replace('&', ChatColor.COLOR_CHAR));
|
||||
}
|
||||
meta.setLore(loreList);
|
||||
}
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
|
||||
public static ItemStack addPattern(ItemStack i, Pattern pat) {
|
||||
if (i.getType().toString().contains("BANNER")) {
|
||||
BannerMeta meta = (BannerMeta) i.getItemMeta();
|
||||
List<Pattern> patterns = meta.getPatterns();
|
||||
patterns.add(pat);
|
||||
meta.setPatterns(patterns);
|
||||
i.setItemMeta(meta);
|
||||
return i;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DyeColor getBaseColor(ItemStack i) {
|
||||
if (i.getType().toString().contains("BANNER")) {
|
||||
BannerMeta meta = (BannerMeta) i.getItemMeta();
|
||||
if (Main.getInstance().getNmsManager().isAtLeastVersion(1, 11, 0)) {
|
||||
return allColors.get(i.getDurability());
|
||||
} else {
|
||||
return meta.getBaseColor();
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PatternType getPatternType(ItemStack i) {
|
||||
if (i.getType().toString().contains("BANNER")) {
|
||||
BannerMeta meta = (BannerMeta) i.getItemMeta();
|
||||
return meta.getPattern(0).getPattern();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DyeColor getColorFromBanner(ItemStack i) {
|
||||
if (i.getType().toString().contains("BANNER")) {
|
||||
BannerMeta meta = (BannerMeta) i.getItemMeta();
|
||||
return meta.getPattern(0).getColor();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static DyeColor getRandomDye() {
|
||||
return allColors.get(random.nextInt(allColors.size()));
|
||||
}
|
||||
|
||||
public static PatternType getRandomPattern() {
|
||||
return allPatterns.get(random.nextInt(allPatterns.size()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user