Banner menu v2 (WIP)

This commit is contained in:
Lesley Dom committed 2020-09-10 15:49:01 +02:00
1 parent 58c9602594
commit 4ebd4eb189
3 files changed
+10 -11

No files matched your search

@@ -28,6 +28,7 @@ package net.arcaniax.buildersutilities;
import net.arcaniax.buildersutilities.commands.system.CommandForwarder;
import net.arcaniax.buildersutilities.listeners.*;
import net.arcaniax.buildersutilities.menus.inv.InventoryManager;
import net.arcaniax.buildersutilities.utils.BannerUtil;
import net.arcaniax.buildersutilities.utils.CustomConfig;
import net.arcaniax.buildersutilities.utils.NmsManager;
import org.bukkit.ChatColor;
@@ -67,6 +68,9 @@ public final class Main extends JavaPlugin {
this.nmsManager = new NmsManager();
this.inventoryManager = new InventoryManager(this);
this.inventoryManager.init();
BannerUtil.addColors();
BannerUtil.addPatterns();
Metrics metrics = new Metrics(this, BSTATS_ID);
@@ -44,7 +44,7 @@ import java.util.Random;
public class BannerMenuProvider implements InventoryProvider {
private static final ItemStack grayPane = Items
.create(Material.LIGHT_GRAY_STAINED_GLASS_PANE, (short) 0, 1, "&7", "");
.create(Material.GRAY_STAINED_GLASS_PANE, (short) 0, 1, "&7", "");
private static final ItemStack randomizeHead = Items.createHead(
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzk3OTU1NDYyZTRlNTc2NjY0NDk5YWM0YTFjNTcyZjYxNDNmMTlhZDJkNjE5NDc3NjE5OGY4ZDEzNmZkYjIifX19",
1, "&7Click to randomise", "");
@@ -56,9 +56,9 @@ public class BannerMenuProvider implements InventoryProvider {
@Override
public void init(Player player, InventoryContents contents) {
contents.fillRect(0, 0, 5,8, ClickableItem.empty(grayPane));
contents.fill(ClickableItem.empty(grayPane));
contents.set(0, 1, ClickableItem.of(randomizeHead, inventoryClickEvent -> selectRandomColor(player)));
contents.set(0, 7, ClickableItem.empty(whiteBanner));
contents.set(0, 4, ClickableItem.empty(whiteBanner));
contents.set(0, 7, ClickableItem.of(closeButton, inventoryClickEvent -> contents.inventory().close(player)));
int row = 2;
@@ -20,7 +20,7 @@
* 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;
@@ -42,12 +42,7 @@ public class BannerUtil {
public static final List<PatternType> allPatterns = new ArrayList<>();
private static final Random random = new Random();
{
addColors();
addPatterns();
}
private void addPatterns() {
public static void addPatterns() {
for (PatternType pt : PatternType.values()) {
if (!pt.equals(PatternType.BASE)) {
allPatterns.add(pt);
@@ -55,7 +50,7 @@ public class BannerUtil {
}
}
private void addColors() {
public static void addColors() {
allColors.add(DyeColor.BLACK);
allColors.add(DyeColor.RED);
allColors.add(DyeColor.GREEN);